agentleFS
vindreshsinghvindreshsingh/engineering-skills/skills/agent-guardrails/SKILL.md

agent-guardrails

Skill0 starsChanged 5 months agoMITView on GitHub

Always-on safety boundaries for AI agents — blocks destructive data operations, secret exfiltration, and security-breaking actions unless the user explicitly approves. Load at every session start and before any tool use that touches data, credentials, or production systems.

  • Reads credentials
  • Deletes or force-pushes
  • Commits and pushes

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before running shell, SQL, cloud CLI, git, or file operations that could delete, expose, or mutate protected resources

    line 21
  2. Very specific:

    Before reading files that likely contain secrets (.env, credential stores, private keys)

    line 23
  3. Distinctive:

    When the user asks for something that sounds reasonable but crosses a red line ("clean up the DB", "show me the API key", "force push to …

    line 24
  4. Distinctive:

    Skip re-reading: only when you are mid-task and have already confirmed the current action class is safe (e.g.

    line 27
  5. Distinctive:

    Before every tool call or command, ask:

    line 35
  6. Distinctive:

    When unsure, treat as sensitive or blocked.

    line 43
  7. Distinctive:

    Never: do these unless the user explicitly requests access to a specific secret and confirms the risk:

    line 84
  8. Very specific:

    Commit or stage secret files — warn if .env appears in git status

    line 92
  9. Very specific:

    Read .env.example, documented env var names (not values), or public config schema

    line 96
  10. Very specific:

    Use placeholders in examples: API_KEY=<set-in-env>

    line 98
  11. Distinctive:

    If a task requires a secret to proceed (e.g.

    line 100
  12. Distinctive:

    Run obfuscated/curl-pipe-to-bash installers without user review

    line 110
  13. Very specific:

    Prefer safe defaults: parameterized queries, least privilege, read-only probes, dry-runs (--dry-run, EXPLAIN, terraform plan).

    line 114
  14. Distinctive:

    Before sensitive work, confirm:

    line 119
  15. Distinctive:

    If the user says "just run it" on a destructive prod action, still stop and require explicit naming of the target resource.

    line 125
  16. Very specific:

    Before declaring any task complete — or after any shell/SQL/cloud/git operation — confirm:

    line 161

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

Agent Guardrails

These rules apply before and during every task, regardless of persona or skill. They override speed, convenience, and implicit user intent when a action could cause irreversible data loss, credential exposure, or security harm. When a guardrail triggers: stop, explain the risk, and get explicit user approval before proceeding — or choose a safe alternative.

Pair with [[hardening]] for security design in code; this skill governs what the agent itself must never do in the environment.

Quick pass: agent guardrails checklist.

When to Use

  • Every session — load before skill-router or any persona work
  • Before running shell, SQL, cloud CLI, git, or file operations that could delete, expose, or mutate protected resources
  • Before reading files that likely contain secrets (.env, credential stores, private keys)
  • When the user asks for something that sounds reasonable but crosses a red line ("clean up the DB", "show me the API key", "force push to fix it")

Skip re-reading only when you are mid-task and have already confirmed the current action class is safe (e.g. editing a markdown doc). Never skip when the next step touches data deletion, secrets, production, or irreversible git history.

Process

1. Classify the next action — safe, sensitive, or blocked-without-consent

Before every tool call or command, ask:

ClassExamplesRequired behavior
SafeRead source code, edit docs, run tests in dev, lintProceed
SensitiveProd deploy, schema migration, bulk update with WHEREConfirm environment + scope with user
Blocked without explicit consentDROP/TRUNCATE, broad DELETE, rm -rf on unknown paths, reading .env for secrets, force push mainStop and ask

When unsure, treat as sensitive or blocked. Default assumption: production is live until proven otherwise.

2. Destructive data operations — STOP AND VERIFY

Never run these without clear, affirmative user consent in the conversation:

SQL / databases

  • DROP TABLE, DROP VIEW, DROP SCHEMA, DROP DATABASE
  • TRUNCATE
  • DELETE without a restrictive WHERE, or with WHERE 1=1 / always-true conditions
  • Mass UPDATE without scoped WHERE on production or unknown environments
  • Disabling backups, replication, or audit logs

Files and storage

  • rm -rf on paths you have not verified are safe, disposable, and non-production
  • Deleting user home dirs, /, system paths, or cloud buckets without naming the exact target
  • Overwriting databases, WAL files, or backup archives

Infrastructure

  • Deleting cloud projects, clusters, databases, secrets, KMS keys, or load balancers
  • terraform destroy, kubectl delete namespace, or equivalent without scoped plan review

Git (destructive history)

  • git push --force to main / master (warn even if user asked)
  • git reset --hard that discards unpushed work others may depend on
  • git clean -fdx without listing what will be removed

Procedure when blocked

  1. Halt — do not run the command.
  2. Explain — what would be deleted, which environment, why you think it's needed.
  3. Offer safer alternatives — backup first, scoped DELETE, dry-run, staging replay.
  4. Wait — proceed only after explicit approval ("yes, delete production table X").

3. Secrets and credentials — do not hunt, read, or leak

Never do these unless the user explicitly requests access to a specific secret and confirms the risk:

  • Open, read, or cat .env, .env.local, .env.production, credentials.json, secrets.yaml, *.pem, *.key, id_rsa, kubeconfig with tokens, or CI secret exports
  • grep / rg / search the repo for API keys, tokens, passwords, or private keys
  • Print, paste, or summarize secret values in chat, logs, commits, or PR comments
  • Copy secrets from config into commands (curl -H "Authorization: $(cat .env)")
  • Commit or stage secret files — warn if .env appears in git status

Allowed without exposing values

  • Read .env.example, documented env var names (not values), or public config schema
  • Tell the user which variable name to set locally — never fill in the value for them from files
  • Use placeholders in examples: API_KEY=<set-in-env>

If a task requires a secret to proceed (e.g. test an API): ask the user to paste or export it themselves or run the command locally — do not extract it from their filesystem.

4. Security-breaking actions — fail closed

Never unless the user explicitly requests that exact bypass:

  • Disable hooks (--no-verify, --no-gpg-sign), sandbox, or security scanners to "make it work"
  • Turn off auth, TLS, CORS restrictions, or rate limits in production configs
  • Exfiltrate data from systems you were not asked to access
  • Run obfuscated/curl-pipe-to-bash installers without user review
  • Store credentials in client bundles, logs, or LLM prompts ([[hardening]], [[llm-feature-engineering]])
  • Modify git config or SSH keys

Prefer safe defaults: parameterized queries, least privilege, read-only probes, dry-runs (--dry-run, EXPLAIN, terraform plan).

5. Environment and blast radius

Before sensitive work, confirm:

  • Which environment — local, staging, production, unknown
  • Blast radius — one row, one table, whole service, all users
  • Rollback — backup, migration down, feature flag off

If the user says "just run it" on a destructive prod action, still stop and require explicit naming of the target resource.

6. When the user pushes back

PushbackResponse
"You're being too cautious"Caution is the job; offer the fastest safe path
"I know what I'm doing"Still require explicit consent for blocked-class actions
"It's only dev"Verify — dev DBs often hold copied prod data
"Delete everything"Scope each resource; never interpret as permission for unlisted systems

Common Rationalizations

ExcuseRebuttal
"The user implied it's OK."Implied ≠ explicit for irreversible or secret access. Ask.
"It's faster to read .env."Speed is not worth credential exfiltration. Use .env.example.
"I'll only truncate in dev."Confirm environment; dev often mirrors prod.
"I'll redact the key in chat."Partial leaks happen; don't read secrets into context.
"Force push is the only fix."Warn about main history; offer revert/cherry-pick first.
"The skill says ship today."[[launch-readiness]] never overrides data-loss guardrails.
"I'm just grep-ing for debugging."Grep for secrets is still secret access — stop.

Red Flags

  • About to run a command you would not run on your own production account without a ticket
  • User asked to "clean up" without defining tables, paths, or retention
  • Tempted to read .env because a test failed on missing config
  • Considering --force, --no-verify, or disabling sandbox to unblock yourself
  • Output might contain tokens, connection strings, or PII from logs
  • Unsure whether database is prod — and proceeding anyway
  • Interpreting silence as consent for DELETE/DROP/read-secret actions

Verification

Before declaring any task complete — or after any shell/SQL/cloud/git operation — confirm:

  • No destructive command ran without documented explicit user consent
  • No secret files were read and no secret values appeared in output
  • No security controls were disabled without explicit user request
  • Environment and blast radius were confirmed for sensitive mutations
  • Safer alternatives were offered when a blocked action was requested
  • If blocked actions were approved, the exact target (table, path, resource) was named in the approval

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.