Plan-First Feature Implementation
Make an AI coding agent explore and plan before touching code: file-level plan, risks, and edge cases; implementation gated on your approval.
I want to implement this feature: [DESCRIBE THE FEATURE: the user-visible outcome, not the implementation] Constraints: [e.g. "no new dependencies", "must work with our existing auth", "ship behind a feature flag"] Work in two phases. Do NOT write or edit any code in phase 1. **Phase 1: Explore and plan:** 1. Read the relevant parts of the codebase first. List the files you examined and what each contributes to this feature. 2. Produce the plan: - Approach in 3-5 sentences, including the one key design decision and why. - File-by-file change list: file path → what changes and why. Mark new files as NEW. - Data/schema/API contract changes, if any: exact shapes. - Edge cases this must handle: empty states, concurrent use, failures of any external call, permissions. - What could break: existing behavior this touches, and how we'll know it didn't (which tests cover it, or which need writing). - Out of scope: what I might expect that you're deliberately NOT doing, so we agree now. 3. If the feature description is ambiguous in a way that changes the design, ask me the specific question instead of picking silently. Stop after the plan and wait for my approval. **Phase 2: after I approve:** implement exactly the approved plan. If reality diverges from the plan mid-implementation (an assumption was wrong), stop and tell me what changed rather than improvising a different design. Finish by running the tests and reporting results honestly.
How to use
This is the explore-plan-code workflow that agent vendors themselves recommend: the gate between planning and implementation is where you catch wrong assumptions cheaply. Works in Claude Code, Cursor, and any agentic tool; for chat-only use, paste the relevant files where it says to read the codebase.
More coding prompts
Write the commit message for this change. Diff: """ [PASTE THE STAGED DIFF] """ Why I made this change: [THE REASON, THE TICKET, THE BUG REPORT, or "you infer it"] Convention: [Conventional Commits / this repo's existing style, pasted below / plain] Recent commits from this repo, to match style: """ [PASTE 5-10 RECENT COMMIT SUBJECT LIN
Commit Message
Write a commit message that explains why the change was made, in Conventional Commits format, split into separate commits when needed.
Help me recover from a git mistake without making it worse. What I was trying to do: [THE GOAL] What I ran: [THE EXACT COMMANDS, IN ORDER] What happened instead: [THE OUTPUT OR THE STATE NOW] Has this been pushed or shared: [YES/NO, and to which branch and whether anyone else has pulled] Uncommitted work I cannot lose: [WHAT AND WHERE, o
Undo a Git Mistake
Recover from a bad commit, force push, wrong branch, or lost work with a reversible plan and the exact commands, explained before you run them.
Handler code, routes, and models: """ [PASTE THE ROUTE DEFINITIONS, HANDLERS, REQUEST AND RESPONSE TYPES, VALIDATION SCHEMAS, AND MIDDLEWARE] """ Generate an OpenAPI 3.1 specification from the code above. API name, version, and base URL: [DETAILS] Auth scheme: [BEARER JWT / API KEY / OAUTH / SESSION COOKIE, and where it is enforced] Con
OpenAPI Spec From Code
Generate an accurate OpenAPI 3.1 spec from handler code, including error responses and auth, with gaps flagged instead of invented.