defense-in-depth
Defense in Depth Skill
- License 许可
- MIT
- 所属仓库
- agisota/old-one
- 最近更新
- 2026-07-04
- Stars
- ★ 3
- Forks
- 1
01 前言 Front Matter
- name
- defense-in-depth
- triggers
- [ "defense in depth" ]
- description
- Defense in Depth Skill
03 SKILL.md 正文
Technique: Defense in Depth (Swiss Cheese Model)
Concept: After fixing the root cause, you must add "Armor" to the system to catch this specific class of error in the future.
The Three Layers of Defense
Apply at least two of these layers for every critical bug.
Layer 1: The API Boundary (The "Bouncer")
Stop bad data from entering your house.
- Technique: Schema Validation (Zod, Joi, Pydantic).
- Action: If
pricemust be positive, enforceprice > 0at the JSON parsing layer. - Result: The system rejects the request with
400 Bad Requestinstantly. No internal logic runs.
Layer 2: The Service Boundary (The "Contract")
Stop bad data from moving between rooms.
- Technique: Domain Types / Value Objects.
- Action: Don't pass
string email. Pass aEmailAddressclass that throws an error in its constructor if the format is invalid. - Result: You cannot instantiate an invalid object deep in the business logic.
Layer 3: The Database Constraint (The "Vault")
Stop bad data from being written to history.
- Technique: SQL Constraints / Foreign Keys.
- Action: Add
NOT NULLconstraints. AddCHECK (price >= 0). - Result: Even if code fails, the database refuses to accept the corruption.
The Checklist
When closing a bug, ask:
- [ ] Did I fix the root cause?
- [ ] Defense: Did I add a validation check so this inputs fails early next time?
- [ ] Defense: Did I verify the database prevents this state?
Example:
- Bug: User verified with empty email.
- Fix: Updated regex in signup logic.
- Defense 1: Added
class EmailAddress { ... }which validates on creation. - Defense 2: Added
CHECK (length(email) > 5)to Postgres migration.
04 同仓库更多 Skills
zoom-out
Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.
zeroize-audit
Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C/C++/Rust code handling secrets, keys, passwords, or other sensitive data.
yeet
Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).
yara-rule-authoring
Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.
x-twitter-growth
X/Twitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X/Twitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.
x-api
X/Twitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.