Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add arch3rPro/dsh-skills --skill defensive-patternsgit clone --depth 1 https://github.com/arch3rPro/dsh-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/arch3rpro/dsh-skills/defensive-patterns)<a href="https://agentmods.dev/skills/arch3rpro/dsh-skills/defensive-patterns"><img src="https://agentmods.dev/badge/skills/arch3rpro/dsh-skills/defensive-patterns.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00081 | $0.01297 |
| Opus 5 | $0.00041 | $0.00648 |
| Sonnet 5 | $0.00016 | $0.00259 |
| Haiku 4.5 | $0.00008 | $0.00130 |
Grade A, and why
defensive-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 69 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Defensive Patterns
A catalogue of bug-class rules distilled from defects that actually shipped. Each pattern is one class of failure, stated as the rule that prevents its recurrence. Read this before writing lifecycle, concurrency, subprocess, teardown, or error-reporting code — these are the places where "it usually works" hides a reproducible race.
The defining constraint: these rules are about settlement — the honest, complete reporting of an outcome — and ownership — knowing who owns a resource until it is fully gone. Most concurrency bugs are a settlement or ownership violation in disguise.
This is guidance, not a script. Each pattern names a failure mode and the positive rule that avoids it; apply the ones your code touches. Patterns cluster into two groups — reporting and ownership — with one untrusted-IO trio.
Reporting — tell the whole truth about an outcome
Report orthogonal outcomes independently
A result can be several things at once. A process can time out and exit 0 because it trapped the signal; a call can fail and leave valid partial state. Surface each independent fact (timedOut, signal, exitCode) on its own field or branch — never nest one flag's report inside another's branch, or a caller reads a cut-short run as a clean success. When two facts can both be true, the code that reports only one is lying.
Honor public contracts on BOTH sides
When an implementation receives several representations of one outcome, normalize them before returning through the public API. If a provider may signal failure by throwing or by emitting an error token, the public runtime exposes model-request failures as exactly one form; middleware and caller defects remain thrown. Consumers must never guess whether a caught exception came from the provider, a wrapper, or their own assembly. Document the normalized contract where the type is defined, and exercise every source form through the real consumer.
Contain callback exceptions in the dispatcher
What ships with it
1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 6d ago First seen · 69 lines · 81 tokens per session scan A 4b2f33bdd690
defensive-patterns is a skill published in the GitHub repository arch3rPro/dsh-skills (4 stars, last pushed 19d ago), licensed MIT. It adds 81 tokens to every session and 1,297 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
dredge
When something goes wrong during a build — including when the report can't be reproduced at all — diagnose what type of failure it is before deciding how to respond. Targeted fix, hard reset, full rethink, or a reproduction gap — the right response depends on the right diagnosis.
speckit.checker
Static Analysis Aggregator - Run static analysis on the codebase.
python-performance-optimization
Profile and optimize Python code using cProfile, memory profilers, and performance best practices.
logging-patterns
Logging conventions -- level usage, formatting style, structured output.
speckit.debug
Systematic Debugger - Diagnose problems, find individual root causes, and recommend fix plans.
cm-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.