These are Trail of Bits house standards on top of Anthropic’s requirements. Following these practices ensures your skills are discoverable, maintainable, and effective.
description: "Detects timing side-channel vulnerabilities in cryptographic code. Use when implementing or reviewing crypto code, encountering division on secrets, or constant-time programming questions."
Why it matters: Specific triggers increase the chances Claude will invoke your skill at the right time.
Don’t paste entire specs. Teach when and how to look things up.
Instead of:
## DWARF Spec[10,000 lines of DWARF specification]
Do this:
## Working with DWARFUse these tools to look up what you need:- `dwarfdump -debug-info` - Inspect debug info entries- `readelf -wi` - Quick overview of debug sections- `pyelftools` - Programmatic access for complex analysis**When to use each:**- Use `dwarfdump` for human-readable output- Use `readelf` for quick checks- Use `pyelftools` when you need to parse or transform data
Include trade-offs, decision criteria, and judgment calls:
## Why Constant-Time Matters**The problem:** Timing variations leak secret information through:- Cache access patterns (fast vs slow memory)- Branch prediction (taken vs not-taken)- Division/modulo (variable-time on most CPUs)**Why not just optimize later:** Compiler optimizations can introduce timing leakseven in code that was originally constant-time. You must verify assembly output.**Trade-off:** Constant-time code is often slower. This is acceptable for cryptowhere correctness matters more than performance.
Say why something is wrong, not just that it’s wrong:
## Anti-Patterns### Early Return on Secret Comparison❌ **Bad:**\`\`\`cif (secret[i] != input[i]) return 0; // Early exit\`\`\`**Why it's wrong:** Exit timing reveals position of first mismatch, leaking partialsecret information. An attacker can measure timing to guess bytes one at a time.✅ **Good:**\`\`\`cdiff |= secret[i] ^ input[i]; // Accumulate differences\`\`\`**Why it's right:** All bytes are always compared. Timing is independent of wheremismatches occur.
Code exploration, documentation, and refactoring can offer options:
## Exploration OptionsChoose the approach that fits your needs:**Option A: Quick Overview**- Scan file structure with `tree`- Read entry points and main modules- Review README and documentation**Option B: Deep Dive**- Map all dependencies- Trace execution paths- Analyze data flows- Document architecture**Option C: Targeted Search**- Define specific questions- Search for relevant code- Focus on specific subsystems
## When to Use**Concrete triggers:**- User implements signature, encryption, or key derivation- Code contains `/` or `%` operators on secret-derived values- User mentions "constant-time", "timing attack", "side-channel"- Reviewing functions named `sign`, `verify`, `encrypt`, `decrypt`**Flowchart:**\`\`\`User writing crypto code? ──yes──> Use this skill │ no │ vUser asking about timing attacks? ──yes──> Use this skill │ no │ vSkip this skill\`\`\`
## When NOT to Use- Non-cryptographic code (business logic, UI, etc.)- Public data processing where timing leaks don't matter- Code that doesn't handle secrets, keys, or authentication tokens- High-level API usage where timing is handled by the library
For audit/security skills, include common shortcuts to reject:
## Rationalizations to RejectThese are common shortcuts that lead to missed findings:- **"This code is internal-only"** - Reject: Internal attackers exist; defense in depth matters- **"Performance matters more"** - Reject: Security is non-negotiable for cryptographic code- **"The compiler will optimize it"** - Reject: Never rely on compiler optimizations for security properties- **"It's too rare to matter"** - Reject: Cryptographic vulnerabilities are often systematic, not edge cases
Accept rare false positives if performance gain is significant:
# Fast but has false positivesif [[ "$command" =~ python.*\.py ]]; then # Analyzefi# vs.# Slow but precisepython -c "import tree_sitter; ..." # Parse AST
Trade-off: Regex might trigger on grep python.py but Claude can rephrase. The speed gain is worth it.
Explain deliberate design choices in PR descriptions:
## Performance ConsiderationsThis hook uses regex instead of AST parsing to minimize latency on every Bash command.**Trade-off:** May have false positives on edge cases like `grep "def " python.txt`,but Claude can rephrase. The ~100ms latency reduction is worth it.**Tested:** No false positives in normal development workflows.