/init
Generate FILETREE.md from scratch. Confirms overwrite if it already exists. --self-only keeps every artifact out of git.
> /plugin marketplace add nekocode/filetree-skill> /plugin install filetree@filetree
Command definition
init.mddescription: Generate FILETREE.md from scratch. Confirms overwrite if it already exists. --self-only keeps every artifact out of git.
argument-hint: "[--self-only]"
allowed-tools: Read, Edit, Write, Bash(python3:*), Task, AskUserQuestion
Generate FILETREE.md from scratch for the current repository.
**First**, read the shared rules at `${CLAUDE_PLUGIN_ROOT}/skills/filetree/SKILL.md` — it defines the summary style, **summary language**, UNCHANGED bias (not used here, but good to internalize for future `/filetree:update` calls), and parallelization strategy.
Conduct this whole command — your own narration AND every summary — in the project's canonical language. Resolve it ONCE per SKILL.md "Summary language" (don't restate the chain here) — `config.language` from step 3's `todo` output wins when set. Its next source is `CLAUDE.md` / `AGENTS.md`: step 2 opens them only on the wire path — reuse that content if it did, else read now.
The manifest path is configurable via `.filetree.json`. The script is the only config parser: take `manifest_path` from the `wire-target` / `todo` output below and use it everywhere this doc says "the manifest" — never assume `FILETREE.md`, never re-parse `.filetree.json` yourself.
**Self-only mode** (`--self-only` in `$ARGUMENTS`): every filetree artifact stays out of git via `.git/info/exclude` — nothing to commit, teammates never see it. Wiring then targets the git-excluded `CLAUDE.local.md` INSTEAD of the team's `CLAUDE.md` / `AGENTS.md`, which are never edited in this mode. Reversal: `/filetree:uninstall`.
Steps
1. **Offer config, resolve targets, check existing.** Config comes first because it decides where the manifest goes and what gets indexed — it must be settled before anything is built.
a. **Create the config, then confirm.** If `.filetree.json` does NOT exist, `Write` the default template below (it equals current defaults, so it changes nothing yet). Then use `AskUserQuestion` to ask whether to keep it. **That open prompt is the user's edit window** — while it waits, they can edit the file now on disk (relocate the manifest, add `exclude` / `include`, pin a `language`), and `wire-target` / `todo` below will pick up whatever they save. On **keep**, proceed. On **discard**, delete the file you just created (`python3 -c "import os; os.remove('.filetree.json')"`) and proceed with defaults. If `.filetree.json` ALREADY exists, do nothing here — never create, edit, or remove a pre-existing one (it's the user's, and may already be customized).
{
"manifest_path": "FILETREE.md",
"exclude": [],
"include": [],
"language": null,
"commit_guard": true,
"self_only": false
}b. **Self-only enable — only when `--self-only` was passed.** Run it BEFORE `wire-target` so the next step resolves the right wire target:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/filetree/scripts/filetree_selfonly.py" enableIdempotent (re-runs only repair missing exclude lines). On exit 1 an artifact is already git-tracked — surface the script's message verbatim and STOP; the user must untrack first.
c. Then run `wire-target` — it returns the configured `manifest_path`, `manifest_exists`, `self_only`, and per wire file `{exists, is_symlink, real_path, wired, matches}` (normal mode: `CLAUDE.md` / `AGENTS.md`; self-only mode: `CLAUDE.local.md` only):
python3 "${CLAUDE_PLUGIN_ROOT}/skills/filetree/scripts/filetree.py" wire-targetIf the output shows `self_only: true` but you did NOT just run 1.b (a prior self-only install), run the 1.b enable now — idempotent repair; this `wire-target` output stays valid. If `manifest_exists` is `true`, ask the user to confirm overwrite (they likely meant `/filetree:update`); on decline, stop — do not enter step 2. Skip the prompt when `false`.
2. **Wire `CLAUDE.md` / `AGENTS.md`.** Do this **before** `todo` so the manifest captures the post-wire hash; otherwise the first `/filetree:lint` flags the wired file as drifted. Reuse the `wire-target` output from step 1 (these files are often symlinks → editing the link path fails, so always edit `real_path`). Then per file:
**Self-only mode** (`self_only: true` in the `wire-target` output): the only wire file is `CLAUDE.local.md` — already git-excluded, auto-loaded by Claude Code. Same sub-steps, ONE exception: on `exists: false` do NOT skip — propose CREATING `CLAUDE.local.md` containing just the 2.c section (confirm via `AskUserQuestion`, then `Write`). Never touch `CLAUDE.md` / `AGENTS.md` in this mode.
a. **`exists: false`** → skip; do not create. (Self-only mode: create instead — see above.) b. **Already wired.** Skip when `wired` is `true` — the script found a `## <manifest>` heading, so the section is present however the body was reworded. Otherwise → 2.c. (`matches` is just the raw mention lines, for the 2.d edit preview; don't re-derive the wired decision from it.) c. **Otherwise append a dedicated section to `real_path`** (NEVER the link name — Edit refuses to write through a symlink). Read `real_path` in full, then append the template below as a new top-level `##` section at the END (never merged into an existing `## References` / `## 引用`). Before writing: (1) replace every `FILETREE.md` with the configured `manifest_path` — including the `## ` heading, which MUST keep the bare path verbatim (that exact heading is what 2.b's `wired` check re-detects on the next run); (2) render all prose AND the example summaries in the canonical language resolved above, keeping the fenced block's structure.
## FILETREE.md
`FILETREE.md` indexes every file with a one-line role summary, grouped by
directory. Read it to find code by purpose before `ls`/`grep`/`find` — it
turns "search the repo" into "look it up". Auto-maintained; don't hand-edit.(root)/
- `
Read more
description: Generate FILETREE.md from scratch. Confirms overwrite if it already exists. --self-only keeps every artifact out of git. argument-hint: "[--self-only]" allowed-tools: Read, Edit, Write, Bash(python3:*), Task, AskUserQuestion
Generate FILETREE.md from scratch for the current repository.
**First**, read the shared rules at `${CLAUDE_PLUGIN_ROOT}/skills/filetree/SKILL.md` — it defines the summary style, **summary language**, UNCHANGED bias (not used here, but good to internalize for future `/filetree:update` calls), and parallelization strategy.
Conduct this whole command — your own narration AND every summary — in the project's canonical language. Resolve it ONCE per SKILL.md "Summary language" (don't restate the chain here) — `config.language` from step 3's `todo` output wins when set. Its next source is `CLAUDE.md` / `AGENTS.md`: step 2 opens them only on the wire path — reuse that content if it did, else read now.
The manifest path is configurable via `.filetree.json`. The script is the only config parser: take `manifest_path` from the `wire-target` / `todo` output below and use it everywhere this doc says "the manifest" — never assume `FILETREE.md`, never re-parse `.filetree.json` yourself.
**Self-only mode** (`--self-only` in `$ARGUMENTS`): every filetree artifact stays out of git via `.git/info/exclude` — nothing to commit, teammates never see it. Wiring then targets the git-excluded `CLAUDE.local.md` INSTEAD of the team's `CLAUDE.md` / `AGENTS.md`, which are never edited in this mode. Reversal: `/filetree:uninstall`.
Steps
1. **Offer config, resolve targets, check existing.** Config comes first because it decides where the manifest goes and what gets indexed — it must be settled before anything is built.
a. **Create the config, then confirm.** If `.filetree.json` does NOT exist, `Write` the default template below (it equals current defaults, so it changes nothing yet). Then use `AskUserQuestion` to ask whether to keep it. **That open prompt is the user's edit window** — while it waits, they can edit the file now on disk (relocate the manifest, add `exclude` / `include`, pin a `language`), and `wire-target` / `todo` below will pick up whatever they save. On **keep**, proceed. On **discard**, delete the file you just created (`python3 -c "import os; os.remove('.filetree.json')"`) and proceed with defaults. If `.filetree.json` ALREADY exists, do nothing here — never create, edit, or remove a pre-existing one (it's the user's, and may already be customized).
{
"manifest_path": "FILETREE.md",
"exclude": [],
"include": [],
"language": null,
"commit_guard": true,
"self_only": false
}b. **Self-only enable — only when `--self-only` was passed.** Run it BEFORE `wire-target` so the next step resolves the right wire target:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/filetree/scripts/filetree_selfonly.py" enableIdempotent (re-runs only repair missing exclude lines). On exit 1 an artifact is already git-tracked — surface the script's message verbatim and STOP; the user must untrack first.
c. Then run `wire-target` — it returns the configured `manifest_path`, `manifest_exists`, `self_only`, and per wire file `{exists, is_symlink, real_path, wired, matches}` (normal mode: `CLAUDE.md` / `AGENTS.md`; self-only mode: `CLAUDE.local.md` only):
python3 "${CLAUDE_PLUGIN_ROOT}/skills/filetree/scripts/filetree.py" wire-targetIf the output shows `self_only: true` but you did NOT just run 1.b (a prior self-only install), run the 1.b enable now — idempotent repair; this `wire-target` output stays valid. If `manifest_exists` is `true`, ask the user to confirm overwrite (they likely meant `/filetree:update`); on decline, stop — do not enter step 2. Skip the prompt when `false`.
2. **Wire `CLAUDE.md` / `AGENTS.md`.** Do this **before** `todo` so the manifest captures the post-wire hash; otherwise the first `/filetree:lint` flags the wired file as drifted. Reuse the `wire-target` output from step 1 (these files are often symlinks → editing the link path fails, so always edit `real_path`). Then per file:
**Self-only mode** (`self_only: true` in the `wire-target` output): the only wire file is `CLAUDE.local.md` — already git-excluded, auto-loaded by Claude Code. Same sub-steps, ONE exception: on `exists: false` do NOT skip — propose CREATING `CLAUDE.local.md` containing just the 2.c section (confirm via `AskUserQuestion`, then `Write`). Never touch `CLAUDE.md` / `AGENTS.md` in this mode.
a. **`exists: false`** → skip; do not create. (Self-only mode: create instead — see above.) b. **Already wired.** Skip when `wired` is `true` — the script found a `## <manifest>` heading, so the section is present however the body was reworded. Otherwise → 2.c. (`matches` is just the raw mention lines, for the 2.d edit preview; don't re-derive the wired decision from it.) c. **Otherwise append a dedicated section to `real_path`** (NEVER the link name — Edit refuses to write through a symlink). Read `real_path` in full, then append the template below as a new top-level `##` section at the END (never merged into an existing `## References` / `## 引用`). Before writing: (1) replace every `FILETREE.md` with the configured `manifest_path` — including the `## ` heading, which MUST keep the bare path verbatim (that exact heading is what 2.b's `wired` check re-detects on the next run); (2) render all prose AND the example summaries in the canonical language resolved above, keeping the fenced block's structure.
## FILETREE.md
`FILETREE.md` indexes every file with a one-line role summary, grouped by
directory. Read it to find code by purpose before `ls`/`grep`/`find` — it
turns "search the repo" into "look it up". Auto-maintained; don't hand-edit.(root)/
- `
A Claude Code plugin that maintains FILETREE.md — a one-line description per file with content hashes for staleness detection. Lets the LLM grasp repo layout in a few hundred tokens before touching code.
More commands from other plugins.
compare
CommandCompare two or more options side by side, recommend one, and let the reader pick in the page
awesome-chatgpt
CommandSearch **awesome-ChatGPT-repositories** for open-source GitHub repositories related to ChatGPT and LLMs.
explain
CommandExplain code in detail - what it does, how it works, and why

