πŸ€– HarDojo
Log in Sign up

Planning Prompts & Specs

Make the agent plan first β€” it measurably reduces rework.

The single highest-leverage prompting habit: ask for a plan before asking for code.

Why plan-first works

  • The model reasons before committing to edits.
  • You catch misunderstandings before they become a messy diff.
  • The plan becomes a checklist the agent works through.

The pattern

"Before writing any code, read the relevant files and give me a step-by-step plan with the files you'll change and why. Wait for my approval."

Then approve or adjust:

"Good β€” but don't touch the auth module. Proceed with steps 2–4."

Spec-driven prompts

For anything non-trivial, write a mini spec and paste it:

Feature: Dark mode toggle
- A button in the navbar toggles light/dark.
- Persist the choice in localStorage.
- Apply via a `data-theme` attribute on <html>.
- Default to the OS preference.
- No new dependencies.

The agent now has a definition of done. If it proposes extra scope, you can push back against the spec.

Templates worth stealing

Bug fix

Role: senior engineer. Reproduce and fix [bug] in [file]. First explain the root cause, then propose the smallest fix. Add a regression test. Done when the test passes and existing tests stay green.

Refactor

Refactor [module] without changing behavior. Constraints: keep the public API, no new dependencies. Run the full test suite after each step.

Feature

Implement [feature] per this spec. Start with a plan. Write tests. Done when npm test and npm run lint both pass.

The approval loop

The best human-agent workflow is a dialogue, not a monologue:

plan β†’ your review β†’ adjust β†’ implement β†’ tests β†’ review diff β†’ merge
Every minute you spend on a good plan saves ten minutes of reviewing a bad implementation. Plan first, always.