skills/xray/SKILL.md
Interactive design verification via dependency-graph traversal (replaces /notebook) — point it at a module, spec, or PR. Use when reviewing large modules, verifying agent output, or auditing design, or when the user says "review this module", "verify the design", "is this the right architecture", "check this code against the spec", "what does this module actually do", or invokes /xray.
npx skillsauth add paulnsorensen/dotfiles xrayInstall 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.
Systematic outside-in verification of code modules via dependency graph traversal. Leaves first, confidence bubbles up, evidence backs every verdict.
Target: $ARGUMENTS
Determine the target type from $ARGUMENTS:
domains/orders/, bin/): analyze this directory.claude/specs/xray.md): find the module it describes, analyze that#42): get changed files via gh pr diff, analyze those modulesDerive a slug from the target: domains/orders/ → domains-orders, bin/ → bin.
Look for .context/xrays/{slug}-graph.json. If found:
Read the existing graph
Get the saved gitSha from meta
Run git diff {savedSha}..HEAD --name-only to find changed files
For each changed file that maps to a graph node:
green to yellow (stale)red nodes as red (already flagged)unverified nodes as unverifiedDisplay resume summary:
Resumed xray session: {slug}
Nodes: {verified} verified, {stale} stale (files changed), {remaining} remaining
If no existing session, create .context/xrays/ if needed.
Read these references (they're loaded on demand, not upfront):
references/graph-schema.json — graph contractreferences/sliced-bread-checks.md — architecture rulesSpawn an xray-scout agent (sonnet) with:
targetPath: the resolved module pathslug: the derived slugThe scout builds the semantic dependency graph using ecosystem dependency tools (dependency-cruiser, pydeps, cargo-modules, go list) with ast-grep fallback, enriches with LSP, computes node roles, and writes the graph JSON + Mermaid visualization.
After the scout returns, read the graph JSON and display the opening dashboard:
━━━ {slug} ━━━ {N} nodes, {M} edges, {K} cycles
ENTRY POINTS (nothing imports these)
controller.ts fanIn:0 fanOut:3 [ ]
HUBS (high traffic)
service.ts fanIn:4 fanOut:5 [ ]
DOMAIN (business logic)
pricing.ts fanIn:2 fanOut:2 [ ]
UTILITIES (widely imported, few deps)
types.ts fanIn:6 fanOut:1 [·]
LEAVES (import nothing internal)
validator.ts fanIn:1 fanOut:0 [ ]
[·] = auto-green candidate
Cycles: {list or "none"}
Group nodes by their role field from the graph. Within each group, sort by
fanIn descending. Show [·] marker for auto-green candidates (see Triage).
Display the barrel file's public exports from meta.barrelExports as the
module's contract:
Barrel: {meta.barrelFile}
Entry points:
{barrelExports[].name}({signature or "—"})
...
If no barrel file found, display:
⚠ No barrel/index file found
List all nodes where visibility: "public", grouped by file:
Exports:
{module-a}: {symbolName1}, {symbolName2}, {symbolName3}
{module-b}: {symbolName1}
Spawn a de-slop scan on the whole target directory. Display results in the dashboard:
Health: {N} de-slop findings across {M} files
{top 3 findings with file:line}
From scout's visibility tagging (counts derived from graph nodes):
Encapsulation: {N} public exports, {M} private internals
Issue counts are added here after analyst reports are generated during the DFS loop.
After displaying the dashboard, classify every node into a triage level before starting the DFS loop. This determines how deeply each node gets analyzed.
auto-green — return immediately, no analysis:
role: "leaf") with <50 LOC AND exports only types/constants@generated, auto-generated, or similar)role: "terminal") — always auto-skippedlight — skip spec search and external research:
role: "utility") with passing testsfull — complete analysis pipeline:
role: "hub") — always fullrole: "domain")role: "entry-point")Present the triage plan and let the user adjust:
Triage plan:
auto-green: {N} nodes ({list or "types.ts, constants.ts, ..."})
light: {M} nodes ({list})
full: {K} nodes ({list})
[confirm all] Accept triage plan
[review individually] Step through each classification
[skip triage] Full analysis on everything
On confirm all, apply the triage levels. On skip triage, set all nodes to
triageLevel: "full". On review individually, present each node with its
proposed level and let the user override.
Walk nodes in dfsOrder (leaves first). At each node:
Terminal node handling: Nodes with role: "terminal" are auto-skipped.
Mark as status: "green" with evidence "Terminal node (well-known external library)".
Advance to next node without prompting.
Display breadcrumb and updated layered view:
━━━ Verifying: {symbolName} ({filePath}) [{role}] ━━━
Path: {leaf} → {parent} → {grandparent}
Triage: {auto-green|light|full}
{root} [ ]
├── {child-a} [ ]
│ ├── {current} ← YOU ARE HERE
│ └── {leaf-2} [G]
└── {child-b} [ ]
Spawn xray-analyst (sonnet) for this node with:
role, fanIn, fanOut)triageLevel: the triage level assigned to this nodeThe analyst orchestrates spec-finder and researcher sub-agents (full only), analyzes contracts, callers, test shape, and architecture, then returns a structured node report.
auto-green nodes: The analyst returns immediately with evidence. Display:
━━━ {symbolName} — Auto-Green ━━━
{evidence line}
Auto-confirm as green. Advance to next node without prompting.
After the analyst returns (light and full only), spawn xray-verifier (sonnet) with:
The verifier runs tests via whey-drainer and de-slop scan in parallel, then returns a verification report.
Synthesize the analyst and verifier reports into a concise presentation:
━━━ {symbolName} — Analysis ━━━
Role: {role} fanIn:{N} fanOut:{M}
Contracts: {public API summary}
Spec: {alignment summary or "no spec found"}
Tests: {pass}/{total}, {behavioral_coverage}% behavioral coverage
Architecture: {clean or violations}
De-slop: {finding count}
Build-vs-buy: {flags or "none"}
Proposed: {GREEN|YELLOW|RED} — {evidence summary}
Present the proposed traffic light and wait for user input:
[confirm] Accept proposed verdict
[override G/Y/R] Override with note (required)
[note: <text>] Add observation without confirming
[skip] Skip this node for now
[drill <symbol>] Expand to function-level detail
[drill <symbol> depth=N] N levels of outgoing call hierarchy
[drill <symbol> callers] Incoming call hierarchy
[map] Show full Mermaid graph with current traffic lights
[map <node>] Ego-centric view: node ± 1 level
[up] Bubble to parent node
[done] End session, save progress
documentSymbol to list all symbols in the filecallHierarchy (outgoing) for the drilled symbolcallHierarchy (incoming) to show who calls
this symbol. Display as a flat list, don't enter sub-DFS..context/xrays/{slug}-graph.md with
current traffic light classDefs applied. Display the path.After each verdict, redisplay the layered role view with updated traffic lights.
These commands work at any point in the session:
| Command | Action |
|---------|--------|
| up | Bubble to parent node |
| down / drill <symbol> | Expand function-level detail |
| drill <symbol> depth=N | N levels of outgoing call hierarchy |
| drill <symbol> callers | Incoming call hierarchy |
| next | Skip to next sibling |
| back | Return to previous node |
| tree | Redisplay layered role dashboard with current traffic lights |
| map | Regenerate full Mermaid graph with current traffic lights |
| map <node> | Ego-centric view: node ± 1 level of dependencies |
| notes | Show all accumulated notes across nodes |
| status | Show progress: N verified, M remaining, K stale |
The tool proposes a traffic light based on concrete evidence:
Green (all must be true):
Yellow (any one of):
Red (any one of):
When ALL children of a node are green:
When ANY child is red:
After each verdict or on done, save:
Graph JSON (.context/xrays/{slug}-graph.json):
Mermaid graph (.context/xrays/{slug}-graph.md):
Session notes (.context/xrays/{slug}.md):
---
slug: {slug}
target: {targetPath}
created: {date}
lastUpdated: {date}
gitSha: {sha}
progress: {verified}/{total} nodes
---
# XRay: {slug}
## Progress
- Verified: {N} ({green} green, {yellow} yellow, {red} red)
- Auto-green: {K}
- Remaining: {M}
- Stale: {J}
## Node Notes
### {node-1 symbolName} [{status}]
{accumulated notes}
### {node-2 symbolName} [{status}]
{accumulated notes}
## Session Log
- {timestamp}: Started xray on {target}
- {timestamp}: {node} marked {color} — {reason}
After ~40 tool calls or 15 nodes analyzed, suggest saving progress and resuming in a fresh session to avoid context degradation. Interactive sessions accumulate context faster than batch operations.
When the user says done or all nodes are verified:
Save final state
Display summary:
━━━ XRay Complete: {slug} ━━━
Green: {N} Yellow: {M} Red: {K} Unverified: {J}
Key findings:
- {top finding 1}
- {top finding 2}
- {top finding 3}
Offer next steps:
/wreck on red nodes to write missing tests?"/de-slop to fix detected anti-patterns?"/age — that reviews diffs between commits. This reviews design./de-slop standalone — de-slop runs as part of xray verification./test — test execution is delegated to whey-drainer within xray.callHierarchy is not available for all languages — use grep-based fallback.context/xrays/ directory requires write access — create it if missingtools
Reconstruct what a past coding-agent session was doing so you can resume it — goal, files touched, last verified state, and the next step — by querying the session logs. Use when the user says "what was I working on", "recover that session", "reconstruct where I left off", "resume my last session", "what did that session change", "rebuild context from logs", or invokes /work-recovery. Report-only — it never scores or judges. Do NOT use for usage scoring (that is /skill-improver, /tool-efficiency, /prompt-analytics) or one-off interactive log queries (that is /session-analytics).
development
Curate this repo's hallouminate wiki (.hallouminate/wiki/, the repo:dotfiles:wiki corpus) — add or update architecture pages, per-harness docs, and gotchas. Use when the user says "update the wiki", "document this in the wiki", "refresh the harness docs", "add a wiki page", "curate the wiki", "the wiki is stale", or invokes /wiki-curator. Also use at session end to write back a non-obvious decision or gotcha worth preserving. Grounds the existing wiki first, follows one-topic-per-file conventions, verifies every external doc URL before writing, and reindexes. Do NOT use for general code search (that is cheez-search) or for editing AGENTS.md command reference.
tools
Audit how a tool, command, or MCP server is actually used across coding-agent sessions and produce calibrated recommendations — tool-vs-task fit, error forensics, fix recommendations, permission friction, MCP health, and token economics. Use when the user says "tool efficiency", "am I using X efficiently", "audit tool usage", "why does X keep failing", "how do I fix this error", "what should I change", "permission friction", "is this MCP worth it", "tool error rate", "fix recommendations", or invokes /tool-efficiency. Do NOT use for auditing a skill or agent definition (that is /skill-improver) or for one-off interactive log queries (that is /session-analytics).
tools
Analyze how prompts and skill routing behave across coding-agent sessions and produce calibrated recommendations — prompt-pattern analysis, routing accuracy, and knowledge gaps. Use when the user says "analyze my prompts", "prompt patterns", "is routing working", "which skill should have fired", "knowledge gaps", "what do I keep asking", or invokes /prompt-analytics. Do NOT use for auditing a single skill/agent definition (that is /skill-improver), tool/MCP efficiency (that is /tool-efficiency), or one-off interactive log queries (that is /session-analytics).