defi-protocol-templates

defi-protocol-templates is a skill for Claude Code, Codex from rmyndharis/antigravity-skills. It costs 38 tokens per session (3,257 once invoked), scanned A, original, MIT.

A collection of implementation templates for decentralized finance, or DeFi, applications that use blockchain-based smart contracts. It covers staking, automated market makers, governance, lending, borrowing, flash loans, and yield farming.

In plain words
What is it for?
Use it to build or plan staking systems, token-governance systems, automated exchanges, lending platforms, flash-loan features, and yield-farming applications.
Why use it?
It provides starting patterns for common financial protocols instead of requiring each one to be designed from scratch. Smart-contract work still requires careful security review and testing.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to build or plan staking systems, token-governance systems, automated exchanges, lending platforms, flash-loan features, and yield-farming applications.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rmyndharis/antigravity-skills/defi-protocol-templates
About the project

Antigravity Skill Vault is a collection of reusable Agent Skills for Google Antigravity, covering software development, operations, security, and business work. It is for people who want Antigravity agents to follow specialized expertise, personas, and structured workflows. The catalogue skills are entries from this collection.

rmyndharis/antigravity-skills · 1,522 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add rmyndharis/antigravity-skills --skill defi-protocol-templates
Clone the repo
git clone --depth 1 https://github.com/rmyndharis/antigravity-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for defi-protocol-templates

README.md
[![agentmods](https://agentmods.dev/badge/skills/rmyndharis/antigravity-skills/defi-protocol-templates/github.svg)](https://agentmods.dev/skills/rmyndharis/antigravity-skills/defi-protocol-templates)
Your own site
<a href="https://agentmods.dev/skills/rmyndharis/antigravity-skills/defi-protocol-templates"><img src="https://agentmods.dev/badge/skills/rmyndharis/antigravity-skills/defi-protocol-templates/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for defi-protocol-templates

Your own site · 80×15
<a href="https://agentmods.dev/skills/rmyndharis/antigravity-skills/defi-protocol-templates"><img src="https://agentmods.dev/badge/skills/rmyndharis/antigravity-skills/defi-protocol-templates.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,257 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00038 $0.03257
Opus 5 $0.00019 $0.01629
Sonnet 5 $0.00008 $0.00651
Haiku 4.5 $0.00004 $0.00326

Measured 7d ago against content hash d9e1c20d1d4c, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

defi-protocol-templates scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/defi-protocol-templates/SKILL.md · 466 lines

How it starts

The opening of the file, as written. The whole thing — 466 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DeFi Protocol Templates

Production-ready templates for common DeFi protocols including staking, AMMs, governance, lending, and flash loans.

Do not use this skill when

  • The task is unrelated to defi protocol templates
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

Use this skill when

  • Building staking platforms with reward distribution
  • Implementing AMM (Automated Market Maker) protocols
  • Creating governance token systems
  • Developing lending/borrowing protocols
  • Integrating flash loan functionality
  • Launching yield farming platforms

Staking Contract

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract StakingRewards is ReentrancyGuard, Ownable {
    IERC20 public stakingToken;
    IERC20 public rewardsToken;

    uint256 public rewardRate = 100; // Rewards per second
    uint256 public lastUpdateTime;
    uint256 public rewardPerTokenStored;

    mapping(address => uint256) public userRewardPerTokenPaid;
    mapping(address => uint256) public rewards;
    mapping(address => uint256) public balances;

    uint256 private _totalSupply;

    event Staked(address indexed user, uint256 amount);
    event Withdrawn(address indexed user, uint256 amount);
    event RewardPaid(address indexed user, uint256 reward);

    constructor(address _stakingToken, address _rewardsToken) {
        stakingToken = IERC20(_stakingToken);
        rewardsToken = IERC20(_rewardsToken);
    }

    modifier updateReward(address account) {
        rewardPerTokenStored = rewardPerToken();
        lastUpdateTime = block.timestamp;

        if (account != address(0)) {
            rewards[account] = earned(account);
            userRewardPerTokenPaid[account] = rewardPerTokenStored;
        }
        _;
    }

    function rewardPerToken() public view returns (uint256) {
        if (_totalSupply == 0) {
            return rewardPerTokenStored;
        }
        return rewardPerTokenStored +
            ((block.timestamp - lastUpdateTime) * rewardRate * 1e18) / _totalSupply;
    }

    function earned(address account) public view returns (uint256) {
        return (balances[account] *
            (rewardPerToken() - userRewardPerTokenPaid[account])) / 1e18 +
            rewards[account];
    }

    function stake(uint256 amount) external nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot stake 0");
        _totalSupply += amount;
        balances[msg.sender] += amount;
        stakingToken.transferFrom(msg.sender, address(this), amount);
        emit Staked(msg.sender, amount);
    }

    function withdraw(uint256 amount) public nonReentrant updateReward(msg.sender) {
        require(amount > 0, "Cannot withdraw 0");
        _totalSupply -= amount;
        balances[msg.sender] -= amount;
        stakingToken.transfer(msg.sender, amount);
        emit Withdrawn(msg.sender, amount);
    }

    function getReward() public nonReentrant updateReward(msg.sender) {
        uint256 reward = rewards[msg.sender];
        if (reward > 0) {
            rewards[msg.sender] = 0;
            rewardsToken.transfer(msg.sender, reward);
            emit RewardPaid(msg.sender, reward);
        }
    }

    function exit() external {
        withdraw(balances[msg.sender]);
        getReward();
    }
}

Read the full file on GitHub · 466 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 466 lines · 38 tokens per session scan A d9e1c20d1d4c

Subscribe to this mod's changes

defi-protocol-templates is a skill published in the GitHub repository rmyndharis/antigravity-skills (1,522 stars, last pushed 1mo ago), licensed MIT. It adds 38 tokens to every session and 3,257 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

aomi-transact

Build natural-language crypto/DeFi agents and EVM MCP plugins (Claude Code, Cursor, Codex, Gemini). Aomi turns prompts into wallet-signed txs on Ethereum, Base, Arbitrum, Optimism, Polygon, Linea — non-custodial, fork-simulated. 40+ apps: Uniswap, Aave, Lido, Morpho, GMX, Hyperliquid, Polymarket.

sickn33/agentic-awesome-skills · 95 tokens

btcpay-server-automation

Automate Btcpay Server tasks via Rube MCP (Composio). Always search tools first for current schemas.

ComposioHQ/awesome-claude-skills · 31 tokens

defi-architect

DeFi protocol specialist for AMMs, lending protocols, yield strategies, and economic securityUse when "defi, amm, liquidity pool, lending protocol, yield farming, oracle, liquidation, tokenomics, tvl, impermanent loss, defi, amm, lending, yield, liquidity, oracle, tokenomics, protocol, ethereum, web3" mentioned.

omer-metin/skills-for-antigravity · 77 tokens

crypto-trading-bots

Comprehensive expertise in automated crypto trading systems, including DEX sniping bots, arbitrage strategies, MEV protection, Telegram trading bots, and anti-rug protection. Use when "trading bot, sniping bot, arbitrage bot, Telegram trading, DEX bot, MEV bot, copy trading, auto trading, token sniper, " mentioned.

omer-metin/skills-for-antigravity · 78 tokens

emblemai-crypto-wallet

Crypto wallet management across 7 blockchains via EmblemAI Agent Hustle API. Balance checks, token swaps, portfolio analysis, and transaction execution for Solana, Ethereum, Base, BSC, Polygon, Hedera, and Bitcoin.

sinhoneyy/master-skills · 55 tokens

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol.

Jamkris/everything-gemini-code · 49 tokens