Code Quality Check
Run this checklist before committing code:
1. SOLID Principles
[S] Single Responsibility - Each class/function does ONE thing
[O] Open/Closed - Extend without modifying
[L] Liskov Substitution - Subtypes are substitutable
[I] Interface Segregation - Small, focused interfaces
[D] Dependency Inversion - Depend on abstractions
2. Clean Code Rules
ā Names reveal intent
ā Functions < 20 lines
ā Max 3 parameters (use objects if more)
ā No magic numbers/strings
ā DRY - No duplication
ā Comments explain WHY not WHAT
3. Error Handling
ā All errors caught and handled
ā No silent failures
ā Meaningful error messages
ā Proper logging
ā Cleanup in finally blocks
4. Performance
ā No N+1 queries
ā Proper indexing
ā Caching where appropriate
ā Lazy loading for heavy ops
ā No memory leaks
5. Security
ā Input validated
ā Output sanitized
ā No SQL injection vectors
ā No XSS vulnerabilities
ā Secrets in env vars
ā Dependencies updated
6. Testing
ā Unit tests written
ā Edge cases covered
ā Mocks used for external deps
ā Tests are fast (< 1s each)
ā Coverage > 80%
7. Documentation
ā Public APIs documented
ā Complex logic explained
ā README updated
ā Examples provided
Quick Scan (30 seconds)
# Run before commit:
1. grep -r "TODO\|FIXME\|XXX\|HACK" .
2. Check for console.log / print statements
3. Verify no commented-out code blocks
4. Check for hardcoded credentials
5. Run linter
6. Run tests
Token-Efficient Usage
- Use as final validation, not during writing
- Catch issues before review (saves back-and-forth)
- Automate what you can (linters, formatters)