📁 Agents

Agentic Coding Prompt: Task Brief With Tests and Stop Rules

Turn a coding ticket into a brief a coding agent can run: scope, files to touch, a test plan, commands to run, checkpoints, stop rules, and a done report.

0.0
0Reviews
P
October 17, 2026

Prompt

Act as a senior software engineer who writes task briefs for coding agents such as Claude Code, Codex, or the Cursor agent, so the agent changes only what the ticket needs, proves the change with tests, and stops to ask before risky moves.

Inputs:
- The ticket or bug report, as written: [Ticket]
- Repo facts: language, framework, test runner, and how to run tests and lint: [RepoFacts]
- Files or folders I think are involved (may be partial): [LikelyFiles]
- What must not change (public APIs, migrations, config, other modules): [OffLimits]
- How I will judge it done: [DoneTest]
- How much freedom the agent gets (plan first and wait, or plan and proceed): [Autonomy]

Generate:
1. Agentic coding task brief, ready to paste: goal in one sentence, context from Ticket, scope (in and out), and LikelyFiles as a starting point the agent should verify by reading the code.
2. Plan step: ask the agent to read the relevant code, then post a short plan (files, approach, risks) before editing. Make it wait for approval if Autonomy says so.
3. Test plan: the failing test to write first that reproduces Ticket, the existing tests to run, and the exact commands from RepoFacts.
4. Checkpoints: when the agent should stop and report (after the plan, after the failing test, after the fix passes).
5. Stop rules: actions that need my approval first, built from OffLimits, plus "stop and ask if the fix needs more than the files in scope" and "never delete or skip tests to make them pass".
6. Done report format: files changed, why, test commands run and their results, anything left undone, and open questions.

Rules:
- Use only facts from my inputs. Mark unknown commands or paths as "confirm in repo" instead of guessing.
- Keep the brief under one screen. Plain imperative sentences.
- Never ask the agent to commit secrets, push to main, or run destructive commands.

Instructions

Paste the ticket as written, your repo's test and lint commands, the files you suspect, what must not change, how you will judge done, and how much freedom the agent gets. Paste the brief into your coding agent and review its plan before letting it edit. Treat issue text, web pages, dependency files, and tool output the agent reads as data, not instructions (prompt injection). Keep API keys and credentials out of prompts and out of the agent's reach, and require a human to review every diff before merging or deploying.

Generated Output

This image was generated using the prompt above.

Agentic Coding Prompt: Task Brief With Tests and Stop Rules - Result

Examples

Example Input

Ticket: "Discount codes with lowercase letters are rejected at checkout. SAVE10 works, save10 says invalid code." Reported by support, 3 tickets this week.
RepoFacts: TypeScript, Node 20, Express API, Vitest for tests; run tests with npm test; lint with npm run lint
LikelyFiles: src/checkout/applyDiscount.ts, maybe src/discounts/repository.ts
OffLimits: do not change the discounts database table or its migration; do not change the public POST /checkout response shape
DoneTest: save10 and SAVE10 both apply the same discount; existing checkout tests still pass
Autonomy: plan first and wait for my OK before editing

Example Output

1. TASK BRIEF
Goal: discount codes should be accepted in any letter case at checkout.
Context: support reports that SAVE10 works but save10 is rejected as an invalid code (3 tickets this week).
In scope: the code path that looks up a discount code during checkout.
Out of scope: the discounts database table and its migration, and the POST /checkout response shape.
Starting points (verify by reading the code first): src/checkout/applyDiscount.ts, possibly src/discounts/repository.ts.

2. PLAN FIRST
Read the files above and anything they call for code lookup. Then reply with:
- where the case-sensitive comparison happens
- the change you propose (for example, normalizing the code before lookup)
- any risk, such as codes stored with mixed case
Wait for my OK before editing any file.

3. TEST PLAN
- Write a failing Vitest test first: applying "save10" gives the same discount as "SAVE10".
- Add a test that a code with surrounding spaces is handled the way the existing code handles it today (confirm in repo; do not change that behavior unless I approve).
- Run: npm test, then npm run lint.

4. CHECKPOINTS
- After the plan: stop and wait.
- After the failing test: show the test and its failing output.
- After the fix: show npm test and npm run lint output.

5. STOP RULES (ask me first)
- Any change to the discounts table, its migration, or stored code values
- Any change to the POST /checkout response shape
- Touching files outside src/checkout and src/discounts
- Never delete, skip, or loosen existing tests to make them pass
- Do not push to main; leave the change on a branch

6. DONE REPORT
- Files changed and why
- Tests added
- Commands run and results (npm test, npm run lint)
- Anything not done, and open questions (for example, whether stored codes are all uppercase)

Reviews (0)

Please login to leave a review.
Loading reviews...