Giving AI the Right Context
Even a perfectly worded prompt fails if the AI doesn't know your codebase's conventions, constraints, or history. Context often matters more than phrasing.
What counts as context
- Relevant files, pointing at the actual code involved instead of describing it from memory.
- Project conventions, naming patterns, folder structure, preferred libraries, things a new human hire would also need to learn.
- Error messages and logs, the exact text, not a paraphrase, stack traces often contain the one detail that matters.
- Constraints, "don't add new dependencies," "this must stay backward compatible," "keep this file under 200 lines."
Standing instructions
Many AI coding tools support a persistent instructions file (Claude Code uses CLAUDE.md, for example) that's automatically included in every conversation, a good place for conventions that apply to every task, so you don't have to repeat them.
# CLAUDE.md
- Use Tailwind utility classes, not custom CSS files.
- All new API routes need a matching Zod schema.
- Run `npm test` before considering a change complete.
Breaking work into steps
Large, multi-part tasks ("build a whole checkout flow") produce weaker results than a sequence of smaller, well-defined ones ("add the cart total calculation," then "wire it into the checkout page," then "add validation"). Each smaller step is easier to verify, and a mistake in step one doesn't compound through steps two and three before you notice it.
WARNING
An AI that doesn't have access to your actual codebase will still confidently guess, and often get file paths, function names, or library APIs wrong. Always give it a way to look at the real code rather than working from a description alone.