Skills defi-protocol-templates
🧩

defi-protocol-templates

Safe 🌐 Network access⚡ Contains scripts⚙️ External commands

Build DeFi protocol contracts faster

You need solid DeFi contract templates but do not want to start from scratch. This skill provides ready-to-use structures for staking, AMMs, governance, and lending protocols that you can adapt quickly.

Supports: Claude Codex Code(CC)
📊 71 Adequate
1

Download the skill ZIP

2

Upload in Claude

Go to Settings → Capabilities → Skills → Upload skill

3

Toggle on and start using

Test it

Using "defi-protocol-templates". Explain the AMM template and list the main functions.

Expected outcome:

  • The AMM tracks two token reserves and issues liquidity shares to providers.
  • Main functions are addLiquidity, removeLiquidity, and swap.
  • Prices follow a constant product model with a 0.3 percent fee on swaps.

Using "defi-protocol-templates". What does the staking contract reward calculation look like?

Expected outcome:

  • The contract uses rewardPerTokenStored to track accumulated rewards per staked token.
  • When users stake or withdraw, pending rewards are calculated and distributed.
  • The formula multiplies time elapsed by reward rate divided by total supply.

Using "defi-protocol-templates". How do I create a governance proposal?

Expected outcome:

  • Call the propose function with a description string.
  • You must hold tokens above the proposal threshold.
  • The proposal enters a voting period that lasts approximately three days.

Security Audit

Safe
v4 • 1/17/2026

Pure documentation skill containing only Solidity code examples in markdown. No executable scripts, network calls, file system access, or environment variable harvesting detected. All 74 static findings are false positives caused by the scanner misinterpreting Solidity code syntax and markdown formatting as security threats.

2
Files scanned
630
Lines analyzed
3
findings
4
Total audits
Audited by: claude View Audit History →

Quality Score

38
Architecture
100
Maintainability
85
Content
30
Community
100
Security
91
Spec Compliance

What You Can Build

Prototype a DeFi MVP

Adapt staking and AMM templates to validate a new protocol idea quickly.

Plan protocol scope

Review governance and flash loan examples to define product requirements.

Compare baseline patterns

Use templates as a baseline to spot missing controls in custom code.

Try These Prompts

Staking basics
Summarize the staking rewards template and list the key state variables and events.
AMM setup
Explain how addLiquidity and swap work in the AMM template and note any math assumptions.
Governance flow
Outline the governance proposal lifecycle in the template and list where custom logic should go.
Flash loan safety
Identify security checks in the flash loan template and suggest two additional safeguards.

Best Practices

  • Add comprehensive unit tests before deploying any adapted template
  • Use audited OpenZeppelin libraries for token and access control logic
  • Review math for overflow and rounding edge cases in production

Avoid

  • Deploying templates without a professional security audit
  • Skipping access control and pause mechanisms for critical functions
  • Ignoring token decimal handling and fee edge cases

Frequently Asked Questions

What platforms are compatible?
Templates are Solidity based and work on EVM chains that support OpenZeppelin libraries.
What are the limits of these templates?
They are minimal examples without full oracle, liquidation, or upgrade proxy logic.
How do I integrate this with my project?
Copy the contract and adapt interfaces, parameters, and access control for your needs.
Does this skill access my data?
No. It contains static templates only with no data collection or external calls.
What if compilation fails?
Check Solidity version compatibility and ensure OpenZeppelin dependencies are installed.
How does this compare to full DeFi frameworks?
This is lighter and faster for prototyping but lacks complete production features.

Developer Details

File structure

📄 SKILL.md