kicad-tools: Command for Claude Code

.claude/commands/repo/tidy.md

tidy is a command for Claude Code from rjwalters/kicad-tools. It costs 19 tokens per session (9,820 once invoked), scanned A, original, MIT.

A repository cleanup command that finds junk, temporary files, empty folders, build output, and caches.

In plain words
What is it for?
Cleaning the whole repository or one folder, optionally removing rebuildable caches, reviewing every item interactively, and measuring folder sizes.
Why use it?
It removes safe clutter while leaving caches and anything that might contain real work for explicit review.

Command for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: positional $N argument; mentions Codex.

This is rjwalters/kicad-tools's own configuration. It tells Claude Code how to work on kicad-tools itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything kicad-tools configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is # repo root (`../repo-wt-fix123`, `/private/tmp/…`, `/private/var/folders/…`),.

Reuse

Borrowing it

Nothing to install: this file belongs to rjwalters/kicad-tools. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/rjwalters/kicad-tools/main/.claude/commands/repo/tidy.md
Clone the repo
git clone --depth 1 https://github.com/rjwalters/kicad-tools

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 tidy

README.md
[![agentmods](https://agentmods.dev/badge/commands/rjwalters/kicad-tools/tidy.svg)](https://agentmods.dev/commands/rjwalters/kicad-tools/tidy)
Your own site
<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/tidy"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/tidy.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 9,820 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.00019 $0.09820
Opus 5 $0.00010 $0.04910
Sonnet 5 $0.00004 $0.01964
Haiku 4.5 $0.00002 $0.00982

Measured 3d ago against content hash 963e671140ad, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

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 3d 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.

.claude/commands/repo/tidy.md · 633 lines

How it starts

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

/repo:tidy — Tidy Up

Sweep the working tree for clutter and clean it up. Inventory everything, categorize by confidence, then by default delete the SAFE category (pure junk that holds no unique work) and report what was freed. Regenerable caches (compilation/tool/build output) are kept by default and only cleared when you pass --caches — deleting them is harmless but forces a costly rebuild, so it is opt-in. Items that could be real work (ASK) are always presented for a human call, never auto-deleted.

Usage

/repo:tidy                    # Inventory, delete SAFE junk (caches kept), report; ASK items presented
/repo:tidy --caches           # Also clear regenerable caches (__pycache__/, dist/, .mypy_cache/, …)
/repo:tidy --ask              # Walk every category interactively before deleting anything
/repo:tidy --sizes            # Also measure worktree root sizes (slow: du has no prune)
/repo:tidy packages/core      # Scope to one subtree

(--apply is accepted as a synonym for the default, for muscle memory. --caches composes with --ask: --ask still walks every category, --caches just moves the cache tier into the auto-delete set for the non-interactive default. --sizes only adds the per-worktree size column described in step 1 — it never changes what is deleted.)

Steps

1. Inventory

Gather candidates without deleting anything:

# Ignored files that exist on disk (usually build output/caches)
git clean -ndX

# Untracked files (may include work-in-progress — treat carefully)
git clean -nd

# Empty directories
find . \( -name .git -o -name node_modules -o -name target \
          -o -name dist -o -name .venv \) -prune \
     -o -type d -empty -print

# Large files in the working tree (>10 MB, tracked or not)
find . \( -name .git -o -name node_modules -o -name target \
          -o -name dist -o -name .venv \) -prune \
     -o -type f -size +10M -print

# Orphaned environment content — packages still on disk that the current
# lockfile no longer references. Detect the lockfile and its package manager;
# the prune itself is an ASK item (see Categorize), never run from here.
[ -f pnpm-lock.yaml ]     && echo "prunable: pnpm"   # pnpm prune
[ -f package-lock.json ]  && echo "prunable: npm"    # npm prune

# Git worktree roots — authoritative and tool-agnostic. RETAIN this output as a
# path set for step 2's denylist; do not just print it. `--porcelain` gives one
# `worktree <path>` line per entry, including worktrees that live outside this
# repo root (`../repo-wt-fix123`, `/private/tmp/…`, `/private/var/folders/…`),
# which `git clean` never sees.
git worktree list --porcelain

# The worktree paths alone, for step 3's WORKTREES block. Extract them with
# `sed`, not `awk '{print $2}'`: awk splits on whitespace and would truncate
# `/repos/my checkout/wt` to `/repos/my`. The `worktree ` prefix is fixed, so
# stripping it with sed and reading whole lines keeps paths with spaces intact
# (paths containing newlines need `git worktree list --porcelain -z`).
git worktree list --porcelain | sed -n 's/^worktree //p'

# Worktree SIZES ARE NOT COLLECTED BY DEFAULT — only when `--sizes` is passed.
# See below for why. When it is passed, bound each root so a slow one degrades
# the size column instead of stalling the step:
git worktree list --porcelain | sed -n 's/^worktree //p' \
  | while IFS= read -r wt; do
      timeout 20 du -sh "$wt" 2>/dev/null \
        || printf '%s\t%s\n' 'size unavailable' "$wt"
    done

Read the full file on GitHub · 633 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. 3d ago First seen · 633 lines · 19 tokens per session scan A 963e671140ad

Subscribe to this mod's changes

tidy is a command published in the GitHub repository rjwalters/kicad-tools (56 stars, last pushed today), licensed MIT. It adds 19 tokens to every session and 9,820 once invoked, about $0.0001 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-09-03.