# AI Prompt Structure Standards
## Rule
All system prompts and instruction files for AI coding tools MUST follow a consistent structure with role, constraints, output format, and examples.
## Required Structure
```markdown
## Role
[One paragraph: who the AI is and what it specializes in]
## Stack
[Bullet list of technologies with versions]
## Rules
[ALWAYS/NEVER constraints with specific patterns]
## Output Format
[How generated code should be structured]
## Examples
[At least one good/bad pair for key patterns]
```
## Constraint Formatting
### Good — Specific and Actionable
```markdown
- ALWAYS use TypeScript interfaces for component props (not type aliases)
- NEVER use `any` — use `unknown` with type narrowing instead
- ALWAYS wrap async operations in try/catch with typed error handling
- NEVER use default exports except for Next.js pages and layouts
```
### Bad — Vague and Unenforceable
```markdown
- Write good TypeScript
- Handle errors properly
- Use best practices
- Follow conventions
```
## Example Requirements
- Include at least one good/bad example pair per major pattern
- Examples should be real code, not pseudocode
- Include file path comment at the top of each example
## Length Limits
| Tool | Max Lines | Max Tokens |
|------|-----------|------------|
| CLAUDE.md | 500 lines | ~4000 tokens |
| .cursorrules | 200 lines | ~2000 tokens |
| copilot-instructions.md | 150 lines | ~1500 tokens |
| .windsurfrules | 150 lines | ~1500 tokens |
## Anti-Patterns
- "Write clean code" (unmeasurable, AI interprets differently each time)
- 50+ constraints (AI can't follow that many — prioritize top 10)
- No examples (AI guesses your patterns)
- Contradicting constraints in different sections