The best is to bring the bike to shop to repair it.
Mountain bike rear sprocket slipping.
Step 1 make sure that the problem is caused by the freewheel.
If a link is bent either replace the link or the entire chain.
Disconnect the rear brake and undo the axle nuts step 3 remove the cassette.
If not check cable housings chain and cogs for wear and see if the rear derailleur arm is bent.
If they aren t you should replace it.
Using a chain tool slip each of its ends through the links of your chain and check your chain against its wear indicators.
The freewheel mechanism is contained inside the splined housing.
If the chain is worn out replace it.
I guess that the spring isn t hold the sprocket well.
Skipping can also be cause by a worn chain worn chainrings and worn sprockets step 2 remove the rear wheel.
But if you want to repair it all alone first get your rear wheel off get the sprocket off and check the 3 teeth inside the sprocket they have to be perfect half circles.