defi-protocol-templates
by wshobsondefi-protocol-templates is a GitHub skill that helps scaffold DeFi contract patterns for staking, AMMs, governance, lending, and flash loans. Best used as a starting point for Solidity design and prompting, not as an audited production framework.
This skill scores 66/100, which means it clears the bar for listing but should be treated as a template library more than a fully operational workflow. Directory users can likely trigger it correctly for common DeFi contract patterns, but they should expect to supply their own deployment, testing, and protocol-specific decision-making.
- Clear trigger scope: the description and use cases explicitly cover staking, AMMs, governance, lending, flash loans, and yield farming.
- Contains substantial real content rather than placeholders, with long inlined Solidity templates that can give agents concrete starting points.
- Provides more leverage than a generic prompt when drafting standard DeFi protocol contracts because it bundles multiple common protocol patterns in one skill.
- Operational guidance is thin: there is no install command, no support files, and little visible workflow or constraint documentation for adapting the templates safely.
- Trust and adoption signals are limited because the repository evidence shows no tests, references, resources, or implementation notes tied to the included contract patterns.
Overview of defi-protocol-templates skill
What defi-protocol-templates actually gives you
The defi-protocol-templates skill is a code-generation and scaffolding aid for common DeFi contract patterns: staking, AMMs, governance, lending, and flash-loan-style building blocks. Its value is speed: instead of starting from a blank Solidity file, you begin with recognizable protocol structures that cover core state, events, and major function flows.
Best fit for this skill
This defi-protocol-templates skill is best for Web3 builders who already know the product they want to launch and need a strong starting point for contract architecture. It fits:
- Solidity developers prototyping protocol mechanics
- AI-assisted coding workflows for DeFi MVPs
- Teams comparing baseline implementations before custom design
- Hackathon or internal R&D projects needing fast first drafts
The real job to be done
Most users do not need “templates” in the abstract. They need to turn a rough protocol idea like “single-sided staking with linear rewards” or “simple governance token with delegation” into a concrete implementation plan and starter contract. defi-protocol-templates helps with that translation step.
What makes defi-protocol-templates different from a generic prompt
A generic prompt can describe a DeFi protocol, but this skill is more useful when you want the model to stay anchored to known DeFi contract categories. That reduces ambiguity and often produces more structured output for common cases like reward accounting, pool math, or governance token mechanics.
Important limits before you install
The repository evidence shows this skill is essentially a single SKILL.md with embedded examples, not a full framework with tests, scripts, audits, or deployment tooling. That means defi-protocol-templates for Web3 is a starter and design aid, not a production package. You should not treat generated code as audit-ready.
How to Use defi-protocol-templates skill
Install context for defi-protocol-templates
Use defi-protocol-templates install in the context of an AI coding setup that supports GitHub-hosted skills. A typical install pattern is:
npx skills add https://github.com/wshobson/agents --skill defi-protocol-templates
If your client supports direct GitHub skill loading, add the repository and point to the skill slug defi-protocol-templates.
Read this file first
Start with:
plugins/blockchain-web3/skills/defi-protocol-templates/SKILL.md
There are no companion README, resources, rules, or helper scripts surfaced here, so nearly all useful guidance lives in that one file. Read it before prompting so you know which protocol families the skill already expects.
Know what the skill covers
The skill content is strongest when your request maps cleanly to one of these patterns:
- staking rewards
- AMM contracts
- governance tokens or voting structures
- lending and borrowing logic
- flash-loan-related protocol mechanics
If your design is cross-chain, oracle-heavy, liquidation-intensive, or deeply optimized for gas, this skill is only a first draft aid.
Prepare the minimum input before prompting
For high-quality defi-protocol-templates usage, give the model:
- protocol type
- token standard assumptions
- chain or EVM compatibility target
- reward, fee, or interest model
- admin and upgrade assumptions
- security constraints
- what you want generated: contract only, interfaces, tests, docs, or all of them
Weak input:
Build a DeFi protocol
Strong input:
Use the defi-protocol-templates skill to draft a Solidity staking rewards contract for an ERC-20 token on Ethereum. Users stake one token and earn rewards in another token at a fixed per-second rate. Include pause controls, owner-funded rewards, events, reward accounting comments, and a list of security risks that still require review.
Turn a rough goal into a good prompt
A practical defi-protocol-templates guide prompt usually has four parts:
- Name the protocol archetype
- State the economic rules
- State the operational constraints
- Ask for artifacts, not just code
Example:
Use defi-protocol-templates to generate a minimal AMM pair contract and factory outline for an EVM chain. Assume constant-product pricing, 0.3% fee, ERC-20 pairs only, no fee-on-transfer support, and no upgradeability. Return: architecture summary, core Solidity contracts, edge cases, and a checklist for testing swaps, liquidity add/remove, and reserve sync behavior.
Ask for assumptions explicitly
The biggest adoption blocker with this skill is hidden assumptions. DeFi outputs become much better when you force the model to declare:
- trust model
- price source assumptions
- token behavior assumptions
- reentrancy and access control assumptions
- whether math is simplified for clarity or intended for deployment
This avoids accepting a plausible-looking contract that silently omits critical protocol rules.
Suggested workflow for real use
A practical workflow for defi-protocol-templates for Web3:
- Pick the nearest protocol template in
SKILL.md - Prompt for a minimal version first
- Review assumptions and missing invariants
- Ask for tests and adversarial cases
- Only then add features like fees, admin controls, or upgrade patterns
- Run static analysis and manual review outside the skill
This staged approach is safer than asking for a “full production DeFi protocol” in one pass.
What to ask for in the first pass
For the first generation, request:
- contract architecture summary
- state variable explanations
- function list with access control
- event design
- known attack surfaces
- what is intentionally omitted
That gives you an inspectable design layer before you spend time reviewing generated Solidity.
Practical repo-reading path
Because this skill has only one substantive file, your reading path is simple:
- Scan
When to Use This Skill - Identify which embedded template is closest to your protocol
- Compare the example structure to your intended token flow
- Prompt the model to adapt, not copy, the relevant section
This matters because template mismatch is a common source of bad output. A staking template adapted to vesting or a simple AMM adapted to concentrated liquidity will usually mislead more than help.
Misfit cases to recognize early
Do not rely on defi-protocol-templates usage alone if you need:
- audited production contracts
- deployment scripts and environment setup
- protocol-specific economic simulations
- liquidation engine design
- oracle integration details
- formal verification artifacts
- non-EVM implementations
In those cases, use the skill for initial structure only and bring in specialized tooling or audited references.
defi-protocol-templates skill FAQ
Is defi-protocol-templates good for beginners?
Partly. It is useful for seeing common DeFi contract shapes, but it is not beginner-safe on its own. If you cannot already review Solidity for access control, arithmetic, and token interaction risks, you should treat all output as educational draft code.
Is this better than asking an AI for DeFi code directly?
Usually yes for common protocol families, because defi-protocol-templates narrows the task to known DeFi categories. That tends to improve structure and relevance. It is not automatically better for unusual protocol designs.
Does defi-protocol-templates include deployment or test tooling?
Based on the repository evidence provided here, no. There are no surfaced scripts, resources, or test harness files. Expect to generate or supply deployment, testing, and CI steps yourself.
Can I use defi-protocol-templates for production contracts?
Not directly. Use it to accelerate design and first-pass implementation, then add:
- comprehensive tests
- invariant checks
- static analysis
- gas review
- external security review or audit
Which protocol ideas fit best?
Best-fit requests are straightforward variants of:
- staking rewards
- basic AMMs
- governance token patterns
- simple lending/borrowing flows
- flash loan primitives
The further you move toward novel tokenomics or complex market design, the less reliable template-based generation becomes.
When should I not install this skill?
Skip defi-protocol-templates install if you mainly need a turnkey protocol repo, battle-tested integrations, or an audited base. This skill is strongest as an AI prompting aid, not as an end-to-end developer toolkit.
How to Improve defi-protocol-templates skill
Give protocol rules, not just protocol names
The fastest way to improve defi-protocol-templates output is to specify exact rules:
- who can deposit
- how rewards accrue
- when users can withdraw
- who can update rates
- what fees exist
- what happens in failure cases
“Build lending” is weak. “Build overcollateralized lending with ERC-20 collateral, fixed interest, owner-set parameters, and liquidation hooks left as stubs” is much better.
Ask the model to separate template code from custom logic
A strong prompt pattern is:
Use defi-protocol-templates and clearly label which parts are generic template structure and which parts are specific to my protocol requirements.
This helps you review riskier custom sections faster.
Force a security review pass after generation
After the first output, ask for:
- reentrancy risks
- access control gaps
- accounting edge cases
- fee manipulation paths
- token compatibility assumptions
- griefing vectors
That second pass often matters more than the initial code draft.
Improve results with explicit output format
Request a fixed response structure such as:
- assumptions
- architecture
- Solidity code
- missing protections
- test checklist
- audit questions
Structured output reduces the chance that the defi-protocol-templates skill returns code without enough review context.
Common failure modes to watch for
Typical problems with this skill’s domain include:
- incomplete reward accounting
- missing access restrictions
- unsafe external token calls
- omitted reserve or balance sync logic
- unrealistic flash loan repayment checks
- governance models that ignore delegation or vote snapshots
If any of those are central to your protocol, ask for them explicitly rather than assuming the template covers them.
Iterate by tightening one variable at a time
Do not revise everything at once. After the first draft, improve output by changing one dimension per prompt:
- add upgradeability
- add emergency pause
- change fee model
- add multi-token rewards
- add test coverage
- replace owner model with roles
This makes it easier to spot where the design breaks.
Pair the skill with your own standards
The best way to improve defi-protocol-templates for Web3 in practice is to supply your own house rules: Solidity version, OpenZeppelin usage, event naming, NatSpec expectations, upgrade pattern, and testing framework. The skill gives you a starting shape; your standards make it usable.
