---
name: repo-checkup
description: Audit and slim down a repository's AGENTS.md/CLAUDE.md rules, reduce directory noise for coding agents without moving business files, and review project skills. Use when the user asks to checkup, audit, or tidy a repo, shrink bloated AGENTS.md/CLAUDE.md, make a messy folder friendlier for coding agents, or review project skills. Never move or rename business files, and never expand or rewrite rules with generic boilerplate.
---

# Repo Checkup

Run a safe, low-friction checkup on the current project or workspace directory. Keep changes minimal, reversible, and easy for beginners to approve.

## Hard Constraints

- **Never move, rename, or delete user business files** (code, scripts, docs, spreadsheets, outputs). Moving files breaks hardcoded paths and user habits.
- **Never run `git init` + `git add -A`** on a non-Git folder (risk of committing large binaries or `.env` secrets).
- **Never pad, polish, or auto-generate boilerplate** in `AGENTS.md`. Only merge split rules, delete noise, or offload deep content.
- **At most 3 proposals per run**, ranked by impact. Default answer for every item is **skip**; only apply items the user explicitly confirms.

## Workflow

### 1. Safety Snapshot & Undo Gate

Before proposing or making any edits, check Git status (`git rev-parse --is-inside-work-tree` and `git rev-parse --verify HEAD`):

- **Inside a Git repo with at least one commit**: check whether target config files (`AGENTS.md`, `CLAUDE.md`, `.gitignore`, `.ignore`, `.agents/skills/`) have uncommitted changes.
  - If those config files are clean (even if other files in the repo are dirty), plan to commit ONLY the modified config files in one commit (`git commit -- <files>`) so undo is a single `git revert`.
  - If those config files themselves have uncommitted changes, fall back to the backup directory below.
- **Outside a Git repo, repo has zero commits yet, or config files are dirty**: back up any config file before modifying it into `.agents/.backup-YYYYMMDD/`. Ensure `.agents/.backup-*` is excluded in `.ignore` / `.gitignore` so agents never search old backups, and delete backup folders older than 30 days.

### 2. Audit & Slim `AGENTS.md` / `CLAUDE.md` (Prune & Offload Only)

1. **Resolve split-brain first** (root and subdirectories):
   - If `CLAUDE.md` is a plain file containing only `AGENTS.md` (broken Windows symlink checkout), replace it with `@AGENTS.md`.
   - If both `AGENTS.md` and `CLAUDE.md` hold independent content, merge unique rules from `CLAUDE.md` into `AGENTS.md` and normalize `CLAUDE.md` to `@AGENTS.md` (or keep an existing valid Unix symlink).
2. **Apply the Deletion Test** to every line of `AGENTS.md`:
   *"Would removing this line cause a coding agent to make a predictable mistake?"*
   - **Keep only** (target root `AGENTS.md` **≤150 lines**):
     - Non-guessable build, test, lint, or run commands.
     - Hard negative constraints (generated paths not to edit, sensitive boundaries, non-standard quirks).
     - One-line pointers to deeper docs or skills.
   - **Delete**: repo summaries or directory dumps the agent can inspect directly, generic coding advice, stale bug-fix diaries, formatting rules already enforced by linters.
   - **Offload** (cross-CLI safe locations only — do NOT split into `.claude/rules/` or `.agents/rules/`):
     - Repeatable multi-step procedures → `.agents/skills/<name>/SKILL.md`
     - Architecture/API/reference guides → `docs/` (leave a 1-line index pointer in `AGENTS.md`)
     - Submodule-only constraints → `<subdir>/AGENTS.md` (plus sibling `CLAUDE.md` containing `@AGENTS.md`)

### 3. Reduce Directory Search Noise (Optional, Zero File Moves)

1. Judge whether the directory is a **single project** or a **multi-task dumping ground**. If it mixes unrelated tasks, do NOT split files automatically — simply add a one-line recommendation to start future unrelated tasks in a new folder or Paseo workspace.
2. Exclude bulky non-source directories (datasets, exports, archives, build artifacts, media, `.agents/.backup-*`) from agent search:
   - **Inside a Git repo**: add patterns to `.gitignore`.
   - **Outside a Git repo**: create or update **`.ignore`** (ripgrep ignores `.gitignore` outside Git repos, whereas `.ignore` always works).
3. If top-level folders are confusing, offer a **≤5-line directory map** in `AGENTS.md` labeling which folders matter and which to ignore.

### 4. Review Project Skills & Team Proposals

1. Inspect `.agents/skills/` and `.claude/skills/`:
   - Keep project-local skills at **≤5**. Flag obsolete, overlapping, or overly long descriptions (>600 chars) for cleanup.
   - Compare names against global `~/.agents/skills/`; if a skill is already in the team/global catalog, propose deleting the duplicate local copy.
   - Ensure Claude Code CLI can see every project skill in `.agents/skills/`:
     - **Windows**: create per-skill Junctions via PowerShell `New-Item -ItemType Junction` using `(Resolve-Path ".agents\skills\<name>").Path` (NEVER Git Bash `ln -s`), and add `.claude/skills/` to `.git/info/exclude`.
     - **macOS / Linux / WSL2**: relative symlinks `.claude/skills/<name> -> ../../.agents/skills/<name>`.
2. **Optional history glance** (ONLY if the user explicitly asks to review recent chats): read only lightweight Paseo metadata titles under `~/.paseo/agents/<project>/*.json` (never parse raw JSONL logs or `paseo.db`), highlight at most 2–3 recurring tasks, and ask whether any should become a skill.
3. **Team-wide skill proposal**: if a workflow looks useful across projects, output a plain-text 3-line proposal (`适用场景 / 痛点 / 核心步骤`) for the user to forward manually. Never auto-send externally. Before outputting, verify zero absolute paths, customer/project code names, internal IPs, or secrets remain.

### 5. Present Proposals & Execute Confirmed Items

Present a compact numbered list of **at most 3 items**:

```text
1. [改什么] ...
   [不改会怎样] ...
```

Ask the user which numbers to apply (remind them: replying "跳过" or ignoring leaves everything untouched). After applying confirmed items, report:
- Exact files modified
- How to undo in one step (`git revert <sha>` or restoring from `.agents/.backup-YYYYMMDD/`)
