05
High-Quality Prompt Templates
High-Quality Prompt Templates
In day-to-day development, fixed templates let you consistently reproduce good results. Here are 3 patterns you can use right away.
Task + Context + Constraints + Output + Acceptance
[Task] Implement frontend validation logic for a login form
[Context] Using React + TypeScript, existing components Form and Input, can reuse hooks/useToast
[Constraints] Don't add new dependencies; return specific field-level error messages on failure
[Output] Complete code block with type definitions; include 2 input/output examples
[Acceptance] Code must pass ESLint; explain which edge cases are covered
This works for the vast majority of feature work. The key is spelling out "where the project stands now" and "what counts as done."
Role + Steps + Checklist
You're a code review assistant. Follow these steps:
1) Read @pages/login.tsx and @components/Form.tsx
2) Find accessibility issues that can be improved
3) Output a fix as a patch (in a Markdown code block), then list a checklist
Checklist: keyboard navigable, fields have labels, error messages are screen-reader accessible
Good for refactoring, reviews, and accessibility audits — anything that benefits from a structured checklist.
Diff/Patch Instructions
Generate a patch for @components/Button.tsx:
- Change the primary button background to #0f172a, add shadow on hover
- Keep props unchanged, don't break existing usage
- Output a unified diff, don't include unrelated files
When you're making small changes to existing code, asking for a patch minimizes collateral damage and unrelated modifications.
Practice
- Pick one of the patterns above and run it in Cursor against your current project. See if AI follows the format.
- Tweak the "constraints" and "acceptance" fields, observe how the output changes, and start building your own template library.