agentleFS
meyverickmeyverick/agentic/skills/guardrails/SKILL.md

guardrails

Skill0 starsChanged 14 days agoISCView on GitHub

Cross-cutting hardening for security, container/dependency hygiene, HTML/DOM sinks, and language soundness gotchas across any project or language. Use when writing or modifying code that touches dependencies, Docker/containers, HTML/templates/DOM, auth, secrets, nullability, or lifetimes/resources. Use when reviewing code for security pitfalls. Do NOT use when only reading or exploring without code changes.

  • Reads credentials

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use evaluation, prototype and 2 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.
  • NVIDIASkill

    evaluation

    Evaluates accuracy of quantized or unquantized LLMs using NeMo Evaluator Launcher (NEL). Triggers on "evaluate model", "benchmark accuracy", "run MMLU", "evaluate quantized model", "run nel". Handles deployment, config generation, and evaluation execution. Always load when validating completed runs or reporting evaluation scores, including standalone launching-evals analysis. Not for quantizing models (use ptq), standalone serving (use deployment), or comparing completed baseline-vs-quantized results (use compare-results).

    Also in 3 projects that use this

  • GoogleSkill

    prototype

    Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

    Also in 3 projects that use this

  • GoogleSkill

    grill-me

    A relentless interview to sharpen a plan or design.

    Also in 4 projects that use this

  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 1

    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:

    Only reading or exploring without mutations (use explore mode)

    line 25

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

Guardrails

Cross-cutting hardening that loads first — before domain skills — to prevent the 5 universal failure classes across any stack: HTML/DOM sink hazards & canvas morph collisions, secret leaks, container/dependency bloat, unchecked null vs. explicit absence (Option), and lifetime/resource leaks. Tiny Level 1 inline; Level 2 behind references/guardrails-patterns.md.

Activation Boundary

Triggers on:

  • Writing/modifying code that touches deps (Cargo.toml, package.json, go.mod, pyproject.toml), Docker (Dockerfile, compose), HTML/DOM (hypermedia templates, Maud/Datastar, JSX/Svelte), auth (tokens, cookies, sessions), or secrets
  • Reviewing a change for security, nullability, lifetime/resource safety, or container hardening
  • Handling untrusted HTML sinks (innerHTML, unescaped templates), <canvas> morph protection, or secret-like strings

Does NOT trigger on:

  • Only reading or exploring without mutations (use explore mode)
  • Pure planning (proposal/design/tasks) before code
  • Skills that explicitly state Do NOT use guardrails (none today)

When to Use

Load this skill first before any domain skill when the task touches the high-risk surfaces above. Check the 5 universal guardrails below, then proceed to domain logic. If no high-risk surface is touched, skip guardrails to save tokens.

Contrast

SurfaceBefore (Anti-Pattern)After (Universal Guardrail)Why & Ecosystem Specificities
1. HTML, DOM & Canvas SinksUnescaped HTML injection, unguarded <canvas> morphs, or implicit on* string handlersAuto-escaped templates, data-ignore on stateful canvases, and explicit event bindingsPrevents XSS, preserves WebGL/WASM contexts during Datastar/HTMX DOM morphs, and avoids silent on* stripping in Svelte/JSX
2. Secrets & CredentialsCommitting .env / keys or echoing tokens in CI/deploy logs.gitignore deny-lists, runtime secret injection, and unconditional log redactionAGENTS.md invariant: never commit credentials or .env files across any environment
3. Containers & DependenciesShipping build toolchains, root users, or unpinned dev adapters in productionMulti-stage builds, locked manifests, and minimal non-root runtime images (distroless)Eliminates attack surface and runtime drift (Rust/Go -> distroless:nonroot, TS/Python -> locked slim non-root)
4. Explicit Absence & ParsingUnchecked if (x != null) or raw any payload accessParse at I/O boundaries and encode absence in types (Option<T>, strict null checks)Prevents runtime null-dereference panics (Rust: if let Some(v) = x, TS: strictNullChecks, Go/Py: explicit nil/None guard)
5. Lifetimes & ResourcesEliding borrowed output lifetimes, holding locks across .await, or leaking handlesExplicit 'a lifetime ties, lexical lock scopes, and deterministic Drop/defer/usingGuarantees memory soundness, prevents async deadlocks, and ensures deterministic descriptor cleanup

Anti-examples

1. Do NOT: Leave HTML sinks unescaped, <canvas> unprotected from DOM morphs, or event handlers implicit

<!-- before (wrong) — raw HTML sink + unprotected canvas destroyed on morph + fragile inline handler -->
<div innerHTML={untrustedBio} oncustom={handler}>
  <canvas id="sim-canvas"></canvas>
</div>
// after (right, Rust Maud + Datastar) — auto-escaped text, explicit data-on-click, and data-ignore on canvas container
html! {
    div data-on-click="$open = !$open" {
        p { (untrusted_bio) }
        div id="canvas-stage" data-ignore {
            canvas id="sim-canvas" {}
        }
    }
}

Why: Auto-escaping blocks XSS; data-ignore (or framework key preservation) stops DOM morphing from dropping active WebGL/WebGPU contexts; explicit event syntax (data-on-click, on:click, onClick) prevents silent handler stripping.

2. Do NOT: Commit secrets or echo credentials in logs

# before (wrong)
git add .env && git commit -m "configure api keys"
# after (right) — deny-list secret & artifact paths in .gitignore, inject at runtime
printf '\n.env\n.env.*\n*.pem\n*.key\ncredentials\nnode_modules/\ntarget/\ndist/\nbuild/\n' >> .gitignore

Why: AGENTS.md Inviolable Prohibition — never commit .env or private keys, and mask tokens unconditionally in telemetry.

3. Do NOT: Ship build toolchains or root containers to production

# before (wrong) — single-stage build running as root with full compiler/dev toolchain
FROM rust:latest
COPY . .
RUN cargo build --release
CMD ["./target/release/app"]
# after (right) — multi-stage build into minimal non-root distroless runtime
FROM rust:1-bookworm AS build
WORKDIR /src
COPY . .
RUN cargo build --release --locked

FROM gcr.io/distroless/cc-debian13:nonroot
COPY --from=build /src/target/release/app /app
USER nonroot:nonroot
ENTRYPOINT ["/app"]

Why: Least-privilege execution — production images carry only the locked artifact and run as nonroot.

4. Do NOT: Assume nullable references or unvalidated payloads

// before (wrong) — C/JS mental model in Rust or unchecked nullable access
if user != null { /* ... */ }
// after (right) — explicit type-level absence handling
if let Some(u) = user { /* use u */ }

Why: Absence must be encoded and narrowed explicitly (Option<T> / Result<T, E> in Rust, strictNullChecks in TypeScript, err != nil in Go).

5. Do NOT: Elide borrowed output lifetimes or hold locks across .await

// before (wrong) — ambiguous borrowed return lifetime
fn longest(x: &str, y: &str) -> &str { if x.len() > y.len() { x } else { y } }
// after (right) — explicit lifetime specifier tying output borrow to inputs
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } }

Why: Explicit ownership and lifetime bounds ('a in Rust; defer/using/with for I/O handles in Go/TS/Python) prevent dangling references and resource leaks.

References

  • references/guardrails-patterns.md — Level 2 detail for each universal guardrail across languages (code before/after, failure signal, remediation)
  • ./AGENTS.md Chapter 4 & Chapter 8 — cross-cutting security, boundary validation (FEAR), and unconditional redaction invariants

Gotchas

  • Loads first, but only when a high-risk surface is present — only reading anti-triggers prevent bloat on explore tasks
  • Co-activates cleanly with language-specific skills (such as rust-systems or hypermedia-engine-stacks) without locking the workspace to a single project
  • Single source for cross-cutting pre-flight checks: keep SKILL.md compact and read references/guardrails-patterns.md only when deeper pattern detail is needed

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.