Destynova2/cli-code-skills / cli-audit-xray
cli-audit-xray
VerifiedReveal 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".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 9.9 KB |
| references/examples.md | markdown | 2.6 KB |
| references/optimization-families.md | markdown | 2.5 KB |
| references/risk-rules.md | markdown | 2.1 KB |
| references/semantic-optimization-graph.md | markdown | 2.9 KB |
references/examples.md
View on GitHub# Worked Examples
> **When to read:** When the user asks for examples or when calibrating report style.
## Contents
- Repeated Normalization
- AI Runtime Boundary
- DLP Boundary
---
## Repeated Normalization
Input:
```python
def handle(prompt):
if not allowed(prompt):
return "blocked"
clean1 = normalize(prompt)
scan = dlp_scan(normalize(prompt))
emb = embed(normalize(prompt))
if scan.has_secret:
return "blocked"
return retrieve_and_answer(emb, clean1)
```
Candidate:
````markdown
## Optimization Card 1 — Repeated prompt normalization
**Location**
`handle(prompt)`
**Observed structure**
`normalize(prompt)` is executed three times on the same input.
**Semantic / mathematical view**
```text
clean = normalize(prompt)
scan = dlp_scan(clean)
emb = embed(clean)
answer = retrieve_and_answer(emb, clean)
```
**Operational issue**
Repeated string normalization may allocate and traverse the prompt multiple times.
**Candidate rewrite**
Compute `clean` once and reuse it.
**Required invariants**
- `normalize(prompt)` is deterministic.
- `normalize(prompt)` has no side effects.
- Repeated exceptions/timing are not externally relied upon.
**Validation method**
- Unit test for identical behavior.
- Property test: `normalize(x) == normalize(x)` for supported inputs.
- Benchmark on short, long, and multilingual prompts.
**Expected impact**
Latency: medium
Memory: medium
Cloud cost: low
Security/correctness: neutral or positive
**Risk**
Low if `normalize()` is pure.
**Status**
provable_under_assumptions
**Confidence**
0.90
````
## AI Runtime Boundary
Pattern:
```text
linear_attention
-> residual add
-> RMSNorm
-> MoE routing
-> gather
-> expert MLP
-> weighted reduction
-> residual add
```
Candidate focus:
```text
attention output -> residual add -> RMSNorm -> MoE routing input
```
Why: many small tensor operations can increase kernel launch overhead, memory traffic, and intermediate materialization. Validation requires output tolerance comparison, decode-path microbenchmark, kernel count, and representative shape/profile coverage.
## DLP Boundary
Pattern:
```text
request -> auth -> route -> prompt expansion -> DLP -> model call -> post-filter
```
Candidate: inspect whether a two-phase DLP is safer and cheaper:
```text
scan raw prompt -> safe expansion -> scan expanded prompt if expansion can introduce sensitive content
```
Risk: medium/high because this changes a security boundary. Requires threat model review, secret corpus tests, latency benchmark, and audit-log comparison.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |