1. cheat-sheets
  2. /ai prompting

AI Prompting for Code

Last reviewed: June 2026

Pair with the full guide: Prompting for Code · Project Rules

Prompt Template

## Goal
[One sentence — what should exist when done]

## Stack
[Framework versions, language, key libraries]

## Requirements
- [ ] Requirement 1
- [ ] Requirement 2

## Constraints
- Only modify: [files]
- Do not: [add deps, refactor X]

## Verify
[Commands: npm test, npm run lint]

Context Checklist

Before sending a coding prompt, attach or mention:

ItemInclude?
Target file(s)Yes — @Files or path
Pattern to matchYes — "like LoginForm.jsx"
Stack versionsYes — in rules or prompt
Entire repoNo
Error output (full)Yes — when debugging
Secrets / .envNever

Mode Quick Reference

ModePrompt starter
Ask"Explain how X works in @Files"
Plan"Propose a plan. Do not implement."
Agent"Implement step N of the plan above."
Debug"Root cause of this error: [paste stack]"

Review Checklist (Before Merge)

  • [ ] git diff — only expected files
  • [ ] Lint + typecheck pass
  • [ ] Tests pass; new tests assert behavior
  • [ ] No new env vars without docs
  • [ ] No hardcoded secrets
  • [ ] Imports resolve (npm run build)

Bad Prompt → Better Prompt

BadBetter
Fix the bugIn Footer.jsx, fix broken link on line 42; match other footer links
Make it fasterProfile fetchData; cache GET /api/users for 60s; no new deps
Add testsAdd tests for validateEmail edge cases: empty, invalid, valid