Agent skill

Compound Patterns

by ccashwell in ccashwell/evm-cortex

A skill your agent uses when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots.

MITAuto-check passedBusiness, Finance & HR

Install Compound Patterns

skills CLI
$ npx skills add ccashwell/evm-cortex --skill compound-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex compound-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/compound-patterns .claude/skills/compound-patterns && rm -rf skills-src

Use ~/.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/

Facts

Skill name
compound-patterns
GitHub stars
131
Token cost
~1.3k tokens
SKILL.md length
152 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots.

  • Integrating with Compound V3 (Comet) for lending
  • SKILL.md covers Architecture, Supply / Withdraw Base Asset, Collateral Management and Borrowing, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Building liquidation bots

What it does

Compound Patterns is an agent skill from ccashwell/evm-cortex. Use when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots. Covers single-asset lending, collateral management, absorb mechanics, and interest rate models.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Business, Finance & HR, covering Banking and insurance. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Integrating with Compound V3 (Comet) for lending
  • Building liquidation bots

Example prompts

  • “/compound-patterns”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    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.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Compound Patterns loads about 1.3k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 152 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

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.

Safety

Auto-check passed

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.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 152 words, ~1,279 tokens.

Download SKILL.mdSave it as .claude/skills/compound-patterns/SKILL.md (or your agent's skills folder).
name
compound-patterns
description
Use when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots. Covers single-asset lending, collateral management, absorb mechanics, and interest rate models.

Compound V3 (Comet) Integration

Architecture

Compound V3 (Comet) is a fundamentally different design from V2. Each Comet deployment is a single-asset market — one base asset (e.g., USDC) with multiple collateral assets. There are no cTokens; the Comet contract itself tracks balances.

ComponentDescription
CometCore market contract (one per base asset)
CometRewardsClaims COMP rewards for suppliers/borrowers
ConfiguratorGovernance-controlled parameter updates
BulkerV2Batch operations including native ETH wrapping

Supply / Withdraw Base Asset

solidity
import {IComet} from "./interfaces/IComet.sol";

IComet comet = IComet(COMET_USDC);

// Supply base asset (earn interest)
IERC20(usdc).approve(address(comet), amount);
comet.supply(usdc, amount);

// Withdraw base asset
comet.withdraw(usdc, amount);
// Use type(uint256).max for full withdrawal

Collateral Management

solidity
// Supply collateral (does NOT earn interest)
IERC20(weth).approve(address(comet), amount);
comet.supply(weth, amount);

// Withdraw collateral
comet.withdraw(weth, amount);

// Check collateral balance
uint256 collateral = comet.collateralBalanceOf(account, weth);

Borrowing

solidity
// Borrow base asset against collateral
// Simply withdraw more base than you supplied
comet.withdraw(usdc, borrowAmount);

// Repay borrow — supply base asset
IERC20(usdc).approve(address(comet), repayAmount);
comet.supply(usdc, repayAmount);

Account State

solidity
// Positive = supplying, negative = borrowing
int256 balance = comet.balanceOf(account);

// Check if account is liquidatable
bool isLiquidatable = comet.isLiquidatable(account);

// Get borrow balance (always positive)
uint256 borrowBalance = comet.borrowBalanceOf(account);

// Check if an action is allowed
bool canBorrow = comet.isBorrowCollateralized(account);

Liquidation via Absorb

solidity
// Compound V3 uses "absorb" instead of traditional liquidation
// Anyone can call absorb on an underwater account
address[] memory accounts = new address[](1);
accounts[0] = underwaterAccount;
comet.absorb(msg.sender, accounts);

// After absorb, protocol holds the collateral
// Buy collateral at a discount through the Comet contract
uint256 reserves = comet.getCollateralReserves(weth);
comet.buyCollateral(weth, minAmount, baseAmount, recipient);

Interest Rate Model

Compound V3 uses a kinked rate model:

if utilization <= kink:
    borrowRate = baseBorrowRate + (utilization * borrowRateSlopeLow)
else:
    borrowRate = baseBorrowRate + (kink * borrowRateSlopeLow)
                 + ((utilization - kink) * borrowRateSlopeHigh)
solidity
uint256 utilization = comet.getUtilization();
uint256 supplyRate = comet.getSupplyRate(utilization);
uint256 borrowRate = comet.getBorrowRate(utilization);
// Rates are per-second, scaled by 1e18
// APR = rate * SECONDS_PER_YEAR

COMP Rewards

solidity
import {ICometRewards} from "./interfaces/ICometRewards.sol";

ICometRewards rewards = ICometRewards(COMET_REWARDS);

// Claim COMP rewards
rewards.claim(cometAddress, account, true); // true = accrue first

// Check pending rewards
ICometRewards.RewardOwed memory owed = rewards.getRewardOwed(cometAddress, account);
// owed.token = COMP address, owed.owed = claimable amount

Safe Integration Pattern

solidity
contract CometIntegration {
    IComet public immutable comet;
    address public immutable baseToken;

    constructor(address _comet) {
        comet = IComet(_comet);
        baseToken = IComet(_comet).baseToken();
    }

    function supplyBase(uint256 amount) external {
        IERC20(baseToken).transferFrom(msg.sender, address(this), amount);
        IERC20(baseToken).approve(address(comet), amount);
        comet.supply(baseToken, amount);
    }

    function supplyCollateral(address asset, uint256 amount) external {
        IERC20(asset).transferFrom(msg.sender, address(this), amount);
        IERC20(asset).approve(address(comet), amount);
        comet.supply(asset, amount);
    }

    function borrow(uint256 amount) external {
        comet.withdraw(baseToken, amount);
        IERC20(baseToken).transfer(msg.sender, amount);
    }

    function isHealthy() external view returns (bool) {
        return !comet.isLiquidatable(address(this));
    }
}

Checklist

  • Differentiate base asset operations (earn interest) from collateral (no interest)
  • Use isLiquidatable() to monitor health before withdrawals
  • Use BulkerV2 for batching operations and native ETH support
  • Approve exact amounts to Comet before supply
  • Account for per-second interest accrual in balance checks
  • Test absorb + buyCollateral flow for liquidation bots
  • Check collateral factors and supply caps via getAssetInfo()

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/compound-patterns of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Compound Patterns 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.

Compound Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Compound Patterns this skillccashwell/evm-cortex131—~1.3kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
Okx Cex Earnokx/agent-skills1862 repos~3.3kAutomated safety check: PassMIT
Buffettdigoal/blog8.6k1 repos~2.7kAutomated safety check: PassGPL-2.0
Solana Payments Wallets Tradingnpc-live/clawfirm1561 repos~4.7kAutomated safety check: PassMIT
Oracle Flashloan Analysisquillai-network/quillshield_skills129—~2.8kAutomated safety check: PassMIT

Similar skills

  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Okx Cex Earn

    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.

    186 GitHub starsUsed in 2 repos~3.3k tokens
    Business, Finance & HRAuto-check passed
  • Buffett

    digoal/blog

    Activates Warren Buffett's complete investment thinking system.

    8.6k GitHub starsUsed in 1 repo~2.7k tokens
    Business, Finance & HRAuto-check passed
  • Pay people in SOL or USDC, buy and sell tokens, check prices, discover trending and new tokens, create and manage Solana wallets, stake SOL, earn yield through lending and managed vaults, borrow…

    156 GitHub starsUsed in 1 repo~4.7k tokens
    Business, Finance & HRAuto-check passed
  • Oracle Flashloan Analysis

    quillai-network/quillshield_skills

    Detects price oracle manipulation and flash loan attack vectors in DeFi smart contracts.

    129 GitHub stars~2.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Master Builder

    ibuilder/massing

    Reason like a master builder — one mind holding an entire built-asset project from raw land through design, construction, handover, operations, and disposition, anywhere in the world.

    122 GitHub stars~2.6k tokensUpdated 6 days ago
    Business, Finance & HRAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    ccashwell/evm-cortex

    A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.

    131 GitHub stars~25k tokensUpdated 8 days ago
    Auto-check passed
  • Aave Integration

    ccashwell/evm-cortex

    A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 8 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 8 days ago
    Auto-check passed

Questions about Compound Patterns

What does Compound Patterns do?

A skill your agent uses when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots. Compound Patterns is an agent skill from ccashwell/evm-cortex. Use when integrating with Compound V3 (Comet) for lending, borrowing, or building liquidation bots.

When should I use Compound Patterns?

Compound Patterns fits situations like: integrating with Compound V3 (Comet) for lending; building liquidation bots.

How do I install Compound Patterns in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill compound-patterns -a claude-code`. Or copy the skill folder (skills/compound-patterns in ccashwell/evm-cortex) into .claude/skills/compound-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Compound Patterns in Codex?

Run `npx skills add ccashwell/evm-cortex --skill compound-patterns -a codex`. Or copy the skill folder (skills/compound-patterns in ccashwell/evm-cortex) into .agents/skills/compound-patterns in your project. Codex loads it when a task matches its description.

Can I use Compound Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill compound-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/compound-patterns, .gemini/skills/compound-patterns, .github/skills/compound-patterns and .opencode/skills/compound-patterns in your project.

What does Compound Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Compound Patterns is instructions for the agent only.

Does Compound Patterns access the network?

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.

Is Compound Patterns safe to install?

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.

What licence does Compound Patterns use?

Compound Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Compound Patterns use?

About 1.3k tokens (SKILL.md is roughly 5.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Compound Patterns?

Skills that share tags, products or a category with Compound Patterns: Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars), Okx Cex Earn (okx/agent-skills, 186 stars), Buffett (digoal/blog, 8.6k stars) and Solana Payments Wallets Trading (npc-live/clawfirm, 156 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Compound Patterns?

ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.

Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.