clean-codebase

clean-codebase is a skill for Claude Code from pjt222/agent-almanac. It costs 68 tokens per session (2,183 once invoked), scanned A, original, MIT.

A code-cleanup procedure that removes unused imports and variables, dead code, lint warnings, and inconsistent formatting without changing the program’s business logic or architecture.

In plain words
What is it for?
Use it to clean a project’s files, apply safe or aggressive hygiene fixes, and optionally run tests or create a backup before deletion.
Why use it?
It reduces clutter and makes automated code checks easier to understand after rapid development.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the agent-almanac plugin — 122 skills, 77 agents shipped together

Good fit Use it to clean a project’s files, apply safe or aggressive hygiene fixes, and optionally run tests or create a backup before deletion.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pjt222/agent-almanac/clean-codebase
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 pjt222/agent-almanac --skill clean-codebase
Clone the repo
git clone --depth 1 https://github.com/pjt222/agent-almanac

Made for: Claude Code.

Or install agent-almanac, the plugin that ships this one along with the rest of its 122 skills, 77 agents.

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-codebase

README.md
[![agentmods](https://agentmods.dev/badge/skills/pjt222/agent-almanac/clean-codebase/github.svg)](https://agentmods.dev/skills/pjt222/agent-almanac/clean-codebase)
Your own site
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/clean-codebase"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/clean-codebase/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clean-codebase

Your own site · 80×15
<a href="https://agentmods.dev/skills/pjt222/agent-almanac/clean-codebase"><img src="https://agentmods.dev/badge/skills/pjt222/agent-almanac/clean-codebase.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 68 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,183 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to medium

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • medium Rogue Agent · line 173
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.00068 $0.02183
Opus 5.5 $0.00027 $0.00873
Sonnet 5.5 $0.00014 $0.00437
Haiku 4.5 $0.00007 $0.00218

Measured 1mo ago against content hash 85851c3b61cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

clean-codebase 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 1mo 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.

i18n/caveman-lite/skills/clean-codebase/SKILL.md · 292 lines

How it starts

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

clean-codebase

When to Use

Use this skill when a codebase has accumulated hygiene debt:

  • Lint warnings have piled up during rapid development
  • Unused imports and variables clutter files
  • Dead code paths exist but were never removed
  • Formatting is inconsistent across files
  • Static analysis tools report fixable issues

Do NOT use for architectural refactoring, bug fixes, or business logic changes. This skill focuses purely on hygiene and automated cleanup.

Inputs

Parameter Type Required Description
codebase_path string Yes Absolute path to codebase root
language string Yes Primary language (js, python, r, rust, etc.)
cleanup_mode enum No safe (default) or aggressive
run_tests boolean No Run test suite after cleanup (default: true)
backup boolean No Create backup before deletion (default: true)

Procedure

Step 1: Pre-Cleanup Assessment

Measure the current state to quantify improvements later.

# Count lint warnings by severity
lint_tool --format json > lint_before.json

# Count lines of code
cloc . --json > cloc_before.json

# List unused symbols (language-dependent)
# JavaScript/TypeScript: ts-prune or depcheck
# Python: vulture
# R: lintr unused function checks

Got: Baseline metrics saved to lint_before.json and cloc_before.json

If fail: If lint tool not found, skip automated fixes and focus on manual review

Step 2: Fix Automated Lint Warnings

Apply safe automated fixes (spacing, quotes, semicolons, trailing whitespace).

JavaScript/TypeScript:

eslint --fix .
prettier --write .

Python:

black .
isort .
ruff check --fix .

R:

Rscript -e "styler::style_dir('.')"

Rust:

cargo fmt
cargo clippy --fix --allow-dirty

Got: All safe lint warnings resolved; files formatted consistently

If fail: If automated fixes introduce test failures, revert changes and escalate

Read the full file on GitHub · 292 lines

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. 1mo ago First seen · 292 lines · 68 tokens per session scan A 85851c3b61cb

Subscribe to this mod's changes

clean-codebase is a skill published in the GitHub repository pjt222/agent-almanac (39 stars, last pushed yesterday), licensed MIT. It adds 68 tokens to every session and 2,183 once invoked, about $0.0003 per session on Opus 5.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-09-03.