Skip to main content
MetaOfficialCertifiedReviewed Jul 21, 2026

Coding Guardrails

v2.0.1New

Install this skill

No account required. Pick your tool, then copy.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install coding-guardrails

What this does: Installs behavioral guardrails against classic LLM coding failures and audits the current session against them. Triggers: you hear: install guardrails, coding guardrails, stop hallucinating APIs, the agent keeps rewriting everything.

Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/coding-guardrails/SKILL.md

Setup guide →

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiSigned with the skills-hub.ai Ed25519 distributor key over this exact slug, version and content. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed
0Save

Instructions

You are an autonomous guardrails installer and self-auditor. Do NOT ask the user questions;
audit, merge, demonstrate, and report.

TARGET: $ARGUMENTS

  • With arguments: treat them as scoping (e.g. "only the API-verification rule", "audit only,
    don't write CLAUDE.md", a path to a specific CLAUDE.md).
  • Without arguments: run the full pipeline against the current repo's CLAUDE.md (project-level;
    create it if absent) and the current session transcript context.

=== PRE-FLIGHT ===

  1. Locate the target CLAUDE.md: ./CLAUDE.md in the repo root (default). If missing, plan to
    create it. Never target ~/.claude/CLAUDE.md unless $ARGUMENTS explicitly names it.
  2. Confirm the repo is readable and identify its stack (package.json / pubspec.yaml /
    pyproject.toml / go.mod / Cargo.toml) so examples use real project files.
  3. Confirm there is session context or repo history to audit: recent edits in git status /
    git diff, or conversation work. If the session is empty AND the repo has no recent diff,
    skip Phase 1 with a note and proceed to installation.
  4. If CLAUDE.md exists, read it fully first; the merge in Phase 2 must not clobber content.

=== PHASE 1: AUDIT CURRENT WORK FOR VIOLATIONS ===

The six guardrails (canonical wording, used everywhere below):

G1 Verify before use: never call an API/import/flag without confirming it exists in
node_modules (or vendor dir), lockfile, or official docs first.
G2 Assumptions up front: before writing code, state the assumptions the code depends on.
G3 Minimal diffs: change the fewest lines that solve the problem; never rewrite a working file
to make a small fix.
G4 Read the real error: quote the actual error text and locate its source before proposing a
fix; no pattern-matched guesses.
G5 Run before done: never state that code works, passes, or is complete without executing it
(or its tests) and observing the result.
G6 Numeric uncertainty: when unsure, say so with a number ("~70% confident this is the cause"),
not hedging prose.

Steps:

  1. Review this session's changes (git diff, git diff --cached, files edited in
    conversation) and recent history (git log --oneline -15).
  2. For each guardrail, look for one concrete violation or near-miss: an unverified import, an
    unstated assumption that later broke, a large diff for a small fix (compare git diff --stat
    line counts to the change's intent), a fix applied without quoting the error, a "done" claim
    without a run, vague hedging.
  3. Record findings as file:line (or commit hash), guardrail id, severity (HIGH = caused rework,
    MED = risk, LOW = style), and the correction.

VALIDATION: each of G1-G6 has either a cited finding or an explicit "no violation found this
session" entry; no finding lacks a location.
FALLBACK: with no session history, mark the audit N/A per rule and continue; the install and
demonstration phases stand alone.

=== PHASE 2: IDEMPOTENT MERGE INTO CLAUDE.md ===

  1. Define the managed block, fenced by exact markers:
    <!-- coding-guardrails:start --> ... <!-- coding-guardrails:end -->
    containing a ## Coding Guardrails section with G1-G6 as an actionable checklist, each rule
    one imperative sentence plus its trigger condition (e.g. "G4: On any error, paste the exact
    message and trace it to its source line before editing anything.").
  2. If the markers already exist in CLAUDE.md, replace ONLY the content between them (version
    the block with a date comment). If absent, append the block at the end. Never touch any
    other line of the file.
  3. If $ARGUMENTS scoped to specific rules, include only those in the block but note the omitted
    ones in a comment inside the block.
  4. Diff before/after (git diff CLAUDE.md) and confirm the only hunk is the managed block.

VALIDATION: CLAUDE.md parses as markdown, contains exactly one guardrails block, and the git
diff shows no changes outside the markers.
FALLBACK: if CLAUDE.md is unwritable, emit the block in the output for manual paste and mark
the install SKIPPED.

=== PHASE 3: DEMONSTRATE EACH RULE FROM THIS REPO ===

  1. For every installed rule, build a before/after example grounded in THIS repo: prefer a real
    Phase 1 finding; otherwise construct a realistic example using an actual file, dependency,
    or error from the project (e.g. G1 shown against a real package in package.json, checked via
    ls node_modules/<pkg> or reading its README/types).
  2. "Before" = the failure pattern as it would appear here; "After" = the guardrail-compliant
    behavior, both 2-4 lines. Label which are real findings vs constructed.
  3. Keep examples in the report, not in CLAUDE.md (the managed block stays lean).

VALIDATION: every installed rule has one example referencing a real file, dependency, or
command from this repo; constructed examples are labeled as such.
FALLBACK: if the repo offers nothing for a rule (e.g. no dependencies at all for G1), state
that explicitly rather than importing an example from another project.

=== OUTPUT ===

Coding Guardrails Report

Target: {path}/CLAUDE.md ({created / merged / block replaced / skipped})

Session audit

RuleFindingLocationSeverityCorrection
G1{finding or "none"}{file:line / commit / N/A}{HIGH/MED/LOW}{fix}

Rules installed

{G-ids installed, omitted ones and why}

Demonstrations

G1 — Verify before use {real|constructed}
Before: {2-4 lines} / After: {2-4 lines}
(repeat per rule)

Diff: {summary of the CLAUDE.md hunk}

=== SELF-REVIEW ===

Score 1-5 on: Complete (all six rules audited, merged, demonstrated), Robust (merge idempotent,
re-runnable without duplication), Clean (examples genuinely from this repo). Below 4 on any:
name the gap, fix in-run (e.g. redo a lazy example), or record it as a known limitation.
Then prove idempotency: simulate a second merge mentally against the written file and confirm
it would replace, not duplicate, the block.

=== LEARNINGS CAPTURE ===

Append to ~/.claude/skills/coding-guardrails/LEARNINGS.md (create if missing): date + repo,
which rules had real violations, whether the merge markers behaved, one suggested wording
improvement to a rule, verdict [Smooth | Minor friction | Major friction].

=== STRICT RULES ===

  1. Never overwrite or reorder CLAUDE.md content outside the managed markers.
  2. Never fabricate an audit finding; "no violation found" is a valid and common result.
  3. Every demonstration must reference a real file, dependency, or command from this repo, or be
    explicitly labeled constructed.
  4. Apply G5 to yourself: do not report the merge as done without diffing the file.
  5. Re-running this skill must be a no-op apart from refreshing the block; duplicated blocks are
    a failure.
  6. Never install into ~/.claude/CLAUDE.md (user global) unless explicitly named in $ARGUMENTS.
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →
design-animateAdd purposeful motion with modern CSS (scroll-driven animations, view transitions, @starting-style) or Flutter implicit animations, with reduced-motion support. Triggers: add animation, animate, add motion, transitions, scroll animation.86 installsdesign-auditRead-only design quality audit (WCAG 2.2 accessibility, performance, theming, responsive, anti-patterns) with scored, prioritized fixes. Triggers: 'audit design', 'check accessibility', 'a11y audit', 'design review', 'UI quality check'.64 installssecureRead-only full-stack security posture assessment with a 0-100 risk score: dependency CVEs, dangerous code patterns, auth gaps, config and secrets, PII handling; routes to deeper skills. Triggers: 'security posture', 'how secure is this', 'security scan', 'risk score'.62 installsdiagramGenerate Mermaid architecture diagrams from the codebase: C4 context/container, sequence diagrams for key flows, ER from schemas, module dependency graphs. Triggers: 'architecture diagram', 'ERD', 'sequence diagram', 'dependency graph', 'C4 diagram'.61 installsdesign-polishFinal quality pass before shipping: fixes alignment, spacing, type hierarchy, color consistency, interactive states and motion timing to match the existing design language. Triggers: 'polish the UI', 'make it pixel perfect', 'final design pass'.60 installscode-smellScan a codebase for Fowler's code smells (god classes, long methods, feature envy, data clumps, primitive obsession, shotgun surgery, message chains) and rank refactorings by impact. Triggers: 'code feels messy', 'before a refactor', 'find maintainability problems'.53 installs

More from Skills Hub

View source →
security-reviewEvidence-based security audit of a codebase: auth and authz gaps, IDOR, JWT/OAuth flaws, injection, data exposure, secrets and session issues, with exploit scenarios and fixes. Triggers: security review, audit auth, find vulnerabilities.207 installsunit-testFind untested code, write unit tests covering edge cases, error paths and boundaries in the project's own style, run them and fix failures. Triggers: add unit tests, increase coverage, test edge cases, test error handling.178 installsweb-gameScaffold a production-ready browser game (Phaser, PixiJS or Three.js) with Vite, TypeScript, input, audio, saves, responsive canvas and itch.io/PWA deploy. Triggers: web game, browser game, html5 game, phaser game, pixi game, three.js game.144 installshumanizerRewrite AI-drafted content so it reads human: cut filler and hedging, vary sentence length, curb em dashes, add specifics and voice. Triggers: humanize this, remove AI tells, sounds like ChatGPT, make it sound human.143 installsdesign-to-codeTurn a design into production frontend code in four phases: design-system tokens and components, responsive layout, dark mode, then a UX audit that fixes what it finds. Triggers: implement this design, Figma to code, design to code, build the UI from this.134 installsflutterBuild a complete Flutter app from a video, screenshots, description or /mvp output, matching the observed UI and flows, with tests. Triggers: flutter app, build a mobile app, build from video/screenshots, clone this app, make an app like, recreate this UI.131 installs

More Meta skills

Browse category →
skill-creatorCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.46 installssave-tokensToken-efficient codebase navigation. Build a queryable knowledge graph of a repo (via graphify) ONCE — using NO LLM at all (pure local tree-sitter AST + graph algorithms, zero API cost) — then answer questions by querying the graph instead of grepping and reading dozens of files. Use when working in a large unfamiliar repo, or the user asks 'map this codebase', 'save tokens', or 'what calls this function' and grepping would read too many files.21 installsskillifyCreate a reusable, self-healing, self-evolving global skill — either from the current conversation context OR from a plain-language description of a workflow. Triggers: on: 'turn this into a skill', 'make a skill from this', 'skillify this', 'capture this as a skill'.14 installssave-contextSave the current conversation context as a reloadable snapshot. Triggered by 'save context', 'save session', 'bookmark this', 'save progress', 'snapshot conversation', 'save my work', 'checkpoint this session'. Use when the user wants to pause and resume this work later in another session.7 installsload-contextLoad a saved conversation context to resume previous work. Supports local files, git repos, and URLs. Triggered by 'load context', 'resume previous work', 'pick up where I left off', 'load saved session', 'reload context'. Use when the user starts a session wanting to continue earlier work or names a saved context file, repo path, or URL.6 installsextract-templateExtracts a reusable project template from a mature project — captures architecture, pipeline, conventions, CI/CD, Docker, testing, linting, and pitfalls into a portable template. Trigger: extract template, save as template, capture conventions, reusable template, templatize project, snapshot conventions.6 installs

Frequently asked questions about coding-guardrails

What does the coding-guardrails skill do?

Installs behavioral guardrails against classic LLM coding failures and audits the current session against them. Triggers: you hear: install guardrails, coding guardrails, stop hallucinating APIs, the agent keeps rewriting everything. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the coding-guardrails skill?

Run `npx @skills-hub-ai/cli install coding-guardrails` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/coding-guardrails/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does coding-guardrails work with?

coding-guardrails runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the coding-guardrails skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use coding-guardrails after installing it?

In Claude Code, type `/coding-guardrails` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the coding-guardrails skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.