Editorial cleanup of the always-loaded rule and memory files (CLAUDE.md, AGENTS.md, .claude/rules, memory). Runs `teyla tidy --json` from the Teyla CLI, then proposes rewrites that turn dated anecdotes into rules, merge near-duplicates and move one-off history out. Shows a diff and asks before writing. Needs the `teyla` CLI. Use when asked to "tidy the rules", "clean up CLAUDE.md", "my rules file is bloated" or "prune memory".
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Tidy?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/zaitsew-tidy)
---
name: tidy
description: Editorial cleanup of the always-loaded rule and memory files (CLAUDE.md, AGENTS.md, .claude/rules, memory). Runs `teyla tidy --json` from the Teyla CLI, then proposes rewrites that turn dated anecdotes into rules, merge near-duplicates and move one-off history out. Shows a diff and asks before writing. Needs the `teyla` CLI. Use when asked to "tidy the rules", "clean up CLAUDE.md", "my rules file is bloated" or "prune memory".
argument-hint: "[path ...] — files or directories; default: the global files, all memory and every repo"
---
# Tidy
The Teyla CLI's scanner finds the mechanical junk. This pass is the editorial part, the one a script
must not do: prose a person wrote is only ever changed here, as a proposal they approve.
## 0. Check the CLI
```sh
{ command -v teyla || ls "$HOME/.local/bin/teyla"; } >/dev/null 2>&1 && echo "teyla: found" || echo "teyla: MISSING"
```
If it prints `teyla: MISSING`, say only this one line and stop; do not run anything else:
> This needs the Teyla CLI. Install it, then ask again: `uv tool install --python 3.12 git+https://github.com/zaitsew/teyla` (or `pipx install git+https://github.com/zaitsew/teyla`). Python 3.11 or newer.
If the CLI is found only at `~/.local/bin/teyla` (not on PATH), use that full path wherever a command below says `teyla`.
## 1. Run the scanner
```sh
teyla tidy --json $ARGUMENTS
```
If it reports `auto_fixable` findings, offer `teyla tidy --apply` first (it backs up, and
touches only whitespace, blank runs, tabs and an exact duplicate bullet), then rescan.
Never edit by hand what `--apply` does.
## 2. Read what it flagged, and nothing else
For each finding file, read the flagged lines and enough around them to judge. Do not
re-read the whole tree, and do not touch a file with no finding.
## 3. Propose, per finding kind
- **dated anecdote** (`stale-date`, a "(2026-08-11: ...)" aside): keep the rule, drop the
story. Rewrite as the rule plus a one-line why. If the date is the point (an expiry),
keep it as `teyla remind add`, not as prose.
- **near-dup / dup-line**: merge into the stronger wording; say which line survives.
- **history that is not a rule** (what happened, who, when): move it out of the
always-loaded file into a memory file or docs; leave a link only if it is still needed.
- **size**: pick the three biggest sections that are history, not rules.
- **broken-import / broken-link / memory-index / memory-unlisted**: fix the pointer or
delete the line; for memory, add the one-line index entry or delete the orphan.
- **non-english** in a repo file: translate it (language data a feature needs is an
exception: name the file and leave it).
## 4. Never touch
- a fenced code block, anything between `<!-- teyla:protect -->` and
`<!-- /teyla:protect -->`, and a `MERGE-APPROVED` list: byte-identical,
even when it looks stale or duplicated. Surface it as a question, never as an edit.
- a generated file (first lines say "generated by `teyla policy sync`" or
"`teyla harness sync`"): propose the change in the source file it names.
- a rule's meaning: shorten wording, never drop or soften a constraint to save lines.
## 5. Show, then ask
Print one unified diff per file and a one-line reason per hunk. Ask once for approval of
the batch (or per file when asked). Write only what was approved, and say what was left.
A symlinked file is edited at its target, once.