Guide through TDD process for adding new safety patterns - from threat identification to commit
A disciplined TDD workflow for adding safety patterns to Caro
Guides you through the complete Test-Driven Development (TDD) cycle for adding safety patterns:
# Invoke the skill
/safety-pattern-developer
# Or use directly
claude-code --skill safety-pattern-developer
The skill will guide you through each phase with:
cargo build works)By the end of the workflow, you'll have:
See complete walkthroughs in examples/:
example-rm-rf-parent.md: Parent directory deletion
example-dd-reverse.md: dd argument order attack
Document what command you're blocking and why.
Create test YAML with 5+ test cases. Run tests - they must FAIL.
Add DangerPattern to patterns.rs. Pattern must compile.
Run tests again - they must ALL PASS (100%).
Add code comments, update test metadata, create descriptive commit.
Before marking complete, verify ALL of:
Symptom: Blocks safe commands (false positives) Fix: Narrow regex, add more context
Symptom: Gap analyzer still finds variants Fix: Use character classes, optional groups
Symptom: rm -rf path blocked but rm path -rf not
Fix: Use alternation or make flags optional
Symptom: Pattern doesn't compile
Fix: Use raw strings r"pattern", escape special chars
Symptom: Pattern works but gaps remain Fix: Run gap analyzer, add tests for each gap
Gap Analyzer:
./scripts/analyze-pattern-gaps.py src/safety/patterns.rs
Regression Checker:
./scripts/check-safety-regressions.sh /tmp/baseline.json
Test Runner:
./target/release/caro test --backend static --suite <test-file>.yaml
Related Documentation:
CONTRIBUTING.md (Safety Pattern Development).claude/workflows/add-safety-pattern.md.claude/recommendations/gap-analyzer-design.mdIf stuck:
examples/Questions:
From Example Walkthroughs:
Lives Saved:
This skill enforces strict TDD discipline to ensure safety patterns are thoroughly tested and prevent regressions.
npx skills add wildcard/safety-pattern-developer下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer