[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79BM9TDESZC9JB5VJS659DY":3,"skill-same:01M79BM9TDESZC9JB5VJS659DY":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":34,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M79BM9TDESZC9JB5VJS659DY","defi-patterns",null,"DeFi-specific vulnerability patterns catalog - reentrancy, flash loans, oracle manipulation, MEV, sandwich attacks. Used during threat modeling.","sahil-kaushik1\u002FAuditing-Workflow","sahil-kaushik1","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F143880923?v=4","01M79BEEK3947RQYD3WC00K9W3","Sahil Kaushik","01M79BEEKVHPFPTNBDB0GFXBHE",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdefi-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: defi-patterns\ndescription: DeFi-specific vulnerability patterns catalog - reentrancy, flash loans, oracle manipulation, MEV, sandwich attacks. Used during threat modeling.\ntrigger: During threat modeling — when the Threat Modeler generates tasks for DeFi protocols.\nagents: [threat-modeler, deep-reasoner, hypothesis-generator]\n---\n\n# DeFi Patterns Skill\n\n> **Trigger**: During threat modeling for DeFi\u002Ffinancial smart contracts.\n> **Purpose**: Catalog of DeFi-specific vulnerability patterns with detection heuristics and task templates.\n\n---\n\n## Pattern Catalog\n\n### 1. Reentrancy Patterns\n\n**Variants**: Same-function, cross-function, cross-contract, read-only reentrancy.\n\n**Detection Heuristics**:\n```bash\n# External calls before state updates\ngrep -rn \"\\.call\\|\\.transfer\\|\\.send\" --include=\"*.sol\" | grep -v \"test\\|mock\"\n# Check if state updates happen AFTER these calls\n```\n\n**Task Template**:\n```markdown\nTarget: {contract}.{function}()\nInvariant: State is consistent before and after external calls\nFailure Predicate: Re-entry allows double-spend or stale-state exploitation\nDrift Anchors: [\"reentrancy\", \"external call\", \"state update\", \"callback\"]\n```\n\n### 2. Flash Loan Attack Patterns\n\n**Variants**: Price manipulation, governance attack, collateral inflation, liquidity drain.\n\n**Detection Heuristics**:\n```bash\n# Spot price usage (manipulable via flash loans)\ngrep -rn \"getReserves\\|balanceOf.*pair\\|slot0\\|observe\" --include=\"*.sol\"\n# Large value operations without flash-loan guards\ngrep -rn \"flashLoan\\|flash\\|onFlashLoan\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nAttacker Capabilities: Can flash-loan up to pool TVL in a single tx\nInvariant: Protocol accounting is correct regardless of transaction-local liquidity\nFailure Predicate: Attacker profits at protocol\u002Fuser expense via same-block borrow+repay\nDrift Anchors: [\"flash loan\", \"price manipulation\", \"same-block\", \"liquidity\"]\n```\n\n### 3. Oracle Manipulation Patterns\n\n**Variants**: Spot price manipulation, TWAP manipulation, stale oracle, oracle failure.\n\n**Detection Heuristics**:\n```bash\n# Oracle usage\ngrep -rn \"latestRoundData\\|latestAnswer\\|getPrice\\|getRate\\|consult\\|observe\" --include=\"*.sol\"\n# Staleness checks\ngrep -rn \"updatedAt\\|timestamp\\|heartbeat\\|sequencerUp\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Oracle price reflects true market value ± acceptable deviation\nFailure Predicate: Stale\u002Fmanipulated oracle causes incorrect liquidation, mispricing, or fund loss\nDrift Anchors: [\"oracle\", \"price feed\", \"staleness\", \"manipulation\"]\n```\n\n### 4. First Depositor \u002F Share Inflation\n\n**Detection Heuristics**:\n```bash\n# Share\u002Fasset conversion\ngrep -rn \"convertToShares\\|convertToAssets\\|previewDeposit\\|previewMint\" --include=\"*.sol\"\n# Division operations in conversion\ngrep -rn \"totalSupply.*==.*0\\|totalAssets.*==.*0\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: shares * pricePerShare == assets ± 1 wei for all depositors\nFailure Predicate: First depositor can inflate share price to steal from subsequent depositors\nDrift Anchors: [\"share inflation\", \"first deposit\", \"rounding\", \"ERC4626\"]\n```\n\n### 5. Sandwich \u002F MEV Patterns\n\n**Detection Heuristics**:\n```bash\n# Slippage parameters\ngrep -rn \"minAmount\\|slippage\\|deadline\\|amountOutMin\" --include=\"*.sol\"\n# Swaps without slippage protection\ngrep -rn \"swap\\|exchange\" --include=\"*.sol\" | grep -v \"slippage\\|minAmount\"\n```\n\n**Task Template**:\n```markdown\nAttacker Capabilities: Can front-run and back-run target tx in same block\nInvariant: User receives fair execution price regardless of block ordering\nFailure Predicate: Attacker extracts value via sandwich (front-run + back-run)\nDrift Anchors: [\"MEV\", \"sandwich\", \"frontrun\", \"slippage\"]\n```\n\n### 6. Liquidation Patterns\n\n**Detection Heuristics**:\n```bash\ngrep -rn \"liquidat\\|healthFactor\\|collateralRatio\\|isUndercollateralized\" --include=\"*.sol\"\ngrep -rn \"badDebt\\|shortfall\\|deficit\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Protocol remains solvent after every liquidation; no bad debt created\nFailure Predicate: Liquidation creates bad debt or leaves protocol underwater\nDrift Anchors: [\"liquidation\", \"collateral\", \"bad debt\", \"solvency\"]\n```\n\n### 7. Accounting Desync Patterns\n\n**Detection Heuristics**:\n```bash\n# Internal vs external balance tracking\ngrep -rn \"totalAssets\\|totalSupply\\|_totalShares\\|internalBalance\" --include=\"*.sol\"\n# Multiple update paths for the same variable\ngrep -rn \"totalAssets\\s*[+\\-=]\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Internal accounting matches actual token balances at all times\nFailure Predicate: Internal tracking diverges from actual balances, enabling theft or DoS\nDrift Anchors: [\"accounting\", \"desync\", \"balance tracking\", \"totalAssets\"]\n```\n\n### 8. Governance \u002F Timelock Bypass\n\n**Detection Heuristics**:\n```bash\ngrep -rn \"propose\\|execute\\|queue\\|cancel\\|votingDelay\\|votingPeriod\\|quorum\" --include=\"*.sol\"\ngrep -rn \"timelock\\|TimelockController\\|delay\" --include=\"*.sol\"\n```\n\n### 9. Precision Loss \u002F Rounding\n\n**Detection Heuristics**:\n```bash\n# Division operations (potential rounding)\ngrep -rn \" \u002F \\| \\\\* \\|mulDiv\\|fullMulDiv\\|muldiv\" --include=\"*.sol\" | grep -v \"test\\|mock\\|\u002F\u002F\"\n# Casting operations\ngrep -rn \"uint128\\|uint96\\|uint64\\|uint32\\|uint16\\|uint8\" --include=\"*.sol\" | grep -v \"event\\|error\"\n```\n\n### 10. Donation Attack \u002F Direct Transfer\n\n**Detection Heuristics**:\n```bash\n# Balance-based accounting (can be inflated via direct transfer)\ngrep -rn \"address(this).balance\\|balanceOf(address(this))\" --include=\"*.sol\"\n```\n\n---\n\n## Cross-Pattern Combinations\n\nThe most dangerous vulnerabilities combine multiple patterns:\n\n| Combination | Example |\n|------------|---------|\n| Flash loan + Oracle manipulation | Borrow → manipulate price → liquidate → repay |\n| Reentrancy + Accounting desync | Re-enter during withdrawal → double-count assets |\n| Sandwich + Precision loss | Frontrun to manipulate rounding direction |\n| Governance + Flash loan | Flash-loan tokens → vote → execute → repay |\n| First deposit + Donation | Donate to inflate share price before others deposit |\n\n---\n\n## Output\n\nWhen this skill is active, the Threat Modeler should:\n1. Check each pattern's detection heuristics against the target codebase\n2. For each match, generate a task using the pattern's task template\n3. Note cross-pattern combinations that apply\n","# DeFi Patterns Skill\n\n> **Trigger**: During threat modeling for DeFi\u002Ffinancial smart contracts.\n> **Purpose**: Catalog of DeFi-specific vulnerability patterns with detection heuristics and task templates.\n\n---\n\n## Pattern Catalog\n\n### 1. Reentrancy Patterns\n\n**Variants**: Same-function, cross-function, cross-contract, read-only reentrancy.\n\n**Detection Heuristics**:\n```bash\n# External calls before state updates\ngrep -rn \"\\.call\\|\\.transfer\\|\\.send\" --include=\"*.sol\" | grep -v \"test\\|mock\"\n# Check if state updates happen AFTER these calls\n```\n\n**Task Template**:\n```markdown\nTarget: {contract}.{function}()\nInvariant: State is consistent before and after external calls\nFailure Predicate: Re-entry allows double-spend or stale-state exploitation\nDrift Anchors: [\"reentrancy\", \"external call\", \"state update\", \"callback\"]\n```\n\n### 2. Flash Loan Attack Patterns\n\n**Variants**: Price manipulation, governance attack, collateral inflation, liquidity drain.\n\n**Detection Heuristics**:\n```bash\n# Spot price usage (manipulable via flash loans)\ngrep -rn \"getReserves\\|balanceOf.*pair\\|slot0\\|observe\" --include=\"*.sol\"\n# Large value operations without flash-loan guards\ngrep -rn \"flashLoan\\|flash\\|onFlashLoan\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nAttacker Capabilities: Can flash-loan up to pool TVL in a single tx\nInvariant: Protocol accounting is correct regardless of transaction-local liquidity\nFailure Predicate: Attacker profits at protocol\u002Fuser expense via same-block borrow+repay\nDrift Anchors: [\"flash loan\", \"price manipulation\", \"same-block\", \"liquidity\"]\n```\n\n### 3. Oracle Manipulation Patterns\n\n**Variants**: Spot price manipulation, TWAP manipulation, stale oracle, oracle failure.\n\n**Detection Heuristics**:\n```bash\n# Oracle usage\ngrep -rn \"latestRoundData\\|latestAnswer\\|getPrice\\|getRate\\|consult\\|observe\" --include=\"*.sol\"\n# Staleness checks\ngrep -rn \"updatedAt\\|timestamp\\|heartbeat\\|sequencerUp\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Oracle price reflects true market value ± acceptable deviation\nFailure Predicate: Stale\u002Fmanipulated oracle causes incorrect liquidation, mispricing, or fund loss\nDrift Anchors: [\"oracle\", \"price feed\", \"staleness\", \"manipulation\"]\n```\n\n### 4. First Depositor \u002F Share Inflation\n\n**Detection Heuristics**:\n```bash\n# Share\u002Fasset conversion\ngrep -rn \"convertToShares\\|convertToAssets\\|previewDeposit\\|previewMint\" --include=\"*.sol\"\n# Division operations in conversion\ngrep -rn \"totalSupply.*==.*0\\|totalAssets.*==.*0\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: shares * pricePerShare == assets ± 1 wei for all depositors\nFailure Predicate: First depositor can inflate share price to steal from subsequent depositors\nDrift Anchors: [\"share inflation\", \"first deposit\", \"rounding\", \"ERC4626\"]\n```\n\n### 5. Sandwich \u002F MEV Patterns\n\n**Detection Heuristics**:\n```bash\n# Slippage parameters\ngrep -rn \"minAmount\\|slippage\\|deadline\\|amountOutMin\" --include=\"*.sol\"\n# Swaps without slippage protection\ngrep -rn \"swap\\|exchange\" --include=\"*.sol\" | grep -v \"slippage\\|minAmount\"\n```\n\n**Task Template**:\n```markdown\nAttacker Capabilities: Can front-run and back-run target tx in same block\nInvariant: User receives fair execution price regardless of block ordering\nFailure Predicate: Attacker extracts value via sandwich (front-run + back-run)\nDrift Anchors: [\"MEV\", \"sandwich\", \"frontrun\", \"slippage\"]\n```\n\n### 6. Liquidation Patterns\n\n**Detection Heuristics**:\n```bash\ngrep -rn \"liquidat\\|healthFactor\\|collateralRatio\\|isUndercollateralized\" --include=\"*.sol\"\ngrep -rn \"badDebt\\|shortfall\\|deficit\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Protocol remains solvent after every liquidation; no bad debt created\nFailure Predicate: Liquidation creates bad debt or leaves protocol underwater\nDrift Anchors: [\"liquidation\", \"collateral\", \"bad debt\", \"solvency\"]\n```\n\n### 7. Accounting Desync Patterns\n\n**Detection Heuristics**:\n```bash\n# Internal vs external balance tracking\ngrep -rn \"totalAssets\\|totalSupply\\|_totalShares\\|internalBalance\" --include=\"*.sol\"\n# Multiple update paths for the same variable\ngrep -rn \"totalAssets\\s*[+\\-=]\" --include=\"*.sol\"\n```\n\n**Task Template**:\n```markdown\nInvariant: Internal accounting matches actual token balances at all times\nFailure Predicate: Internal tracking diverges from actual balances, enabling theft or DoS\nDrift Anchors: [\"accounting\", \"desync\", \"balance tracking\", \"totalAssets\"]\n```\n\n### 8. Governance \u002F Timelock Bypass\n\n**Detection Heuristics**:\n```bash\ngrep -rn \"propose\\|execute\\|queue\\|cancel\\|votingDelay\\|votingPeriod\\|quorum\" --include=\"*.sol\"\ngrep -rn \"timelock\\|TimelockController\\|delay\" --include=\"*.sol\"\n```\n\n### 9. Precision Loss \u002F Rounding\n\n**Detection Heuristics**:\n```bash\n# Division operations (potential rounding)\ngrep -rn \" \u002F \\| \\\\* \\|mulDiv\\|fullMulDiv\\|muldiv\" --include=\"*.sol\" | grep -v \"test\\|mock\\|\u002F\u002F\"\n# Casting operations\ngrep -rn \"uint128\\|uint96\\|uint64\\|uint32\\|uint16\\|uint8\" --include=\"*.sol\" | grep -v \"event\\|error\"\n```\n\n### 10. Donation Attack \u002F Direct Transfer\n\n**Detection Heuristics**:\n```bash\n# Balance-based accounting (can be inflated via direct transfer)\ngrep -rn \"address(this).balance\\|balanceOf(address(this))\" --include=\"*.sol\"\n```\n\n---\n\n## Cross-Pattern Combinations\n\nThe most dangerous vulnerabilities combine multiple patterns:\n\n| Combination | Example |\n|------------|---------|\n| Flash loan + Oracle manipulation | Borrow → manipulate price → liquidate → repay |\n| Reentrancy + Accounting desync | Re-enter during withdrawal → double-count assets |\n| Sandwich + Precision loss | Frontrun to manipulate rounding direction |\n| Governance + Flash loan | Flash-loan tokens → vote → execute → repay |\n| First deposit + Donation | Donate to inflate share price before others deposit |\n\n---\n\n## Output\n\nWhen this skill is active, the Threat Modeler should:\n1. Check each pattern's detection heuristics against the target codebase\n2. For each match, generate a task using the pattern's task template\n3. Note cross-pattern combinations that apply\n",{"name":5,"agents":24,"trigger":28,"description":7},[25,26,27],"threat-modeler","deep-reasoner","hypothesis-generator","During threat modeling — when the Threat Modeler generates tasks for DeFi protocols.","main","39a25d63191d67efe43cdce5b7507069e2307f0f",".claude\u002Fskills\u002Fdefi-patterns","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1","https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1Te4TcrpgcN4j8DsYqVdjPl4QXVbs5XXo\u002Fview?usp=drive_link","Web3 security researcher \u002F developer","2026-10-18 15:17:21",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add sahil-kaushik1\u002FAuditing-Workflow --skill defi-patterns",{"tool":43,"command":44},"bunx","bunx skills add sahil-kaushik1\u002FAuditing-Workflow --skill defi-patterns",{"tool":46,"command":47},"pnpm","pnpm dlx skills add sahil-kaushik1\u002FAuditing-Workflow --skill defi-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdefi-patterns\u002FSKILL.md",true,[],[52,58,64,71,78,85],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M79BSEAG0SS9CC2EN1S51K2X","stripe-patterns","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsync\u002Frendertrust\u002F.claude\u002Fskills\u002Fstripe-patterns\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79BSBAZXQBWCPKYJP38A35B","payment-patterns","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsync\u002Fkeryk-ai\u002F.claude\u002Fskills\u002Fpayment-patterns\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M79BS8PKZXFGBNQBS2GHNXZW","testing-patterns","Testing patterns for Jest and Playwright. Use when writing tests, setting up test fixtures, or validating RLS enforcement. Routes to existing test conventions.","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.gemini\u002Fskills\u002Ftesting-patterns\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M79BS3PR92A4QNEJAFNDKB2G","team-coordination","Agent Teams orchestration patterns for multi-agent SAFe workflows. Use when spawning agent teams, coordinating teammates, enforcing quality gates via task dependencies, or orchestrating the 11-agent SAFe pipeline. Covers team creation, messaging, shared task lists, and SAFe gate enforcement. Do NOT use for single-agent or simple subagent workflows.","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.gemini\u002Fskills\u002Fteam-coordination\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M79BRZ422QD8D5QHQMXAVPWZ","task-compilation","Compile broad audit goals into structured proof obligations with 9 mandatory fields. Used after decomposition by the Threat Modeler agent.","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.gemini\u002Fskills\u002Ftask-compilation\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M79BRV2MK2AJZBNSE2BETP28","storage-layout-analysis","Proxy patterns, slot collisions, upgrade safety. Used during decomposition to identify storage-related vulnerabilities in upgradeable contracts.","https:\u002F\u002Fgithub.com\u002Fsahil-kaushik1\u002FAuditing-Workflow\u002Fblob\u002Fmain\u002F.gemini\u002Fskills\u002Fstorage-layout-analysis\u002FSKILL.md",[],[]]