wshobson avatar

Defi Protocol Templates

Need to spin up DeFi contracts without starting from scratch? This generates production-ready Solidity templates for staking rewards, AMM pools, governance tokens, and lending protocols. It handles the tedious boilerplate like reentrancy guards, reward calculations, and liquidity math that you'd otherwise copy from other projects or spend hours debugging. The templates include proper OpenZeppelin imports and follow standard patterns, so you can focus on customizing the business logic instead of wrestling with basic token mechanics. Perfect for hackathons or when you need to prototype DeFi concepts quickly.

skills.sh installs
10.8K
GitHub stars
42.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add wshobson/agents --skill defi-protocol-templates --agent claude-code

Installs into .claude/skills of the current project.

Files

DeFi Protocol Templates

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

When to Use This Skill

  • Building staking platforms with reward distribution
  • Implementing AMM (Automated Market Maker) protocols
  • Creating governance token systems
  • Integrating flash loan functionality

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;

Sponsors

Details

Repository
github.com/wshobson/agents
Categories
Finance & Trading, Web3 & Blockchain

More from wshobson/agents

All 174
1okx avatarokx-dex-tokenokx/onchainos-skillsUse this skill for token-level data: search tokens, trending/hot tokens (热门, 代币榜单), liquidity pools, holder distribution (whale/巨鲸, sniper, bundler-tagged holde9.7Kskills.sh installs
2okx avatarokx-cex-skill-mpokx/agent-skillsUse this skill when the user asks to: 'find a trading skill', 'search for skills', 'install a skill', 'add a skill', 'download a skill', 'browse skill marketpla8.4Kskills.sh installs
3okx avatarokx-dex-signalokx/onchainos-skillsUse this skill for smart-money/whale/KOL/大户 activity tracking, aggregated buy signal/信号 alerts, and leaderboard/牛人榜 rankings. Covers: (1) address tracker — raw 7.6Kskills.sh installs
4okx avatarokx-dex-trenchesokx/onchainos-skillsRead-only on-chain research for pump.fun and other meme-token launchpads (Solana / BSC / X Layer / TRON). MUST invoke (prefer over WebFetch / MCP price tools) w7.5Kskills.sh installs
5okx avatarokx-securityokx/onchainos-skillsUse this skill for security scanning: check transaction safety, is this transaction safe, pre-execution check, security scan, token risk scanning, honeypot dete6.5Kskills.sh installs
6affaan-m avataragent-payment-x402affaan-m/eccAdd x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer t5.5Kskills.sh installs