progressive-disclosure:restructure
This skill should be used when the user asks to "restructure CLAUDE.md", "restructure AGENTS.md", "create a documentation index", "add a table of contents to CLAUDE.md", "organize project docs", "refactor root configuration file", "build a doc index", or wants to restructure how a repository's root configuration file references its documentation. Generates a thematic, book-style index in the highest-precedence root configuration file.
What this skill does
# Restructure Progressive Disclosure
Refactor the repository's highest-precedence root configuration file to contain a thematic, book-style index of all documentation. Organizes references like a table of contents — grouped by theme, ordered for progressive discovery.
## Principles
- **Preserve existing content**: The root configuration file's existing rules and instructions are kept intact. The index is inserted as a clearly delimited section.
- **Idempotent**: Re-running produces the same result. HTML comment markers delineate the generated section so subsequent runs replace rather than duplicate.
- **Thematic ordering**: Documents are grouped by theme following the taxonomy in `references/themes.md`, not by directory structure. The ordering mimics a book's table of contents.
- **Conversational links**: Each reference uses a natural-language description that tells the agent *when* to load the document, not just *what* it contains. Example: "For TypeScript conventions, see `docs/typescript.md`" rather than a bare link.
## Workflow
### Step 0: Resolve Target File
Check whether the user explicitly named a target file in their prompt (e.g. "restructure `docs/CONTRIBUTING.md`", "update `README.md`").
- **If a file was named**: use it as the target. Verify it exists before proceeding; if it does not, halt and report the missing path.
- **If no file was named**: fall through to Step 1.
### Step 1: Select Target Root Configuration File
*Skip this step if Step 0 resolved a target.*
Apply precedence rules to find the highest-precedence existing root configuration file:
1. `AGENTS.md`
2. `CLAUDE.md`
3. `GEMINI.md`
4. `USER.md`
5. `TOOLS.md`
6. `BOOTSTRAP.md`
7. `DESIGN.md`
8. `NOTICE.md`
If none exist, create `AGENTS.md` as the target.
Read the target file to understand its existing structure.
### Step 2: Discover All Documentation
Run the discovery script to enumerate all `.md` files:
```bash
"${CLAUDE_PLUGIN_ROOT}/skills/analyze/scripts/discover.sh" "$(pwd)"
```
Exclude root configuration files themselves from the index (they are the *container*, not indexed content). Include `README.md` as an indexed document.
Index only **visible** files. Inside a git repository the discovery script already restricts the documentation pool to git-tracked files — never add an untracked or gitignored file to the index, since other agents cannot load it. If the existing file already links to such a file, drop that link and note it.
When the script reports a `SAME-CONTENT:` symlink group (e.g. `CLAUDE.md` symlinked to `AGENTS.md`), index the underlying file **once** — do not list both the symlink and its target as separate entries.
### Step 3: Classify Documents by Theme
For each discovered document, classify it into a theme using the taxonomy in `references/themes.md`. Apply signals in order:
1. **Path-based** — match directory components against the path signal table
2. **Filename-based** — match against the filename signal table
3. **Heading-based** — read the first H1 or H2 and match keywords
4. **Fallback** — place in Appendix
This classification is semantic — use judgment for ambiguous documents. A file at `docs/auth-flow.md` with H1 "Authentication Architecture" belongs in Architecture, not Security.
### Step 4: Generate the Index
Build the index section with this structure:
```markdown
<!-- progressive-disclosure:index:start -->
## Documentation Index
### Getting Started
- For initial setup and installation, see [`docs/quickstart.md`](docs/quickstart.md)
### Architecture
- For system design and component relationships, see [`docs/architecture.md`](docs/architecture.md)
- For data flow diagrams, see [`docs/data-flow.md`](docs/data-flow.md)
### Development
- For TypeScript conventions, see [`docs/typescript.md`](docs/typescript.md)
[...additional themes with documents...]
<!-- progressive-disclosure:index:end -->
```
Rules for the generated index:
- Only include themes that have at least one document
- Each entry is a single line with a conversational prefix and a markdown link
- The conversational prefix describes *when* the agent should load that document
- Within each theme, order per `references/themes.md` within-theme rules
- Skip themes with zero documents
### Step 5: Insert or Replace in Target File
**If markers already exist** (`<!-- progressive-disclosure:index:start -->` and `<!-- progressive-disclosure:index:end -->`):
Replace everything between the markers (inclusive) with the new index block.
**If no markers exist**:
Check for an existing section heading like `## Documentation`, `## Index`, `## Table of Contents`, or `## References`. If found, insert the index block immediately after that heading (replacing its body up to the next `##`). If no matching section exists, append the index block at the end of the file.
### Step 6: Verify
After writing the index:
1. Confirm all linked files actually exist and are git-tracked (no broken or phantom references)
2. Confirm the marker pair is present exactly once
3. Count documents indexed vs total documents found — report coverage percentage
4. If coverage is below 100%, list unindexed documents and their paths
### Presentation
After restructuring, display:
- Which root configuration file was modified
- How many documents were indexed across how many themes
- Coverage percentage
- Any documents that were skipped and why
- A reminder that re-running is safe (idempotent via markers)
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.