cli-audit-xray
Skill5 starsChanged 8 months agoMITView on GitHub
Reveal hidden semantic, mathematical, dataflow, resource-flow, and operational structure in code. Produces optimization candidates with explicit invariants, risks, validation methods, and handoffs. Use when analyzing a function, hot path, AI inference pipeline, compiler/runtime bottleneck, DevSecOps pipeline, LLM gateway, distributed system, or complex business logic for missed optimization opportunities. Also triggers on "semantic xray", "semantic optimization graph", "hidden structure", "optimization cards", "dataflow optimization", "resource flow", "repeated computation", "unnecessary allocation", "cache placement", "CPU/GPU boundary", "prove this optimization", "is this rewrite safe", or "find optimizations humans miss".
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- murillo-consulting/cli-skillsedited, first seen Oct 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- murillo-consulting/cli-skills★ 099% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/cli-audit-code.mdcCursor rule
- .cursor/rules/cli-audit-doc.mdcCursor rule
- .cursor/rules/cli-forge-arch.mdcCursor rule
- .cursor/rules/cli-forge-schema.mdcCursor rule
- cli-audit-codeSkill
- cli-audit-dataSkill
- cli-audit-docSkill
- cli-audit-driftSkill
- cli-audit-hanoiSkill
- cli-audit-reviewSkill
- cli-audit-shellSkill
- cli-audit-syncSkill
- cli-audit-tangleSkill
- cli-audit-testSkill
- cli-audit-wizardSkill
- cli-cycleSkill
- cli-forge-archSkill
- cli-forge-chefSkill
- cli-forge-choice-uxSkill
- cli-forge-dataSkill
- cli-forge-demoSkill
- cli-forge-docSkill
- cli-forge-githubSkill
- cli-forge-hldSkill
- cli-forge-infraSkill
- cli-forge-lldSkill
- cli-forge-oci-rootlessSkill
- cli-forge-perfSkill
- cli-forge-pipelineSkill
- cli-forge-plumeSkill
- cli-forge-prezSkill
- cli-forge-profileSkill
- cli-forge-quorumSkill
- cli-forge-readmeSkill
- cli-forge-resilienceSkill
- cli-forge-schemaSkill
- cli-forge-treeSkill
- cli-git-conventionalSkill
- cli-watermarkSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. About 0 are common, 2 are distinctive, and 14 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Trace/flamegraph/profile path: use the dynamic evidence to focus static inspection.
- Very specific: line 75
Read ../gotchas.md if it exists.
- Very specific: line 76
Read ../shared/optimization-card.md for the canonical card contract.
- Very specific: line 77
Read ../shared/triage.md for tier/confidence semantics.
- Very specific: line 78
Read ../shared/done-gate.md and ../shared/gate-ladder.md when a candidate requires proof or benchmark.
- Very specific: line 79
If present, read .claude/tangle-partition.json to focus on god functions, cycles, and boundary functions.
- Very specific: line 80
If present, read CONTRACTS.md before proposing rewrites that depend on behavior or invariants.
- Very specific: line 84
Use references/semantic-optimization-graph.md for node types and mapping rules.
- Very specific: line 98
Use references/optimization-families.md when looking for patterns.
- Very specific: line 129
Use references/risk-rules.md for floating point, side effects, concurrency, and security boundaries.
- Very specific: line 182
When running under cli-cycle, audit targets that usually run earlier (cli-audit-tangle, cli-audit-drift, cli-audit-test) are report-only …
- Distinctive: line 187
No runtime gain claim without measurement: If hardware, compiler, backend, cache, shape, distribution, or workload matters, mark it …
- Very specific: line 188
Security before speed: Do not move, remove, cache, or deduplicate auth/DLP/policy/audit behavior unless the trust boundary is preserved.
- Very specific: line 191
Concrete locations only: Every card should have file:line evidence when source is available.
- Very specific: line 210
Does not replace topology analysis: Use cli-audit-tangle for call graph partitioning.
- Very specific: line 211
Does not replace contracts: Use cli-audit-drift to check intention vs implementation.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Optimization: This skill uses on-demand loading. Heavy content lives in
references/and is loaded only when needed.
Language rule: Skill instructions are written in English. When generating user-facing output (reports, files, documentation), detect the project's primary language (from README, comments, docs, commit messages) and produce the output in that language. If the project is bilingual, ask the user which language to use before proceeding.
Audit X-Ray — Semantic Optimization Scanner
Reveal what the code is really doing before proposing optimizations. The output is not "make it faster"; it is a ranked set of falsifiable optimization candidates with locations, invariants, validation methods, and handoffs to the skills that can prove or implement the next step.
Core rule:
First reveal structure. Then propose hypotheses. Then classify risk. Then validate.
What This Skill Adds
cli-audit-xray sits between static code quality, topology, drift, and performance work:
cli-audit-codefinds quality smells; X-Ray finds hidden semantic cost in otherwise acceptable code.cli-audit-tanglefinds graph shape; X-Ray adds dataflow, resource flow, and optimization meaning to hot or tangled paths.cli-audit-driftchecks code against contracts; X-Ray extracts missing invariants that should become contracts.cli-forge-perfproves runtime gains; X-Ray produces candidates worth benchmarking.
Input
$ARGUMENTS is the target to inspect:
- Function or file: build a focused Semantic Optimization Graph around that code.
- Directory: sample likely hot paths, entrypoints, adapters, pipelines, and large loops.
- Trace/flamegraph/profile path: use the dynamic evidence to focus static inspection.
- Empty: inspect
src/or the primary source directory at a shallow level.
Mitosis — Scale Analysis to Scope
Reference ../shared/tiering.md for canonical S/M/L/XL semantics.
| Scope | Tier | Behavior |
| One function / one hot path | S | Full semantic map + up to 5 optimization cards |
| One file / small module | M | Dataflow + resource flow + ranked cards |
| Directory / service slice | L | Sample top 10-15 risky paths; use tangle/perf evidence if available |
| Monorepo / distributed system | XL | Do not deep-scan everything; produce map of candidate zones and handoffs |
Bias down when unsure. A noisy X-Ray report is worse than a narrow one with strong evidence.
Workflow
Step 0 — Load Shared Contracts
Before producing findings:
- Read
../gotchas.mdif it exists. - Read
../shared/optimization-card.mdfor the canonical card contract. - Read
../shared/triage.mdfor tier/confidence semantics. - Read
../shared/done-gate.mdand../shared/gate-ladder.mdwhen a candidate requires proof or benchmark. - If present, read
.claude/tangle-partition.jsonto focus on god functions, cycles, and boundary functions. - If present, read
CONTRACTS.mdbefore proposing rewrites that depend on behavior or invariants.
Step 1 — Build the Mental SOG
Use references/semantic-optimization-graph.md for node types and mapping rules.
Extract:
- operations and transformations;
- data objects and shapes;
- control flow, loops, retries, async waits;
- resource flow: allocations, copies, serialization, locks, I/O, network, CPU/GPU boundaries;
- constraints and invariants;
- observable side effects;
- security and trust boundaries.
Step 2 — Lift Where Useful
Use references/optimization-families.md when looking for patterns.
Lift imperative regions into maps, filters, reductions, scans, joins, state machines, tensor operations, graph traversals, policy decisions, or equations. Do not force math when it adds no decision value.
Step 3 — Discover Candidates
Look for:
- repeated computation;
- common subexpressions;
- loop-invariant work;
- map/filter/reduce fusion;
- needless materialization;
- clone/copy/allocation hot spots;
- serialization/deserialization churn;
- bad cache placement;
- network or database calls inside loops;
- lock scope around I/O;
- CPU/GPU or device/host roundtrips;
- misplaced validation, DLP, auth, or policy boundaries.
Step 4 — Gate Every Candidate
For each candidate, answer:
- What must be true?
- What could break?
- Which invariant is missing?
- How can we validate it?
- Is this a proof problem, benchmark problem, test problem, or architecture problem?
Use references/risk-rules.md for floating point, side effects, concurrency, and security boundaries.
Step 5 — Report and Emit Envelope
Produce a Markdown report and, when running under cli-cycle or when writing files is allowed, emit .claude/cli-audit-xray.json following ../shared/result-schema.md.
Output Format
# Semantic X-Ray Audit — {project-or-scope}
**Target**: {file/directory/hot path} | **Language**: {detected} | **Date**: {date}
**Scope tier**: S/M/L/XL | **Candidate count**: N
## Executive Summary
- Hidden structure found:
- Highest-leverage candidate:
- Highest-risk assumption:
- Next proof step:
## Semantic Map
### Dataflow
### Control Flow
### Resource Flow
### Trust / Security Boundaries
## Hidden Invariants
| Invariant | Evidence | Missing? | Downstream use |
## Optimization Candidates
{optimization cards using ../shared/optimization-card.md}
## Handoffs
| Target skill | Scope | Reason |
## Validation Plan
Map candidates to unit tests, property tests, benchmarks, trace comparisons, or contracts.Dynamic Handoffs
| Condition detected | Recommend | Why |
| Candidate requires runtime measurement, profile, or A/B proof | /cli-forge-perf | Use native benchmark protocol and significance gate |
| Candidate depends on an implicit behavior invariant | /cli-audit-drift | Promote the invariant into CONTRACTS.md or verify existing contract |
| Candidate sits in a god function, cycle, or unclear boundary | /cli-audit-tangle | Restructure or isolate before optimizing |
| Candidate needs new property/unit/negative tests | /cli-audit-test | Validate equivalence and prevent regressions |
| Semantic graph is useful to humans (> 12 nodes or cross-boundary flow) | /cli-forge-schema | Render Mermaid from the semantic map |
| Candidate touches auth, DLP, audit logs, retry, backpressure, or failover | /cli-forge-resilience | Treat it as operational risk, not only optimization |
| Candidate needs a CI perf gate or reproducible baseline | /cli-forge-pipeline | Make the validation repeatable in CI |
Rule: Recommend, don't auto-execute. Phrase as: "Consider running /cli-forge-perf — candidate X needs a reproducible A/B benchmark."
When running under cli-cycle, audit targets that usually run earlier (cli-audit-tangle, cli-audit-drift, cli-audit-test) are report-only recommendations if they already ran. Do not emit backward automatic handoffs that create a cycle; use their existing outputs when available.
Rules
- No optimization claim without preconditions. Say "valid if..." instead of "correct."
- No runtime gain claim without measurement. If hardware, compiler, backend, cache, shape, distribution, or workload matters, mark it benchmarkable.
- Security before speed. Do not move, remove, cache, or deduplicate auth/DLP/policy/audit behavior unless the trust boundary is preserved.
- Floating-point is not algebra over reals. Mention NaN, infinity, rounding, overflow, underflow, tolerance, and order effects.
- Side effects are semantics. Logging, metrics, mutation, global state, time, randomness, I/O, exceptions, cancellation, and locks can invalidate rewrites.
- Concrete locations only. Every card should have
file:lineevidence when source is available. - Do not fix by default. This skill reports candidates and patch plans. Use explicit user direction before editing code.
Integration with other cli-* skills
| Skill | Relationship |
cli-forge-perf | X-Ray proposes benchmarkable candidates; perf proves or rejects them |
cli-audit-code | Code quality can flag local smells that X-Ray turns into semantic-cost candidates |
cli-audit-tangle | Tangle supplies topology and boundary functions; X-Ray supplies data/resource meaning |
cli-audit-drift | Drift supplies contracts; X-Ray supplies missing invariants and rewrite preconditions |
cli-audit-test | X-Ray identifies equivalence/property tests required by optimizations |
cli-forge-schema | Renders semantic maps and resource-flow diagrams |
cli-forge-pipeline | Turns recurring validation into CI gates |
cli-cycle | Can run X-Ray as an adaptive Wave 2/3 audit and aggregate its JSON envelope |
What This Skill Does NOT Do
- Does not replace profilers. It finds hypotheses; perf proves dynamic cost.
- Does not replace topology analysis. Use
cli-audit-tanglefor call graph partitioning. - Does not replace contracts. Use
cli-audit-driftto check intention vs implementation. - Does not auto-rewrite. It can propose patch plans, but changes require explicit user direction.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

