/behavioral-state-analysis:behavioral-state-analysisfrom behavioral-state-analysis
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.
Ships in behavioral-state-analysis. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Audit smart contracts by extracting behavioral intent, then systematically breaking it across security dimensions.
Follow these strictly to avoid context exhaustion:
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):
deposits == withdrawals + balance hold?Access Control Threat Engine (ACTE):
User → [actions] → Admin?State Integrity Threat Engine (SITE):
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>
A→B→C, test transitive trustblock.timestamp manipulation, expired signatures, replayWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub quillai-network/quillshield_skills --plugin behavioral-state-analysisOther plugins' skills for the same job