技能 defi-protocol-templates
🧩

defi-protocol-templates

安全 🌐 網路存取⚡ 包含腳本⚙️ 外部命令

更快地建構 DeFi 協議合約

您需要穩健的 DeFi 合約模板,但不想從頭開始。此技能提供可立即使用的質押、AMM、治理和借貸協議結構,您可以快速調整使用。

支援: Claude Codex Code(CC)
📊 69 充足
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「defi-protocol-templates」。 Explain the AMM template and list the main functions.

預期結果:

  • 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.

正在使用「defi-protocol-templates」。 What does the staking contract reward calculation look like?

預期結果:

  • 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.

正在使用「defi-protocol-templates」。 How do I create a governance proposal?

預期結果:

  • 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.

安全審計

安全
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
已掃描檔案
630
分析行數
3
發現項
4
審計總數
審計者: claude 查看審計歷史 →

品質評分

38
架構
100
可維護性
85
內容
22
社群
100
安全
91
規範符合性

你能建構什麼

建立 DeFi MVP 原型

調整質押和 AMM 模板以快速驗證新的協議構想。

規劃協議範圍

審視治理和閃電貸範例來定義產品需求。

比較基準模式

使用模板作為基準,找出自訂程式碼中缺失的控制項。

試試這些提示

質押基礎
總結質押獎勵模板並列出關鍵狀態變數和事件。
AMM 設置
說明 AMM 模板中 addLiquidity 和 swap 的運作方式,並標註任何數學假設。
治理流程
概述模板中治理提案的生命週期,並列出自訂邏輯應該放置的位置。
閃電貸安全
識別閃電貸模板中的安全檢查,並建議兩項額外的保護措施。

最佳實務

  • 在部署任何調整過的模板之前,添加全面的單元測試
  • 使用經過審計的 OpenZeppelin 函式庫來處理代幣和訪問控制邏輯
  • 在生產環境中審查數學運算的溢位和捨入邊緣情況

避免

  • 未經專業安全審計即部署模板
  • 跳過關鍵函數的訪問控制和暫停機制
  • 忽略代幣小數處理和費用邊緣情況

常見問題

哪些平台相容?
模板基於 Solidity,可在支援 OpenZeppelin 函式庫的 EVM 鏈上運作。
這些模板的限制是什麼?
它們是輕量級範例,沒有完整的預言機、清算或升級代理邏輯。
如何與我的專案整合?
複製合約並根據您的需求調整介面、參數和訪問控制。
此技能會存取我的資料嗎?
不包含。它僅包含靜態模板,不收集資料或進行外部呼叫。
如果編譯失敗怎麼辦?
檢查 Solidity 版本相容性,並確保已安裝 OpenZeppelin 依賴項。
這與完整的 DeFi 框架相比如何?
這更輕量、更快速,適合建立原型,但缺少完整的生產功能。

開發者詳情

檔案結構

📄 SKILL.md