A coding agent can write a few hundred lines before the next meeting starts. The tests pass, but nobody can say whether the feature matches what the team agreed in Tuesday's meeting. The code isn't the hard part. The missing checkpoint is someone confirming the intent before the patch lands.
That gap matters as AI coding becomes ordinary team practice. Stack Overflow's 2025 Developer Survey found that 84% of developers were using or planning to use AI tools in their development process. But speed doesn't guarantee a sound result: the same survey found that 45% said debugging AI-generated code was time-consuming.
The useful question isn't whether a prompt sounds clever. It's what checkable artifact it produces, and when a person reviews that artifact. A spec, a failing test, a plan, or a review checklist gives the team something concrete to examine before or after code changes.
The prompts below follow work from meeting decision to first commit. Adapt them to your repository, then keep the human checkpoint: approve the intent, inspect the tests, verify the diagnosis, or review the diff before merging.
Table of Contents
- 1. Spec-First Prompt
- 2. Test-First Prompt
- 3. Plan-Then-Execute Prompt
- 4. Project Rules Prompt
- 5. Bug Reproduction and Root-Cause Prompt
- 6. Meeting-to-Tasks Prompt
- 7. Refactor-With-Constraints Prompt
- 8. Design-to-UI Prompt
- 9. Code Review Prompt
- 10. Migration Plan Prompt
- How the 10 AI coding prompt patterns compare
- Start With One Prompt and Make It a Team Habit
1. Spec-First Prompt
A feature request is not a specification. “Add saved searches” leaves unanswered who can see them, what happens when a search is empty, and whether changes should appear immediately. Ask the agent to turn the request into a short document before it edits code.

Prompt: “Using this feature request and the relevant product decisions, draft a Markdown specification. Include user stories, acceptance criteria, out-of-scope items, dependencies, and open questions. Don't write or change code. Mark any assumption that needs confirmation.”
Approve the artifact, not the prose
A good spec makes disagreements visible while they're still cheap to resolve. For saved searches, a product manager might confirm that users can save searches but can't share them with teammates. That decision becomes a constraint the implementation can follow.
Keep the approved document in the repository, where the team can version it alongside the code. A product requirements document works best as a shared source of truth, not a temporary chat response. Tools such as GitHub's Spec Kit and AWS Kiro can support workflows that separate requirements and design from implementation.
The trade-off is upfront attention. A small typo fix may not need its own specification, and a long document can become busywork if nobody maintains it. For a feature with unclear behavior or several stakeholders, though, a concise spec prevents the agent from settling product questions by guessing.
2. Test-First Prompt
For a bug or a well-defined behavior change, start with an executable expectation. Tests give the agent a target, but they also make the team's interpretation of the request visible. That's why the assertions deserve review before the implementation begins.

Prompt: “In the existing test framework, write tests for the requested discount behavior in the appropriate test file. Cover zero, negative, and over-limit inputs. Run the tests and show the failure output. Don't change production code until I approve the tests.”
For a discount-calculation feature, the tests might establish how the function handles a negative purchase total or a discount larger than the allowed maximum. For a reported bug, the first test should reproduce the failure with the smallest useful input. If it doesn't fail against the current code, the team hasn't yet captured the bug.
Check what the test actually says
After reviewing the test names, assertions, and failure output, ask the agent to implement the behavior and rerun the tests. Specify the framework and file location so it doesn't invent a parallel test setup. For a practical overview of testing AI-generated code, keep the focus on running and inspecting the output, not accepting the agent's claim that everything passes.
A passing test proves only that the tested conditions pass. It can't validate requirements the tests omit, and a test that merely repeats the implementation's assumptions gives false confidence. Review the cases yourself and compare them with the requested behavior. Teams new to writing cases can refer to test case fundamentals for QA teams.
3. Plan-Then-Execute Prompt
A change that crosses an API, service, and UI shouldn't start with edits scattered across all three. First ask the agent to inspect the repository and explain its approach without modifying files. The useful output is a reviewable plan that names where each change belongs.
Require file-level detail
“Inspect the code relevant to this change. Don't edit files. Return a step-by-step plan naming each file to change, the intended change, any dependencies, risks, and a rollback approach. Identify anything you can't confirm from the repository. Wait for approval before implementation.”
Say the team needs a new database column. A useful plan identifies the migration, data-access layer, API response, and UI that depend on it. It should also flag whether existing records need a default and what would need to be reversed if the rollout fails.
This prompt is especially useful when the agent can run shell commands or edit many files. A human can catch a mistaken architectural assumption before it spreads through the patch. Once the plan is approved, instruct the agent to work through its steps in small increments, checking the diff between them.
Don't approve a plan on appearance
A plan can look thorough and still miss a consumer or overstate what the codebase reveals. Check the named files against the repository and ask the agent to verify uncertain dependencies. For a small, isolated change, this extra step may cost more than it saves. For a migration or a cross-service feature, that cost is usually easier to manage than an unreviewed chain of edits.
4. Project Rules Prompt
A new coding session shouldn't have to rediscover the team's rules. Put durable instructions in a repository file that the assistant reads at the start of each session, then keep task-specific prompts focused on the work at hand.
“Read the repository's project rules before making changes. Follow the stated architecture and commands. Don't edit generated files, vendored code, or migrations unless this task explicitly requires it. If the rules conflict with the request, stop and explain the conflict.”
Keep the rules useful
A rule file should tell the agent what it can act on. “Use TypeScript strict mode” is clearer than “write high-quality code.” “Run npm test before proposing a commit” is more actionable than “test thoroughly.” Include the project's established conventions, relevant architecture decisions, commands to run, and files or areas that should not be touched.
A December 2025 empirical study of open-source projects found that developers author rule files to give coding assistants essential context, organized across five major themes. That points to a practical role for project rules: maintain shared codebase knowledge, not just stylistic preferences.
For example, a team can record why a service owns a particular validation step, then tell the agent not to duplicate it in the UI. Assign a human to update the file when conventions change. Long, stale rule files become another source of conflicting assumptions, so keep only information an agent needs repeatedly.
5. Bug Reproduction and Root-Cause Prompt
A stack trace is evidence, not a diagnosis. Give the agent the failure as it happened and ask it to test possible explanations before changing code. That keeps “make the error disappear” from becoming the acceptance criterion.

“Here's the full stack trace, the steps to reproduce the failure, and the relevant logs. First, identify plausible root causes and the evidence that would confirm or rule out each one. Don't edit files yet. After verifying the cause, propose the smallest fix and a regression test.”
Make the agent show its work
Say checkout occasionally processes the same order twice. A useful investigation might try to reproduce the race, examine the lock or transaction behavior, and then show which evidence supports the cause. Ask the agent to say which hypothesis the evidence rules out. If it can't reproduce the issue, it should state what information is missing rather than invent certainty.
Include the full stack trace and logs, but limit the file scope to the relevant service and its tests. Broad permission to rewrite unrelated code makes a debugging task harder to review. After agreeing on a diagnosis, ask for a targeted patch and a regression test. For a failed deployment, the equivalent evidence may be a configuration diff and the deployment logs.
The trade-off is that intermittent bugs can resist local reproduction. A plausible diagnosis still needs human scrutiny, and logs may contain secrets that shouldn't be pasted into an unapproved tool. Verify the data you share and examine the final diff for changes outside the agreed scope.
6. Meeting-to-Tasks Prompt
Teams often agree on behavior in a meeting, then lose the details between the conversation and the ticket. Use a meeting transcript to draft decisions, questions, and work items, but preserve evidence so a model's interpretation doesn't become the team's decision.
“From this transcript, extract confirmed decisions, action items, open questions, and draft tickets with acceptance criteria. For each decision, include the supporting quote. Flag any action item without an owner. Don't treat suggestions or unresolved questions as approved requirements.”
A product sync might produce a PRD draft and tickets for the specific behaviors the team agreed to. A design review might instead leave a list of open questions for the next planning discussion. In either case, ask the agent to link each extracted decision to a direct quote and label ambiguous statements rather than smoothing them into a confident summary.
Confirm decisions before tickets
A transcript records what people said, not necessarily what they decided. A human who attended the meeting should check owners, interpret disagreement, and confirm that the acceptance criteria preserve the intended behavior. Only then should draft tickets enter the team's tracker.
This pattern closes the gap between meeting and implementation, but it doesn't make the transcript a product authority. Speech recognition can be wrong, and people can change their minds after the meeting. Keep the original context available, and treat the generated tickets as drafts until the responsible people approve them.
7. Refactor-With-Constraints Prompt
Refactoring means improving structure without changing behavior. Name the desired improvement and the invariants the agent must preserve. Without both, a request to “clean up” a module can become an unplanned rewrite.
Bound the change
“Refactor this module from callbacks to async/await for readability. Keep the existing function signatures, public API behavior, and database schema unchanged. Make the change in small steps, show the diff after each step, and run the relevant tests before continuing.”
For a callback migration, the agent should change the implementation while keeping callers working. If it proposes changing an exported function signature, that conflicts with the constraint and should stop for review. The same approach works for extracting a shared utility: name the modules involved and state which behavior must remain identical.
Review intermediate diffs rather than waiting for one large patch. Run the relevant tests after each meaningful step, then run the broader suite before merging. A targeted test suite keeps the loop fast, but it may miss an interaction elsewhere in the application.
The main trade-off is scope. Tight constraints make a refactor easier to verify, but can rule out a cleaner design that needs a broader change. If the agent discovers that the requested goal requires changing an API or schema, ask it to explain the trade-off and wait for a human decision instead of expanding the task.
8. Design-to-UI Prompt
A screenshot or design frame shows a target, but not how the product builds interfaces. Tell the agent which existing components and design tokens to use, and specify the states that aren't visible in the default image.
“Implement this Figma frame as a responsive React component using the existing button, card, and form components. Follow the project's spacing and color tokens. Include keyboard navigation, visible focus states, and appropriate contrast. Build loading, empty, validation-error, and narrow-screen states. Don't invent new design tokens.”
For a pricing page, provide the frame plus the component names used elsewhere in the repository. Ask the agent to map the visible layout to those components, then compare the output with the design at relevant viewport widths. The designer should review the rendered screen, because a component can compile and still miss spacing, hierarchy, or interaction details.
Review states, not just the screenshot
A static frame won't reveal keyboard behavior, validation feedback, or how a card changes when content wraps. Name those states in the prompt and ask for accessible labels and keyboard operation. For more on translating a design into implementation, use this design-to-development handoff guide.
A prompt can produce a useful first pass, but it can't resolve design ambiguity by itself. Bring the designer in when the agent must choose between competing interpretations, and verify the rendered UI rather than relying on a description of what it built.
Use the accompanying video as a reference for the design-to-implementation workflow:
9. Code Review Prompt
An AI reviewer can flag routine issues before a teammate reads the diff. Provide the requirement and review criteria, then request specific, actionable findings rather than a general judgment of code quality.
“Review this diff against the linked requirement. Check correctness, security, performance, readability, and missing tests. Report actionable findings ranked by severity, with the affected file or line and a suggested correction. Don't edit files.”
For a payment change, ask the agent to check input validation and unsafe assumptions. For an authentication change, focus on access checks and failure cases. Include the relevant spec or ticket so the review can compare the patch with the intended behavior, not just coding style.
Use findings as questions
A 2025 study on prompt-engineering techniques for secure code generation examined how prompting strategies affect security outcomes in generated code. Make security requirements explicit and testable; a feature prompt or passing tests alone does not establish that a patch is safe.
For security-sensitive changes, ask the agent to identify trust boundaries, untrusted inputs, authorization checks, and security tests. Treat its findings as questions for review: a second pass may catch concerns, but can also miss vulnerabilities or raise false alarms. A human must decide whether the change meets the threat model and is safe to merge. The useful artifact is an actionable review checklist, with a human checkpoint before approval, not a verdict from the agent.
10. Migration Plan Prompt
A framework or dependency upgrade is often riskier as one large patch than as a sequence of verifiable changes. Ask the agent to inventory the current usage and consult authoritative migration guidance before proposing edits. For a large codebase, the first useful artifact is a phased plan, not a sweeping upgrade.
“Inventory the current uses of this dependency and identify affected modules. Check the official migration guide and changelog for breaking changes. Propose phases with compatibility checks, tests, and rollback points. Don't change code until I approve the plan.”
For a Node.js service, the plan might begin with dependency updates on a staging branch, then validate modules with integration tests before moving on. A monolith replacing its date library could start with read-only code paths, leaving writes for a later phase once formatting and parsing behavior are checked.
Make each phase reversible
Ask the agent to name the files and compatibility checks for each phase, and make every phase end with passing tests. A human should verify that the referenced migration guidance applies to the versions in use and inspect the dependency changes before approving execution. Keep changes isolated in version control so the team can revert a phase without discarding unrelated work.
The trade-off is overhead: phased upgrades take more coordination than a single change. But combining a framework shift, a dependency replacement, and unrelated cleanup makes failures harder to diagnose. If the codebase is small and the upgrade is straightforward, a single focused patch may be easier to review. For teams weighing a larger modernization effort, the guide to comparing COBOL migration partners can help frame partner selection.
How the 10 AI coding prompt patterns compare
| Item | Best for | Human checkpoint | Main risk |
|---|---|---|---|
| Spec-First Prompt (Requirements Before Code) | Agreeing on scope and requirements before implementation | Approve and update the spec | Specs can become stale or overly detailed |
| Test-First Prompt (Write Failing Tests, Then Implement) | Defining expected behavior and catching regressions | Review test cases and verify test results | Tests may encode the same misunderstanding as the code |
| Plan-Then-Execute Prompt (Plan Mode) | Reviewing a change approach before editing files | Approve or revise the plan | Plans can miss edge cases |
| Project Rules Prompt (Persistent Repository Context) | Applying team conventions consistently across sessions | Review and maintain repository rules | Outdated or bloated rules can mislead the agent |
| Bug Reproduction and Root-Cause Prompt | Diagnosing bugs from reproducible evidence | Check hypotheses and confirm the root cause | Poor logs or reproduction details can derail debugging |
| Meeting-to-Tasks Prompt (Transcript to Actionable Work) | Turning meeting discussions into traceable tasks | Confirm decisions, owners, and extracted tasks | Transcription errors or ambiguous ownership |
| Refactor-With-Constraints Prompt | Cleaning up code while preserving behavior | Verify constraints and test results | Weak test coverage can hide behavior changes |
| Design-to-UI Prompt (Figma or Screenshot to Code) | Building interfaces from designs using existing components | Review fidelity, accessibility, and UI states | Pixel-level mismatch or inaccessible markup |
| Code Review Prompt (Structured Pre-Review) | Screening diffs for common quality and security issues | Validate findings and retain human review | False positives or missed business-logic errors |
| Migration Plan Prompt (Incremental Upgrade) | Staging risky framework or dependency upgrades | Verify phases, compatibility, and rollback plans | Breaking changes may be missed or plans may drift |
Start With One Prompt and Make It a Team Habit
Choose a prompt based on a real bottleneck, then judge it by the artifact it produces and the human decision that artifact requires. If product decisions arrive late in code review, try a spec-first or meeting-to-tasks prompt. If changes behave differently than expected, use a test-first or root-cause prompt. If reviewers keep finding missed edge cases, add a structured pre-review before the human review.
Apply the prompt to one ticket. Save the prompt, its output, and the changes a person made. For a spec, record which acceptance criteria the product owner revised. For debugging, retain the evidence that supports the identified cause. For review, mark which findings were valid and which were false alarms. These records show whether the prompt helps the work, not just whether its wording sounds effective.
Use repeated misses to improve the workflow. If the agent overlooks an architecture rule, add that rule to the repository context. If generated tests omit a boundary case, make the team's testing expectations explicit. If plans repeatedly miss a dependency, improve the context available before planning. Longer prompts are not the default fix. The goal is to give the agent the information it needs to produce a useful artifact.
Keep the human checkpoint tied to the risk. A person should approve requirements before implementation, inspect test assertions before code changes, and verify security findings against the system's actual access boundaries. A styling change calls for a review of the rendered interface; a permissions change calls for a check of the access model. AI can draft, organize, and test, but the team remains responsible for understanding and owning code that enters the repository.
A prompt library earns its place when it preserves context and produces artifacts people use. Store useful prompts beside relevant project knowledge, and connect each generated patch to the requirement, plan, or test that guided it. Remove prompts that add paperwork without improving decisions or review. Over a few sprints, the team can build a set of patterns grounded in its codebase, linking meeting decisions to requirements, tests, and commits instead of treating coding prompts as isolated tricks.
SpecStory, Inc. offers a shared workspace that captures team conversations and turns decisions into traceable project context and code. That can keep prompts, requirements, and generated changes connected from meeting to commit. Visit SpecStory, Inc. to explore how it works.
Newsletter
Get new posts in your inbox
Bring your team together to build better products. Fresh takes on remote collaboration and AI-driven development.
