Sprang analyze
Analyze a codebase to produce a rich semantic knowledge graph — file summaries, architecture layers, guided tour, domain map, risk scores. Use when the user says "/sprang-analyze", "analyze the codebase", "full analysis", or "run sprang-analyze".From its SKILL.md
npx -y skills add FavioVazquez/sprang --skill sprang-analyzeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.2 KB, as published. Nobody here has run it
Analyze the codebase and produce .sprang/knowledge-graph.json with full
semantic enrichment. You are the analysis engine — read every file, write rich
summaries, detect architecture, score risk.
CRITICAL: Complete ALL 8 phases (Phase 0 through Phase 7) in one run. Stopping early leaves the Architecture, Domains, and Learn tabs empty. NEVER write
.sprang/knowledge-graph.jsonyourself — Phase 7 assembles it. RESUME: If a graph already exists atphase: complete, jump to Phase 4 to re-run enrichment only.
For the full phase-by-phase procedure, read REFERENCE.md in this skill's
directory. Read it before starting — the summary below is not sufficient to
execute the skill correctly.
Options
--full— force complete rebuild even if a graph exists--language <lang>— output summaries in a specific language (ISO code: zh, ja, ko, es, fr, de, pt, ru)--chunk <N>— split node output into chunks of N nodes- A directory path — analyze that directory instead of cwd
Phases
- Pre-flight — resolve
PROJECT_ROOTandSPRANG_ROOT="$PROJECT_ROOT/.sprang", read.sprangignore, decide incremental vs full, collect README/manifest context and the entry point. - Scan — enumerate files, detect languages/frameworks, build the
project-internal import map → write
scan-result.json. - Analyze files — semantic batching (related files together), max 10 files
and ~800 lines per batch → write
final-nodes-chunk-*.json(max 50 nodes each),final-edges.json, andassembled-graph.json(project metadata only). - Architecture layers — assign every file node to exactly one of 3-10
layers → write
final-layers.jsondirectly (notlayers.json). - Guided tour — 5-8 BFS-ordered steps → write
final-tours.jsonas an array of Tour objects (not a flat step array — each needsid,title,description,steps). - Domain mapping — cluster into 2-6 business domains → write
final-domains.jsonwith domain/flow/step structure. - Risk + smells + git layer → write
risk-scores.jsonas{"<node-id>": {"risk_score": 0.0, "risk_factors": [], "structural_warnings": [], "decision_context": {...}}}. The assemble step applies all of these fields to the nodes. - Assemble — prefer the CLI
sprang merge "$PROJECT_ROOT"(normalises + validates, no Python needed). Ifsprangis not on PATH, fall back toPROJECT_ROOT="$PROJECT_ROOT" python3 skills/sprang-analyze/scripts/merge.py. Then write.sprang/SPRANG_REPORT.md.
All intermediate files live in
.sprang/intermediate/and both readers consume these exact names:final-nodes-chunk-*.json,final-edges.json,final-layers.json,final-tours.json,final-domains.json,risk-scores.json,assembled-graph.json. All must exist before assembling.
Schema reminders
- Do NOT emit a
layerfield on nodes — layer membership comes fromfinal-layers.json. Alayerofnullfails validation. - Use only canonical edge types:
imports,exports,contains,inherits,implements,calls,subscribes,publishes,middleware,reads_from,writes_to,transforms,validates,depends_on,tested_by,configures,related,similar_to,deploys,serves,provisions,triggers,migrates,documents,routes,defines_schema,contains_flow,flow_step,cross_domain,cites,contradicts,builds_on,exemplifies,categorized_under,authored_by. - Test coverage is
tested_by: source file → the test file that covers it (note the direction: source → test).
After completion
Report files analyzed, nodes/edges, top risks, layers and domains found. Suggest
the sprang-chat skill to ask questions, sprang-onboard for the guided tour,
and pnpm --filter @sprang/dashboard dev to open the dashboard.