improve-codebase

improve-codebase is a skill for Claude Code from tomzx/agents. It costs 96 tokens per session (4,764 once invoked), scanned B, original, MIT.

A routine cleanup workflow that makes a small batch of safe codebase improvements and opens one pull request. A codebase is the complete collection of source code and related project files.

In plain words
What is it for?
It helps remove unused code, add missing types, fix lint issues, remove unused dependencies, and update dependencies when safe. It then runs the project checks and prepares a pull request.
Why use it?
It turns recurring maintenance work into a reviewable change and verifies the result with the project’s linting, type checks, and tests.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: positional $N argument; mentions AGENTS.md.

Good fit It helps remove unused code, add missing types, fix lint issues, remove unused dependencies, and update dependencies when safe. It then runs the project checks and prepares a pull request.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tomzx/agents/improve-codebase
View source ↗ tomzx/agents
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 tomzx/agents --skill improve-codebase
Clone the repo
git clone --depth 1 https://github.com/tomzx/agents

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/tomzx/agents/improve-codebase.svg)](https://agentmods.dev/skills/tomzx/agents/improve-codebase)
Your own site
<a href="https://agentmods.dev/skills/tomzx/agents/improve-codebase"><img src="https://agentmods.dev/badge/skills/tomzx/agents/improve-codebase.svg" alt="Measured on agentmods" height="20"></a>
Per session 96 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,764 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00096 $0.04764
Opus 5 $0.00048 $0.02382
Sonnet 5 $0.00019 $0.00953
Haiku 4.5 $0.00010 $0.00476

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

Security

Grade B, and why

improve-codebase scanned grade B with 1 finding 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 4d 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.

Asks the agent to reveal its instructionsmediumSystem prompt leakage

Directions to print, repeat or translate the system prompt extract configuration the operator did not intend to expose.

For `--dry-run`, write the full report to `.sdlc/improvement-dryrun-<YYYY-MM-DD>.md` and print it. For `--no-pr`, leave the local branch in place and print instructions to review and push.
skills/improve-codebase/SKILL.md · 392 lines

How it starts

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

Improve Codebase

Makes a bounded set of safe, verified improvements to a codebase, then opens a single reviewable PR. Designed to run on a weekly cadence so the codebase gets incrementally better without a big-bang refactor.

The Core Problem This Solves

/audit-sdlc and /sync-repository tell you what is wrong. They produce reports and issues, but the work of actually deleting the dead export, adding the missing type annotation, and running the formatter still falls to a human. That backlog grows faster than anyone clears it.

This skill closes that loop. Each run it scans for the same opportunities the audit skills find, picks a small batch that is safe to apply automatically, applies it, proves it is safe by running the project's own lint/typecheck/test suite, and ships it as one PR. Over weeks, the backlog shrinks instead of grows.

Skill Reads code Writes code Opens PR Cadence
audit-sdlc yes no (report only) no on demand
sync-repository yes .sdlc/ only, or --fix no on demand
improve-codebase yes yes, source code yes weekly routine

Use audit-sdlc to find problems. Use improve-codebase to fix the safe ones automatically.

Prerequisites

  • Working directory is the root of a git repository on a clean working tree (no uncommitted changes)
  • A default branch to branch from (main, or the repo's detected default)
  • A way to verify changes: a test suite, a linter/formatter, or a typechecker. The skill discovers these (see Discovery below). If none can be found, it runs in --dry-run only and asks the user to record commands in AGENTS.md.
  • Read any files under .sdlc/context/ for project conventions
  • Network access to push the branch and open a PR (unless --no-pr)

Safety Contract (Non-Negotiable)

These rules make the skill safe to run unattended on a schedule:

  1. Never touch the default branch. All work happens on a short-lived branch.
  2. Never auto-fix anything rated higher than "low risk". Security issues, dependency majors, complexity refactors, and public API changes become issues, not commits.
  3. Never skip verification. Every change must be validated by the project's own checks. If verification fails, revert that change and continue with the next candidate.
  4. One concern per commit, one PR per run. Reviewers see small atomic commits, not a wall of diff.
  5. Respect .gitignore, lint configs, and existing suppression comments (# noqa, //nolint). Do not fight the project's stated preferences.
  6. Never force-push, never amend published commits, never bypass hooks.
  7. Bounded output. A run stops at the change budget so the PR stays reviewable.
  8. Never introduce new dependencies. Only removes or patches existing ones.

Read the full file on GitHub · 392 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. 4d ago First seen · 392 lines · 96 tokens per session scan B f1d91c9a5bef

Subscribe to this mod's changes

improve-codebase is a skill published in the GitHub repository tomzx/agents (6 stars, last pushed 4d ago), licensed MIT. It adds 96 tokens to every session and 4,764 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it B with 1 finding (asks the agent to reveal its instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories