Best Practices
Language References
Based on file extension, load the appropriate reference:
- •
.ts,.js→references/typescript.md - •
.tsx,.jsx→references/typescript.md+references/react/react.md - •
.py→references/python.md+references/python/INDEX.md - •
.go→references/go.md - •
.swift→references/swift.md
Universal principles: references/universal.md
Next.js/React References
For Next.js projects, use references/react/ directory:
- •
references/react/rules/INDEX.md- pattern index by impact level - •
references/react/rules/_sections.md- priorities and categories - •Specific rule files matching observed patterns
Rule Application
- •Auto-detect frameworks; only apply Next.js rules if Next.js is detected
- •Prefer CRITICAL rules first (waterfalls, bundle size, hydration)
- •Preserve behavior and public interfaces
Code Quality Standards
- •Comments: Only for complex business logic; remove code-restating comments
- •Error Handling: Try-catch only where recoverable; no defensive checks in trusted paths
- •Type Safety: No
any; use proper types orunknownwith guards - •Style: Match existing code style; check CLAUDE.md
- •Cleanup: Remove all unused imports, variables, functions, types
- •No compat hacks: Delete unused
_vars, re-exports of deleted code - •Renaming: Use descriptive names instead of marking unused
- •Dead code: Delete completely, never comment out
Workflow
- •Identify target scope
- •Detect frameworks and languages
- •Load language + framework references
- •Filter rules for detected frameworks only
- •Analyze complexity, redundancy, violations
- •Execute behavior-preserving refinements
- •Validate tests pass