global/skills/doc-index/SKILL.md
Generate document index files (manifest, bundles, graph, router) for project documentation. Creates docs/.index/ with searchable registry, feature-grouped bundles, cross-reference dependency graph, and query routing. Supports flat mode (generic projects, script-driven) and grouped mode (projects with doc_id frontmatter, Claude-curated).
npx skillsauth add kcenon/claude-config doc-indexInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate structured YAML index files for project documentation.
/doc-index
No arguments. Operates on the current project directory.
| File | Purpose |
|------|---------|
| docs/.index/manifest.yaml | Document registry with metadata, sections, and tags |
| docs/.index/bundles.yaml | Feature-grouped document sets with line ranges |
| docs/.index/graph.yaml | Cross-reference dependency graph with impact analysis |
| docs/.index/router.yaml | Query-to-bundle routing with ID routes |
The skill operates in two modes based on the project's document structure:
doc_id frontmatter): Path-based classification. Claude categorizes documents by directory structure and generates index files with basic keyword matching.doc_id frontmatter): Claude-curated. Claude reads key documents, understands domain relationships, and generates index files with semantic understanding..md filesdocs/.index/ directory if needed: mkdir -p docs/.indexbundles.yaml already exists, note the custom: section for preservationrouter.yaml already exists, note the id_patterns: section for preservationRun these commands to collect project metadata:
# 1. Find all markdown files
find . -name "*.md" -not -path "*/.git/*" -type f | sort
# 2. Count files with doc_id frontmatter
grep -rl "^doc_id:" --include="*.md" . | wc -l
# 3. Total file count
find . -name "*.md" -not -path "*/.git/*" -type f | wc -l
Calculate: doc_id_count / total_count
For flat mode projects, generate all 4 files using path-based classification:
rules/ → rule, skills/ → skill, agents/ → agent, reference/ → reference, etc.Then proceed to Phase 4 (Write) and Phase 5 (Report).
This is the core of the skill. You read documents and generate index files with domain understanding.
Run these to gather raw metadata efficiently:
# All section headings with line numbers
grep -rn '^## \|^### ' docs/ 2>/dev/null | head -800
# All doc_ids
grep -rn '^doc_id:' docs/ 2>/dev/null
# File sizes
find docs/ -name "*.md" -type f -exec wc -c {} + 2>/dev/null | sort -n
# Cross-references (markdown links between docs)
grep -rn '\[.*\]([^)]*\.md[^)]*)' docs/ 2>/dev/null | grep -v '\.index/' | head -1500
Read these selectively — do NOT read entire large documents:
SDS (Software Design Specification): Find via doc_id containing SAD or SDS.
### .*SI-[A-Z] headings, read each SI's definition (~20-40 lines per SI)SRS (Software Requirements Specification): Find via doc_id containing SRS.
## section headings to understand the category structure (SRS-DATA, SRS-CALC, SRS-SEC, etc.)Reference documents: For each file in the reference directory:
Screen/Flow documents: Read frontmatter only for hazard_ids, screen_id, flow_id
Write docs/.index/manifest.yaml with this structure:
# docs/.index/manifest.yaml
# Generated by /doc-index
_meta: {schema: "1.0.0", generated: "YYYY-MM-DD", docs: N, size_mb: X.XX}
core:
- id: DOC-ID
file: relative/path.md
title: "Document Title"
keywords: [keyword1, keyword2]
req_count: N # SRS-xxx count (if any)
sections:
- {h: "Heading", l: start, e: end, req: [SRS-CAT]}
# UI Screens (compact)
screens:
- {id: DOC-ID, file: path.md, scr: SCR-NNN, title: "...", hazards: [H-01]}
# UI Flows (compact)
flows:
- {id: DOC-ID, file: path.md, flw: FLW-NNN, screens: [SCR-001, SCR-002]}
# Reference Documents (subcategorized)
reference:
regulatory:
- {id: DOC-ID, file: path.md, title: "..."}
rendering:
- {id: DOC-ID, file: path.md, title: "..."}
# ... infrastructure, security, clinical, business, standards, general
# Placeholders — stubs
placeholders:
- {id: DOC-ID, file: path.md}
# Reports — skip unless reviewing
reports:
- path.md
Classification rules:
ui/screens/ → screens, ui/flows/ → flows, ui/ other → ui_supportreference/ → reference (subcategorize by content: regulatory, rendering, infrastructure, security, clinical, business, standards)placeholders/ → placeholders, reports/ → reportsWrite docs/.index/bundles.yaml. This is where domain understanding matters most.
# docs/.index/bundles.yaml
# Generated by /doc-index
_meta: {schema: "1.0.0", generated: "YYYY-MM-DD"}
SI Bundles — For each SI found in the SDS:
Read the SI definition section and determine related files using these signals (in priority order):
### headingSRS 할당 / SRS allocation row in the definition table → find the matching SRS ## sections by category codeFormat per SI bundle:
si-xx:
name: "SI Full Name (SI-XX)"
files:
- {file: path.md, lines: "start-end", note: "SI-XX def"}
- {file: srs-path.md, lines: "start-end", note: "Section Name (SRS-CAT-xxx)"}
- {file: reference/related-doc.md}
Workflow Bundles — For each FLW document:
SCR-NNN patterns)workflow-{flow-name}Cross-Cutting Bundles:
security: SRS security section + threat model + auth/encryption/protection reference docssafety: SRS safety section + risk management + screens with hazard referencesdatabase: Database schema + data-related reference docsapi: Interface design spec + API reference docstesting: Verification/validation plans + test-related docsregulatory-submission: Core regulatory deliverables only (SRS, SDS, SVP, VAL, PRD, SDP, TM, DBS, IDS) — exclude reports, audit files, placeholdersPreserve the existing custom: section from the previous bundles.yaml if it exists.
Write docs/.index/graph.yaml:
# docs/.index/graph.yaml
# Generated by /doc-index
_meta: {schema: "1.0.0", generated: "YYYY-MM-DD"}
cascade — Document-level impact chains. For each document that references another (from cross-reference data):
screen_cascade — Screen → flow mappings. For screens appearing in 2+ flows, mark as hub screens.
req_chains — For each SRS category (SRS-DATA, SRS-CALC, etc.):
hazard_map — From screen frontmatter hazard_ids: map each H-NN to affected screens.
Write docs/.index/router.yaml:
# docs/.index/router.yaml
# Generated by /doc-index
_meta: {schema: "1.0.0", generated: "YYYY-MM-DD"}
id_routes — Auto-discover identifier patterns from documents:
SRS: compound format SRS-{CAT}-{NNN}, source = SRS document, build section_map from SRS ## headingsTC: from SVP documentH: from risk management reference docHUS: from validation planSCR: directory-based ui/screens/SCR-{NNN}-*.mdFLW: directory-based ui/flows/FLW-{NNN}-*.mdSI: from SDS document, alpha code format SI-{CODE}IF: from SDS documentT: from threat model documentintent_routes — Keyword → bundle mapping based on which bundles were generated.
skip — [placeholders/*, reports/weekly_report/*, reports/monthly_report/*]
Preserve the existing id_patterns: section if present.
After generating all files:
docs/.index/Present results:
## Document Index Generated
| Metric | Value |
|--------|-------|
| Mode | flat/grouped |
| Total documents | N |
| manifest.yaml | X bytes |
| bundles.yaml | Y bytes |
| graph.yaml | Z bytes |
| router.yaml | W bytes |
| SI bundles | N (grouped only) |
| Workflow bundles | N (grouped only) |
| Item | Rule |
|------|------|
| Scope | Only .md files, excluding .git/ and docs/.index/ |
| Custom bundles | custom: section in bundles.yaml is never overwritten |
| ID patterns | id_patterns: section in router.yaml is never overwritten |
| Code blocks | References inside fenced code blocks are excluded from graph |
| No scripts | All logic is in SKILL.md — no external scripts |
| Scenario | Claude Action | |----------|---------------| | "What docs exist about X?" | Read router.yaml → match keyword → Read bundles.yaml | | "I'm working on feature X" | Read bundles.yaml → find matching bundle → Read docs with line ranges | | "I changed file X" | Read graph.yaml → find cascade targets → impact checklist | | "What does SRS-CALC-001 say?" | Read router.yaml → id_routes.SRS → section_map.CALC → read exact lines | | "Which screens has H-07?" | Read graph.yaml → hazard_map.H-07 → list affected screens |
development
Generate and validate the bidirectional traceability matrix linking requirements, design, code, tests, risk records, and standard clauses. Consumes docs/.index/{manifest,bundles,graph,router}.yaml plus an optional compliance/ directory and produces docs/.index/traceability.yaml (machine-readable) and docs/.index/traceability.md (human-readable). Read-mostly: writes only the two trace artifacts and never mutates source documents. Opt-in — no-op when docs/.index/graph.yaml is absent so non-regulated repos are unaffected.
development
Maintain a SOUP (Software Of Unknown Provenance) register for every third-party software item the project depends on. Discovers candidates from lockfiles (package-lock.json, go.sum, Cargo.lock, requirements.txt, pyproject.toml, pom.xml, packages.lock.json), enriches with human-supplied risk class and verification refs, validates against a license allow-list and the requirements catalogue, and emits a per-supplier report. Outputs docs/.index/soup.yaml plus docs/.index/soup.md. Subcommands: discover | enrich | validate | list | report. Bidirectional linking with traceability via the soup_ids[] field on requirement rows. Opt-in: no-op when no lockfile is detected and docs/.index/soup.yaml is absent. Atomic writes (*.tmp + rename); idempotent (records sorted by id). Implements IEC 62304 sections 5.3.3 (SOUP requirements) and 8.1.1 (configuration items).
devops
Parse sonarcloud[bot] PR comments, classify findings, codify whitelisted auto-fixes, escalate the rest.
testing
Manage Hazard and Risk records for projects on the regulated-industry track. Maintains a single normalized risk file (docs/.index/risk-file.yaml) holding hazard identification, initial and residual risk estimates, control measures with verification links, and bidirectional Risk<->Requirement linking via the requirements[] field. Subcommands: add | edit | evaluate | validate | list. Output is consumed by the traceability skill (matrix risk_ids[] field) and the evidence-pack skill (risk_file kind). Opt-in: no-op when docs/.index/manifest.yaml is absent so non-regulated repos are unaffected. Atomic writes via *.tmp + rename; idempotent for diffability. Implements ISO 14971 sections 5-9 operationally.