Updated:

1. Diamond under your feet

/execute as @a at @s if block ~ ~-1 ~ grass_block run setblock ~ ~-1 ~ diamond_block

Put it in a repeating, always active command block. The if block check limits it to grass, so floors stay safe.

2. Change a 3x3 area

/execute at @a run fill ~-1 ~-1 ~-1 ~1 ~-1 ~1 gold_block replace grass_block

3. Ice path on water

/execute at @a run fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 frosted_ice replace water

Frosted ice melts back to water over time. Use ice to keep it.

4. Flowers behind you

/execute as @a at @s if block ~ ~-1 ~ grass_block run setblock ~ ~ ~ poppy keep

keep only places the flower in air.

5. Undo

/fill ~-20 ~-3 ~-20 ~20 ~3 ~20 grass_block replace diamond_block

Stop the command block first. See the fill command.

6. Particle trail

/execute at @a run particle minecraft:heart ~ ~ ~ 0.2 0.2 0.2 0 2

Leaves hearts behind without changing any blocks. On Bedrock use particle minecraft:heart_particle ~ ~ ~.

7. Only for chosen players

/tag Steve add trail
/execute as @a[tag=trail] at @s if block ~ ~-1 ~ grass_block run setblock ~ ~-1 ~ diamond_block

Tag a player first, then use @a[tag=trail] in the repeating block. Remove it with /tag Steve remove trail. See the tag command.

8. Only while holding an item (Java)

/execute as @a at @s if items entity @s weapon.mainhand minecraft:blaze_rod if block ~ ~-1 ~ grass_block run setblock ~ ~-1 ~ diamond_block

The path appears only while the player holds a blaze rod, like a magic wand (1.20.5+). See held item effects.

Troubleshooting

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.