Guide · Agent skill
How to use the DeFi Protocol Templates agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The DeFi Protocol Templates skill is an agent skill that helps an AI coding agent draft smart contract code for common decentralized finance features: token staking with reward payouts, a simple token-swap exchange (AMM), governance token systems and flash loans. This guide explains what the skill does, how to install it, how to ask for it in plain language, and what it does and does not cover. The templates are for learning and prototyping, so read the safety notes before you deploy anything.
Quick start
- 1Download the ZIP. Download the skill ZIP from this page.
- 2Unzip into the skills folder. Unzip it into ~/.claude/skills/ for all projects, or into a project's .claude/skills/ folder for one project.
- 3Or upload in the Claude apps. In the Claude apps, go to Settings, then Capabilities, then Skills, and upload the skill.
- 4Make a specific request. Ask for a named feature, such as a staking contract or an AMM, and mention Solidity and OpenZeppelin.
- 5Review the output. Read each function, check the imports and confirm the fixed values match your design.
- 6Test on a test network. Compile and test the contracts on a test network or local chain with fake tokens before any real use.
What an agent skill is and what this one makes the agent do
An agent skill is a folder of instructions and reference files that an AI agent loads when a task matches the skill's description. This one is named defi-protocol-templates and is described as providing production-ready templates for staking, AMMs, governance and flash loans.
Once the skill is active, the agent can draft Solidity contracts that start from example code instead of a blank file. The main included examples are a StakingRewards contract, a SimpleAMM contract, and a governance token contract with a Governor contract in the reference file. The examples import contracts from the OpenZeppelin library.
- Staking: a contract where users deposit a staking token and earn rewards in a rewards token over time.
- AMM: a SimpleAMM contract with liquidity add and remove, a token swap function and a 0.3% fee.
- Governance: an ERC20Votes-based governance token and a Governor contract.
- Flash loans: named in the skill description, but the files we reviewed show no flash loan code, so do not expect a ready-made example.
How to install the DeFi Protocol Templates skill
Download the ZIP for this skill from this page. Unzip it into your personal skills folder, ~/.claude/skills/, so it is available in all your projects. To limit it to one project, unzip it into that project's .claude/skills/ folder instead.
If you use the Claude apps, you can instead upload the skill under Settings, then Capabilities, then Skills.
unzip <downloaded-zip-file> -d ~/.claude/skills/How to trigger the skill with natural requests
You do not need a special command. The skill is meant to load when your request is about building decentralized finance applications or smart contract protocols. Name the feature you want and say that you want a template or starting point.
Be specific about the feature and the language. Mention whether you want a staking contract, an AMM, a governance token or flash loans, and that you want Solidity code built on OpenZeppelin. The more concrete your request, the more useful the draft will be.
- Write a staking contract in Solidity that pays rewards per second to stakers.
- Draft a simple AMM for two ERC20 tokens with add liquidity, remove liquidity and swap functions.
- Create a governance token with voting support using OpenZeppelin, plus a basic Governor contract.
- Show me a starting template for a flash loan contract and explain each function.
What you need before you use the output
The skill gives you code, but you still need the skills to read and test it. The source says you need Solidity knowledge to read and adapt the contracts, and the OpenZeppelin contracts library, because the examples import from it.
The source does not list a compiler or a test environment. These are implied, not stated: to try the code you will need a Solidity compiler and a test network or local chain. Test with fake tokens before you go near real assets.
- Solidity knowledge to read and adapt the code
- The OpenZeppelin contracts library, which the examples import
- A Solidity compiler and a test network or local chain (implied, not specified in the files)
Safety notes: scripts, network and audit status
According to the skill's listing, it runs no scripts and uses no network. It is a set of instructions and reference code. The contracts are templates for learning and prototyping, not audited code ready to hold real money.
The included AMM and staking code has known simplifications. For example, the swap function takes no minimum output amount, and the staking reward rate is a fixed value of 100 per second in the example. Anyone deploying contracts that hold user funds should get a professional security audit first.
- Do not deploy contracts that hold real user funds without a professional security audit.
- Review every line the agent produces, since templates may contain flaws.
- Use a test network before any real deployment.
- The skill does not give legal, financial or tokenomics advice.
Tips for getting better results
Ask for one contract at a time, then ask the agent to explain how it works before you adapt it. Start by reading the examples in the skill's reference file, which holds the fuller pattern library, so you know what the agent is starting from.
When you adapt a template, change the fixed values, such as the reward rate and the fee, to match your design, and ask the agent to list the assumptions it made.
- Ask for explanations of the event names and functions, not just the code.
- Ask the agent to point out the simplifications in a template.
- Keep the OpenZeppelin imports so the code stays close to the reference examples.
What people use it for
- Teaching yourself how a staking contract tracks rewards per token over time.
- Prototyping a two-token swap pool with a 0.3% fee before a design review.
- Creating a starter governance token with voting support for a test DAO.
- Getting a reference skeleton to adapt for an internal blockchain proof of concept.
Frequently asked questions
Is the DeFi Protocol Templates skill free?
This skill is listed under the MIT licence, which permits reuse under its terms. The source does not state any price, so check the licence text for the exact terms before reuse.
What do I need to use this skill?
You need Solidity knowledge to read and adapt the code, and the OpenZeppelin contracts library, which the examples import. A Solidity compiler and a test network or local chain are implied for testing the code.
Can I use these contracts to hold real money?
No, not without a professional security audit. The source describes the templates as illustrative, and the AMM and staking code has known simplifications.
Does the skill run scripts or access the internet?
According to the listing, it runs no scripts and uses no network. It provides instructions and reference Solidity code.
How is this different from writing contracts myself or using other tools?
The skill gives an agent a starting structure built on OpenZeppelin, which saves setup time for learning or prototyping. It does not replace an audit, and the source does not compare it with other tools, so evaluate alternatives on your own needs.
Why doesn't the agent use the skill when I ask about DeFi?
The skill is meant to load for requests about building decentralized finance applications or smart contract protocols. Ask for a specific feature, such as a staking or AMM contract, and confirm the skill folder is in ~/.claude/skills/ or the project's .claude/skills/ folder.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are learning how staking, AMM or governance contracts are structured, or you want a reference skeleton to prototype on a test network. Pick something else if you plan to deploy contracts holding real user funds without a professional audit, or if you cannot read and test Solidity yourself.
Download the skill