agentleFS
Bexruz-cellBexruz-cell/agent-skills/skills/production-hardening/SKILL.md

production-hardening

Skill1 starsChanged 52 days agoMITView on GitHub

Production hardening and reliability audit for Python/Node.js applications. Trigger before git commit, before deploy, when user asks for security audit, API resilience check, database pool review, performance optimization, race condition scan, secret leak detection, or production readiness review. Use when preparing code for production or investigating stability issues.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run secret and high-entropy string scan across the repository (exclude paths listed in config).

    line 20
  2. Distinctive:

    If CRITICAL findings exist, exit with non-zero status and block further automated actions until resolved.

    line 31
  3. Very specific:

    Never cat entire large log files or directories.

    line 35
  4. Very specific:

    Prefer rg / grep -n with context limits over full-file reads.

    line 36
  5. Distinctive:

    When running the audit script, capture only structured JSON output.

    line 38
  6. Distinctive:

    Never print or log actual secret values — only report file:line and redacted fingerprint.

    line 42
  7. Distinctive:

    Never modify source files automatically unless user explicitly requests a fix.

    line 43
  8. Distinctive:

    Do not exfiltrate repository contents outside the local workspace.

    line 44
  9. Very specific:

    Test directories (tests/, test_*.py) are skipped by default.

    line 46
  10. Distinctive:

    Before declaring the audit complete:

    line 50
  11. Very specific:

    Run basic syntax check (python -m py_compile on changed Python files) if fixes were proposed.

    line 54
  12. Distinctive:

    Always emit the report in this exact structure:

    line 58
  13. Distinctive:

    If Status is FAILED, list the blocking issues first.

    line 86
  14. Very specific:

    Add to .cursor/rules or ask:

    line 105

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Trigger Criteria

Activate this skill when:

  • User is about to commit or push code to main/master
  • User requests a security / production readiness audit
  • User mentions: "harden", "production check", "security audit", "pool leak", "race condition", "secret scan", "before deploy", "API resilience"
  • Code contains async workers, database connections, background tasks, or external API calls
  • User asks to review stability, timeouts, or resource cleanup

Execution Protocol

  1. Load configuration from schemas/audit_config.json.
  2. Run secret and high-entropy string scan across the repository (exclude paths listed in config).
  3. Perform AST-based syntax and structural checks on Python files (HTTP-client context only).
  4. Scan for common anti-patterns listed in references/security_rules.md:
    • Unclosed connection pools
    • Missing timeouts on HTTP clients
    • Unprotected shared state in async code
    • SQLite "database is locked" patterns
    • Hardcoded credentials
  5. Execute scripts/hardening_audit.py with appropriate flags.
  6. Collect findings and classify severity (CRITICAL / HIGH / MEDIUM / LOW).
  7. Produce the standardized report defined in Output Format.
  8. If CRITICAL findings exist, exit with non-zero status and block further automated actions until resolved.

Token & Shell Safety

  • Never cat entire large log files or directories. Always pipe through head -n 50 or Select-Object -First 50.
  • Prefer rg / grep -n with context limits over full-file reads.
  • Limit AST walk depth and file size (skip files > 1 MB unless explicitly requested).
  • When running the audit script, capture only structured JSON output.

Security Boundaries

  • Never print or log actual secret values — only report file:line and redacted fingerprint.
  • Never modify source files automatically unless user explicitly requests a fix.
  • Do not exfiltrate repository contents outside the local workspace.
  • Respect .gitignore and the ignore list in audit_config.json.
  • Test directories (tests/, test_*.py) are skipped by default.

Verification Gate

Before declaring the audit complete:

  • Confirm hardening_audit.py exited cleanly or with expected non-zero code.
  • Confirm JSON report is valid.
  • Confirm no raw secrets appear in the final output.
  • Run basic syntax check (python -m py_compile on changed Python files) if fixes were proposed.

Output Format

Always emit the report in this exact structure:

# Production Hardening Report

Status: PASSED | FAILED

## Summary
- Critical: N
- High: N
- Medium: N
- Low: N

## Findings
### [CRITICAL] <title>
- File: path:line
- Rule: <CWE / internal id>
- Description: ...
- Recommendation: ...

## Affected Files
- path/to/file1
- path/to/file2

## Next Actions
- <concrete steps>

If Status is FAILED, list the blocking issues first.

Failure Modes & Known Limitations

  • Entropy analysis can produce false positives on legitimate high-entropy strings (UUIDs, base64 blobs, minified identifiers). Always verify HIGH findings manually.
  • Minified / bundled JavaScript is skipped by size limit and ignore patterns; run a dedicated JS secret scanner if needed.
  • Dynamic attribute access (getattr(obj, "get")) is not detected by the AST checker.
  • HTTP client detection relies on naming conventions (requests, session, client, httpx, …). Custom wrappers may be missed.
  • The scanner does not execute code; it is purely static.

Invocation Examples by Environment

Claude Code / Antigravity CLI

/skill production-hardening
# or just mention: "run production hardening audit before commit"

Cursor (Rules / Composer)

Add to .cursor/rules or ask:

Use the production-hardening skill and run a full audit on the current workspace.

Gemini CLI

@production-hardening audit this repository before deploy

Direct CLI

python skills/production-hardening/scripts/hardening_audit.py --root . --json

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.