Everyone goes off the boil. Some people quicker than others. Some people get back into the groove quicker than others too.
There are a few things you can do.
Ride as much and as often as you can. You won’t get better on a bike sitting on the sofa. Getting out three or four times a week and riding some moderately challenging terrain (whatever that means to you) will have a huge effect.
If I can only get out for an hour on a week night I tend to practice flat fast corners, drops, getting my foot down – hooning about. It all adds up.
Always try and ride the things that scare you. Don’t just ride them once and breath a sigh of relief – do it repeatedly. Session them (awaits ridicule for use of outlawed phrase).
Ride with people who are better than you. Imo this is one of the best ways to improve your riding – talk about these things on the trail and get better riders to demonstrate how they tackle a certain feature over and over.
Learn to fall off. It happens to everyone. There is a knack to it, if you can grasp this it’s half the battle. If that means switching to flats and messing about on the nearest grassy hill then so be it.