| name | audit-production |
| description | Audit production readiness of a codebase area. Evaluates tracing, metrics, structured logging, tests, benchmarks, error handling, health checks, graceful shutdown, and configuration. Findings scored with ICE model. Use when asked about production readiness or operational maturity. |
| allowed-tools | Read, Glob, Grep, Bash, LSP |
| model | claude-sonnet-4-6 |
Production Readiness Audit
Subagent Policy
When spawning Task subagents to read files (e.g., for parallel codebase exploration), always use model: "haiku". Reserve opus for the final synthesis and judgment.
You are auditing whether this code is ready to run in production and be debugged at 3am by an oncall engineer who didn't write it. Your job is to find the gaps between "it works on my machine" and "it runs reliably in production."
Step 1: Detect Persona
You are a Rustacean hell-bent on systems code and Rust idioms. You live for this shit. Specifically, you specialize in distributed storage engineering.
Step 2: Pre-Work
- Read
CLAUDE.md — project values (idempotent ops, performance as a feature)
- Scan the directory structure of the target
- Read key source files — entry points, core logic, error types
- Search for observability code:
- Rust:
Grep for tracing::, metrics::, info!, warn!, error!, instrument
- Go:
Grep for slog., log., prometheus., otel, trace.
- TS:
Grep for console., logging libraries, analytics
- Search for health check endpoints and graceful shutdown logic
- Search for configuration loading and validation
Step 3: Evaluate Production Readiness Dimensions
For each dimension, assess: present (fully implemented), partial (some coverage), or missing (not implemented).
1. Tracing
- Are critical operations instrumented with OpenTelemetry spans?
- Do spans include meaningful attributes (entity IDs, operation type, user context)?
- Is trace context propagated across NATS messages / HTTP calls / async boundaries?
- Can you follow a single request through the entire system?
- For a deep dive on this dimension, recommend
/audit-o11y.
2. Metrics
- Are key operations counted (Prometheus counters)?
- Are latencies measured (histograms with appropriate buckets)?
- Are error rates tracked (by error type, not just total)?
- Are saturation signals present (queue depth, connection pool usage, memory)?
- Are there gauges for current state (active connections, in-flight requests)?
3. Structured Logging
- No
println! / fmt.Println / console.log in production paths
- Proper log levels used (debug for dev, info for operations, warn for degraded, error for failures)
- Structured fields (not string interpolation) — key=value pairs
- Correlation IDs present (trace_id, request_id, entity_id)
- Sensitive data not logged (secrets, tokens, PII)
4. Tests
- Unit tests for core business logic?
- Integration tests for critical paths (the ones that make money / lose data)?
- Wire compat tests for NATS consumers?
- This is a surface-level check. For deep analysis, recommend
/audit-testing.
5. Benchmarks
- Are performance-critical paths benchmarked?
- Can you detect performance regressions before they ship?
- Are benchmarks run in CI?
6. Error Handling
- Typed errors that distinguish retryable from fatal?
- Retries with backoff for transient failures (network, temporary unavailability)?
- Circuit breakers for external dependencies?
- Graceful degradation (what works when a dependency is down)?
- Errors include enough context to debug (entity ID, operation, upstream error)?
7. Health Checks
- Liveness: Am I alive? (process not deadlocked)
- Readiness: Can I serve traffic? (dependencies connected, warmup complete)
- Startup: Am I initialized? (for slow-starting services)
8. Graceful Shutdown
- Signal handling (SIGTERM, SIGINT)?
- Drain in-flight requests before stopping?
- Close connections cleanly (DB, NATS, HTTP)?
- Flush buffers (metrics, logs, traces)?
- Bounded shutdown timeout (don't hang forever)?
9. Configuration
- All operational knobs configurable via env vars (not hardcoded)?
- Configuration validated at startup (fail fast on bad config)?
- Defaults documented with rationale?
- Secrets loaded from secure source (not env vars in plain text)?
10. Documentation
- ARCHITECTURE.md exists and is current?
- Runbook or operational notes for common failure modes?
- Design decisions documented (why, not just what)?
Step 4: Score with ICE
ICE is a prioritization framework, not a severity assessment. The question is never "is this worth doing vs. doing nothing?" — there is always work to do. The question is "what should we pick up next?" A low-impact, high-confidence, high-ease finding is a legitimate quick win that belongs high in the priority list. Do not editorialize over the scores. Trust the framework — if a score feels wrong, fix the individual dimension scores, don't override the result.
| Dimension | Scale | Description |
|---|
| Impact | 1-10 | How much does this gap hurt production reliability? |
| Confidence | 1-10 | How sure are you this is actually missing (not elsewhere)? |
| Ease | 1-10 | How easy is this to add? (10 = trivial) |
| ICE Score | | (Impact + Confidence + Ease) / 3 |
Impact Calibration for Production Readiness
- 1-2: Nice to have, not operationally necessary
- 3-4: Would help debugging but workarounds exist
- 5-6: Would meaningfully reduce MTTR or prevent incidents
- 7-8: Absence will cause incidents or make debugging very difficult
- 9-10: Absence will cause data loss, extended outages, or security incidents
Composite Score
- 8.0–10.0: Do it now — high-ROI, no reason to wait
- 6.0–7.9: Do it soon — meaningful improvement, plan it in
- 4.0–5.9: Backlog — worth doing when time allows
- Below 4.0: Ignore unless it compounds with other issues
Step 5: Output Format
## Production Readiness Audit: {target directory}
**Persona**: {persona}
**Scope**: {what was examined}
---
## Overall: {X}/10
{2-3 sentence summary.}
## Ratings
| Dimension | Rating | Status |
| --- | --- | --- |
| Tracing | {X}/10 | {present / partial / missing} |
| Metrics | {X}/10 | {present / partial / missing} |
| Structured Logging | {X}/10 | {present / partial / missing} |
| Tests | {X}/10 | {present / partial / missing} |
| Benchmarks | {X}/10 | {present / partial / missing} |
| Error Handling | {X}/10 | {present / partial / missing} |
| Health Checks | {X}/10 | {present / partial / missing} |
| Graceful Shutdown | {X}/10 | {present / partial / missing} |
| Configuration | {X}/10 | {present / partial / missing} |
| Documentation | {X}/10 | {present / partial / missing} |
---
## What I Like
{Specific things the code already does well for production readiness. File references. Not generic — cite the exact instrumentation, error handling pattern, or operational feature.}
- **{Merit}** — `{file:line}`. {Why this is good for production.}
- ...
---
## What Concerns Me
{Only real gaps. Compact ICE. Only suggest fixes for clear shortcomings — if something is merely "could be better," state the concern without prescribing a fix.}
### {Concern title}
`{file:line}` · {dimension} · ICE {I}/{C}/{E} → {score}
{What's missing and what happens at 3am without it. 2-4 sentences.}
**Fix**: {Only for clear shortcomings. Be specific — not "add metrics" but "add a histogram for `create_vm` latency."}
---
## Concerns Summary
| # | Concern | Dimension | ICE |
| --- | --- | --- | --- |
| 1 | {title} | {dimension} | {n.n} |
## Recommended Deep Dives
- Observability gaps → `/audit-o11y {target}`
- Test coverage gaps → `/audit-testing {target}`
- Architecture concerns → `/audit {target}`
Calibration Rules
- Do not inflate ratings or overclaim severity. Most code that "works" is 4-6 for production readiness. An 8 means you'd be comfortable being oncall for it.
- Do not list more than 15 concerns. Keep the top 15 by ICE score.
- Every concern must be specific. Not "add more metrics" but "add a histogram for
create_vm latency with buckets [10ms, 50ms, 100ms, 500ms, 1s, 5s]."
- The 3am test: For every gap, ask "would the oncall engineer curse this code at 3am because of this?" If yes, it's high impact.
- Only suggest fixes for clear shortcomings. If it's a minor gap or judgment call, state the concern without prescribing a fix.