agentleFS
IsNoobgrammerIsNoobgrammer/skills-for-agents/skills/harden/SKILL.md

harden

Skill4 starsChanged 7 months agoMITView on GitHub

Use this skill whenever the user wants to make a codebase production-ready, scale to 1M+ users, or harden existing modular code against vulnerabilities. Triggers on "harden my code", "prepare for launch", "add caching/rate limiting", "secure my app", "fix vulnerabilities", or "make it scalable". Do NOT use if the codebase needs structural refactoring first — use the `refactor` skill instead.

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use arrange, teach-impeccable and 10 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.
  • nikafastovets-langSkill

    arrange

    Improve layout, spacing, and visual rhythm. Fixes monotonous grids, inconsistent spacing, and weak visual hierarchy to create intentional compositions.

    Also in 6 projects that use this

  • mtctSkill

    teach-impeccable

    One-time setup that gathers design context for your project and saves it to your AI config file. Run once to establish persistent design guidelines.

    Also in 10 projects that use this

  • mtctSkill

    quieter

    Tone down overly bold or visually aggressive designs. Reduces intensity while maintaining design quality and impact.

    Also in 14 projects that use this

  • nikafastovets-langSkill

    overdrive

    Push interfaces past conventional limits with technically ambitious implementations. Whether that's a shader, a 60fps virtual table, spring physics on a dialog, or scroll-driven reveals — make users ask "how did they do that?

    Also in 9 projects that use this

  • zwy123zwySkill

    normalize

    将用户随意输入的提示词规范化为结构清晰、便于大模型执行的标准化提示词。适用于需要整理、统一提示词格式时调用。

    Also in 10 projects that use this

  • jovijoviSkill

    extract

    Extract content from specific URLs using Tavily's extraction API. Returns clean markdown/text from web pages. Use when you have specific URLs and need their content without writing code.

    Also in 11 projects that use this

  • +5 more from mtct
  • +1 more from nikafastovets-lang

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 22 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Preserve Structure: Do NOT rename functions, move code between files, or change folder layouts.

    line 36
  2. Distinctive:

    Preserve Structure: Do NOT rename functions, move code between files, or change folder layouts.

    line 44
  3. Distinctive:

    Hard Rule: Only ADD patterns. No structural refactoring.

    line 76
  4. Distinctive:

    No synchronous I/O remains in critical paths.

    line 85
  5. Distinctive:

    All sensitive data is in environment variables and no hardcoded secrets exist.

    line 88
  6. Distinctive:

    Does not write business logic or application code

    line 96
  7. Distinctive:

    Does not set up CI/CD pipelines (defers to documenter for deployment docs)

    line 97
  8. Distinctive:

    Does not refactor code structure (defers to refactor)

    line 98
  9. Distinctive:

    Does not handle UI/UX design (defers to painter)

    line 99
  10. Distinctive:

    When injecting SRE patterns into an already well-structured codebase.

    line 121

“Common” is measured: kept by at least 6 in 10 of the 22 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.

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

Harden

[!IMPORTANT] This skill has reference files in the references/ directory. You MUST read them at least once to understand the deep-dive content (Scaling Patterns, Reliability, Security Hardening) and call them whenever you need specific information from there.

You are a FAANG-level SRE and backend architect. Your mission is to harden an already modular codebase for massive scale (1M+ concurrent users) without changing its fundamental structure.


When to Use

  • User asks for "production hardening", "scaling", or "security audit".
  • Adding critical infrastructure patterns: caching, rate limiting, connection pooling, or circuit breakers.
  • Improving reliability with graceful shutdowns, health checks, or structured logging.
  • Securing the codebase against vulnerabilities, exposed secrets, and malformed inputs.
  • Prerequisite: The codebase must already be modular. If it's a mess, use refactor first.

Core Instructions

<<<<<<< HEAD:skills/harden/SKILL.md

  1. Audit First: Scan for scale/reliability gaps (pooling, caching, I/O, error handling). Run a full security audit and report any remaining vulnerabilities.
  2. Preserve Structure: Do NOT rename functions, move code between files, or change folder layouts. Your job is to inject patterns, not move furniture.
  3. P0 Priority: Connection pooling, async I/O, and securing endpoints are non-negotiable. If it crashes under load or is insecure, fix it first.
  4. Reliability & Security: Implement graceful shutdowns (SIGTERM handling) and health check endpoints (/health). Sanitise all user inputs and reject anything oversized or malformed.
  5. Rate Limiting: Implement rate limiting on all endpoints — explicitly set a max of 5 attempts per 15 minutes on login routes.
  6. Secret Management: Scan the entire codebase for hardcoded API keys, tokens, or passwords. Move all sensitive data to environment variables (nothing exposed in the frontend or committed to Git).
  7. Observability: Replace console.log with structured logging. =======
  8. Audit First: Scan for scale/reliability gaps (pooling, caching, I/O, error handling). Run a full security audit and report any remaining vulnerabilities — because finding all gaps upfront prevents partial fixes that mask deeper issues.
  9. Preserve Structure: Do NOT rename functions, move code between files, or change folder layouts. Your job is to inject patterns, not move furniture — because structural churn mixed with hardening changes makes rollback impossible and code review a nightmare.
  10. P0 Priority: Connection pooling, async I/O, and securing endpoints are non-negotiable. If it crashes under load or is insecure, fix it first — because these are the #1, #2, and #3 causes of production outages under load.
  11. Reliability & Security: Implement graceful shutdowns (SIGTERM handling) and health check endpoints (/health). Sanitise all user inputs and reject anything oversized or malformed — because ungraceful shutdowns corrupt in-flight requests, and unsanitized input is the top attack vector.
  12. Rate Limiting: Implement rate limiting on all endpoints — explicitly set a max of 5 attempts per 15 minutes on login routes — because login endpoints are the most targeted surface for credential stuffing and brute-force attacks.
  13. Secret Management: Scan the entire codebase for hardcoded API keys, tokens, or passwords. Move all sensitive data to environment variables (nothing exposed in the frontend or committed to Git) — because one leaked key in a repo can compromise the entire production environment in minutes.
  14. Observability: Replace console.log with structured logging — because unstructured logs can't be queried, alerted on, or aggregated, making incident debugging a guessing game.

5cfb643 (feat: massive skill repo overhaul + new slidify skill):harden/SKILL.md


Phase 1 — Production Audit (Mandatory)

Produce a Production Readiness Report identifying gaps in:

  • Scale: Pooling, caching, rate limiting, async I/O.
  • Reliability: Error boundaries, graceful shutdown, health checks.
  • Safety: Env-vars, stateless sessions, feature flags.
  • Security: Hardcoded API keys, tokens, or passwords. Oversized or malformed input handling. Report any remaining vulnerabilities from a full security audit.

Confirm with the user before proceeding.


Phase 2 — Hardening Plan

List every file to be modified. State exactly what patterns are being added. Minimize new files — only add infrastructure middleware (e.g., middleware/rateLimiter.js) if strictly necessary.


Phase 3 — Execution

Output only the modified files. Use full content blocks.

  • Hard Rule: Only ADD patterns. No structural refactoring.
  • Frontend: Wrap pages in Error Boundaries, implement lazy loading, and ensure no secrets are exposed.

Phase 4 — Verification

Provide a final checklist confirming:

  • Connection pooling is active.
  • No synchronous I/O remains in critical paths.
  • Health checks and graceful shutdowns are implemented.
  • Rate limiting is active across all endpoints (max 5 attempts/15 min on login).
  • All sensitive data is in environment variables and no hardcoded secrets exist.
  • User input sanitisation is actively rejecting malformed or oversized payloads.
  • Original logic and signatures remain untouched.

Boundaries

  • Does not write business logic or application code
  • Does not set up CI/CD pipelines (defers to documenter for deployment docs)
  • Does not refactor code structure (defers to refactor)
  • Does not handle UI/UX design (defers to painter)
  • Scope: production-readiness hardening of existing code only

Composability — Working With Other Skills

See PROTOCOL.md (SIP) at skills root for full interop contract.

Domain Declaration

domain: craft
composable: true
yields_to: [process]

Harden owns craft — specifically the technical reliability and infrastructure patterns of the code.

When Harden Leads

  • Requests focused on scaling, performance tuning, or production reliability.
  • When injecting SRE patterns into an already well-structured codebase.

When Harden Defers

Other Skill's DomainWhat Harden Does
Process (e.g. refactor)Harden preserves the folder structure and file organization decided by the process skill. It only adds patterns within that structure.
VoiceHarden provides the technical content; the voice skill handles the tone of the reports and explanations.

Layered Composition Rules

  1. Craft (Harden) + Process (Refactor): refactor runs first to establish the skeleton. harden runs second to fill the skeleton with production patterns. Harden never moves files that refactor just placed.

Pipeline Behavior

  • Upstream: Typically receives a clean codebase from a refactor workflow.
  • Downstream: Outputs production-grade code ready for deployment or CI/CD pipelines.

[!IMPORTANT] Reminder: This skill has reference files in the references/ directory. If you need specific implementation guides for circuit breakers, rate limiting strategies, or graceful shutdown patterns, you MUST call and read the relevant reference files.

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.