defi-protocol-templates

defi-protocol-templates is a skill for Claude Code from HermeticOrmus/claude-code-game-development. It costs 38 tokens per session (3,198 once invoked), scanned A, a copy of defi-protocol-templates, MIT.

A set of smart-contract templates for decentralised finance, or DeFi: financial applications that run on blockchains instead of through a traditional institution. It covers staking, automated market makers, governance, lending, flash loans, and yield farming.

In plain words
What is it for?
Use it when building staking and reward systems, token-governed applications, lending and borrowing protocols, automated token exchanges, flash loans, or yield-farming platforms.
Why use it?
It gives developers starting structures for common DeFi protocol designs instead of requiring every contract pattern to be created from scratch.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the blockchain-web3 plugin — 4 skills shipped together

Good fit Use it when building staking and reward systems, token-governed applications, lending and…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hermeticormus/claude-code-game-development/defi-protocol-templates
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 HermeticOrmus/claude-code-game-development --skill defi-protocol-templates
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/claude-code-game-development

Made for: Claude Code.

Or install blockchain-web3, the plugin that ships this one along with the rest of its 4 skills.

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/hermeticormus/claude-code-game-development/defi-protocol-templates.svg)](https://agentmods.dev/skills/hermeticormus/claude-code-game-development/defi-protocol-templates)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/claude-code-game-development/defi-protocol-templates"><img src="https://agentmods.dev/badge/skills/hermeticormus/claude-code-game-development/defi-protocol-templates.svg" alt="Measured on agentmods" 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,198 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.
Origin 100% copy Near-identical to another mod 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.03198
Opus 5 $0.00019 $0.01599
Sonnet 5 $0.00008 $0.00640
Haiku 4.5 $0.00004 $0.00320

Measured 7d ago against content hash ac05df0cf5d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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.

Origin

This is a copy

100% identical to defi-protocol-templates — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/blockchain-web3/skills/defi-protocol-templates/SKILL.md · 455 lines

How it starts

The opening of the file, as written. The whole thing — 455 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.

When to Use This Skill

  • 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 · 455 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 · 455 lines · 38 tokens per session scan A ac05df0cf5d6

Subscribe to this mod's changes

defi-protocol-templates is a skill published in the GitHub repository HermeticOrmus/claude-code-game-development (61 stars, last pushed 3mo ago), licensed MIT. It adds 38 tokens to every session and 3,198 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to defi-protocol-templates, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

cgs-create-control-manifest

Use for create control manifest tasks that define implementation rules, boundaries, allowed dependencies, validation commands, and review gates; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 44 tokens

cgs-regression-suite

Use for regression suite tasks that define or run regression coverage for changed systems, prior bugs, critical paths, and release blockers; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 45 tokens

cgs-art-bible

Use for art bible tasks that define visual identity, shape language, palette, camera, animation, UI style, and asset constraints; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 46 tokens

authoring-godot-prompter-skills

Use when writing or editing a SKILL.md or an agent definition in this repo — required frontmatter, section ordering, and the GDScript-then-C# example convention.

jame581/GodotPrompter · 47 tokens

helius-jupiter

Skill "helius-jupiter" from helius-labs/core-ai, covering helius x jupiter — build defi apps on solana, mcp router surface, prerequisites, 1. helius mcp server and 2. jupiter api key.

helius-labs/core-ai · 0 tokens

helius-okx

Skill "helius-okx" from helius-labs/core-ai, covering helius x okx — build trading & intelligence apps on solana, mcp router surface, prerequisites, 1. helius mcp server and 2. okx skill library (required).

helius-labs/core-ai · 0 tokens