clean-code-boy-scout-rule

clean-code-boy-scout-rule is a skill for Claude Code from helmedeiros/clean-code-skills. It costs 49 tokens per session (705 once invoked), scanned A, original, MIT.

A coding practice that asks you to leave each file a little cleaner when you already change it. It is called the Boy Scout Rule, after the idea of leaving a campsite cleaner than you found it.

In plain words
What is it for?
Use it during feature work, bug fixes, or code review to make small improvements such as clearer names or simpler code in files you are already touching.
Why use it?
It gradually reduces technical debt, meaning small accumulated code problems, without requiring separate large refactoring projects.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the clean-code-skills plugin — 21 skills, 2 commands shipped together

Good fit Use it during feature work, bug fixes, or code review to make small improvements such as clearer names or simpler code in files you are already touching.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/helmedeiros/clean-code-skills/clean-code-boy-scout-rule
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add helmedeiros/clean-code-skills --skill clean-code-boy-scout-rule
Clone the repo
git clone --depth 1 https://github.com/helmedeiros/clean-code-skills

Made for: Claude Code.

Or install clean-code-skills, the plugin that ships this one along with the rest of its 21 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clean-code-boy-scout-rule

README.md
[![agentmods](https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/clean-code-boy-scout-rule.svg)](https://agentmods.dev/skills/helmedeiros/clean-code-skills/clean-code-boy-scout-rule)
Your own site
<a href="https://agentmods.dev/skills/helmedeiros/clean-code-skills/clean-code-boy-scout-rule"><img src="https://agentmods.dev/badge/skills/helmedeiros/clean-code-skills/clean-code-boy-scout-rule.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 705 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.00705
Opus 5 $0.00024 $0.00352
Sonnet 5 $0.00010 $0.00141
Haiku 4.5 $0.00005 $0.00071

Measured 8d ago against content hash 9d9be4ab13d1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

clean-code-boy-scout-rule scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/clean-code-boy-scout-rule/SKILL.md · 71 lines

How it starts

The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Clean Code: Boy Scout Rule

Leave every file you touch cleaner than you found it by making small, incremental improvements alongside your primary changes.

When This Skill Applies

  • Modifying a file that has minor quality issues
  • Working in a codebase with accumulated technical debt
  • The user mentions the boy scout rule or leaving code better
  • During code review when reviewers suggest "while you're here" improvements
  • After completing a feature, considering what small improvements to make

Core Principle

"Always leave the campground cleaner than you found it." When you open a file to make a change, make one small improvement before you leave. Over time, these incremental improvements compound. The code gets cleaner every day without dedicated refactoring sprints. The rule applies only to code you are already touching — do not refactor files unrelated to your task.

Workflow

Step 1: Make Your Primary Change

Complete the feature, bug fix, or task that brought you to the file. Ensure it works and tests pass.

Step 2: Scan for Quick Wins

Look for small improvements in the code you just touched or read:

  • A variable that could have a better name
  • A method that could be extracted
  • A comment that is redundant or outdated
  • Dead code that can be removed
  • An import that is unused

Step 3: Apply One Improvement

Make one small, low-risk improvement. Keep it in the same commit or a separate commit — but keep it small. The improvement should take less than 5 minutes.

Step 4: Verify

Run the test suite. The improvement must not change behavior. If it does, it is not a "clean up" — it is a refactoring that deserves its own process.

Step 5: Document If Needed

If the improvement is not obvious from the diff, add a brief note in the commit message: "Also: renamed ambiguous variable d to elapsedDays."

Detection / Indicators

  • Files with minor quality issues that persist for months because "it's not my task"
  • Codebase quality slowly degrades over time
  • Developers avoid touching certain files because they are messy
  • Code review comments like "this name is confusing but it's out of scope"
  • Technical debt grows without any effort to reduce it

Read the full file on GitHub · 71 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 71 lines · 49 tokens per session scan A 9d9be4ab13d1

Subscribe to this mod's changes

clean-code-boy-scout-rule is a skill published in the GitHub repository helmedeiros/clean-code-skills (2 stars, last pushed 6mo ago), licensed MIT. It adds 49 tokens to every session and 705 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

re0-merge

Review and land an external contribution the way this suite does: gate it against the thesis, land it with the author's credit intact, complete a new skill rather than merging it raw, then approve, credit, and explain before closing. Use when reviewing a pull request, as any collaborator or maintainer, not only the…

LilMGenius/paperthin · 70 tokens

sip

After you create or change an artifact or skill, taste-test it with our own skills instead of trusting your in-session judgment — recursive self-improvement, made automatic. Use right after writing or editing anything, before calling it done, committing, or handing it off.

LilMGenius/paperthin · 55 tokens

prism

Split one artifact — a claim, plan, or file — across 2 to 5 independent lenses, one per genuinely distinct failure mode (correctness, security, readability, cost, adversarial-user), and return their convergence: where they agree, where they disagree, and the single next question that resolves the disagreement. Use…

LilMGenius/paperthin · 98 tokens

hate

Attack a plan, design, or argument like you want it to fail before you commit real effort — return the single load-bearing objection and the cheapest experiment that would prove it matters, not a checklist. User-invoked on purpose: a hate-it reflex always in the agent's reach would bias it toward demolition. Weighs…

LilMGenius/paperthin · 79 tokens

issue-analyze

GitHub Issue and PR review thread deep analysis with Codex blind verdict. Use when: analyzing issue root cause, classifying problems, investigation planning, triaging PR review comments for actionability. Not for: fixing bugs (use bug-fix), code exploration (use code-explore). Output: classified analysis + verdict…

sd0xdev/sd0x-harness · 73 tokens

load-pr-review

Load GitHub PR review comments into AI session — analyze, triage, plan. Default: analysis-only (no auto-fix). Use when: reviewing PR feedback, planning fixes, addressing review comments, replying to reviewers. Not for: creating reviews (use codex-review-fast), creating PRs (use create-pr), viewing PR status (use…

sd0xdev/sd0x-harness · 77 tokens