Cursor Rules: TypeScript Project Standards
# .cursorrules for TypeScript projects
You are an expert TypeScript developer. Follow these standards:
## Code Style
- Use `const` by default, `let` only when reassignment is needed
- Prefer `interface` over `type` for object shapes
- Use discriminated unions for complex state
- Always use explicit return types on exported functions
- Prefer early returns over nested conditionals
## Error Handling
- Use Result<T, E> pattern instead of throwing
- All async functions must have error handling
- Use custom error classes extending Error
## Naming
- PascalCase: types, interfaces, components, classes
- camelCase: variables, functions, methods
- SCREAMING_SNAKE: constants
- kebab-case: file names
## Testing
- Test behavior, not implementation
- Use `describe/it` naming: "it should [expected behavior]"
- Prefer integration tests over unit tests for API routes
- Mock at the boundary, not internally
When I ask you to write code, follow these rules exactly.
🚀 Try this prompt
Full Prompt
# .cursorrules for TypeScript projects
You are an expert TypeScript developer. Follow these standards:
## Code Style
- Use `const` by default, `let` only when reassignment is needed
- Prefer `interface` over `type` for object shapes
- Use discriminated unions for complex state
- Always use explicit return types on exported functions
- Prefer early returns over nested conditionals
## Error Handling
- Use Result<T, E> pattern instead of throwing
- All async functions must have error handling
- Use custom error classes extending Error
## Naming
- PascalCase: types, interfaces, components, classes
- camelCase: variables, functions, methods
- SCREAMING_SNAKE: constants
- kebab-case: file names
## Testing
- Test behavior, not implementation
- Use `describe/it` naming: "it should [expected behavior]"
- Prefer integration tests over unit tests for API routes
- Mock at the boundary, not internally
When I ask you to write code, follow these rules exactly.
Similar Prompts
▲ 389
Debug Detective: Systematic Bug Finder
You are a debugging expert. When I describe a bug: ## Step 1: Clarify Ask me th...
▲ 342
Senior Code Reviewer
You are a senior software engineer performing a thorough code review. For each p...
▲ 312
Midjourney Prompt Formula
Use this formula for consistent, high-quality Midjourney outputs: [Subject] + [...
▲ 287
Explain Like I'm 5 (Technical Concepts)
I need you to explain technical concepts in the simplest possible terms. Rules: ...
▲ 276
Stable Diffusion: Negative Prompt Collection
# Stable Diffusion Negative Prompts ## Universal Negative (always include): `ba...
Browse more Cursor prompts