307 lines
13 KiB
Markdown
307 lines
13 KiB
Markdown
|
|
# Solidity AI开发技能包
|
|||
|
|
|
|||
|
|
**GitHub**: [0xlayerghost/solidity-agent-kit](https://github.com/0xlayerghost/solidity-agent-kit) | **Gitea**: [mc-skills/0xlayerghost--solidity-agent-kit](http://192.168.0.109:3000/mc-skills/0xlayerghost--solidity-agent-kit)
|
|||
|
|
|
|||
|
|
## 中文摘要
|
|||
|
|
|
|||
|
|
为AI编码助手提供专业级Solidity智能合约开发技能集,包含编码规范、DeFi安全检查、部署验证等9个技能模块,支持以太坊及多条EVM兼容链,帮助AI代理一致性地应用最佳实践。
|
|||
|
|
|
|||
|
|
## 标签
|
|||
|
|
|
|||
|
|
`Solidity` `智能合约` `AI代理` `DeFi安全` `EVM`
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## README 原文
|
|||
|
|
|
|||
|
|
<div align="center">
|
|||
|
|
|
|||
|
|
# solidity-agent-kit
|
|||
|
|
|
|||
|
|
**Battle-tested AI agent skills for Solidity smart contract development**
|
|||
|
|
|
|||
|
|
*Equip your coding agent with professional-grade Solidity practices — from coding standards to DeFi security.*
|
|||
|
|
|
|||
|
|
<br/>
|
|||
|
|
|
|||
|
|
[](https://opensource.org/licenses/MIT)
|
|||
|
|
[](https://soliditylang.org)
|
|||
|
|
[](https://getfoundry.sh)
|
|||
|
|
[](https://skills.sh/0xlayerghost/solidity-agent-kit)
|
|||
|
|
[](#supported-agents)
|
|||
|
|
|
|||
|
|
<br/>
|
|||
|
|
|
|||
|
|
**EVM Compatible**
|
|||
|
|
|
|||
|
|
[](https://ethereum.org)
|
|||
|
|
[](https://polygon.technology)
|
|||
|
|
[](https://arbitrum.io)
|
|||
|
|
[](https://optimism.io)
|
|||
|
|
[](https://base.org)
|
|||
|
|
[](https://avax.network)
|
|||
|
|
[](https://bnbchain.org)
|
|||
|
|
[](https://zksync.io)
|
|||
|
|
[](https://linea.build)
|
|||
|
|
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## What is solidity-agent-kit?
|
|||
|
|
|
|||
|
|
`solidity-agent-kit` is a **collection of AI agent skills** that supercharge your coding agent with professional-grade Solidity development knowledge. Instead of writing one-off prompts or hoping your AI agent knows best practices, you install these skills once and get consistent, battle-tested behaviors across every project.
|
|||
|
|
|
|||
|
|
> Equip your AI coding agent with battle-tested Solidity development practices — from coding standards to DeFi security.
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
Without solidity-agent-kit With solidity-agent-kit
|
|||
|
|
───────────────────────── ─────────────────────────
|
|||
|
|
AI agent writes code... AI agent invokes /solidity-coding
|
|||
|
|
❌ inconsistent style ✅ enforces NatSpec, custom errors
|
|||
|
|
❌ misses security checks ✅ runs /solidity-security rules
|
|||
|
|
❌ no deployment verification ✅ pre-deploy checklist enforced
|
|||
|
|
❌ weak test coverage ✅ fuzz tests, 100% branch coverage
|
|||
|
|
❌ DeFi vulnerabilities ✅ anti-flash-loan, anti-whale guards
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Table of Contents
|
|||
|
|
|
|||
|
|
- [Install](#install)
|
|||
|
|
- [Skills Included](#skills-included)
|
|||
|
|
- [EVM Chain Support](#evm-chain-support)
|
|||
|
|
- [Architecture](#architecture)
|
|||
|
|
- [Supported Agents](#supported-agents)
|
|||
|
|
- [Tech Stack](#tech-stack)
|
|||
|
|
- [Project Structure](#project-structure)
|
|||
|
|
- [License](#license)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Install
|
|||
|
|
|
|||
|
|
### Quick Install
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# Interactive — choose which skills to install
|
|||
|
|
npx skills add 0xlayerghost/solidity-agent-kit
|
|||
|
|
|
|||
|
|
# Install all skills at once (no prompts)
|
|||
|
|
npx skills add 0xlayerghost/solidity-agent-kit -y
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Auto-detects all AI agents on your machine and installs for each one. Creates `.agents/`, `.claude/`, `.cursor/`, `.windsurf/` folders — `.agents/` holds the actual files, others are symlinks.
|
|||
|
|
|
|||
|
|
### Install for a Specific Agent
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
# Claude Code
|
|||
|
|
npx skills add 0xlayerghost/solidity-agent-kit -y --agent claude-code
|
|||
|
|
|
|||
|
|
# Cursor
|
|||
|
|
npx skills add 0xlayerghost/solidity-agent-kit -y --agent cursor
|
|||
|
|
|
|||
|
|
# Windsurf
|
|||
|
|
npx skills add 0xlayerghost/solidity-agent-kit -y --agent windsurf
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### After Install
|
|||
|
|
|
|||
|
|
Copy the `CLAUDE.md` template to your project root so skills are auto-invoked — no `/slash-commands` needed:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
curl -sL https://raw.githubusercontent.com/0xlayerghost/solidity-agent-kit/main/CLAUDE.md.template -o CLAUDE.md
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Or manually copy [`CLAUDE.md.template`](./CLAUDE.md.template) → `CLAUDE.md` in your project root.
|
|||
|
|
|
|||
|
|
> `CLAUDE.md` is loaded at the start of every Claude Code session. It tells your agent **when** to invoke each skill automatically.
|
|||
|
|
|
|||
|
|
Add to `.gitignore` to keep your repo clean:
|
|||
|
|
|
|||
|
|
```gitignore
|
|||
|
|
# Agent skills (installed locally, not committed)
|
|||
|
|
.agents/
|
|||
|
|
.claude/
|
|||
|
|
.cursor/
|
|||
|
|
.trae/
|
|||
|
|
.windsurf/
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
### Uninstall
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
npx skills remove 0xlayerghost/solidity-agent-kit
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Skills Included
|
|||
|
|
|
|||
|
|
| # | Skill | Trigger | Description | Link |
|
|||
|
|
|---|-------|---------|-------------|------|
|
|||
|
|
| 1 | **solidity-coding** | Writing / editing `.sol` files | Pragma, naming, NatSpec, custom errors, anti-patterns, OZ imports | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-coding) |
|
|||
|
|
| 2 | **solidity-security** | Writing / editing any contract | Private key protection, access control, reentrancy guards, gas limits | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-security) |
|
|||
|
|
| 3 | **solidity-testing** | Writing / editing `*.t.sol` | Test layout, coverage ≥90%, fuzz testing, invariant tests with Foundry | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-testing) |
|
|||
|
|
| 4 | **solidity-deploy** | Writing `*.s.sol` / deploying | Pre-deploy checklist, env vars, constructor args, post-deploy workflow | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-deploy) |
|
|||
|
|
| 5 | **solidity-debug** | Debugging failed txs | Cast calldata decoding, revert analysis, gas diagnosis, trace reading | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-debug) |
|
|||
|
|
| 6 | **solidity-audit** | Security reviews | Manual audit checklist: storage, access control, arithmetic, ERC compatibility | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/solidity-audit) |
|
|||
|
|
| 7 | **defi-security** | DeFi protocol work | Anti-whale, anti-flash-loan, launch checklist, emergency pause, MEV defense | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/defi-security) |
|
|||
|
|
| 8 | **git-workflow** | Before commits / PRs | Conventional commits, branch naming, PR templates for Solidity projects | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/git-workflow) |
|
|||
|
|
| 9 | **claude-code-usage** | After every `/clear` | Context recovery, subagent strategy, Plan Mode, TodoWrite patterns | [View](https://skills.sh/0xlayerghost/solidity-agent-kit/claude-code-usage) |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## EVM Chain Support
|
|||
|
|
|
|||
|
|
Skills are designed for **EVM-compatible chains** and work out of the box with Foundry's multi-chain tooling:
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
Mainnet / L2s Testnets
|
|||
|
|
────────────── ──────────────
|
|||
|
|
Ethereum (ETH) Sepolia
|
|||
|
|
Polygon (MATIC) Mumbai
|
|||
|
|
Arbitrum One Arbitrum Sepolia
|
|||
|
|
Optimism OP Sepolia
|
|||
|
|
Base Base Sepolia
|
|||
|
|
Avalanche C-Chain Fuji
|
|||
|
|
BNB Smart Chain BSC Testnet
|
|||
|
|
zkSync Era zkSync Sepolia
|
|||
|
|
Linea Linea Sepolia
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Chain-specific `foundry.toml` configuration, RPC URL management, and `cast` commands are all covered in the deploy and debug skills.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Architecture
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
Your Project
|
|||
|
|
│
|
|||
|
|
├── CLAUDE.md ◄── skill auto-invoke rules
|
|||
|
|
│
|
|||
|
|
└── .agents/
|
|||
|
|
└── 0xlayerghost/
|
|||
|
|
└── solidity-agent-kit/
|
|||
|
|
├── solidity-coding/ ──► Enforces code style & NatSpec
|
|||
|
|
├── solidity-security/ ──► Guards access control & reentrancy
|
|||
|
|
├── solidity-testing/ ──► Fuzz + invariant test coverage
|
|||
|
|
├── solidity-deploy/ ──► Pre/post deploy checklist
|
|||
|
|
├── solidity-debug/ ──► Cast-based tx analysis
|
|||
|
|
├── solidity-audit/ ──► Manual security review
|
|||
|
|
├── defi-security/ ──► DeFi-specific attack vectors
|
|||
|
|
├── git-workflow/ ──► Conventional commits & PRs
|
|||
|
|
└── claude-code-usage/ ──► Agent context strategies
|
|||
|
|
|
|||
|
|
|
|||
|
|
AI Agent Workflow:
|
|||
|
|
─────────────────────────────────────────────────────────────
|
|||
|
|
User Request ──► CLAUDE.md detects task type
|
|||
|
|
│
|
|||
|
|
┌────────────┼────────────┐
|
|||
|
|
▼ ▼ ▼
|
|||
|
|
Writing .sol Testing .t.sol Deploying .s.sol
|
|||
|
|
│ │ │
|
|||
|
|
/solidity-coding /solidity- /solidity-deploy
|
|||
|
|
/solidity-security testing /defi-security
|
|||
|
|
│ │ │
|
|||
|
|
└────────────┴────────────┘
|
|||
|
|
│
|
|||
|
|
forge build
|
|||
|
|
forge test
|
|||
|
|
│
|
|||
|
|
✅ Verified
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Supported Agents
|
|||
|
|
|
|||
|
|
| Agent | Status | Notes |
|
|||
|
|
|-------|--------|-------|
|
|||
|
|
| **Claude Code** | ✅ Full support | Best experience — CLAUDE.md auto-invoke |
|
|||
|
|
| **Cursor** | ✅ Full support | `.cursor/rules` integration |
|
|||
|
|
| **Windsurf** | ✅ Full support | `.windsurf/rules` integration |
|
|||
|
|
| **Trae** | ✅ Supported | `.trae` integration |
|
|||
|
|
| **OpenCode** | ✅ Supported | — |
|
|||
|
|
| **Gemini CLI** | ✅ Supported | — |
|
|||
|
|
| **GitHub Copilot** | 🚧 Partial | Manual invocation |
|
|||
|
|
| **Codex CLI** | ✅ Supported | — |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Tech Stack
|
|||
|
|
|
|||
|
|
| Tool | Version | Purpose |
|
|||
|
|
|------|---------|---------|
|
|||
|
|
| **Solidity** | `^0.8.20` | Smart contract language |
|
|||
|
|
| **Foundry** | latest | Build, test, deploy (`forge`, `cast`, `anvil`) |
|
|||
|
|
| **OpenZeppelin** | `4.9.x` | Secure contract standards (ERC20/721/1155/Governor) |
|
|||
|
|
| **Slither** | latest | Static analysis (90+ vulnerability detectors) |
|
|||
|
|
| **skills.sh** | latest | Skill package management & distribution |
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Project Structure
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
solidity-agent-kit/
|
|||
|
|
├── CLAUDE.md.template ← Copy to project root as CLAUDE.md
|
|||
|
|
├── skills/
|
|||
|
|
│ ├── solidity-coding/ ← Coding standards & naming conventions
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── solidity-security/ ← Security best practices
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── solidity-testing/ ← Test organization & coverage
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── solidity-deploy/ ← Deployment workflow & checks
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── solidity-debug/ ← On-chain transaction debugging
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── solidity-audit/ ← Manual security audit checklist
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── defi-security/ ← DeFi-specific attack prevention
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ ├── git-workflow/ ← Git conventions for Solidity projects
|
|||
|
|
│ │ └── SKILL.md
|
|||
|
|
│ └── claude-code-usage/ ← AI agent context strategies
|
|||
|
|
│ └── SKILL.md
|
|||
|
|
├── openai/
|
|||
|
|
├── LICENSE
|
|||
|
|
└── README.md
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## Who Is This For
|
|||
|
|
|
|||
|
|
- Solidity developers using **Foundry** (`forge`, `cast`, `anvil`)
|
|||
|
|
- Teams building **DeFi protocols**, NFT projects, and DAO governance
|
|||
|
|
- Developers using **AI coding agents** who want consistent, secure output
|
|||
|
|
- Security engineers running **automated audits** with Slither + manual checklists
|
|||
|
|
- Anyone deploying on **EVM-compatible chains**
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## License
|
|||
|
|
|
|||
|
|
MIT — see [LICENSE](./LICENSE)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
<div align="center">
|
|||
|
|
|
|||
|
|
**Built by [0xlayerghost](https://github.com/0xlayerghost)**
|
|||
|
|
|
|||
|
|
*Blockchain & Solidity Engineer*
|
|||
|
|
|
|||
|
|
[](https://github.com/0xlayerghost)
|
|||
|
|
[](https://skills.sh/0xlayerghost)
|
|||
|
|
|
|||
|
|
*If this helped you ship safer contracts, give it a ⭐*
|
|||
|
|
|
|||
|
|
</div>
|