Skip to content

Prompt Templates

Stop typing the same prompts repeatedly. Build a systematic library of reusable prompt templates that ensure consistent, high-quality AI responses while saving hours of typing time.

Without templates, developers often:

  • Type similar prompts 10-20 times daily
  • Get inconsistent AI responses
  • Forget important context or constraints
  • Waste mental energy on prompt crafting

With templates, you:

  • Save 20-30 minutes daily on prompt writing
  • Get 40% better AI responses through optimized prompts
  • Maintain consistency across your team
  • Focus on problem-solving, not prompt engineering

Code Generation

Templates for creating new code components

Debugging

Systematic debugging prompt patterns

Refactoring

Consistent refactoring instructions

Documentation

Templates for various documentation needs

Testing

Test generation and improvement prompts

Reviews

Code review and analysis templates

## Feature: [FEATURE_NAME]
### Context
- Current file: [FILE_PATH]
- Related files: [RELATED_FILES]
- Design reference: [FIGMA_LINK/SPEC]
### Requirements
1. [REQUIREMENT_1]
2. [REQUIREMENT_2]
3. [REQUIREMENT_3]
### Constraints
- Must maintain backward compatibility
- Follow existing patterns in [EXAMPLE_FILE]
- Include proper error handling
- Add comprehensive JSDoc comments
### Implementation Approach
Please implement this feature using [PATTERN/ARCHITECTURE]

Usage Example:

## Feature: User Authentication Modal
### Context
- Current file: components/Layout.tsx
- Related files: lib/auth.ts, components/Button.tsx
- Design reference: @figma authentication-flow
### Requirements
1. Modal with email/password inputs
2. Social login buttons (Google, GitHub)
3. Remember me checkbox
4. Forgot password link
### Constraints
- Must maintain backward compatibility
- Follow existing patterns in components/Modal.tsx
- Include proper error handling
- Add comprehensive JSDoc comments
### Implementation Approach
Please implement this feature using our existing Modal component pattern
## Bug Investigation: [ISSUE_DESCRIPTION]
### Symptoms
- Error message: [ERROR_MESSAGE]
- When it occurs: [TRIGGER_CONDITIONS]
- Affected users: [USER_SEGMENT]
### Current Behavior
[DESCRIBE_CURRENT]
### Expected Behavior
[DESCRIBE_EXPECTED]
### Investigation Steps
1. Add strategic console.logs to trace execution flow
2. Check for [COMMON_CAUSE_1]
3. Verify [ASSUMPTION_1]
4. Run tests and report findings
### Context Files
@file [RELEVANT_FILE_1]
@file [RELEVANT_FILE_2]
## Refactor: [COMPONENT/FUNCTION_NAME]
### Goal
[SPECIFIC_REFACTORING_GOAL]
### Current Issues
1. [ISSUE_1]
2. [ISSUE_2]
### Target Architecture
- Pattern: [DESIGN_PATTERN]
- Dependencies: [NEW_DEPS]
- Breaking changes: [YES/NO]
### Preservation Requirements
- All existing tests must pass
- Public API remains unchanged
- Performance must not degrade
### Step-by-Step Approach
1. [STEP_1]
2. [STEP_2]
3. Run tests after each step
## Generate Tests: [COMPONENT/FUNCTION]
### Test Framework
- Framework: [Jest/Vitest/etc]
- Style: [describe/it blocks]
- Coverage target: [80%+]
### Test Categories Needed
- [ ] Happy path scenarios
- [ ] Edge cases
- [ ] Error conditions
- [ ] Performance boundaries
- [ ] Integration points
### Specific Scenarios
1. [SCENARIO_1]
2. [SCENARIO_2]
### Mock Requirements
- External APIs: [API_LIST]
- Database calls: [DB_OPERATIONS]
- Time-dependent operations
Include descriptive test names and comprehensive assertions

Use conditional sections based on context:

## Implement: [FEATURE]
### Base Requirements
[ALWAYS_INCLUDE]
{{IF_FRONTEND}}
### UI Requirements
- Responsive design
- Accessibility (WCAG 2.1 AA)
- Loading states
- Error states
{{/IF_FRONTEND}}
{{IF_BACKEND}}
### API Requirements
- RESTful endpoints
- Input validation
- Rate limiting
- Proper status codes
{{/IF_BACKEND}}
{{IF_DATABASE}}
### Database Considerations
- Migration script
- Indexes for performance
- Data integrity constraints
{{/IF_DATABASE}}

Link templates for complex workflows:

## Workflow: Add New Feature
### Step 1: Planning
[Use PLANNING_TEMPLATE]
### Step 2: Implementation
[Use FEATURE_TEMPLATE with context from Step 1]
### Step 3: Testing
[Use TEST_TEMPLATE with implementation from Step 2]
### Step 4: Documentation
[Use DOCS_TEMPLATE with all previous context]
## Create React Component: [COMPONENT_NAME]
### Type
- [ ] Functional Component
- [ ] Server Component (Next.js 13+)
- [ ] Client Component with 'use client'
### Features
- [ ] TypeScript props interface
- [ ] Memo optimization
- [ ] Error boundary
- [ ] Loading state
- [ ] Storybook story
### Hooks Needed
- [ ] useState for: [STATE_DESCRIPTION]
- [ ] useEffect for: [EFFECT_PURPOSE]
- [ ] Custom hooks: [HOOK_NAMES]
### Performance
- [ ] Implement React.memo if pure
- [ ] Use useCallback for handlers
- [ ] Lazy load if heavy

Track your prompts for one week:

  • What do you ask repeatedly?
  • What context do you always include?
  • What constraints do you often forget?
## Template Name: [DESCRIPTIVE_NAME]
### Always Include
- [CONSTANT_ELEMENT_1]
- [CONSTANT_ELEMENT_2]
### Variables
- [VARIABLE_1]: [DESCRIPTION]
- [VARIABLE_2]: [DESCRIPTION]
### Optional Sections
- [CONDITION]: [OPTIONAL_CONTENT]
  1. Use template 5 times
  2. Note missing elements
  3. Remove unnecessary parts
  4. Adjust for optimal AI response

Store templates in:

  • .cursor/prompts/ directory
  • Team wiki/documentation
  • Cursor rules for auto-inclusion
.cursor/
├── prompts/
│ ├── feature/
│ │ ├── component.md
│ │ ├── api-endpoint.md
│ │ └── database-migration.md
│ ├── debug/
│ │ ├── performance.md
│ │ ├── memory-leak.md
│ │ └── integration-failure.md
│ ├── refactor/
│ │ ├── extract-function.md
│ │ ├── design-pattern.md
│ │ └── performance-optimize.md
│ └── team/
│ ├── code-review.md
│ ├── onboarding.md
│ └── documentation.md
  1. VS Code Snippets Integration
{
"Cursor Feature Template": {
"prefix": "cursor-feature",
"body": [
"## Feature: ${1:FeatureName}",
"",
"### Context",
"- Current file: ${TM_FILEPATH}",
"- Related files: ${2:files}",
"",
"### Requirements",
"1. ${3:requirement}",
"",
"### Constraints",
"- ${4:constraint}"
]
}
}
  1. Cursor Rules Integration
.cursor/rules/templates.md
When implementing new features, always structure the request using our feature template format with Context, Requirements, and Constraints sections.

Track these metrics:

MetricBefore TemplatesWith TemplatesImprovement
Prompt writing time5 min/prompt30 sec/prompt90% faster
AI response qualityVariableConsistent40% better
Rework neededOftenRare75% less
Team consistencyLowHigh3x better
  1. Start Simple - Begin with 3-5 core templates
  2. Iterate Frequently - Refine based on AI responses
  3. Version Control - Track template changes in git
  4. Team Workshops - Build templates together
  5. Automate Usage - Integrate with shortcuts/snippets

With your prompt template library established:

Remember: Great templates are living documents. Update them as you learn what produces the best AI responses for your specific needs.