Interview Me Then Plan: Requirements Interview Before Any Code

Claude Code questions you about a feature's requirements and edge cases, then delivers an implementation plan with acceptance criteria and test commands, without writing code first.

You get: Working code with an explanation

More like this

Ready to use: no blanks to fill in.

The prompt

interview-me-then-plan-requirements-interview-before-any-code.md
You are a staff engineer pairing with me in Claude Code. Do not write or edit any code in this session until I approve the plan. Start by asking which feature I want to build. Then read the relevant parts of the repo and interview me in rounds of at most four short questions, covering users, inputs and outputs, error and empty states, permissions, data changes, performance, and what is out of scope. Rules: 1) Ground every question in what you found in the repo, and cite file paths. 2) Do not ask what the code already answers. 3) Stop interviewing when remaining unknowns would not change the design, and list them as assumptions. 4) Test commands must be ones that exist in this repo; say so if one is missing. Output: a requirements summary, assumptions, a numbered implementation plan with files to touch and the order of changes, acceptance criteria as testable checklist items, the exact commands to run the tests, risks and open questions, and a final line asking for my approval.

Example output

AI-written example

Requirements summary

Add a "Export CSV" button to the invoices list (src/web/pages/InvoicesPage.tsx) that downloads all invoices matching the current filters. Only users with the billing:read role can export (src/server/auth/roles.ts). Exports are capped at 50,000 rows and include invoice number, customer, status, issue date, due date, and total in cents and display currency.

Assumptions

  • Filters in src/web/hooks/useInvoiceFilters.ts are the single source of truth for what gets exported.
  • Synchronous streaming is fine; no background job or email delivery.
  • No schema changes. The existing invoices table and idx_invoices_issued_at are enough.
  • Dates are exported in UTC ISO 8601.
  • Localization of headers is out of scope.

Implementation plan

  1. src/server/services/invoiceExport.ts (new): stream rows from InvoiceRepository.findFiltered() through a CSV serializer. Escape formulas (leading =, +, -, @).
  2. src/server/routes/invoices.ts: add GET /api/invoices/export with requireRole('billing:read'). Reuse the validation schema in src/server/schemas/invoiceQuery.ts.
  3. src/server/repositories/InvoiceRepository.ts: add a cursor-based streamFiltered() so the whole result set is never loaded into memory.
  4. src/web/api/invoices.ts: add exportInvoices(filters) that triggers a file download.
  5. src/web/pages/InvoicesPage.tsx: add the button, a disabled state while downloading, and an error toast.
  6. Tests: tests/server/invoiceExport.test.ts and tests/web/InvoicesPage.test.tsx.

Acceptance criteria

  • [ ] A user with billing:read receives 200 with Content-Type: text/csv and a filename like invoices-2025-06-01.csv.
  • [ ] A user without the role receives 403 and the button is hidden.
  • [ ] The exported rows match the active filters exactly.
  • [ ] An empty result returns a header-only CSV, and the UI shows "No invoices to export".
  • [ ] More than 50,000 matching rows returns 422 with a message asking the user to narrow filters.
  • [ ] Cells starting with =, +, -, or @ are prefixed with '.
  • [ ] Commas, quotes, and newlines in customer names are correctly escaped.
  • [ ] A 50,000-row export completes in under 10 seconds with server memory growth under 100 MB.

Test commands

pnpm test tests/server/invoiceExport.test.ts
pnpm test tests/web/InvoicesPage.test.tsx
pnpm test
pnpm lint
pnpm typecheck

No end-to-end or performance test script exists in package.json. The performance criterion would need a manual check or a new script, which is not in this plan.

Risks and open questions

  • Streaming through the current Express error middleware (src/server/middleware/errors.ts) may not handle failures after headers are sent. This needs verification.
  • Should exports be written to the audit log (src/server/services/auditLog.ts)? I assumed yes, but please confirm.
  • Customer names may contain personal data, so confirm there are no retention or compliance requirements.

Do you approve this plan, or would you like changes before I write any code?

Generated from this prompt by AI. Your results will vary.

Tips and common edits

Use it before starting any non-trivial feature when the ticket is vague. Answer the questions in short replies; Claude Code will not edit files until you approve.

Questions about this prompt

More in Claude Code

Claude Code Plan-Then-Implement a Feature With Approval Checkpoints

Makes Claude Code explore the repo, write a step-by-step plan for your approval, then build the feature in small verified steps, stopping at each checkpoint for your go-ahead.

Agent Run Post-Mortem: Trace Root Cause and Prompt or Tool Fixes

Analyzes a pasted agent trace to find the first real failure and proposes exact prompt rewrites or tool changes, each with a test.

Characterization Tests Before a Refactor

Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.

Checkpoint and Rollback Manager with Compensation Steps and Failure Injection Tests

Guides Claude Code to implement checkpoint snapshots, rollback modes, and compensating actions for side-effecting agent phases, then prove them with failure-injection tests. Helps you decide the rollback strategy per phase.

Claude Code Behavior-Preserving Refactor with Characterization Tests and Staged Commits

Guides Claude Code to refactor a module safely by first pinning current behavior with characterization tests, then applying small reversible steps with verification after each. Delivers a diff, risk register, and rollback plan.

Claude Code Feature Implementation Plan and Build from a Ticket with Repo Convention Discovery

Has Claude Code investigate how similar features are built in the repository, produce an implementation plan with acceptance tests, then implement it in verified increments. Surfaces risks, open questions, and next actions before and after coding.

Claude Code Hook Writer: Auto-Run Lint, Typecheck or Tests After Edits

Produces a PostToolUse hook entry for settings.json, the script it calls and a concrete procedure to test that the check runs after file edits.

Claude Code Root-Cause Bug Investigation with Failing Test and Minimal Patch

Directs Claude Code to reproduce a bug, trace it to a root cause using repository evidence, write a failing regression test, and apply the smallest safe fix. Ends with a verified diff, risks, and next actions.

Codebase Tour for a Specific Task

Explores a repo through the lens of your task and explains the architecture, key files and data flow, then says where to start.

Coding Agent Task Brief with Guardrails, Test Plan, and Rollback Steps

Creates a scoped brief for an AI coding agent that limits file changes, defines tests, and includes a rollback plan and review checklist.

Custom Slash Command Builder for Repeated Claude Code Tasks

Turns a task you repeat into a custom slash command file with frontmatter, arguments, restricted allowed tools and a fixed output format.

DAG Scheduler with Fan-Out/Fan-In Barriers and Resumable Run Ledger for Agent Pipelines

Guides Claude Code to build or refactor a dependency-aware DAG scheduler for agent phases, with cycle validation, bounded parallelism, join policies, retries, and an append-only run ledger so interrupted runs resume without redoing finished nodes.