defender
Blue-team release-gate analysis for smart contract deployment and upgrade readiness. Classifies repositories, checks…
Token-efficient smart contract security auditing via Behavioral State Analysis (BSA). Scopes analysis to contract type, runs only relevant threat engines, and uses tiered output depth. Use for auditing smart contracts, security reviews, or DeFi threat modeling.
$ npx -y skills add quillai-network/quillshield_skills --skill behavioral-state-analysis --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/behavioral-state-analysisContext preview
The summary Claude sees to decide when to auto-load this skill.
Token-efficient smart contract security auditing via Behavioral State Analysis (BSA). Scopes analysis to contract type, runs only relevant threat engines, and uses tiered output depth. Use for auditing smart contracts, security reviews, or DeFi threat modeling.
name: behavioral-state-analysis description: Token-efficient smart contract security auditing via Behavioral State Analysis (BSA). Scopes analysis to contract type, runs only relevant threat engines, and uses tiered output depth. Use for auditing smart contracts, security reviews, or DeFi threat modeling.
Audit smart contracts by extracting behavioral intent, then systematically breaking it across security dimensions.
**Follow these strictly to avoid context exhaustion:**
1. **Be terse.** Use bullet points and tables, not prose. No filler sentences. 2. **Smart scope first.** Classify the contract type in Phase 1, then run ONLY relevant engines in Phase 2 (see engine selection matrix below). 3. **Tiered output depth:**
4. **No redundant analysis.** If a dimension has no attack surface (e.g., no value flows = skip ETE), say "N/A" and move on. 5. **Cap Phase 1 output** to ≤30 lines per contract. List invariants and states, skip verbose specification documents. 6. **PoC generation** only for Critical and High severity findings. For others, describe the exploit path in ≤3 steps. 7. **Combine phases in output** — don't repeat findings across phases. Each finding appears once with all metadata inline.
Extract intent from code and docs. Output per contract:
Contract: <Name> Type: <DeFi/Token/Governance/NFT/Utility/Proxy> States: [list] Key Invariants (≤5): - <invariant> Privileged Roles: [list] Value Entry/Exit Points: [list or "none"]
**Then select engines:**
| Contract Type | Run ETE | Run ACTE | Run SITE | |--------------|---------|----------|----------| | DeFi (DEX/lending/vault/staking) | Yes | Yes | Yes | | Token (ERC20/721/1155) | Yes | Lite | Lite | | Governance/DAO | Lite | Yes | Yes | | NFT marketplace | Yes | Yes | Lite | | Utility/Library | No | Lite | Lite | | Proxy/Upgradeable | No | Yes | Yes |
**Lite** = check only the top-priority item for that engine (see below).
Run only the engines selected above. For each engine, analyze in this priority order — stop if contract surface is exhausted:
**Economic Threat Engine (ETE):** 1. Value flow tracing — where can value enter/leave? Any sinks or circular flows? 2. Economic invariant verification — does `deposits == withdrawals + balance` hold? 3. Incentive analysis — any rational actor exploits (MEV, sandwich, griefing)?
**Access Control Threat Engine (ACTE):** 1. Unprotected privileged functions — any admin/owner actions callable by anyone? 2. Role escalation paths — can `User → [actions] → Admin`? 3. msg.sender vs tx.origin confusion; signature replay
**State Integrity Threat Engine (SITE):** 1. Non-atomic state updates — partial updates before external calls? 2. Sequence vulnerabilities — initialization bypass, unexpected call ordering? 3. Cross-contract stale data or reentrancy vectors
**Lite mode** = run only item #1 from that engine's list.
For each hypothesis from Phase 2:
Score: `Confidence = (Evidence × Feasibility × Impact) / FP_Rate`
| Factor | 1.0 | 0.7 | 0.4 | 0.1 | |--------|-----|-----|-----|-----| | Evidence | Concrete path, no deps | Specific state needed | Pattern-based | Heuristic | | Feasibility | PoC confirmed | Achievable state | External conditions | Infeasible |
Impact: 5=total loss, 4=partial loss, 3=griefing, 2=info leak, 1=best practice FP_Rate: 0.05 (known pattern) → 0.15 (moderate) → 0.40 (weak) → 0.60 (heuristic)
**Prioritization:** Report findings ≥10% confidence. Never suppress Impact ≥4.
### [F-N] Title Severity: Critical|High|Medium|Low | Confidence: X% Location: contract.sol#L10-L25, functionName() Root Cause: <1-2 sentences> Exploit: <numbered steps, ≤5> Impact: <1 sentence with quantified risk> Fix: <code diff or 1-2 sentence recommendation> PoC: <only for Critical/High — minimal test code>
AI agent skills for advanced smart contract security auditing. These skills teach AI agents (Claude, Cursor) the QuillShield methodology for detecting vulnerabilities that traditional static analysis tools miss.
Blue-team release-gate analysis for smart contract deployment and upgrade readiness. Classifies repositories, checks…
Detects Denial of Service and griefing vulnerabilities in smart contracts. Covers unbounded loop DoS, block gas limit exhaustion,…
Detects unsafe external call patterns and token integration vulnerabilities in smart contracts. Covers unchecked…
Detects input validation failures and arithmetic vulnerabilities in smart contracts. Covers missing zero-address and zero-amount…
Detects price oracle manipulation and flash loan attack vectors in DeFi smart contracts. Classifies oracle trust models…
Detects vulnerabilities in upgradeable proxy smart contracts including storage layout collisions, uninitialized implementations,…