Would it be best to take it off first then soak it in soap, or should I use petrol to get the grease off first?
If you've got the tools (chain whip, lockring tool, wrench), it is easier and more thorough to remove the cassette and soak it in a degreaser than it is to clean it in situ.
I remove the chain and cassette, drop them in a wide-mouthed jar, cover with Simple Green (a non-toxic cleaner, possibly not available where you are), and let it sit for a few hours, agitating occasionally. Then rinse, let dry, and re-lube the chain.
You don't need to take the cassette (cogs) off to clean it.
Use a citrus degreaser fluid. Clean the chain and chainrings at the same time. You can use a rag pulled taut to get between the cogs, or there are a number of specialized cassette and chain cleaning tools available.
There are many instructional videos out there with tips on cassette and chain cleaning also.
Same as the others - I leave it on the bike to clean.
I use a combination of an old screwdriver to break up and pick off any compacted dirt from between cogs. Too much of that and the chain doesn't sit right. Then I use a cassette cleaning brush tool to brush off the loose and powdery dirt.
Last is a wipe with an old rag to restore some shine to the sides of the cassette, but I don't degrease it.
The chain I clean in a similar way - I pick off larger blobs of dirt that live on the outside of the inner plates. Then I use a chain cleaning machine with degreaser in it, either turps or proper fluid. Petrol tends to upset the tool's plastic.
Then I let that dry, and apply a wet or dry lube after an hour or so.
I've found out that those cotton strings or ropes from paper shopping bags are a rather practical tool for cleaning cassettes.
Remove the wheel, sit down and put it against your shins, cassette facing away. Then engage one of these strings between two cogs and move it left/right/left/right. The freewheel helps and for increased efficiency the string can be soaked with detergent or solvent. It may be washed and re-used quite a number of times.
You don't need to take the cassette off the bike. Spray/squirt a concentrated degreaser and use cloth strips (I recommend 1 inch wide and 3 inch long) to get in between the cogs, clean them nicely and free the surface of all the tough muck. Better yet, if you've got a specialized cassette cleaning claw, give it a go: they work pretty well. Hope this helps you.
Depends on what is meant by "best".
The most thorough approach would be to remove the cassette from the wheel and clean it in an ultrasonic cleaner. Probably excessive.
Second best it to remove the cassette and use a mild solvent (e.g. WD40) and a rag to clean the sprockets. This is a good time to examine sprockets for cog wear (the smaller ones in particular).
It is also possible to clean in situ with a wipe, a rag or some kind of floss.
Whatever you do, do not flood a mounted cassette with solvent. You might inadvertently remove lubricant from the freehub and/or wheel hub.
I personally remove, clean and examine my cassette once a year. If your chain is well maintained you are unlikely to have to clean your cassette more frequently.
I personally do a full bike overhaul every six months, though I absolutely torture my road bike doing off-roading on places I wouldn't even put a mountain bike....
My chain is cleaned thoroughly after every ride, and then stored in a small vat of chain oil to keep it from rusting. (Bad practice, I know, but I'm lazy and like to make sure the chain is ready for every ride. Pull it out, attach it, run it through the cogs a couple of times and then wipe off the excess oil from the chain and cogs and derailleur before the ride.)
I'd first remove the wheel, get my cassette lock-ring removal tool and a chain whip and remove the cassette, taking a note of all the positions of the rings. Then, on my cassette, there are little holes that were probably put in for weight reduction; I'd nail each cog onto a big board of ply-board, soak in a strong degreaser and agitate with a brass wire brush, then pressure-washing off everything, then repeat on the other side. (As I said, this bike is tortured, and as such, everything needs a very heavy cleaning...)
The free-hub itself I would also replace, too. Every year or so, I replace my chain, chain-rings and cassette, bottom bracket, headset and hub axles/bearings. I personally disagree with using a degreaser on the cassette whilst it's still on the wheel as the degreaser can get into the wheel hub, and much worse, into the free-hub mechanism itself.
A more basic way would be to just remove the cassette, degrease it in a plastic tub and leave it to soak for a couple of minutes then brush off with a plastic brush, rinse off and then re-assemble. Place your (I'm assuming) freshly-cleaned chain back on, lubricate the chain and then ride on! If possible, avoid getting oil on the chainrings; only the insides of the chain need lubrication. There is no extreme heat happening on the chain and cassette, so lubrication is not a requirement, and if anything, would hinder the efficiency of your chain by something hilarious like 0.0005 percent because of the layer of oil there. A pathetic number, but another good reason is it'll turn any road dust and brake dust into a grinding paste for your chain.