Soil preparation is the part of planting that is invisible afterwards and determines most of what happens next. Two principles cover nearly all of it: improve the whole area rather than individual holes, and clear perennial weeds before anything goes in.
Clear perennial weeds first
Bindweed, ground elder, couch grass and horsetail must be removed before planting, not afterwards. Once they are growing up through an established clump they are close to impossible to eliminate without lifting everything.
Dig them out thoroughly with a fork, following every root and removing all fragments, or exclude light with heavy sheeting for a full growing season.
This is worth a season's delay. A border planted over bindweed becomes a permanent battle.
Never rotavate infested ground, which chops the roots into hundreds of pieces and plants every one.
Improve the whole bed
Roots spread sideways far more than downwards, so a plant put into a pocket of enriched soil surrounded by poor ground stays within that pocket.
Fork over the whole area, remove stones and weed roots, and work a generous layer of compost or well-rotted manure into the top spit.
The alternative is the no-dig approach: spread five to ten centimetres of compost over the surface and let the worms incorporate it. This works well and preserves soil structure, though it takes longer to show results on very poor ground.
Do not fill the planting hole with compost
This is the commonest mistake and it is counterproductive.
A hole filled with rich compost creates a pot in the ground. Roots find it comfortable, stay within it, and never venture into the surrounding soil, so the plant stays small, unstable and dependent on watering.
Backfill with the soil you removed, improved with no more than about a quarter compost mixed through.
Clay
Heavy, fertile, slow to drain and slow to warm. The problem is structure rather than nutrition.
Add organic matter generously and repeatedly, applied to the surface each year rather than dug in once. Over several years this opens the structure considerably.
Coarse grit helps in planting positions. Do not add sand in small quantities, which combines with clay to make something closer to concrete.
Never work clay when it is wet, which destroys structure for years. Raised beds are the quickest route to workable ground on very heavy clay.
Sand
Free-draining, easy to work, and it loses water and nutrients almost as fast as you supply them.
The remedy is the same: organic matter, in quantity and repeatedly, which increases both water and nutrient retention. Mulch heavily to reduce evaporation.
Chalk
Free-draining, alkaline, often shallow over solid rock and low in nutrients.
Add organic matter, and choose plants that suit the pH rather than fighting it. Attempting to grow acid-lovers on chalk is a long expensive disappointment, and they are far better in containers of ericaceous compost.
Test the pH
A cheap kit tells you where you stand. Most garden soils sit between 5.5 and 7.5, and most plants are content across that range.
It is far easier to choose plants that suit your pH than to change it. Raising pH with lime is reasonably straightforward; lowering it is difficult, temporary and mostly futile, which is why ericaceous plants belong in containers on chalk.
Drainage
If water stands on the surface for days after rain, no amount of compost will fix it quickly.
Consider a raised bed, which lifts the planting above the problem, or choose plants that suit damp ground. A permanently wet corner suits ligularia, rodgersia and astilbe far better than anything you would achieve by draining it.
Timing
Prepare ground in autumn where possible, so winter weather breaks down clods and the soil settles before spring planting.
Let a newly prepared bed stand for a few weeks before planting, which allows it to settle and lets a flush of weed seed germinate to be hoed off before anything goes in.
Green manures
On ground that will stand empty over winter, a green manure such as field beans, grazing rye or phacelia protects the surface from heavy rain, prevents nutrients washing out and adds organic matter when dug in or cut down in spring.
Field beans additionally fix nitrogen, which makes them a useful precursor to a hungry crop.