Common rules define language-agnostic principles that apply broadly across all projects. Language-specific rules can extend or override these where language idioms differ.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/affaan-m/everything-claude-code/llms.txt
Use this file to discover all available pages before exploring further.
Coding Style
Immutability (CRITICAL)
File Organization
MANY SMALL FILES > FEW LARGE FILES
- High cohesion, low coupling
- 200-400 lines typical, 800 max
- Extract utilities from large modules
- Organize by feature/domain, not by type
Error Handling
ALWAYS handle errors comprehensively:Handle errors explicitly at every level
Handle errors explicitly at every level
Provide user-friendly error messages in UI-facing code
Provide user-friendly error messages in UI-facing code
Log detailed error context on the server side
Log detailed error context on the server side
Never silently swallow errors
Never silently swallow errors
Input Validation
ALWAYS validate at system boundaries:- Validate all user input before processing
- Use schema-based validation where available
- Fail fast with clear error messages
- Never trust external data (API responses, user input, file content)
Code Quality Checklist
Before marking work complete:- Code is readable and well-named
- Functions are small (<50 lines)
- Files are focused (<800 lines)
- No deep nesting (>4 levels)
- Proper error handling
- No hardcoded values (use constants or config)
- No mutation (immutable patterns used)
Testing
Minimum Test Coverage: 80%
Test Types (ALL required):Test-Driven Development
MANDATORY workflow:Troubleshooting Test Failures
- Use tdd-guide agent
- Check test isolation
- Verify mocks are correct
- Fix implementation, not tests (unless tests are wrong)
Agent Support
tdd-guide
Security
Mandatory Security Checks
Before ANY commit:- No hardcoded secrets (API keys, passwords, tokens)
- All user inputs validated
- SQL injection prevention (parameterized queries)
- XSS prevention (sanitized HTML)
- CSRF protection enabled
- Authentication/authorization verified
- Rate limiting on all endpoints
- Error messages don’t leak sensitive data
Secret Management
NEVER hardcode secrets in source code
NEVER hardcode secrets in source code
ALWAYS use environment variables or a secret manager
ALWAYS use environment variables or a secret manager
.env files (not committed) or a secret management service.Validate that required secrets are present at startup
Validate that required secrets are present at startup
Rotate any secrets that may have been exposed
Rotate any secrets that may have been exposed
Security Response Protocol
If security issue found:Patterns
Skeleton Projects
When implementing new functionality:Search for battle-tested skeleton projects
Use parallel agents to evaluate options
- Security assessment
- Extensibility analysis
- Relevance scoring
- Implementation planning
Repository Pattern
Encapsulate data access behind a consistent interface:Define standard operations
Define standard operations
Concrete implementations handle storage details
Concrete implementations handle storage details
Business logic depends on the abstract interface
Business logic depends on the abstract interface
Benefits
Benefits
API Response Format
Use a consistent envelope for all API responses:- Include a success/status indicator
- Include the data payload (nullable on error)
- Include an error message field (nullable on success)
- Include metadata for paginated responses (total, page, limit)
Git Workflow
Commit Message Format
Pull Request Workflow
When creating PRs:Hooks
Hook Types
PreToolUse
PostToolUse
Stop
Auto-Accept Permissions
TodoWrite Best Practices
Use TodoWrite tool to:- Track progress on multi-step tasks
- Verify understanding of instructions
- Enable real-time steering
- Show granular implementation steps
- Out of order steps
- Missing items
- Extra unnecessary items
- Wrong granularity
- Misinterpreted requirements