dev-context-code-graph
Builds per-repo code graphs in JSON and markdown-ready derived artifacts. Use when you need blast radius, symbol-level maps, import graphs, inheritance, or test links.
What this skill does
# Code Graph Build a deterministic, machine-readable code graph for a single repository. Treat the graph as a machine-readable substrate for an LLM-maintained repo wiki or context hub, not just a terminal-only report. This skill mirrors the `dev-context-multi-repo` artifact workflow, but works at file and symbol level instead of portfolio level. Use this skill when you need: - a committable `graphs/code-graph.json` artifact - file and symbol maps for one repo - import, call, inheritance, and test-link analysis - graph-theory review signals such as articulation points, bridges, cycles, topological order, and alternate paths - blast radius and minimal review context for changed files or symbols - budget-bounded context retrieval around 1–3 hot symbols via Personalized PageRank - a grounded repo description or module description generated from graph data instead of ad hoc codebase prose Do not use this skill for: - portfolio-wide repo discovery or cross-repo system maps - architecture or migration planning across many repos - prose documentation cleanup without graph generation Use related skills instead: - [dev-context-multi-repo](../dev-context-multi-repo/SKILL.md) for repo portfolios and hub-level knowledge graphs - [dev-context-engineering](../dev-context-engineering/SKILL.md) for deciding when code graph vs context graph vs repo graph is the right artifact - [docs-ai-prd](../docs-ai-prd/SKILL.md) for code-graph specs and acceptance criteria - [docs-codebase](../docs-codebase/SKILL.md) for publishing graph-backed docs and reports ## Quick Reference | Need | Start here | |------|------------| | Generate the base artifact set | `## Workflow` | | Validate schema and graph integrity | `### Phase 3: Validate` | | Query blast radius or symbol neighborhoods | `### Phase 4: Query` | | Surface structural graph risk | `query_code_graph.py --articulation-points`, `--bridges`, `--cycles`, `--topo-sort`, `--from ... --to ... --k N` | | Run hot-symbol PPR retrieval | `query_code_graph.py --ppr --seed <id> [--seed <id> ...] --top N` | | Detect modules via communities | `query_code_graph.py --communities [--resolution γ] [--community-seed N]` | | Pick the right query for a review | [references/query-recipes.md](references/query-recipes.md) | | Load scripts, schemas, and reports | `## Navigation` | ## Standard Outputs Every run should target the same output model: - `code-profiles/<repo>.json` Machine-readable code profile conforming to `schemas/code-profile.schema.json`. - `graphs/code-graph.json` Primary machine-readable artifact. Queryable symbol graph conforming to `schemas/code-graph.schema.json`. - `reports/code-graph-validation.json` *(optional but recommended)* Output of `scripts/validate_code_graph.py --output ...`. - `reports/code-graph-report.md` *(optional but recommended)* Human-readable summary report generated from the graph. - `reports/query-*.md` *(optional but recommended)* Persisted blast-radius, neighborhood, and relationship answers worth filing back into a repo knowledge base. - `reports/code-graph-report.html` *(optional)* Static HTML report for local review. - `reports/code-graph.mmd` *(optional)* Mermaid diagram export for graph neighborhoods or impact views. ## Workflow ### Phase 1: Scan 1. Identify supported source files by extension while skipping generated and vendored build trees. 2. Classify files as `source`, `test`, `config`, or `unknown`. 3. Parse each file with the best deterministic strategy available. 4. Record parse status explicitly: `parsed`, `heuristic`, `unsupported`, `error`, or `skipped`. Primary helper: [scripts/scan_code_repo.py](scripts/scan_code_repo.py) ## ASCII Flow ```text single-repo code graph request -> scan files and classify source, test, config, or unknown -> parse symbols with deterministic or heuristic parser -> build nodes and edges into graphs/code-graph.json -> validate schema, references, duplicates, orphans, and parse confidence -> query neighborhoods, impact, paths, PPR, communities, or structural risk -> persist useful reports back into repo context -> use findings for review, docs, onboarding, or blast-radius planning ``` ### Phase 2: Build 1. Read one or more `code-profiles/*.json` files. 2. Materialize canonical nodes and edges into `graphs/code-graph.json`. 3. Add structural edges from repo to file and from parent symbol or file to child symbol. 4. Synthesize `external_symbol` nodes for unresolved or third-party import/call targets. Primary helper: [scripts/build_code_graph.py](scripts/build_code_graph.py) ### Phase 3: Validate Run validation after every build: ```bash python3 scripts/validate_code_graph.py graphs/code-graph.json \ --output reports/code-graph-validation.json ``` The validator checks: - schema and enum compliance - dangling references - orphan nodes - duplicate IDs - containment / parent edge consistency - circular imports - stale verification metadata - parse-status and confidence bounds ### Phase 4: Query Common query patterns: ```bash # Neighborhood around a file or symbol python3 scripts/query_code_graph.py graphs/code-graph.json --node <id> --hops 1 # Blast radius from a file or symbol python3 scripts/query_code_graph.py graphs/code-graph.json --impact <id> --hops 2 # Path between two nodes python3 scripts/query_code_graph.py graphs/code-graph.json --from <id> --to <id> # Up to three node-disjoint shortest paths python3 scripts/query_code_graph.py graphs/code-graph.json --from <id> --to <id> --k 3 # Personalized PageRank from one or more hot symbols python3 scripts/query_code_graph.py graphs/code-graph.json --ppr --seed <id> --top 30 # Module detection via Louvain communities (γ=1 default; >1 = smaller modules, <1 = larger) python3 scripts/query_code_graph.py graphs/code-graph.json --communities --format table python3 scripts/query_code_graph.py graphs/code-graph.json --communities --resolution 1.4 --top 25 # Search by label, path, summary, or tags python3 scripts/query_code_graph.py graphs/code-graph.json --search "invoice service" # Structural risk python3 scripts/query_code_graph.py graphs/code-graph.json --articulation-points --relations imports --top 20 python3 scripts/query_code_graph.py graphs/code-graph.json --bridges --relations imports --top 20 python3 scripts/query_code_graph.py graphs/code-graph.json --cycles --relations imports,inherits,calls python3 scripts/query_code_graph.py graphs/code-graph.json --topo-sort imports # Mermaid diagram export python3 scripts/query_code_graph.py graphs/code-graph.json --diagram --output reports/code-graph.mmd ``` Primary helper: [scripts/query_code_graph.py](scripts/query_code_graph.py) When a query produces durable knowledge, write it to markdown or Mermaid instead of leaving it only in chat output. Use query outputs to generate: - repo-area descriptions - module summaries - change-impact notes - review packets for risky symbols or subsystems ### Phase 5: Publish Generate static reports for humans: ```bash python3 scripts/export_code_graph_report.py graphs/code-graph.json \ --output-dir reports/ ``` Prefer markdown, Mermaid, or HTML outputs that can be reviewed in Obsidian or filed back into a broader context hub. ### Phase 6: Enhance Run lightweight health checks over the graph-backed knowledge: 1. Review validation results for missing edges, parse gaps, and unsupported areas that need explanation. 2. Ask the LLM to suggest reusable reports, concept pages, or follow-up questions based on dense or weakly connected graph regions. 3. File durable findings back into `reports/` or a higher-level repo knowledge base instead of repeating the same exploration later. If the graph is feeding repo descriptions, keep the generation bounded: - summarize only what the graph can support - call out parse gaps explicitly - do not invent ownership, runtime behavior, or architectural roles from symbol names alone ## Supported V1 Scope The v1 parser pipeline is de
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.