/spec-forge:analyze runs instead · from spec-forge
Analyzes document collections to build a knowledge map, identify themes, gaps, duplicates, conflicts, and staleness, then produces an organized analysis with improvement recommendations.
This skill never runs in Claude Code
It ships in spec-forge at skills/, but /spec-forge:analyze (a command, or a skill Claude Code finds first) has the same name: typing it, or Claude choosing it, runs that one instead.
Map, understand, and evaluate a collection of documents as a body of knowledge. Identify structure, themes, gaps, redundancies, conflicts, and staleness. Produce an actionable analysis with reorganization recommendations.
| Situation | Use |
|---|---|
| Single project with docs/ and source code | /spec-forge:audit |
| Docs-only repo with mixed content | /spec-forge:analyze |
| Cross-repo documentation ecosystem | /spec-forge:analyze |
| Research notes, ideas, decision records | /spec-forge:analyze |
| API docs need checking against code | /spec-forge:audit |
| "I have a mess of docs and need to understand them" | /spec-forge:analyze |
Parse the arguments to determine what to analyze:
/spec-forge:analyze ../../aipartnerup-docs), use that as the rootdocs/ directoryUse AskUserQuestion to understand the user's goals:
Scan all documents in the target path(s):
Fast path (preferred): resolve <sf_scripts> (see @../shared/scripts.md) and run python3 "<sf_scripts>/sf-scan.py" --root "<root>" --docs-only to enumerate every markdown document with its path, word count, and any declared requirement IDs in one pass. Use that inventory as the deterministic starting point. Fallback: if python3 is unavailable or the script is not found, glob for all markdown files recursively by hand. Either way, sf-scan is only a facts collector on an arbitrary doc collection — the model still judges each document's TYPE (below), its themes, and its conflicts. Switch to the manual fallback silently.
Document type classification:
| Type | Signals |
|---|---|
vision | Mission, vision, strategy, roadmap, long-term goals |
architecture | System design, component diagrams, data flow, technical architecture |
spec | Requirements, specifications, protocols, standards, conformance |
research | Analysis, investigation, comparison, feasibility study, market research |
decision | ADR, decision record, strategy choice, trade-off analysis |
idea | Brainstorm, proposal, exploration, "what if", future thinking |
guide | How-to, tutorial, getting started, cookbook |
reference | API reference, data dictionary, glossary, type mapping |
blueprint | Master plan, project plan, implementation roadmap |
report | Status report, audit report, analysis output |
meta | README, index, navigation, table of contents |
Display the inventory:
Document Collection: {name}
Root: {path}
Total documents: {N}
Total words: ~{N}k
Directory Structure:
{dir}/ ({n} docs) — {apparent purpose}
{dir}/{subdir}/ ({n} docs) — {apparent purpose}
...
By Type:
vision: {n} docs
architecture: {n} docs
research: {n} docs
...
Group documents by what they're actually about, regardless of directory structure:
Read through all documents and identify the major themes/topics that emerge:
For each theme, list which documents contribute to it:
Theme Clusters:
"{Theme A}" — {description}
Primary: {docs that are mainly about this}
Secondary: {docs that touch on this}
Coverage: {Good / Partial / Sparse}
"{Theme B}" — {description}
Primary: ...
Secondary: ...
Coverage: ...
Build a document relationship map. Pull the deterministic input first: run python3 "<sf_scripts>/sf-trace.py" ids <file...> to extract the requirement IDs each document declares, and use those exact IDs as the input to the reference map rather than eyeballed mentions. Then apply judgement:
Generate a Mermaid graph showing document relationships. (Fall back to reading the declared IDs by hand if the script is unavailable; conflict and theme judgement always stays with the model.)
Systematically compare documents for conflicts:
Look for places where two documents state contradictory facts:
For each conflict:
CONFLICT-{NNN}: {title}
Doc A: {path} — states "{claim A}" (section: {section})
Doc B: {path} — states "{claim B}" (section: {section})
Nature: {factual contradiction / naming inconsistency / version mismatch / priority conflict}
Impact: {who gets confused and how}
Resolution suggestion: {which doc is likely correct, or how to reconcile}
Look for higher-level misalignments:
Look for staleness-related contradictions:
Identify what's missing from the document collection:
Based on the themes and types identified:
Some areas may be documented but not deeply enough:
Check if all relevant audiences are served:
Find documents that overlap significantly:
For each redundancy:
REDUNDANCY-{NNN}: {title}
Documents: {list of overlapping docs}
Overlap: {what they share}
Recommendation: {merge into X / archive Y / consolidate into new doc Z}
Evaluate document freshness:
Classify each document:
Write the analysis report to {target-root}/analysis-report.md (or user-specified path).
Report format:
# Document Landscape Analysis
> Collection: {name}
> Root: {path}
> Analyzed: {date}
> Documents: {N} ({total words}k words)
## Executive Summary
{3-4 paragraphs: what this collection is about, its strengths as a knowledge base,
the most important issues found, and the top recommended actions}
## Document Map
### By Directory
| Directory | Docs | Purpose | Health |
|-----------|------|---------|--------|
| {dir} | {n} | {purpose} | {Good/Mixed/Poor} |
### By Type
| Type | Count | Key Documents |
|------|-------|---------------|
| vision | {n} | {most important ones} |
| architecture | {n} | ... |
| ... | ... | ... |
### Relationship Graph
~~~mermaid
graph LR
...
~~~
## Theme Analysis
### {Theme 1}: {name}
**Coverage**: {Good / Partial / Sparse}
**Key documents**: {list}
**Gaps**: {what's missing}
### {Theme 2}: {name}
...
## Findings
### Conflicts ({n} found)
{Ordered by severity}
#### CONFLICT-001: {title}
...
### Gaps ({n} found)
#### GAP-001: {title}
- **Area**: {theme/topic}
- **What's missing**: {description}
- **Why it matters**: {impact}
- **Recommendation**: {what to create or expand}
### Redundancies ({n} found)
#### REDUNDANCY-001: {title}
...
### Staleness ({n} documents flagged)
| Document | Status | Signals | Recommendation |
|----------|--------|---------|----------------|
| {path} | Likely stale | {signals} | {update/archive/delete} |
## Reorganization Recommendations
{If the current structure has significant issues, propose an alternative organization.
Show current structure → proposed structure side by side.
Only propose reorganization if it would meaningfully improve navigability — don't reorganize for aesthetics.}
### Current Structure
~~~
{current directory tree}
~~~
### Proposed Structure
~~~
{proposed directory tree with annotations}
~~~
### Migration Steps
1. {step — which files to move/merge/archive}
2. ...
## Priority Actions
| # | Action | Addresses | Effort | Impact |
|---|--------|-----------|--------|--------|
| 1 | {action} | CONFLICT-001, GAP-003 | {S/M/L} | {High/Med/Low} |
| 2 | {action} | REDUNDANCY-001 | {S/M/L} | {High/Med/Low} |
| ... | ... | ... | ... | ... |
Display a summary to the user:
Analysis complete: {collection-name}
Documents analyzed: {N}
Themes identified: {N}
Conflicts: {n}
Gaps: {n}
Redundancies: {n}
Stale documents: {n}
Report: {path-to-analysis-report.md}
Top 3 priority actions:
1. {action} — {impact}
2. {action} — {impact}
3. {action} — {impact}
Use AskUserQuestion to ask what to do next:
Based on user choice:
Deep dive: Read the relevant documents in full, provide a detailed analysis of the specific area, and discuss with the user.
Fix conflicts: For each conflict, read both documents in full, determine the correct information (asking the user when uncertain), and propose specific edits. Only apply edits after user approval.
Fill gaps: For identified gaps, suggest which spec-forge skill to use:
/spec-forge:tech-design/spec-forge:prd or /spec-forge:srs/spec-forge:test-cases/spec-forge:idea for explorationReorganize: Execute file moves/renames step by step, confirming with user before each destructive action (deletes, merges). Update internal links after moves.
analysis-report.md exists, note what changed since last analysisWhat SKILL.md sets; muted values are Claude Code's defaults
spec-forge@tercel-claude-plugins is listed by tercel/tercel-claude-plugins — review the source before installing
npx claudepluginhub tercel/tercel-claude-plugins --plugin spec-forge11 skills in this plugin
/auditAudit existing project documentation for quality, completeness, consistency, and code alignment. Scans docs against the actual codebase to find stale references, missing coverage, internal contradictions, and quality issues. Generates a structured findings report with severity levels and actionable fix recommendations. Works on any project with a docs/ directory.
/decomposeLightweight project decomposition skill. Analyzes project scope through a brief interview and determines whether the project should be treated as a single feature or split into multiple sub-features. For multi-split projects, generates a project manifest listing sub-features, dependencies, and execution order.
/ideaUse when exploring a new idea before writing formal specifications. Guides users through iterative discovery, research, and critical analysis to crystallize vague ideas into validated requirement drafts. Includes anti-pseudo-requirement checks, competitive research, demand evidence gathering, and "What if we don't build this?" analysis. Supports pause/resume across sessions, stores ideas in the project's ideas/ directory, and graduates validated ideas into the spec-forge auto chain ([idea] → [decompose] → [prd] → srs → tech-design → review).
/prd-generationGenerates professional Product Requirements Documents (PRDs) following industry-standard methodologies. This skill activates when the user asks to write PRD, create a product requirements document, draft product requirements, do product planning, do feature planning, write a product spec, or create a product document. It synthesizes best practices from the Google PRD framework, the Amazon Working Backwards methodology, and the Stripe Product Spec approach to produce comprehensive, actionable PRDs tailored to the user's project.
/propagateWalk an upstream documentation change downstream — when a PRD, SRS, tech-design, or feature spec is edited, find every dependent document, identify which sections are now stale, and interactively update them to keep the entire doc chain consistent. Use after editing any spec-forge document, or run periodically with --since to catch accumulated drift.
/reviewReview spec-forge generated documents (SRS + tech-design + feature specs) for quality, completeness, and internal consistency. Finds issues like incomplete sections, contradictions, missing traceability, and vague specs, then optionally auto-fixes them. Supports iterative review-fix cycles that run until the review converges — passing, or a round with no net reduction in findings — typically 1–2 rounds.
Other plugins' skills for the same job