- Home
- Skills
- Code Quality & Review
- Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli
Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli
Your agent says "done." These guardrails make it prove it — or stop the line.
$12
Fail-Closed Guardrails — Backup, Drift & Auth-Audit Discipli
Example session with this skill installed
I need to update the session handler in auth.py and make sure the changes are synced to the mirror directory. Apply the guardrails.
- Read your context and instructions
- Compiled the fail-closed guardrails
- Generated the document
I have initiated the guardrail protocol. First, I created hash-verified snapshots of the target files. After modifying the session logic, I ran the AST-based auth audit and the mirror drift check. Both passed. To verify, I ran a falsifier test where I manually introduced a default-allow branch, and the auditor correctly flagged it.
Verification Report
| Tool | Target | Result | Hash/Output |
|---|---|---|---|
bak_snapshot.py | auth.py | SUCCESS | sha256:e3b0c442... |
auth_gate_audit.py | auth.py | CLEAN | 0 Findings |
mirror_drift_check.py | /src vs /mirror | SYNCED | Exit 0 |
test_falsifiers.py | FailOpenCheck | PASSED | Detected illegal return True at line 42 |
# auth.py (Partial) - Verified Session Handler
def verify_session(token):
try:
user = session_store.get(token)
if not user:
raise UnauthenticatedError("Invalid token")
return user
except Exception as e:
# Guardrail: Fail-closed on any error
logger.error(f"Auth failure: {e}")
return False
Next steps
- Review the
.bakfiles created in the source directory for archival. - Deploy the verified
auth.pyto the production environment. - Run the full integration suite to ensure session persistence.
fail-closed-guardrails-backup-drift-auth.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Coding agents often fail quietly by applying stale edits, allowing auth checks to fail open, or letting mirrored files drift. This skill installs a strict execution protocol that prevents these silent failures through mandatory snapshots, AST-based audits, and proof-of-work falsifiers.
What it does
- Mandatory snapshoting creates dated, SHA-256 verified backups of every target file before any edit is permitted.
- Fail-closed auditing uses AST-based static analysis to catch swallowed exceptions, bare
except: passblocks, and default-allow branches in auth code. - Mirror drift detection performs byte-for-byte SHA-256 comparisons between canonical and mirrored directory trees to ensure synchronization.
- Verification protocol forces the agent to provide raw command output from a falsifier test before it can claim any task is complete.
- Read-only inspection mandates a fresh state check of all target files to prevent edits based on stale or cached context.
How it works
- Execute
bak_snapshot.pyon all target files to create verified backups and establish a recovery point. - Apply scoped code changes, restricting edits strictly to the files included in the initial snapshot.
- Run
auth_gate_audit.pyon any modified handlers ormirror_drift_check.pyfor multi-tree deployments. - Trigger a falsifier test that intentionally breaks the system to prove the guardrails are active and functional.
Frameworks & tools
This skill utilizes the Python 3 standard library. It leverages the ast module for static analysis, hashlib for SHA-256 verification, and unittest for the falsifier proof suite.
Why this beats prompting it yourself
Standard prompts often allow agents to summarize results or skip "obvious" steps like backups. This skill provides a specialized set of Python scripts that take verification out of the LLM's hands and put it into the filesystem and AST parser. It replaces "trust me" with hash-verified evidence.
Use cases
- Auditing authentication middleware for hidden fail-open vulnerabilities.
- Maintaining strict synchronization between local source code and a mirrored production or staging tree.
- Migrating sensitive session management code where a silent failure would lead to a data breach.
- Refactoring legacy codebases that lack an existing test suite.
Known limitations
Static audits are optimized for Python AST and may not catch logic errors in other languages. Snapshots are stored locally on the filesystem and require write permissions in the target directory.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 11 days ago
- Software
Python
Git
Permissions
What's inside
Frequently Asked Questions
New in Code Quality & Review
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.