guardrail-patterns
OfficialSafely build opencode-swarm guardrail patterns
System Documentation
What problem does it solve?
Modifying the checkDestructiveCommand() function in opencode-swarm's guardrails.ts file carries high risk of introducing security bypasses that allow destructive shell commands to target the .swarm directory, or breaking existing guardrail functionality. This skill eliminates that risk by providing complete, vetted patterns, known bypass documentation, and strict testing requirements to ensure all modifications are secure and compliant.
Core Features & Use Cases
- Vetted Guardrail Patterns: Provides three proven regex pattern structures (simple inline, multi-condition, argument extraction) for implementing new guardrail blocks, with examples for cross-platform command coverage (POSIX, Windows cmd, PowerShell).
- Bypass Surface Documentation: Lists all known evasion vectors (e.g., backslash-prefixed commands, quote splicing, shell wrapper variations) that require adversarial testing to prevent security gaps.
- Anti-Pattern Reference: Documents common regex mistakes that lead to false negatives or false positives, with corrected code examples to avoid recurring bugs.
- Test Convention Guide: Defines required test categories, infrastructure patterns, and execution rules (bun:test only, no hardcoded paths) to ensure all guardrail changes are fully validated.
- Use Case: For example, if you need to add a guardrail to block the tar --remove-files command from targeting .swarm/ directories, this skill provides the exact pattern structure, platform variant requirements, and test cases needed to implement it securely without introducing bypasses.
Quick Start
Load this skill before making any changes to src/hooks/guardrails.ts or guardrail test files to ensure your modifications follow established security patterns and pass all required validation checks.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: guardrail-patterns Download link: https://github.com/ZaxbyHub/opencode-swarm/archive/main.zip#guardrail-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 536,000+ vetted skills library on demand.