/sstack:tidy-repo [REPO_PATH ...]from sstack
Audits, restructures, and refreshes a repository end-to-end without changing its observable behavior. Maps modules, locks contracts, and runs independent auditors.
Ships in sstack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Sweep one or more repos so that every file reads as plainly as the problem allows. The contract stays fixed: what users, callers and other systems can observe before the sweep is exactly what they observe after it. Everything behind the contract is open to change.
With no argument, work on the repo that contains the current directory. With several repos, give each one its own lane. A lane owns one repo, and no two lanes touch the same files.
Run it as a workflow. Pin every agent to the strongest model the session allows. Fixers work in isolated worktrees. The agent that writes a change never approves it.
Read the repo's own AGENTS.md, CLAUDE.md and CONTRIBUTING.md first. They win over this skill where the two disagree. Then map:
Mark what is out of scope:
Done when every source directory is either in the map or listed as out of scope, with a reason.
Done when the baseline is recorded, the contract inventory exists, and every part you plan to restructure is covered by a test that passes on the current code.
Run independent auditors in parallel, one per lens, across the whole mapped scope. Each finding states:
A separate verifier tries to disprove each finding against the code, its callers, its tests and the git history. Only verified findings go forward, deduplicated by root cause. Keep auditing in rounds until two consecutive rounds find nothing new. That is the dry state.
The lenses are listed under "Audit lenses" below.
Done when the audit is dry, and every verified finding is tagged with its lens and with inside the contract or changes the contract.
Order the work so each step makes the next one smaller:
Cut the work into units. A unit is one theme, small enough to review in one sitting, and it ends in a passing check. Keep purely mechanical edits (moves, renames, formatting) in units apart from logic edits.
Sort findings that change the contract into two groups:
Done when every verified finding belongs to exactly one unit or the decisions list.
For each unit, in order:
Delete only on two signals. Before removing anything as dead, confirm it with at least two independent sources: a reference search, the git history, config and CI files, the test suite, the framework's conventions for things it loads by name, and the docs. Treat one signal alone as a lead, never as proof.
Done when every unit has merged or is listed in the report as blocked, with the reason.
For every class of problem the sweep removed, add the strongest check that keeps it from coming back. Strongest first:
Prove each guard can fail: run it once against the old pattern and watch it go red. Guards land as their own units. A formatter, a linter config, an unused-export or dead-file check, a file-length check, and dependency pinning are the usual candidates. Pick only the ones the sweep actually justified.
Done when every lens that produced verified findings either has a guard proven red, or is listed with the reason why no mechanical guard fits.
List every Markdown file, docstring set, CLI help text and example in the repo. Classify each as one of two kinds:
AGENTS.md and CLAUDE.md, guides under docs/, API references, CLI help, examples, the changelog's unreleased section.Run docs-loop over the repo in dry-run mode, and use its findings as the doc work list. Check each living doc against the code after step 5, not before. Confirm every path and link resolves. Run the commands a doc shows only when they only build, test, lint or read. Check any command that deploys, deletes, publishes or reaches outside the repo by reading it against the code instead of running it. Rewrite what changed, and fix readability in the same pass. Historical docs keep their text; only their broken links get repaired. A doc you cannot classify counts as historical and goes in the report.
Update the repo's agent instructions (AGENTS.md, CLAUDE.md) with the map from step 1 as it now stands, the real build and test commands, and the conventions the sweep settled on. The next agent then keeps the new shape without having to rediscover it.
Run readable over every doc you rewrote if it is installed. Otherwise reread each one and cut filler, repeated points and vague wording.
Make all of these edits before you open the PR. Then land the docs PR through the repo's gate, like any other unit.
Done when the docs PR has merged, every living doc on main matches the code, and every unclassified doc is in the report.
Commit a report under the repo's docs folder, or wherever the repo keeps reports. It covers:
Done when the report is pushed and its URL is in your reply.
.gitignore, stray scripts at the root, stale TODOs with no owner, mismatched license headers, a README that has grown into a manual.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
repo-cleanup, refactoring, code-audit, repository-maintenance
22 skills in this plugin
/docs-loopUse when the user asks to audit docs, check documentation for stale claims, or verify docs against the code./eli5Explain work, a system or a situation to the user in plain words with real names, so they understand it on one read. Use when the user asks to explain like a 5yo, says eli5, or says they do not understand what was done or where things stand./file-prOpen a pull request whose title says why the change matters and whose body opens with the problem in the requester's words. Use when asked to file, open, raise or create a PR, or to rewrite a PR's title or description.Other plugins' skills for the same job
npx claudepluginhub geiserx/sstack --plugin sstack