Topic 2 of 5 · 4 min read
Throwaway spikes for unclear tasks
Goal: Use a throwaway spike to turn an unclear request into sized, specified slices, then discard the spike code.
When you cannot size a task because you do not understand it yet, run a throwaway spike: a disposable agent session whose output is knowledge, not code you keep. You then discard the spike and write the real, sized tasks from what it taught you.
Check yourself · 1 of 3
What is the main product of a throwaway spike?
Why it matters
Fuzzy tasks tempt you to say "just let the agent try". The agent will try, produce a large diff, and you will be stuck reviewing a guess. A spike changes the goal. You are not asking for a solution. You are asking questions about the codebase and trying risky ideas cheaply, on a branch you plan to delete.
How to run one
- Write the questions first. For example: "Where is the checkout total computed? Which modules call it? What would break if tax became per line item?"
- Use a separate branch or worktree. Name it
spike/...so nobody merges it by accident. - Ask for a report, not a fix. Tell the agent: "Do not aim for a finished change. Try the smallest version that could work and report what you found, what surprised you, and what you could not do."
- Time-box it. One short session. If the context fills up, that is itself a result: the work is bigger than you thought.
- Keep the notes, delete the code. Copy the findings into a plan: files involved, risks, an order of work. Then remove the branch.
git switch -c spike/per-line-tax
# ... run the agent, collect notes ...
git switch main
git branch -D spike/per-line-tax
Before and after
Weak: "Make taxes work per line item." The agent edits 40 files, rewrites the totals module and adds a new table. You cannot tell which parts are needed.
Better: first a spike with three questions. It reports that the total is computed in two places, that a rounding rule is shared with invoices, and that one migration is unavoidable. Now you write three slices: unify the totals function, add the line-level tax field, then change the rounding. Each has a test.
What goes wrong
- Merging the spike. It was written to learn, not to last. It skips tests, error handling and design. Throw it away.
- Spiking forever. If the notes do not shrink the problem after one or two sessions, ask a person who knows the system.
- Trusting the findings blindly. The agent can misread a codebase. Check the two or three claims your plan depends on by opening the files yourself.
Examples
A spike brief
Goal: learn, not ship. Branch: spike/search-index.
Questions:
1. Where do search queries enter the app?
2. Which modules build the SQL?
3. What is the smallest change that would let one field be searched with a prefix match?
Try that smallest change. Do not write tests or polish.
Report: files touched, what broke, what you could not tell.
When a spike fails usefully
The agent fills its context after reading the billing module and still cannot say where discounts are applied. That is a finding: the logic is spread out. You decide to ask the billing owner for a walkthrough before sizing anything, and you avoid a large wrong diff.
Key points
- A spike is a disposable agent run whose product is knowledge, not code to merge.
- Write the questions before the run and ask the agent to report findings, surprises and blockers.
- Use a clearly named branch or worktree and time-box the session.
- Keep the notes, delete the code, then write sized tasks with checks from what you learned.
- Verify the few findings your plan depends on by reading the files yourself.
Common mistakes
- Turning a promising spike into the real change by cleaning it up instead of rewriting it as sized slices.
- Running a spike without written questions, so the output is a diff and not an answer.
- Skipping the spike on an unfamiliar area and asking for the full feature straight away.
- Never checking the agent's claims about the codebase before building the plan on them.
Check yourself · 2 of 3
You finish a spike and it answered your questions. What should you do with the spike branch?
Check yourself · 3 of 3
Which instruction best fits a spike brief to an agent?
Practice items, not counted towards your mastery.
Start here
- Small CLs (Google Engineering Practices) (opens in a new tab)ArticleFree
Why small, self-contained changes get better reviews, and how to split large ones.
- Best practices for Claude Code (Claude Code docs) (opens in a new tab)DocsFree
A vendor's advice on verification, planning first and managing a filling context.
- Best practices for using GitHub Copilot to work on tasks (opens in a new tab)DocsFree
What makes a task a good fit for a coding agent: clear scope and acceptance criteria.