agent-guardrails

Stop AI agents from secretly bypassing your rules. Mechanical enforcement with git hooks, secret detection, deployment verification, and import registries. Born from real production incidents: server crashes, token leaks, code rewrites. Works with Claude Code, Clawdbot, Cursor. Install once, enforce forever.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "agent-guardrails" with this command: npx skills add jzocb/agent-guardrails/jzocb-agent-guardrails-agent-guardrails

Agent Guardrails

Mechanical enforcement for AI agent project standards. Rules in markdown are suggestions. Code hooks are laws.

Quick Start

cd your-project/
bash /path/to/agent-guardrails/scripts/install.sh

This installs the git pre-commit hook, creates a registry template, and copies check scripts into your project.

Enforcement Hierarchy

  1. Code hooks (git pre-commit, pre/post-creation checks) — 100% reliable
  2. Architectural constraints (registries, import enforcement) — 95% reliable
  3. Self-verification loops (agent checks own work) — 80% reliable
  4. Prompt rules (AGENTS.md, system prompts) — 60-70% reliable
  5. Markdown rules — 40-50% reliable, degrades with context length

Tools Provided

Scripts

ScriptWhen to RunWhat It Does
install.shOnce per projectInstalls hooks and scaffolding
pre-create-check.shBefore creating new .py filesLists existing modules/functions to prevent reimplementation
post-create-validate.shAfter creating/editing .py filesDetects duplicates, missing imports, bypass patterns
check-secrets.shBefore commits / on demandScans for hardcoded tokens, keys, passwords
create-deployment-check.shWhen setting up deployment verificationCreates .deployment-check.sh, checklist, and git hook template
install-skill-feedback-loop.shWhen setting up skill update automationCreates detection, auto-commit, and git hook for skill updates

Assets

AssetPurpose
pre-commit-hookReady-to-install git hook blocking bypass patterns and secrets
registry-template.pyTemplate __init__.py for project module registries

References

FileContents
enforcement-research.mdResearch on why code > prompts for enforcement
agents-md-template.mdTemplate AGENTS.md with mechanical enforcement rules
deployment-verification-guide.mdFull guide on preventing deployment gaps
skill-update-feedback.mdMeta-enforcement: automatic skill update feedback loop
SKILL_CN.mdChinese translation of this document

Usage Workflow

Setting up a new project

bash scripts/install.sh /path/to/project

Before creating any new .py file

bash scripts/pre-create-check.sh /path/to/project

Review the output. If existing functions cover your needs, import them.

After creating/editing a .py file

bash scripts/post-create-validate.sh /path/to/new_file.py

Fix any warnings before proceeding.

Setting up deployment verification

bash scripts/create-deployment-check.sh /path/to/project

This creates:

  • .deployment-check.sh - Automated verification script
  • DEPLOYMENT-CHECKLIST.md - Full deployment workflow
  • .git-hooks/pre-commit-deployment - Git hook template

Then customize:

  1. Add tests to .deployment-check.sh for your integration points
  2. Document your flow in DEPLOYMENT-CHECKLIST.md
  3. Install the git hook

See references/deployment-verification-guide.md for full guide.

Adding to AGENTS.md

Copy the template from references/agents-md-template.md and adapt to your project.

中文文档 / Chinese Documentation

See references/SKILL_CN.md for the full Chinese translation of this skill.

Common Agent Failure Modes

1. Reimplementation (Bypass Pattern)

Symptom: Agent creates "quick version" instead of importing validated code. Enforcement: pre-create-check.sh + post-create-validate.sh + git hook

2. Hardcoded Secrets

Symptom: Tokens/keys in code instead of env vars. Enforcement: check-secrets.sh + git hook

3. Deployment Gap

Symptom: Built feature but forgot to wire it into production. Users don't receive benefit. Example: Updated notify.py but cron still calls old version. Enforcement: .deployment-check.sh + git hook

This is the hardest to catch because:

  • Code runs fine when tested manually
  • Agent marks task "done" after writing code
  • Problem only surfaces when user complains

Solution: Mechanical end-to-end verification before allowing "done."

4. Skill Update Gap (META - NEW)

Symptom: Built enforcement improvement in project but forgot to update the skill itself. Example: Created deployment verification for Project A, but other projects don't benefit because skill wasn't updated. Enforcement: install-skill-feedback-loop.sh → automatic detection + semi-automatic commit

This is a meta-failure mode because:

  • It's about enforcement improvements themselves
  • Without fix: improvements stay siloed
  • With fix: knowledge compounds automatically

Solution: Automatic detection of enforcement improvements with task creation and semi-automatic commits.

Key Principle

Don't add more markdown rules. Add mechanical enforcement. If an agent keeps bypassing a standard, don't write a stronger rule — write a hook that blocks it.

Corollary: If an agent keeps forgetting integration, don't remind it — make it mechanically verify before commit.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Security

ai-workflow-red-team-lite

对 AI 自动化流程做轻量红队演练,聚焦误用路径、边界失败和数据泄露风险。;use for red-team, ai, workflow workflows;do not use for 输出可直接滥用的攻击脚本, 帮助破坏系统.

Archived SourceRecently Updated
Automation

daily-report-generator

Automatically generate daily/weekly work reports from git commits, calendar events, and task lists. Use when you need to quickly create professional work reports without manual effort.

Archived SourceRecently Updated
Security

vendor-risk-assessment

Assess third-party vendor risk for AI and SaaS products. Evaluates security posture, data handling, compliance, financial stability, and operational resilience. Use when onboarding new vendors, conducting annual reviews, or building a vendor management program. Generates a scored risk report with mitigation recommendations. Built by AfrexAI.

Archived SourceRecently Updated
Coding

highlevel

Connect your AI assistant to GoHighLevel CRM via the official API v2. Manage contacts, conversations, calendars, pipelines, invoices, payments, workflows, and 30+ endpoint groups through natural language. Includes interactive setup wizard and 100+ pre-built, safe API commands. Python 3.6+ stdlib only — zero external dependencies.

Archived SourceRecently Updated