Prompt a coding assistant to implement from a spec
Use a reusable brief to get a minimal change limited to named files, following project conventions and meeting observable acceptance tests.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 10 minutes to read.
In short
A coding assistant does its best work when you hand it a small, clear brief instead of a wish. The brief names the goal, the files it may touch, the conventions to follow and the checks that prove the result. You then reject anything outside that scope.
Think of it like this: It is like briefing a contractor: you say which room to paint, which colour, and that the furniture stays where it is, then you check the room before paying.
Explained simply
When you ask a coding assistant for a feature in one loose sentence, it fills the gaps with guesses. It may edit five files, add a package and rename things you liked. The fix is a brief: a short, fixed template you fill in before every task.
A good brief has five parts. The goal says what should be true at the end. The scope lists the files the assistant may edit. The conventions remind it how your project is written. The acceptance tests say how you will check the result. The output rules ask for a small change and a list of assumptions.
Acceptance tests must be things you can observe. "Typing 10 characters shows 10 / 200" works. "The counter feels nice" does not. You should be able to check each one without reading the code.
When the answer comes back, compare it with the brief. Any file outside the scope, any new dependency, any change you did not ask for is a reason to reject the work and ask again with the scope restated.
Press Play on a diagram to walk through it one step at a time.
- 1Goal
One sentence: what should be true when this is done
- 2Scope
Files the assistant may edit, and files it must not touch
- 3Conventions
Naming, styling, error handling and test style to copy
- 4Acceptance tests
Observable results you can check without reading code
- 5Output rules
Minimal diff, no new packages, explain assumptions
- Per task
- Goal
- Files in scope
- Acceptance tests
- Per project
- Conventions
- Do-not-touch list
- Per assistant
- Output rules
- Ask for assumptions first
In depth
Why a template beats a clever prompt
A template makes every task look the same. You stop forgetting the scope or the tests, and you can compare results between tasks and between assistants. It also lowers the effort of writing a brief, because most lines are reused.
Keep the template in a file in your repository or in your notes. Fill in only what changes. If the assistant supports repository instruction files, put the stable parts, such as conventions, there and keep the per-task parts in the brief.
- Same headings every time
- Stable parts live in the repository
- Per-task parts: goal, scope, acceptance
- Short enough to write in two minutes
Scope is your review budget
Every extra file in a diff costs review time and adds risk. Naming the files in scope keeps the diff small enough to read fully. It also gives you a simple rule: if a file is not on the list, the change is rejected.
If the task really needs another file, the assistant should say so and ask. You then decide and add the file to the scope. That keeps you in control of how far a change spreads.
- "Add a counter to the form"
- Assistant picks files
- Diff touches 6 files
- Review is slow and risky
- Files named in the brief
- Out-of-scope edits refused
- Diff touches 2 files
- Review fits in minutes
Restating conventions
The assistant may have seen only part of your repository. Restate the rules that matter for this task in one or two lines: language settings, naming, styling approach, how errors are shown, and how tests are written.
This is also where you say what to avoid, such as new dependencies, default exports or inline styles. A convention you state once in the brief is cheaper than a style fix after the diff arrives.
- Language and strictness
- Naming and file layout
- Styling approach
- Error handling pattern
- Test style
Acceptance tests you can observe
Write two to four checks. Each one should name an action and a visible or measurable result. Include at least one failure case, such as an empty field or a bad value, since assistants often cover only the happy path.
If you can turn a check into an automated test, ask for it in the brief. Otherwise you will run it by hand, and the brief tells you exactly what to try. Either way, the check is written before the code exists.
- 1Write brief
Goal, scope, conventions, acceptance
- 2Assistant proposes
Plan and assumptions first
- 3Apply change
Small diff in named files
- 4Run checks
Each acceptance item, one by one
- 5Accept or reject
Reject anything out of scope
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Write a reusable implementation brief~35m
- 2Limit the files in scope~35m
- 3Restate project conventions~35m
- 4Name observable acceptance tests~35m
- 5Reject changes outside the scope~35m
Key points
- Keep one brief template and fill it in for every task, so results are comparable.
- Name the exact files in scope. Anything else in the diff is a reason to reject it.
- Restate conventions in the brief, even if the repository already has them. The assistant may not have read them.
- Write acceptance tests as things you can see or run: a page shows text, a command exits with 0.
Key terms
Tap a card to flip it. 0/5 known
Examples
Goal: show a character counter under the notes field.
Files you may edit: src/components/NoteForm.tsx, src/components/NoteForm.test.tsx
Do not touch: any other file, package.json, lockfiles.
Conventions: TypeScript strict, named exports, Tailwind classes only.
Acceptance:
1. Typing 10 characters shows "10 / 200".
2. At 200 characters the counter text turns to the error colour.
3. npm run lint and npm test pass.
Output: minimal diff, no new dependencies. List assumptions first.A reusable brief, filled in for a small feature.
A brief for a small form feature
You want a character counter on a notes field in a Next.js practice repository. Step 1: state the goal in one sentence. Step 2: list the component and its test file as the only files in scope. Step 3: restate that the project uses strict TypeScript and Tailwind. Step 4: write three checks you can see. Step 5: ask for a minimal diff with no new packages. The brief takes two minutes and prevents most surprises.
Goal: show a character counter under the notes field.
In scope: src/components/NoteForm.tsx, src/components/NoteForm.test.tsx
Out of scope: everything else, package.json, lockfiles
Conventions: strict TypeScript, named exports, Tailwind only
Acceptance:
1. 10 typed characters show "10 / 200"
2. At 200 characters the counter uses the error style
3. Pasting 300 characters keeps only 200
Output: minimal diff, no new dependencies, list assumptions firstRejecting an out-of-scope change
The assistant returns a counter, but it also renames a shared Button component and adds a package for string utilities. Step 1: run git diff --stat and see five files, not two. Step 2: reply that the scope was two files and no new packages. Step 3: ask it to redo the change inside the scope. Step 4: check the diff again before running the acceptance items. Rejecting early is cheaper than untangling a mixed change later.
git diff --stat
git checkout -- src/components/Button.tsx package.json package-lock.json
git diff --statQuick reference
- Brief parts: goal, scope, conventions, acceptance tests, output rules.
- Name the files the assistant may edit. Anything else gets rejected.
- Write acceptance checks you can observe without reading code.
- Include one failure case in the acceptance list.
- Ask for a minimal diff and no new dependencies unless you approve.
- Ask for assumptions to be listed before code is written.
- Run git diff --stat first to see whether the scope was respected.
Common mistakes
- Asking for a feature in one vague sentence and accepting whatever files change.
- Writing acceptance tests that only the assistant can judge, such as "looks good".
- Letting a small task grow into a refactor because the assistant offered one.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write a brief with all five parts for adding a "Clear" button to a search box.
- Exercise 2medium
An assistant returned a diff touching 4 files. Your scope listed 1. Describe the review steps and your reply.
- Exercise 3hard
Turn a reusable brief into a template file with placeholders, plus a short checklist for judging the returned diff.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is a long brief better than a short one?
- No. Use as many lines as the five parts need, usually under fifteen. Clear and short is better than long.
- Do I need a brief for tiny changes?
- For a one-line fix you can be brief, but still name the file and the check. The habit matters more than the length.
- What if the assistant ignores the scope?
- Revert the extra changes and restate the scope. If it keeps happening, shrink the task or switch to a mode that asks before editing files.