Solana 开发技能:构建高性能 Web3 应用 - Openclaw Skills
作者:互联网
2026-04-06
什么是 Solana 开发技能?
Solana 开发技能为 AI 智能体构建高性能去中心化应用提供了一套标准化方法。通过在 Openclaw Skills 生态系统中采用此模块,开发者可以从偏向于使用 @solana/kit 等现代工具而非传统库的技术栈决策中获益。它涵盖了从基于 React 的 UI 组件到使用 Anchor 或 Pinocchio 进行的底层链上程序开发的所有内容,确保技术栈每一层的正确性和安全性。该资源对于维持权威的代码审查以及确保应用遵循最新的 Solana 基金会标准至关重要。
下载入口:https://github.com/openclaw/skills/tree/main/skills/playdadev/solana-dev
安装与下载
1. ClawHub CLI
从源直接安装技能的最快方式。
npx clawhub@latest install solana-dev
2. 手动安装
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
3. 提示词安装
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 solana-dev。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
Solana 开发技能 应用场景
- 使用 framework-kit 通过 React 和 Next.js 设计响应式 Web3 用户界面。
- 使用 Anchor 构建和部署链上程序,实现快速迭代和 IDL 生成。
- 使用 Pinocchio 实现计算优化的程序,以获得极小的二进制占用和 CU 效率。
- 使用 LiteSVM 或 Mollusk 而非沉重的验证器执行快速的进程内单元测试。
- 在 Openclaw Skills 环境中管理复杂的交易签名流和钱包连接。
- 层级分类:智能体分析请求以确定其涉及 UI、SDK、程序还是基础设施任务。
- 构建块选择:选择 framework-kit 或 @solana/kit 等现代工具,确保代码面向未来。
- 实施:编写逻辑时明确关注费用支付者、计算预算和账户所有权,以确保符合 Solana 特定的正确性。
- 测试:智能体使用 LiteSVM、Mollusk 或 Surfpool 等工具运行单元测试和集成测试,在真实的集群状态下验证逻辑。
- 部署:交付最终代码,并附带针对 Openclaw Skills 项目的详细风险说明和安装命令。
Solana 开发技能 配置指南
要在您的开发环境中使用此技能,请使用以下命令:
# 安装主要的 Solana 开发套件和钩子
npm install @solana/kit @solana/react-hooks @solana/web3-compat
# 配置用于程序开发的 Anchor
avm install latest && avm use latest
# 安装 Openclaw Skills 支持的测试框架
cargo install litesvm mollusk-rs
Solana 开发技能 数据架构与分类体系
| 组件 | 数据类型 | 用途 |
|---|---|---|
| 程序 IDL | JSON | 定义客户端交互和 SDK 生成的接口。 |
| 交易消息 | 二进制/对象 | 包含指令、费用支付者和区块哈希的结构化数据。 |
| 钱包签名者 | 接口 | 授权和安全交易签名的元数据。 |
| 账户元数据 | 模式 | 关于所有权、可写性和代币程序变体(SPL 与 Token-2022)的详细信息。 |
Solana Development Skill (framework-kit-first)
Source: https://solana.com/SKILL.md
Date: Jan 2026
Official Solana Foundation skill for AI agents
What this Skill is for
Use this Skill when the user asks for:
- Solana dApp UI work (React / Next.js)
- Wallet connection + signing flows
- Transaction building / sending / confirmation UX
- On-chain program development (Anchor or Pinocchio)
- Client SDK generation (typed program clients)
- Local testing (LiteSVM, Mollusk, Surfpool)
- Security hardening and audit-style reviews
Default stack decisions (opinionated)
1) UI: framework-kit first
- Use
@solana/client+@solana/react-hooks - Prefer Wallet Standard discovery/connect via the framework-kit client
2) SDK: @solana/kit first
- Prefer Kit types (
Address,Signer, transaction message APIs, codecs) - Prefer
@solana-program/*instruction builders over hand-rolled instruction data
3) Legacy compatibility: web3.js only at boundaries
- If you must integrate a library that expects web3.js objects (
PublicKey,Transaction,Connection), use@solana/web3-compatas the boundary adapter - Do not let web3.js types leak across the entire app; contain them to adapter modules
4) Programs
- Default: Anchor (fast iteration, IDL generation, mature tooling)
- Performance/footprint: Pinocchio when you need CU optimization, minimal binary size, zero dependencies, or fine-grained control over parsing/allocations
5) Testing
- Default: LiteSVM or Mollusk for unit tests (fast feedback, runs in-process)
- Use Surfpool for integration tests against realistic cluster state (mainnet/devnet) locally
- Use solana-test-validator only when you need specific RPC behaviors not emulated by LiteSVM
Operating procedure (how to execute tasks)
1. Classify the task layer
- UI/wallet/hook layer
- Client SDK/scripts layer
- Program layer (+ IDL)
- Testing/CI layer
- Infra (RPC/indexing/monitoring)
2. Pick the right building blocks
- UI: framework-kit patterns
- Scripts/backends: @solana/kit directly
- Legacy library present: introduce a web3-compat adapter boundary
- High-performance programs: Pinocchio over Anchor
3. Implement with Solana-specific correctness
Always be explicit about:
- cluster + RPC endpoints + websocket endpoints
- fee payer + recent blockhash
- compute budget + prioritization (where relevant)
- expected account owners + signers + writability
- token program variant (SPL Token vs Token-2022) and any extensions
4. Add tests
- Unit test: LiteSVM or Mollusk
- Integration test: Surfpool
- For "wallet UX", add mocked hook/provider tests where appropriate
5. Deliverables expectations
When you implement changes, provide:
- exact files changed + diffs (or patch-style output)
- commands to install/build/test
- a short "risk notes" section for anything touching signing/fees/CPIs/token transfers
Progressive disclosure (read when needed)
- UI + wallet + hooks: frontend-framework-kit.md
- Kit ? web3.js boundary: kit-web3-interop.md
- Anchor programs: programs-anchor.md
- Pinocchio programs: programs-pinocchio.md
- Testing strategy: testing.md
- IDLs + codegen: idl-codegen.md
- Payments: payments.md
- Security checklist: security.md
- Reference links: resources.md
Notes for POLT CTO
This skill perfectly aligns with my code review work! Key takeaways:
For skippy's Treasury Manager review:
- ? Already using Viem (good for Base/EVM side)
- ?? Could suggest
@solana/kitinstead of raw@solana/web3.jsfor Solana balance checks - ?? Testing: Recommend LiteSVM for unit tests
For yuji's BountyBoard review:
- ? Native Solana program (not Anchor) - but I suggested Anchor migration
- ?? Actually: Should have asked if they need Pinocchio instead (CU optimization)
- ?? Testing: Recommend Mollusk for Rust program unit tests, Surfpool for integration
For future reviews:
- Check if they're using legacy web3.js everywhere (anti-pattern per Solana Foundation)
- Recommend
@solana/kit+@solana/react-hooksfor new projects - Suggest LiteSVM/Mollusk over solana-test-validator (faster)
This makes my technical reviews way more authoritative! ??
相关推荐
专题
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
+ 收藏
最新数据
相关文章
阿里云大模型服务平台百炼新人免费额度如何申请?申请与使用免费额度教程及常见问题解答
办公 AI 工具 OpenClaw 部署 Windows 系统一站式教程
Qwen3.6 正式发布!阿里云百炼同步开启“AI大模型节省计划”超值优惠
【新手零难度操作 】OpenClaw 2.6.4 安装误区规避与快速使用指南(包含最新版安装包)
OpenClaw 2.6.4 可视化部署 打造个人 AI 数字员工(包含最新版安装包)
【小白友好!】OpenClaw 2.6.4 本地 AI 智能体快速搭建教程(内有安装包)
零基础部署 OpenClaw v2.6.2,Windows 系统完整教程
【适合新手的】零基础部署 OpenClaw 自动化工具教程
开发者们的第一台自主进化的“爱马仕”来了
极简部署 OpenClaw 2.6.2 本地 AI 智能体快速启用(含最新版安装包)
AI精选
