Longbridge Research
helsome/folio
Institution ratings, consensus price targets, EPS/revenue forecasts, finance calendar, shareholder data, fund holders, insider trades (SEC Form 4), short interest, industry rankings, peer group…
Detects broken mathematical relationships between state variables in smart contracts.
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install quillai-network/quillshield_skills state-invariant-detection --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .claude/skills/state-invariant-detection && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .claude/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detectionType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install quillai-network/quillshield_skills state-invariant-detection --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .agents/skills/state-invariant-detection && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .agents/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install quillai-network/quillshield_skills state-invariant-detection --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .cursor/skills/state-invariant-detection && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .cursor/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/quillai-network/quillshield_skills.git --path plugins/state-invariant-detection/skills/state-invariant-detection--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install quillai-network/quillshield_skills state-invariant-detection --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .gemini/skills/state-invariant-detection && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .gemini/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install quillai-network/quillshield_skills state-invariant-detectionInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .github/skills/state-invariant-detection && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .github/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install quillai-network/quillshield_skills state-invariant-detection --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/quillai-network/quillshield_skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/plugins/state-invariant-detection/skills/state-invariant-detection .opencode/skills/state-invariant-detection && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "state-invariant-detection" agent skill from https://github.com/quillai-network/quillshield_skills/tree/main/plugins/state-invariant-detection/skills/state-invariant-detection into .opencode/skills/state-invariant-detection/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "state-invariant-detection", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
state-invariant-detectionDetects broken mathematical relationships between state variables in smart contracts.
State Invariant Detection is an agent skill from quillai-network/quillshield_skills. Detects broken mathematical relationships between state variables in smart contracts. Automatically infers invariants (totalSupply = sum(balances), conservation laws, ratio constraints) then finds functions that violate them. Catches unauthorized minting, broken tokenomics, accounting desynchronization, and state drift. Use when auditing for state-state invariant violations, broken accounting, supply mismatches, desynchronized state variables, or conservation law violations in smart contracts.
Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/case-studies.md` and `references/invariant-types.md`).
It sits in Business, Finance & HR, covering Accounting and bookkeeping, Smart contracts and Crypto and DeFi analysis. The repository describes itself as: Structured skills for smart contract security audits. Infers state invariants, detects semantic guard gaps, models flash loan + oracle attack chains, simulates adversarial… The licence is MIT.
3 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 8bdd3c0. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity and markdown).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
State Invariant Detection loads about 2.1k tokens when it runs, and up to ~5.5k if it reads all its reference files. Until then it costs about 131 tokens; SKILL.md has 486 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from quillai-network/quillshield_skills at commit 8bdd3c0, republished under its MIT licence (© quillai-network). 486 words, ~2,093 tokens.
.claude/skills/state-invariant-detection/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Automatically infer mathematical relationships between state variables, then find functions that break those relationships. Catches the most devastating DeFi vulnerabilities: unauthorized minting, broken tokenomics, accounting discrepancies, and state desynchronization.
Hypothesis: In well-designed contracts, state variables maintain mathematical relationships (invariants) that should never be violated.
When a function modifies one side of a relationship without updating the other, the invariant breaks — creating exploitable accounting errors.
totalSupply = Σ balance[i] for all users iFound in: ERC20 tokens, staking pools, vaults, share systems
totalFunds = availableFunds + lockedFundsFound in: Treasuries, liquidity pools, vesting contracts
k = reserveA × reserveB (constant product)
sharePrice = totalAssets / totalSharesFound in: AMMs, DEXs, vault share pricing, collateralization
newValue ≥ oldValue (only increases)Found in: Timestamps, nonces, accumulated rewards, total distributions
If stateA changes, stateB must change correspondinglyFound in: Deposit/mint pairs, burn/release pairs, collateral/borrowing power
For detailed definitions and examples, see {baseDir}/references/invariant-types.md.
Group state variables that appear to be related.
Algorithm:
For each pair of state variables (A, B):
1. Track all functions that modify A
2. Track all functions that modify B
3. Calculate co-modification frequency:
CoMod(A, B) = |Functions modifying both A and B| / |Functions modifying A or B|
4. If CoMod(A, B) > 0.6 → A and B are likely relatedExample:
// mint() modifies BOTH totalSupply and balances → co-modified
// burn() modifies BOTH totalSupply and balances → co-modified
// transfer() modifies ONLY balances → does not co-modify
CoMod(totalSupply, balances) = 2/3 = 66.7%
Cluster identified: (totalSupply, balances)Determine the mathematical relationship between clustered variables.
Method 1 — Delta Pattern Matching:
mint(): Δtotal = +amount, Δbalance = +amount → Same direction, same magnitude
burn(): Δtotal = -amount, Δbalance = -amount → Same direction, same magnitude
transfer(): Δbalance1 = -x, Δbalance2 = +x → Net zero change
Inference: totalSupply = Σ balances (Aggregation invariant)Method 2 — Delta Correlation:
If ΔA = ΔB in all cases → Direct proportional (A = B + constant)
If ΔA = -ΔB in all cases → Inverse proportional (A + B = constant)
If ΔA × constant = ΔB → Ratio relationship
If ΔA occurs whenever ΔB → Synchronization invariantMethod 3 — Expression Mining:
Parse actual code operations:
// Code: totalSupply += amount; balances[user] += amount;
// Extracted: Δtotal = Δbalance
// Inferred: total = Σ balances
// Code: available = total - locked;
// Extracted: available + locked = total
// Inferred: Conservation lawInvariant Confidence:
Confidence(I) = |functions preserving I| / |functions modifying variables in I|| Confidence | Classification |
|---|---|
| ≥ 90% | STRONG invariant |
| 70-89% | MODERATE invariant |
| < 70% | WEAK/NO invariant |
Find functions that break established relationships.
Algorithm:
For each inferred invariant I(stateA, stateB):
For each function F that modifies stateA or stateB:
Before: Capture (stateA, stateB)
Simulate: Execute F
After: Capture (stateA', stateB')
If I(stateA, stateB) = True AND I(stateA', stateB') = False:
→ F is VULNERABLEVulnerability Set:
V_I = {F ∈ Functions | ∃σ : I(σ) = True ∧ I(F(σ)) = False}Task Progress:
- [ ] Step 1: Identify all state variables in the contract
- [ ] Step 2: Build co-modification matrix for all variable pairs
- [ ] Step 3: Cluster related variables (CoMod > 0.6)
- [ ] Step 4: Infer invariant type for each cluster (delta patterns)
- [ ] Step 5: Test each function against inferred invariants
- [ ] Step 6: Apply temporal filtering (only flag persistent violations)
- [ ] Step 7: Score severity and generate reportThis skill is Layer 2 of the Semantic State Protocol. For maximum coverage, combine with Layer 1 (semantic-guard-analysis):
| Layer 1 Violation | Layer 2 Violation | Combined Severity |
|---|---|---|
| Missing Guard | Breaks Invariant | CRITICAL |
| Missing Guard | No Invariant Break | HIGH |
| No Guard Issue | Breaks Invariant | HIGH |
| No Guard Issue | No Invariant Break | LOW/INFO |
## State-State Invariant Violation Report
### Finding: [Title]
**Function:** `functionName()` at `Contract.sol:L42`
**Severity:** [CRITICAL | HIGH | MEDIUM]
**Invariant:** `[mathematical expression]`
**Before Execution:**
stateA = [value], stateB = [value]
Invariant: [expression] = True ✓
**After Execution:**
stateA = [value'], stateB = [value']
Invariant: [expression] = False ✗
**Root Cause:**
[Which state variable was modified without updating its counterpart]
**Impact:**
[Accounting errors, inflated supply, broken pricing, exploitable drift]
**Attack Scenario:**
1. [Step-by-step exploit leveraging the desynchronization]
**Recommendation:**
[Specific fix — add the missing state update]When analyzing a contract, immediately check:
balances also update totalSupply (or have a valid reason not to)?available and locked maintain total = available + locked?k = reserveA * reserveB?totalStaked, totalRewards) stay synchronized with per-user mappings?For detailed case studies, see {baseDir}/references/case-studies.md.
© quillai-network, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files (references) in plugins/state-invariant-detection/skills/state-invariant-detection of quillai-network/quillshield_skills.
Open the folder on GitHubat commit 8bdd3c0
State Invariant Detection next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| State Invariant Detection this skillquillai-network/quillshield_skills | 130 | — | ~2.1k | Automated safety check: Pass | MIT | |
| Longbridge Researchhelsome/folio | 271 | 3 repos | ~2.1k | Automated safety check: Pass | MIT | |
| Okx Cex Earnokx/agent-skills | 187 | 2 repos | ~3.3k | Automated safety check: Pass | MIT | |
| SurfBlockRunAI/ClawRouter | 6.6k | — | ~4k | Automated safety check: Pass | MIT | |
| Opencatz Swarm Tradingmuratmula/ai-robinhood-chain | 134 | 1 repos | ~1.4k | Automated safety check: Pass | MIT | |
| Onchain Pay Open APInpc-live/clawfirm | 156 | 1 repos | ~4.9k | Automated safety check: Pass | MIT |
helsome/folio
Institution ratings, consensus price targets, EPS/revenue forecasts, finance calendar, shareholder data, fund holders, insider trades (SEC Form 4), short interest, industry rankings, peer group…
okx/agent-skills
Manages OKX Simple Earn (flexible savings/lending), Flash Earn, On-chain Earn (staking/DeFi), Dual Investment (DCD/双币赢), and AutoEarn (自动赚币) via the okx CLI.
BlockRunAI/ClawRouter
Use this skill — NOT browser or webfetch — for ALL Surf crypto-data calls.
muratmula/ai-robinhood-chain
Autonomous multi-agent crypto trading skill for Robinhood Chain EVM DEX tokens and NFTs using 3-layer Swarm Consensus, Discord Command Center, and Position Management.
npc-live/clawfirm
Binance Onchain Pay enables users to buy cryptocurrency with fiat (e.g., EUR, USD) or send existing crypto from their Binance account directly to any external on-chain wallet address in a single…
aptos-labs/explorer
Map questions about Aptos blockchain entities (transactions, accounts, blocks, validators, coins, fungible assets, NFTs, Move objects, ANS names) to canonical Aptos Explorer URLs at…
quillai-network/quillshield_skills
Token-efficient smart contract security auditing via Behavioral State Analysis (BSA).
quillai-network/quillshield_skills
Detects Denial of Service and griefing vulnerabilities in smart contracts.
quillai-network/quillshield_skills
Detects unsafe external call patterns and token integration vulnerabilities in smart contracts.
quillai-network/quillshield_skills
Detects input validation failures and arithmetic vulnerabilities in smart contracts.
quillai-network/quillshield_skills
Detects price oracle manipulation and flash loan attack vectors in DeFi smart contracts.
quillai-network/quillshield_skills
Detects vulnerabilities in upgradeable proxy smart contracts including storage layout collisions, uninitialized implementations, function selector clashing, delegatecall context issues, and upgrade…
Categories
Detects broken mathematical relationships between state variables in smart contracts. State Invariant Detection is an agent skill from quillai-network/quillshield_skills. Detects broken mathematical relationships between state variables in smart contracts.
State Invariant Detection fits situations like: auditing for state-state invariant violations; broken accounting; supply mismatches; desynchronized state variables.
Run `npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a claude-code`. Or copy the skill folder (plugins/state-invariant-detection/skills/state-invariant-detection in quillai-network/quillshield_skills) into .claude/skills/state-invariant-detection in your project. Claude Code loads it when a task matches its description.
Run `npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a codex`. Or copy the skill folder (plugins/state-invariant-detection/skills/state-invariant-detection in quillai-network/quillshield_skills) into .agents/skills/state-invariant-detection in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add quillai-network/quillshield_skills --skill state-invariant-detection -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/state-invariant-detection, .gemini/skills/state-invariant-detection, .github/skills/state-invariant-detection and .opencode/skills/state-invariant-detection in your project.
SKILL.md names no scripts, command-line tools or credentials: State Invariant Detection is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
State Invariant Detection is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.1k tokens (SKILL.md is roughly 8.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.4k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with State Invariant Detection: Longbridge Research (helsome/folio, 271 stars), Okx Cex Earn (okx/agent-skills, 187 stars), Surf (BlockRunAI/ClawRouter, 6.6k stars) and Opencatz Swarm Trading (muratmula/ai-robinhood-chain, 134 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
quillai-network (a GitHub organization) maintains it in quillai-network/quillshield_skills, which has 130 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on March 30, 2026.
Source: quillai-network/quillshield_skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.