rig-tidy

A post-merge cleanup procedure that reviews recent code changes for unused code, repeated code, outdated comments, and unused imports, then removes safe findings. A merge combines changes into a shared code branch.

In plain words
What is it for?
Use it after merging work to inspect a chosen directory and recent commits, clean obvious clutter, and run the project's tests.
Why use it?
It catches small maintenance problems that can remain after fast development or after several changes are combined.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/agent-rig/rig/rig-tidy
Any agent
npx skills add agent-rig/rig --skill rig-tidy
Clone the repo
git clone --depth 1 https://github.com/agent-rig/rig

Made for: Claude Code, Codex.

Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 802 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00056 $0.00802
Opus 5 $0.00028 $0.00401
Sonnet 5 $0.00011 $0.00160
Haiku 4.5 $0.00006 $0.00080

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

Security

Grade A, and why

rig-tidy 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 2d 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/rig-tidy/SKILL.md · 81 lines

How it starts

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

Post-Merge Cleanup

Audit and clean up the diff from the last N commits. Catches dead code, unused imports, stale comments, and obvious duplicates that slipped in during rapid development.

Configuration

Reads .rig/config.json:

  • sourceScope[0] — the default directory to audit when no scope is given (default: src).
  • test.command — the suite run in the verify step (default: npm test).
  • agents.reviewer — the project's name for the canonical reviewer role (default: reviewer).

If the file is absent, use the defaults above and note you're running unconfigured.

Arguments

The user invoked this with: $ARGUMENTS

What to do

  1. Parse the arguments.

    • scope: directory to audit (default: the default source scope from .rig/config.json (sourceScope[0], default src)).
    • commits: number of recent commits to review (default: 10)

    Examples:

    • /rig-tidy → default scope, 10 commits
    • /rig-tidy path/to/dir 5 → that directory, 5 commits
    • /rig-tidy 20 → default scope, 20 commits
  2. Show what will be audited.

    git log --oneline -${commits}
    git diff HEAD~${commits} --stat -- ${scope} | tail -20
    
  3. Audit the diff via a fresh-context subagent. Spawn a reviewer agent (mapped through agents.reviewer) with this prompt (don't do the audit inline — the implementer context is too close to the code to spot dead-on-arrival abstractions):

    "Audit the diff git diff HEAD~${commits} -- ${scope} for cleanup candidates. Categories: (a) dead code — exported symbols with no callers in the tree, internal helpers used once; (b) unused imports; (c) stale comments — TODOs completed by the diff, comments describing prior behavior, doc lines that no longer match the code; (d) duplicates — near-identical helpers, repeated inline expressions that could collapse; (e) inconsistencies — naming drift, mixed patterns introduced during the window.

    For each finding give file:line, the category, one-line justification, and the proposed deletion or merge. Skip anything you're not confident about. If the window is clean, say so."

Read the full file on GitHub · 81 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. 2d ago First seen · 81 lines · 56 tokens per session scan A a59c0437531c

Subscribe to this mod's changes

rig-tidy is a skill published in the GitHub repository agent-rig/rig (2 stars, last pushed 15d ago), licensed MIT. It adds 56 tokens to every session and 802 once invoked, about $0.0003 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

audit-onboarding-proposal

Independently audit a brownfield onboarding transcript, operational map, or exact proposed documentation patch before application. Use when a fresh reviewer must verify an $onboard-repository first pass, distinguish environment-caused Unknowns from reasoning defects, score its safety and evidence gates, or run a…

hoangnb24/repository-harness · 104 tokens

improve-harness

Run one explicitly authorized, evidence-backed improvement to a repository's agent guidance, tools, runbooks, or validation. Use only when the user invokes $improve-harness or explicitly asks to improve the Harness after observed reusable agent friction. Do not use for ordinary product changes, speculative cleanup…

hoangnb24/repository-harness · 76 tokens

ai-elements

Build AI chat interfaces using ai-elements components — conversations, messages, tool displays, prompt inputs, and more. Use when the user wants to build a chatbot, AI assistant UI, or any AI-powered chat interface.

mxyhi/ok-skills · 46 tokens

red-team-adversarial

Adversarial security and resilience analysis — auto-triggered during /review and /test based on task classification. Provides attack surface analysis, boundary testing, auth bypass attempts, dependency chain attacks, and Beast Mode stress testing.

KbWen/agentic-os · 50 tokens

product-decision-agent

中文产品决策 Agent。用于中国大陆互联网产品、运营、增长、商业化、数据、项目推进和组织协作场景:产品规划、需求分析、PRD、需求优先级、排期、版本规划、Roadmap、MVP、灰度、上线、迭代、增长停滞、拉新、投放、渠道、裂变、CAC、LTV、ROI、留存、转化、DAU/MAU、GMV、漏斗、社区运营、内容供给、创作者、用户运营、活动运营、私域、会员、定价、指标异常、数据口径、埋点、A/B…

mxyhi/ok-skills · 265 tokens

architecture-review

Use for clean architecture, modular monoliths, hexagonal boundaries, service boundaries, data flow, dependency direction, ADRs, or large feature planning.

DominikTobureto/awesome-grok-build · 34 tokens