Use when modifying existing files, refactoring, improving code quality, or touching legacy code by applying the Boy Scout Rule to leave code better than you found it.
Limited to specific tools
Additional assets for this skill
This skill is limited to using the following tools:
name: boy-scout-rule description: Use when modifying existing files, refactoring, improving code quality, or touching legacy code by applying the Boy Scout Rule to leave code better than you found it. allowed-tools:
"Leave the campground cleaner than you found it."
Always leave code better than you found it. Make incremental improvements when you touch a file.
Code Quality:
x, temp, data → descriptive)mix lint && mix test or
yarn test:lint && yarn ts:check && yarn testAdd worker search filter
- Implement location-based filtering
- Add tests for search radius
Boy Scout improvements:
- Extract SEARCH_RADIUS constant
- Add type annotations to helper functions
- Remove unused import statements
- Improve variable naming in search logic
Before:
function calculateTotal(items) { // No types
let t = 0; // Poor naming
for (let i = 0; i < items.length; i++) { // Old-style
t += items[i].price * 1.08; // Magic number
}
return t;
}
After:
const TAX_RATE = 1.08;
function calculateTotal(items: Item[]): number {
return items.reduce((total, item) => {
return total + (item.price * TAX_RATE);
}, 0);
}
Improvements: types, constant, naming, modern syntax, simplified.
During implementation: Make changes, apply boy scout, verify, commit together
During code review: Look for boy scout opportunities, recognize good boy scouting
During bug fixes: Fix bug, improve surrounding code, add tests, clean up