Library › Coding AI › Software developers
Write a tightly scoped prompt for a coding agent
- For Software developers
- You practice Setting limits and rules
- Time about 5 minutes
About this exercise
Write the prompt you'll give a coding agent (a Claude Code or Cursor-style tool) to add CSV export to the orders page. Put the prompt in one code block of at most 12 lines, with at most one short line outside it. It must name the files it may change, ban new dependencies, say which columns go in the export, and tell it to run the existing tests and report the result.
Common mistakes when you ask AI for this
- No file fence. Coding agents edit shared components 'to make it cleaner'. Try: Add: "Only change page.tsx and queries.ts. Don't touch DataTable.tsx."
- Allowing new packages. The agent installs a CSV library or upgrades frameworks. Try: Add: "No new dependencies or upgrades."
- Leaving columns to chance. The agent exports every field in its own order. Try: Add: "Columns in this order: order_id, created_at, customer_email, total, status."
- No test step. The agent says 'done' without running anything. Try: Add: "Run npm test and report pass or fail."
- A prompt buried in explanation. The AI explains its prompt and splits it across blocks. Try: Say: "One code block, at most 12 lines, nothing else."
What a strong prompt includes
- Names allowed files
- Bans new dependencies
- Lists the columns
- Asks for tests
- Asks for one block
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)