harden
Skill9 starsChanged 6 days agoMITView on GitHub
Production-readiness audit for implemented code — five named failure modes, each finding paired with the pattern that prevents it. Audits code in context (a file, directory, or diff) for: silent error swallowing, missing observability at trust boundaries, infrastructure coupling in domain logic, no resilience at external calls (timeout/retry/circuit-breaker), and missing input validation at entry points. Every recommendation names the failure it prevents, not just the pattern to apply. Findings are BLOCK (ship-stopper) or ADVISE (before first traffic). Persists gap history in out/harden/tracker.md so repeat runs open with what changed and flag recurring issues. Use when code works but needs to be production-grade — e.g. "/harden", "/harden src/orders/", "/harden the new auth module", "make this feature enterprise-grade", "is my code production-ready". For structural refactoring use refactor; for shipping verification use done.
52 other projects use a version of this.
Adopted by
Most recently taken up by
- kuni29/claude-skillstheir own version, first seen Nov 29, 2026
- bmaltais/skillstheir own version, first seen Nov 29, 2026
- amineorion/claude-code-safety-skillstheir own version, first seen Nov 29, 2026
- saleh-alhaddad/itqan-engineeringtheir own version, first seen Nov 28, 2026
- decebal/decebal-claude-skillstheir own version, first seen Nov 22, 2026
- rotnov/pycctheir own version, first seen Nov 22, 2026
Used with
Projects with it also use layout, shape and 7 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
owshq-mecSkilllayout
Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy. Use when the user mentions layout feeling off, spacing issues, visual hierarchy, crowded UI, alignment problems, or wanting better composition.
Also in 5 projects that use this
HAR5HA-7663Skillshape
Plan the UX and UI for a feature before writing code. Runs a structured discovery interview, then produces a design brief that guides implementation. Use during the planning phase to establish design direction, constraints, and strategy before any code is written.
Also in 8 projects that use this
jefflesterSkillpython-best-practices
Python development best practices including PEP 8 style guidelines, type hints, docstring conventions, and common patterns. Use when writing or modifying Python code.
Also in 3 projects that use this
AnthropicSkillstart
Set up your bio-research environment and explore available tools. Use when first getting oriented with the plugin, checking which literature, drug-discovery, or visualization MCP servers are connected, or surveying available analysis skills before starting a new project.
Also in 4 projects that use this
SentrySkillreview
Fixture review skill.
Also in 4 projects that use this
CloudflareSkillsecurity-audit
Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.
Also in 3 projects that use this
Other versions52 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 52
- alchemy-run/alchemy★ 2.1ksame name
- alchemy-run/alchemy-effect★ 2.1ksame name
- SterlingChin/marvin-template★ 1ksame name
- educlopez/ui-craft★ 490same name
- nexmoe/DayBee★ 424same name
- nexmoe/eve★ 424same name
- Southclaws/storyden★ 350same name
- AkaraChen/aghub★ 271same name
- zacharyfmarion/openscad-studio★ 252same name
- jagrat7/linux-wallpaper-engine★ 232same name
42 more not listed
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 repository22 other files it gives its agents.
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 49 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Every finding follows a fixed form: the structural signal that triggered it → the named failure mode it exposes → the pattern that prevents …
- Very specific: line 40
Check memory: read out/harden/tracker.md if it exists.
- Distinctive: line 47
Run each check against the target.
- Distinctive: line 156
Remediation task: add schema validation or guard clauses at each flagged entry point.
- Distinctive: line 176
If no checks fired: state that explicitly — "No production-readiness gaps found in the target.
“Common” is measured: kept by at least 6 in 10 of the 49 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
harden — production-ready, not just working
/harden — audit code in context (current diff or last-commit files)
/harden <path> — audit a specific file or directory
Answer one question: which production failure modes is this code structurally exposed to — and what prevents each one?
Every finding follows a fixed form: the structural signal that triggered it → the named failure mode it exposes → the pattern that prevents it → why that pattern prevents this failure specifically → a concrete remediation task. "The textbook recommends it" appears nowhere.
Step 0 — Establish the target and check memory
Determine what to audit:
/harden(no arg): rungit diff HEAD; if empty, usegit diff HEAD~1 HEADto get the last commit's files./harden <path>: audit that file or directory.- Code mentioned in conversation: audit that code directly.
Check memory: read out/harden/tracker.md if it exists. Open with
"Since last harden" — which failure modes were previously found, which were
fixed, which recur. A finding marked open in two consecutive runs gets ⚠️
recurring in this run's output.
Step 1 — The five checks
Run each check against the target. A check fires only when the structural signal is present in the code — absence is not a finding, and a clean result is reported as such. Never invent a finding to appear thorough.
Check 1 — Silent error swallowing [BLOCK]
Signal: catch blocks that (a) swallow without any log, (b) return a zero-value
or null that erases the error context, or (c) catch a broad type (Exception,
Error, any) where a narrower type is possible.
Failure mode: the system fails silently; the operator has no signal; recovery is impossible because the failure is invisible.
Pattern: typed error hierarchy + explicit propagation. Each error is either handled (logged with context + defined recovery) or re-thrown as a typed error with the original cause wrapped.
Why: typed errors make failure modes explicit in the type system; wrapping preserves the stack; structured context makes the log searchable.
Remediation task: for each silent catch — (a) log with structured context and decide on recovery, or (b) wrap and re-throw as a domain-specific error type.
Check 2 — Missing observability [ADVISE]
Signal: operations that cross a trust boundary (HTTP call, DB query, queue
publish, auth decision) with no structured log event, or only a bare string log
(console.log("here"), logger.info("done")).
Failure mode: the system misbehaves in production and the operator cannot reconstruct what happened — no timestamps, no correlation IDs, no outcome fields.
Pattern: structured log at every trust-boundary crossing: operation name, correlation/trace ID, outcome (success/error), duration where latency matters.
Why: structured fields are queryable in any log aggregator; correlation IDs link events across services; outcome + duration give SLOs something to measure.
Remediation task: for each flagged call site, emit a structured log event:
{ op, traceId, outcome, durationMs, errorType? }.
Check 3 — Infrastructure coupling [BLOCK]
Signal: domain logic (business rules, use-case code) with direct calls to infrastructure — raw SQL/ORM queries, HTTP client instantiation, filesystem reads, cache client calls — inside functions named after domain operations, not infrastructure operations.
Failure mode: domain logic cannot be unit-tested without a real database/network; infrastructure changes force domain rewrites; no seam exists for swapping implementations.
Pattern: port/repository interface — domain code depends on an interface; infrastructure implements it. The domain function receives the dependency, not the concrete driver.
Why: the interface is the seam; tests inject a fake; infrastructure is swappable; the domain stays pure.
Remediation task: extract the infrastructure call behind an interface; inject it; the domain function receives the interface, not the driver.
Check 4 — No resilience at external boundaries [BLOCK]
Signal: calls to external systems (HTTP, gRPC, message broker, third-party API) with no timeout, no retry with backoff, no circuit-breaker, and no fallback — a raw call with only a happy-path response handler.
Failure mode: a slow or unavailable dependency cascades — the caller blocks indefinitely, thread pool exhausts, failure propagates system-wide.
Pattern: timeout + retry with exponential backoff + circuit breaker at each external call site.
Why: timeout bounds the worst case; retry handles transient failures; circuit breaker stops cascade when the dependency is down; fallback keeps the caller operational.
Remediation task: for each flagged call, add: explicit timeout, retry (2–3 attempts, exponential backoff), and either a circuit breaker or a defined fallback behavior.
Check 5 — Missing input validation at entry points [BLOCK]
Signal: public-facing entry points (HTTP handlers, queue consumers, CLI argument parsers, public API methods) that pass inputs directly to internal logic without schema validation, type coercion, or guard clauses.
Failure mode: malformed input causes unexpected failures deep in the call stack — hard to debug, potentially exploitable, and the error message reveals internals.
Pattern: validate at the boundary, trust inside. All inputs validated/coerced at the entry point; internal functions receive trusted types.
Why: the entry point is the last place you control the input; validating there gives one authoritative place for input contracts; downstream code can be simple because it assumes valid inputs.
Remediation task: add schema validation or guard clauses at each flagged entry point; return a structured error response for invalid inputs before reaching domain logic.
Step 2 — Emit findings
For each check that fired, emit one block:
### [BLOCK|ADVISE] <Check name>
**Location:** `<path>` line <n>
**Signal:** <quote or describe the structural pattern found>
**Failure mode:** <one sentence>
**Pattern:** <name>
**Why here:** <one sentence specific to this code, not generic>
**Task:** <concrete action, naming files/functions where known>If no checks fired: state that explicitly — "No production-readiness gaps found in the target. If you expected findings, verify the target points at implementation code (not config, tests, or generated files)."
Close with a severity summary: N BLOCK, N ADVISE. BLOCK means don't merge
without resolution. ADVISE means schedule before first real traffic.
Step 3 — Write the tracker
mkdir -p out/hardenAppend a run to out/harden/tracker.md (create with heading if absent):
## <date> — <target>
| Check | Severity | Location | Status |
|---|---|---|---|
| Silent error swallowing | BLOCK | src/orders/handler.ts:42 | open |
| Missing observability | ADVISE | src/orders/handler.ts:60 | open |On a re-run, carry forward open findings and flip open → fixed (<commit>) for
resolved ones. A finding appearing open in two consecutive runs gets ⚠️
recurring in the output and in the tracker.
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.

