Naa College Blog / AI Tools and Vibe Coding
How to Write Better Prompts for AI Coding Tools
Write better coding prompts by stating the goal, repository context, constraints, acceptance criteria, and tests—then review the result.
Updated 2026-10-11 · By Naa College
A useful prompt tells an AI coding tool what outcome you need, what context matters, and what must stay unchanged. A vague request such as “make my website professional” leaves the tool to guess which files, design choices, and existing behaviors are allowed to change.
1. Include six essentials 1. Goal: What problem should the user be able to solve? 2. Context: Which framework, route, component, data source, or error matters? 3. Expected behavior: What should happen for valid, invalid, empty, and edge-case inputs? 4. Constraints: Which existing features must remain untouched? Are new dependencies, APIs, or backend services allowed? 5. Acceptance criteria: What observable results prove the task is complete? 6. Verification: Which build, type-check, tests, and manual checks should run?
2. Turn a vague request into a useful prompt Vague: “Fix my college predictor.”
Better: “Inspect the existing college predictor and identify how it handles the selected category and special-category seats. Do not change the UI or unrelated filters. Explain the current behavior first, then make the smallest change needed to match the stated rule. Add tests for normal results, special-category results, missing data, and empty results. Run the repository's existing checks and report their actual results.”
The better prompt gives the tool a scope, constraints, edge cases, and a definition of done without prescribing an unverified implementation.
3. Ask for an audit before edits For an existing repository, request a brief audit of the framework, routes, shared components, data flow, scripts, and tests. Ask the tool to list proposed files before editing. Preserve user changes and avoid asking for a full rewrite when a small patch is enough.
4. Work in small, reviewable stages - Plan the change. - Implement one coherent unit. - Inspect the diff. - Run tests and the build. - Check that unrelated features still work. - Commit a logical checkpoint. - Verify the preview or deployment before calling the task finished.
If the tool reports that a test passed, look for the command output. If a check cannot run, the final report should say so clearly rather than pretending it passed.
5. Use examples and clear output formats When the desired result has a specific shape, show a small example. Ask for a table, JSON schema, checklist, or exact response format only when it helps. Examples should represent real requirements and include edge cases; avoid examples that encourage hardcoding one answer.
Official prompting guidance from Google's prompt design strategies and Anthropic's prompting best practices also emphasises clear instructions, context, examples, and iterative refinement. Different models may respond differently, so test prompts against the actual tool you use.
6. Protect secrets and project integrity Never include passwords, private keys, service-account credentials, or confidential student data in a prompt or public repository. Ask the tool to preserve environment configuration, review dependencies, and flag any new network requests. Anything shipped to a browser can be inspected by visitors.
7. A reusable prompt template “Act as a careful engineer working in my existing repository. First inspect the current architecture and relevant files. The goal is: [goal]. Expected behavior: [criteria]. Preserve: [existing behavior]. Constraints: [dependencies, data, design, and security limits]. Before editing, identify the likely files and risks. Make the smallest maintainable change, show the diff, run [checks], test edge cases, and report what actually passed and what could not be verified. Do not claim success without evidence.”
The principle: Better prompts reduce ambiguity, but they do not replace code review, tests, or your responsibility to understand the change.
Official and reference sources
- Google AI for Developers — Prompt design strategies
- Anthropic — Prompting best practices
- Google Search Central — SEO Starter Guide
Educational information only. Verify time-sensitive details with the relevant official authority or product documentation.