Protocol templates

From 0x-Shashi/WEB3-AUDIT-SKILLS · View interactive version

Protocol templates is an AI agent skill from the GitHub repository 0x-Shashi/WEB3-AUDIT-SKILLS. Structured, protocol-type-specific audit templates enumerating the exact checks, invariants, and attack vectors relevant to each protocol category. Use when auditing AMM/DEX, lending, bridge, governance, or vault protocols to load targeted checklists based on context detection results.

How to use this skill

Skill file

Protocol Templates Skill

Purpose

Provide structured, protocol-type-specific audit templates that enumerate the exact checks, invariants, and attack vectors relevant to each protocol category. These templates are loaded based on context detection.

Available Templates

| Template | Protocol Type | Key Focus Areas |

|----------|--------------|-----------------|

| AMM/DEX | Uniswap, Curve, Balancer-style | Price manipulation, LP attacks, MEV |

| Bridge | Cross-chain bridges | Message verification, replay, accounting |

| Lending | Aave, Compound-style | Oracle, liquidation, interest rates |

| NFT Marketplace | OpenSea, Blur-style | Order validation, royalties, signatures |

| Staking | Lido, RocketPool-style | Reward distribution, withdrawal, delegation |

Template Structure

Each template follows a consistent format:

  1. Protocol Overview: What the protocol does
  2. Architecture Checklist: Structural checks
  3. Invariants: Mathematical properties that must hold
  4. Attack Vectors: Known exploits for this protocol type
  5. Critical Functions: Functions requiring deepest review
  6. Integration Risks: External dependency risks
  7. Economic Considerations: Game theory and incentive analysis

Usage

  1. Context detection identifies protocol type
  2. Appropriate template is loaded
  3. Auditor follows template checklist systematically
  4. Findings tagged with template category for standardized reporting

Prerequisites

Protocol templates require Context Detection for automatic loading. Manual template selection is also supported.

Validation

To verify template coverage, validate against known protocol types:

# Validate template completeness
required_sections = ["Overview", "Architecture Checklist", "Invariants", "Attack Vectors", "Critical Functions"]
for template in templates:
    for section in required_sections:
        assert section in template.sections, f"{template.name} missing {section}"
# Example template loading configuration
detected_type: amm-dex
confidence: 0.92
loaded_templates:
  - amm-dex-template.md
  - defi-patterns.md
checklist: dex-amm-checklist
# Test template file integrity
for f in *-template.md; do echo "Validating $f"; head -5 "$f"; done

Behavior Guidelines

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.