Campsite Rule patterns for incremental tech debt reduction.
Campsite Rule: Leave code a little better than you found it.
Priority by risk:
"Leave the code a little better than you found it."—Baden-Powell's Campsite Rule
Pragmatic over perfect:
| Priority | Pattern | Risk | Auto-apply? |
|---|---|---|---|
| 1 | Default → Named exports | LOW | Yes |
| 2 | Magic strings → Enums | LOW | Yes |
| 3 | Inline styles → Box props | LOW | Yes |
| 4 | any → Proper types | MEDIUM | Yes |
| 5 | useEffect anti-patterns | MEDIUM | Cautiously |
| 6 | UI modernization | MEDIUM | Yes (when replacement exists) |
| 7 | GraphQL co-location | MEDIUM | Ask first |
| 8 | Extract hooks | HIGH | Ask first |
| 9 | Split large files | HIGH | Ask first |
Benefits: Better tree-shaking, consistent naming, easier refactoring
Benefits: Type safety, exhaustiveness checking, autocomplete
Benefits: Design token consistency, no inline styles
Only refactor when @prepared/ui-* replacement exists:
Move centralized GraphQL operations to component directories:
Ask first - moves files, affects imports
Ask first - creates new files, significant refactor
Files >500 lines should be split:
Ask first - creates multiple files, affects imports
Task: Add loading state to IncidentCard.tsx
File contains:
Apply Campsite Rule:
Result: File is incrementally better without perfect refactor.
Current tech debt in dispatch app:
Goal: Reduce incrementally through Campsite Rule.
For more detailed technical guidance, see these reference files:
On this page