AGENT SKILL

repo-cleanup

Audit a repository and its Claude Code setup for wasted tokens, wasted time, and dead weight — then plan and apply fixes under evidence. Use when the user asks why sessions are slow or expensive, wants CLAUDE.md / .claude / skills / agents / MCP trimmed or optimized, wants dead code, unused dependencies, disabled tests or repo bloat found, asks where the tokens went, or says "repo-cleanup", "/repo-cleanup", "audit this repo", "clean up my .claude folder", "reduce context cost". Read-only by default; every finding carries evidence, a confidence level, and what was not verified.

License 许可
MIT
最近更新
2026-10-07
Stars
★ 1
Forks
1

01 前言 Front Matter

name
repo-cleanup
metadata
{ "version": "1.0.0" }
description
Audit a repository and its Claude Code setup for wasted tokens, wasted time, and dead weight — then plan and apply fixes under evidence. Use when the user asks why sessions are slow or expensive, wants CLAUDE.md / .claude / skills / agents / MCP trimmed or optimized, wants dead code, unused dependencies, disabled tests or repo bloat found, asks where the tokens went, or says "repo-cleanup", "/repo-cleanup", "audit this repo", "clean up my .claude folder", "reduce context cost". Read-only by default; every finding carries evidence, a confidence level, and what was not verified.

02 资源文件 47

03 SKILL.md 正文

repo-cleanup — evidence-driven repo & Claude-setup auditor

Portable: assumes nothing about language, package manager or layout beyond what detect-stack.mjs reports. Zero dependencies; every script is node >= 22.

You are the interpreter, not the measurer. Scripts produce numbers; you turn numbers into findings with a severity, a confidence and a recommendation. Never assert a number you did not get from a script or a command you ran.

Non-negotiables

  1. Read-only by default. audit, plan, verify write nothing outside .repo-cleanup/. Never .gitignore, never source, never settings. Check git status --porcelain before and after, and report that it is unchanged.
  2. Evidence or it is a suspicion. confidence: confirmed needs a measurement taken now or a static proof over the full file set. An estimate is never confirmed, and the word estimate appears next to every estimated number.
  3. Lead with what was NOT verified. Before findings, not in a footnote.
  4. The host repo's rules bind you. Read its CLAUDE.md and .claude/rules/** first; treat what they protect as protected.
  5. No secret reaches a report. Everything written passes redact(). Credential files are detected by name, never opened.
  6. Attribution and themes are the only places a third-party product may be named. Everywhere else a product name is a leak — see reference-leakage.md.
  7. One finding per fix. There is no "fix everything" verb; do not improvise one.

Modes

Argument after /repo-cleanup; default audit.

Mode Reference to load Script
context context-budget.md context-footprint.mjs
tokens token-forensics.md usage-forensics.mjs
docs doc-hygiene.md doc-hygiene.mjs
repo repo-hygiene.md repo-inventory.mjs
refs reference-leakage.md reference-leakage.mjs
audit (default) all five all five
plan <ID> remediation.md —
fix <ID> remediation.md + safety-model.md detected gate
verify [<ID>] remediation.md re-run the relevant analyzer

stack-adapters.md only when the stack is unsupported or you are adding an adapter.

Workflow

0. Orient — always

node .claude/skills/repo-cleanup/scripts/detect-stack.mjs

Emits stack.json. A repo with no manifest and no git is valid input: degrade, do not fail. Read the host CLAUDE.md + .claude/rules/**. Load finding-model.md and safety-model.md.

1. Measure

Run the invoked mode's script(s); load only that mode's reference. Scripts print JSON to stdout. Announce anything potentially expensive before running it and bound it with a timeout.

Save each result: writeEvidence(root, name, data) from scripts/report.mjs.

2. Interpret

Turn observations[] into findings via makeFinding() in scripts/findings.mjs — it enforces the schema and will throw on an empty limitations or an estimate claiming confirmed. That is the guard working; fix the finding, do not bypass it.

Impact needs volume. Without tokens data, a footprint finding's impact is unquantified and its confidence is at most medium. Say so rather than inventing a multiplier.

Drop observations that do not support a finding. An observation is not a finding.

3. Report

writeReport({ root, mode, ranAt, stack, findings, summary, notVerified, ran });

Ranking, grouping and section order are deterministic — do not hand-format the report. Record a baseline with writeBaseline() so verify has something to compare against.

In chat: the top three findings and the single first action. Link .repo-cleanup/report.md; do not paste it.

4. plan / fix / verify

Follow remediation.md. fix requires one finding id, a clean tree, re-confirmed evidence, no protected path, the smallest change, and the detected gate green afterwards. Gate red ⇒ stop and restore. Settings changes route through the bundled update-config skill.

5. Self-audit — every run

If SKILL.md exceeds its 6 KB cap, or a reference has grown detail belonging in a script, raise it as a DOC- finding against this skill. It is not exempt from its own rules.

Do not rebuild what exists

  • settings.json edits → update-config.
  • Permission-prompt reduction → fewer-permission-prompts.
  • Logic review → /code-review, /simplify, /security-review. This skill finds dead and duplicated code; it does not review correctness.

Install elsewhere

Copy .claude/skills/repo-cleanup/ and .claude/commands/repo-cleanup.md into the target repo, then node .claude/skills/repo-cleanup/scripts/validate-installation.mjs. Optional .repo-cleanup.yml at the repo root (documented subset — see scripts/config.mjs). Never write into another repository on the user's behalf; hand them the steps.

Tests: node --test ".claude/skills/repo-cleanup/tests/*.test.mjs".

04 同仓库更多 Skills

mreimitz
mreimitz/elabs-components

brand-ui

Build UI with the brand-ui component system (@elabs-ai/components-* packages — ui, data, ai, flow, maps, charts, marketing, editor, viewer, terminal, tokens, icons). Use when working in a project that depends on @elabs-ai/components-ui or any @elabs-ai/components-* package, when adding/composing components, building dashboards, data tables, AI/chat surfaces, React Flow canvases, MapLibre maps, code editors, file/document viewers, app shells, forms, or marketing sections, when theming with the token system, or when the user mentions brand-ui, @brand, light/dark themes, or "our design system". Provides live project context, the real component API, composition patterns, and the rules that keep components token-driven, accessible, and theme-safe.

★ 1
mreimitz
mreimitz/elabs-components

brand-ui-update-theme

Use when an existing brand-ui theme family should be improved from new material — updated brand guidelines, a new logo, product screenshots, a live site, feedback like "the green is off" or "match their new design system" — e.g. "update the qlik theme with these links", "refresh our theme from the new brand book", "/update-theme". For a brand with no theme yet, use brand-ui-create-theme.

★ 1
mreimitz
mreimitz/elabs-components

brand-ui-theme

Create or retune a brand-ui theme (token work). Use when adding a new theme, re-branding the system to a customer's palette, adjusting global radius/spacing/surfaces, or fixing token-level contrast across themes. Use when the user says "new theme", "brand it for <customer>", "make corners less rounded", "dark theme", "adjust the tokens", or "our colors". Every change is a token in a theme stylesheet — never a hardcoded value in a component.

★ 1
mreimitz
mreimitz/elabs-components

brand-ui-start

The front door for building UI with brand-ui — a router/concierge that asks what you want to do and hands you to the right flow. Use when someone is starting out and unsure where to begin ("help me with brand-ui", "where do I start", "I want to build something", "what can brand-ui do", "get me going"), or types /brand-ui-start. Routes to three flows — build a NEW app (brand-ui-new-app), improve/migrate an EXISTING app (brand-ui-migrate), or just help me USE brand-ui in an app that already has it (brand-ui). If the intent is already obvious (the person said "build me a dashboard" or "audit this screen"), skip the question and go straight to that flow.

★ 1
mreimitz
mreimitz/elabs-components

brand-ui-registry

Curate the brand-ui shadcn-compatible registry (maintainer workflow). Use when deciding whether something belongs as an imported @elabs-ai/components-* primitive vs a copy-own registry block/template, when adding or editing a registry item, or when validating/building the registry for distribution. Use when the user says "add a registry item", "make this a block", "publish to the registry", or "package vs registry". For consuming registry items in an app, use the `brand-ui` skill (npx shadcn add).

★ 1
mreimitz
mreimitz/elabs-components

brand-ui-new-app

Define-to-build — scaffold a new brand-ui app from a plain-language description (VP-02). Use when the user wants to START an app, page, or demo ("build me a sales dashboard", "I need an admin console for X", "new app", "scaffold a chat assistant", "create a landing page for a pitch") rather than add to an existing one. Runs a staged interview (quick 3-question mode or full 7-stage spec mode), writes an app-spec.md, then scaffolds from the matching template + playbook with every wiring point annotated and a starter CLAUDE.md so later agent sessions stay on-brand. For adding components to an existing app use `brand-ui`; for authoring library components use `brand-ui-component`.

★ 1