/nlsmdn:explain [--diff [--staged | --unpushed | target] | --all | --architecture | --flows | --syntax | --system | --infra | --test] [topic]from nlsmdn
Generate project explanation docs in docs/explain/ covering architecture, flows, syntax, system APIs, infra, and testing, or explain a code diff, commit, branch, or PR directly in the conversation with --diff. Use when asked to explain how a project works, document its architecture, or walk through a change.
Ships in nlsmdn. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Generate project explanation documents in docs/explain/. Each aspect of the project gets its own file. An overview.md acts as the index (opened first); a preliminary.md carries the shared project context every other doc assumes. The exception is --diff, which explains a change directly in the conversation and never writes files.
| Flag | What it covers |
|---|---|
--architecture | Components, data flow, layering. Pros/cons of the current design and at least one alternative structuring with its tradeoffs. Include ASCII diagrams (component maps, layer stacks, sequence diagrams, ER, state machines) wherever they make the structure easier to grasp than prose. |
--flows | End-to-end walkthroughs of real code paths: take a concrete input (user action, API request, CLI invocation, scheduled job, etc.), trace it from entry point through the stack to final state change or response. Annotate the actual code inline — explain what each step does and any non-obvious syntax as it appears. |
--syntax | Non-obvious language features actually used in the project and not already explained inline in flows.md. Skip basics like for loops. Where the language offers multiple ways to do the same thing, list them with pros/cons. |
--system | System-level APIs in use (filesystem, networking, process, IPC, OS-specific). For each, list alternatives with pros/cons. |
--infra | Build, CI/CD, deploy, release pipelines. Include how to run each piece locally (scripts, commands, env setup). |
--test | Testing infrastructure: frameworks, test types, fixtures, how to run. |
--all | All six aspects above, dispatched to parallel sub-agents. |
--diff [target] | Explain a code change directly in the conversation. target may be a commit, revision range, branch comparison, PR number, or PR URL. With no target or scope flag, explain current tracked worktree changes against HEAD plus any untracked files, or the unpushed commits when the working tree is clean. This is a standalone, read-only mode: do not generate docs/explain/ files or modify anything. |
--staged | Scope to files returned by git diff --cached --name-only. Combines with any aspect flag or with --diff. |
--unpushed | Scope to files changed across unpushed commits (git diff --name-only $(git rev-list HEAD --not --remotes | tail -1)^..HEAD). Combines with any aspect flag or with --diff. |
| topic | A positional word after an aspect flag narrows the focus (e.g. --architecture database = architecture of the database layer only, --flows login = just the login flow). |
/explain --all # Full project explanation
/explain --diff # Explain worktree changes (else unpushed commits) in this conversation
/explain --diff --staged # Explain staged changes in this conversation
/explain --diff HEAD~2..HEAD # Explain a revision range in this conversation
/explain --diff 123 # Explain PR #123 in this conversation
/explain --architecture # Just architecture
/explain --architecture database # Architecture, focused on the database
/explain --flows # End-to-end walkthroughs of representative code paths
/explain --flows login # Walk through just the login flow
/explain --staged --architecture # Architecture needed to understand staged changes
/explain --unpushed --architecture # Architecture needed to understand unpushed changes
/explain --staged --all # All aspects, scoped to staged files
/explain --infra # CI/CD + local setup
--diff is present, enter the conversational diff mode below. It is standalone: do not combine it with an aspect flag or --all.--diff, accept at most one of --staged, --unpushed, or an explicit target. A target can be a commit, revision range, branch comparison, PR number, or PR URL.--all expands to all six.--staged / --unpushed.--diff, an aspect flag, nor --all was given, ask the user which mode or aspect(s) to cover before proceeding.--diff in the conversation and stop--diff is strictly read-only. Do not create, edit, or overwrite files; do not run formatters or generators; and do not dispatch write-capable sub-agents. Inspect the change and surrounding code with read-only tools, give the explanation in the current conversation, and stop before step 3.
Resolve the change in this order:
| Input | Change to inspect |
|---|---|
| Diff already supplied by the user | The supplied diff and any repository context available locally |
--staged | git diff --cached |
--unpushed | The full unpushed range used by the document modes |
| PR number or URL | PR metadata and patch; for GitHub, use gh pr view and gh pr diff |
| Commit | The commit patch and metadata, using read-only git commands |
| Revision range or branch comparison | The diff for that exact range or merge-base comparison |
| No target | git status --short plus tracked worktree changes against HEAD; inspect untracked files separately because git diff HEAD omits them. If the working tree is clean, the unpushed range, and say so |
If the target is genuinely ambiguous, ask one concise question rather than guessing. If the resolved diff is empty, say which scope was checked and stop.
Treat the diff as a map, not as sufficient context. Read the changed functions plus the callers, callees, tests, types, configuration, and docs needed to explain the existing system and the behavioral change. Reconstruct the relevant before-and-after flow. State uncertain motivation as an inference rather than fact.
Return one coherent chat response with these sections:
Do not dump the whole diff or reproduce long functions. Quote only the snippets needed to anchor an explanation. This is an explanation, not a code review: do not turn it into a findings list unless the user also asked for review.
| Mode | Scope |
|---|---|
--staged set | Output of git diff --cached --name-only |
--unpushed set | Output of git diff --name-only $(git rev-list HEAD --not --remotes | tail -1)^..HEAD |
| neither set | Whole project (respect .gitignore, skip node_modules/, build/, dist/, lockfiles, binaries) |
Empty scope: if --staged is set but nothing is staged, tell the user to stage files first or drop --staged. Do not proceed. Likewise, if --unpushed is set but nothing is unpushed — or there is no remote/upstream so the range can't be determined reliably (or it walks back to the root commit) — tell the user and do not proceed.
preliminary.md firstBefore dispatching aspect sub-agents, write docs/explain/preliminary.md. Keep it tight — just enough shared context that a new reader can follow the other docs:
Every aspect sub-agent should be told to assume readers have read preliminary.md and link to it rather than restate its content.
For each requested aspect, dispatch one sub-agent, launching each batch together as runtime capacity allows.
The sub-agent must be able to write files. Its deliverable is a markdown file it creates itself, so dispatch a general-purpose agent, never a read-only one (Claude Code's Explore, or any harness's read-only agent profile). A read-only agent either fails outright ("I'm in read-only mode") or flails improvising via Bash heredocs, which can stall it. Read-only agents suit tasks whose deliverable is a returned message, not a file.
Assign delegation separately from write access. Default aspect writers do their own research and writing; disable delegation tools where supported and include: "Do not dispatch sub-agents or launch other agent CLIs; research and write this document yourself." When an aspect benefits from coordinated research, replace that line with the named subtasks, maximum descendant count, and stopping condition. Include those descendants in the overall allocation; the aspect writer owns the final document.
Each sub-agent prompt must include:
.gitignore honored)docs/explain/<aspect>.md) — give the absolute pathWrite tool to create the file" instructionoverview.mdAfter sub-agents return, write docs/explain/overview.md as the entry index: short intro, link to preliminary.md, one link per generated aspect file with a one-line summary. In the final chat response, tell the user to open overview.md first.
All output for aspect modes goes to docs/explain/. Existing files there are overwritten — this is generated content, not hand-written. --diff never writes any of these files.
docs/explain/
├── overview.md # Index; open this first
├── preliminary.md # Project context needed to read the rest
├── architecture.md # If --architecture or --all
├── flows.md # If --flows or --all
├── syntax.md # If --syntax or --all
├── system.md # If --system or --all
├── infra.md # If --infra or --all
└── test.md # If --test or --all
# [Aspect Title]
**Scope:** [whole project | staged files: path/a, path/b, …]
**Topic filter:** [none | database | …]
**See also:** [overview](overview.md) · [preliminary](preliminary.md) · [architecture](architecture.md) · [flows](flows.md) · [syntax](syntax.md) · [system](system.md) · [infra](infra.md) · [test](test.md)
[Body following the per-aspect rubric]
Only link to siblings that were actually generated in this run.
architecture.md
flows.md
ShortcutRecorderView($shortcut), router.post("/login", loginHandler), cron.schedule("0 3 * * *", reindex)). One code block, no more than ~10 lines. This is the mental anchor — the API surface that triggers the flow.#### <FunctionName> — <file>:<line>@Binding updated, response body sent, beep suppressed). This is the "and we're done" marker.--syntax also runs this session, call out in a one-line note at the top of the file that language-feature coverage here is inline — syntax.md covers features not already annotated in a flow.syntax.md
flows.mdflows.md was also generated this session, open with a one-line pointer to it so readers know the annotated-code view lives there.system.md
infra.md
test.md
# Explanation Overview
Start here. Read [preliminary](preliminary.md) next for the shared context the
other docs assume.
**Scope:** [whole project | staged files: …]
## Aspects
- [Architecture](architecture.md) — one-line summary
- [Flows](flows.md) — one-line summary
- [Syntax](syntax.md) — one-line summary
- [System APIs](system.md) — one-line summary
- [Infrastructure](infra.md) — one-line summary
- [Testing](test.md) — one-line summary
Only include bullets for aspects actually generated this run.
/explain --diffRead the current tracked worktree diff against HEAD and inspect untracked files separately. Explore the surrounding code needed to explain the change, then respond in the conversation with background, intuition, a concept-grouped code walkthrough, and five multiple-choice questions. Do not write any files.
/explain --diff 123Use GitHub CLI read-only commands to inspect PR #123 and its surrounding repository context. Explain it with the same conversational structure and leave the working tree untouched.
/explain --allWrites preliminary.md, dispatches six parallel sub-agents (one per aspect), writes overview.md last. Final chat message lists the files and tells the user to open overview.md first.
/explain --flowsWhole-project scope. Picks 2–4 representative code paths (user action, API request, CLI/job) and traces each end-to-end in flows.md with inline-annotated code. Use --flows login to focus on a single flow.
/explain --staged --architecturegit diff --cached --name-only → staged files. Write a focused preliminary.md covering the surrounding modules. Dispatch one sub-agent to produce architecture.md limited to what is needed to understand the staged change. Write overview.md linking only to preliminary.md and architecture.md.
/explain --architecture databaseWhole-project scope. Write preliminary.md. Dispatch one architecture sub-agent with topic filter database. architecture.md covers the database layer's structure, decisions, and alternatives only. overview.md links to the two generated files.
"No staged files found. Stage files with git add first, or drop --staged to cover the whole project." Do not fall back to the whole project silently.
For --diff, name the checked target or scope and say that it contains no changes. Do not fall back to a broader scope and do not generate documentation files.
E.g. --infra on a project with no CI/CD. Generate the file anyway with a clear "No CI/CD configured. Build runs manually via …" note, and still link to it from overview.md. Silent omission leaves the user wondering.
The sub-agent can split by top-level directory and run its own parallel reads. If output is still incomplete, re-run the specific aspect flag (with a topic filter if helpful) rather than --all.
docs/explain/ is regenerated, not incrementally updated. Re-run the relevant flags; existing files are overwritten.
preliminary.md content inside aspect docs — link to it.What SKILL.md sets; muted values are Claude Code's defaults
mediumnpx claudepluginhub nielsmadan/skills --plugin nlsmdn65 skills in this plugin
/blind-spotsSurface consequential decisions a plan, design, or research brief left silently assumed, by interviewing the user in dependency order. Use when the user says "blind spots", "grill me", "stress-test this plan", "poke holes in this", "what am I missing", "interrogate this design", "what haven't I decided", or needs a loose idea or research brief clarified before work begins. Do NOT use for a clear factual lookup, to explain a previous reply in more detail (use `huh`), to generate ideas when it is unclear what to build (use `ideation`), or to review an already-written plan with agents (use `review-plan`)./brainstormWork out how to solve a problem the user can already name — interview them with `blind-spots` to understand it, generate structurally different approaches, validate each with an independent critic, then present the survivors with trade-offs and a recommendation. Use when the user says "brainstorm", "brainstorm approaches", "how should we solve/approach/tackle X", "what are our options", "compare approaches", "think this through with me", or wants solutions weighed before committing. Works on any topic, with codebase recon when a repo is involved; `--debate` adds external advisors for high-stakes calls. Do NOT use when stuck on what to build or what the problem is (use `ideation`), to probe an already-chosen plan (use `blind-spots`), or to pick a library or service (use `evaluate-tech`).