example-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExample Skill Template
Skill示例模板
This skill serves as a template and guide for creating new skills. It demonstrates the standard structure and best practices used by all skills in this codebase.
本Skill可作为创建新Skill的模板与指南,展示了此代码库中所有Skill遵循的标准结构与最佳实践。
Overview
概述
Every skill should provide:
- Core Documentation - Main concepts and quick start guide in SKILL.md
- API References - Detailed method/function documentation in
resources/ - Code Examples - Working code samples in
examples/ - Starter Templates - Ready-to-use setup files in
templates/ - Troubleshooting - Common issues and solutions in
docs/
每个Skill都应包含:
- 核心文档 - SKILL.md中的核心概念与快速入门指南
- API参考 - 目录下的详细方法/函数文档
resources/ - 代码示例 - 目录下的可运行代码样例
examples/ - 启动模板 - 目录下的即用型配置文件
templates/ - 故障排查 - 目录下的常见问题与解决方案
docs/
Required Structure
必需结构
skill-name/
├── SKILL.md # Main skill file (required)
├── resources/ # API references and detailed docs
│ ├── api-reference.md
│ └── program-addresses.md
├── examples/ # Working code examples
│ └── feature-name/
│ └── example.ts
├── templates/ # Starter templates
│ └── setup.ts
└── docs/ # Guides and troubleshooting
└── troubleshooting.mdskill-name/
├── SKILL.md # 主Skill文件(必需)
├── resources/ # API参考与详细文档
│ ├── api-reference.md
│ └── program-addresses.md
├── examples/ # 可运行代码示例
│ └── feature-name/
│ └── example.ts
├── templates/ # 启动模板
│ └── setup.ts
└── docs/ # 指南与故障排查
└── troubleshooting.mdSKILL.md Format
SKILL.md格式
Frontmatter (Required)
前置元数据(必需)
Every SKILL.md must start with YAML frontmatter:
yaml
---
name: skill-name
description: Brief description of what this skill covers. Should be 1-2 sentences explaining the protocol/tool and main features.
---每个SKILL.md必须以YAML前置元数据开头:
yaml
---
name: skill-name
description: 本Skill涵盖内容的简要描述。需用1-2句话说明协议/工具及其主要功能。
---Recommended Sections
推荐章节
markdown
undefinedmarkdown
undefinedProtocol Name Development Guide
协议名称开发指南
Brief introduction paragraph.
简要介绍段落。
Overview
概述
Bullet points of main features:
- Feature 1 - Description
- Feature 2 - Description
主要功能要点:
- 功能1 - 描述
- 功能2 - 描述
Program IDs (for Solana protocols)
程序ID(针对Solana协议)
| Program | Address |
|---|---|
| Main Program | |
| 程序 | 地址 |
|---|---|
| 主程序 | |
Quick Start
快速入门
Installation
安装
```bash
npm install package-name
```
bash
npm install package-nameBasic Setup
基础配置
```typescript
// Setup code example
```
typescript
// 配置代码示例Core Features
核心功能
Document each major feature with:
- Explanation
- Code examples
- Important notes
为每个主要功能提供以下内容:
- 说明
- 代码示例
- 重要注意事项
Best Practices
最佳实践
- Security considerations
- Performance tips
- Common patterns
- 安全注意事项
- 性能优化建议
- 常见模式
Resources
资源
- Links to official docs
- GitHub repositories
- Community resources
- 官方文档链接
- GitHub仓库
- 社区资源
Skill Structure
Skill结构
Show the actual file structure of this skill.
undefined展示本Skill的实际文件结构。
undefinedWriting Guidelines
编写指南
Code Examples
代码示例
- Always include imports - Show complete, runnable code
- Use TypeScript - Prefer files with proper types
.ts - Add comments - Explain non-obvious logic
- Handle errors - Show proper error handling patterns
- Use real addresses - Use actual program IDs, not placeholders
- 始终包含导入语句 - 展示完整、可运行的代码
- 使用TypeScript - 优先选择带有正确类型定义的文件
.ts - 添加注释 - 说明非直观逻辑
- 处理错误 - 展示正确的错误处理模式
- 使用真实地址 - 使用实际程序ID,而非占位符
Documentation Style
文档风格
- Be concise - Get to the point quickly
- Use tables - For lists of methods, addresses, parameters
- Show, don't tell - Prefer code examples over lengthy explanations
- Keep updated - Include version info and update dates
- 简洁明了 - 直奔主题
- 使用表格 - 用于展示方法、地址、参数列表
- 示例优先 - 优先使用代码示例而非冗长说明
- 保持更新 - 包含版本信息与更新日期
Resource Files
资源文件
Create separate files in for:
resources/- Complete API method references
- Program addresses and PDAs
- Configuration options
- Type definitions
在目录下创建单独文件用于:
resources/- 完整的API方法参考
- 程序地址与PDA
- 配置选项
- 类型定义
Example Files
示例文件
Examples in should be:
examples/- Self-contained and runnable
- Well-commented
- Cover common use cases
- Include error handling
examples/- 独立可运行
- 注释完善
- 覆盖常见使用场景
- 包含错误处理
Template Files
模板文件
Templates in should be:
templates/- Ready to copy and use
- Include configuration options
- Have placeholder values clearly marked
- Include all necessary imports
templates/- 可直接复制使用
- 包含配置选项
- 清晰标记占位符值
- 包含所有必需的导入语句
Example Protocol Skill
协议Skill示例
Here's how a typical Solana protocol skill is structured:
markdown
---
name: protocol-name
description: Complete guide for Protocol Name - description of what it does.
---以下是典型Solana协议Skill的结构:
markdown
---
name: protocol-name
description: 协议名称完整指南 - 说明其功能。
---Protocol Name Development Guide
协议名称开发指南
Overview
概述
Protocol Name provides:
- Feature A - What it does
- Feature B - What it does
协议名称提供:
- 功能A - 功能说明
- 功能B - 功能说明
Program IDs
程序ID
| Program | Address |
|---|---|
| Main | `ProgramAddress111111111111111111111` |
| 程序 | 地址 |
|---|---|
| 主程序 | |
Quick Start
快速入门
Installation
安装
```bash
npm install @protocol/sdk
```
bash
npm install @protocol/sdkBasic Setup
基础配置
```typescript
import { Protocol } from '@protocol/sdk';
const protocol = new Protocol(connection);
```
typescript
import { Protocol } from '@protocol/sdk';
const protocol = new Protocol(connection);Core Operations
核心操作
Operation 1
操作1
```typescript
// Code example
```
typescript
// 代码示例Operation 2
操作2
```typescript
// Code example
```
typescript
// 代码示例Best Practices
最佳实践
- Practice 1
- Practice 2
- 实践1
- 实践2
Resources
资源
Skill Structure
Skill结构
```
protocol-name/
├── SKILL.md
├── resources/
│ ├── api-reference.md
│ └── program-addresses.md
├── examples/
│ └── basic/
│ └── example.ts
├── templates/
│ └── setup.ts
└── docs/
└── troubleshooting.md
```
undefinedprotocol-name/
├── SKILL.md
├── resources/
│ ├── api-reference.md
│ └── program-addresses.md
├── examples/
│ └── basic/
│ └── example.ts
├── templates/
│ └── setup.ts
└── docs/
└── troubleshooting.mdundefinedChecklist for New Skills
新Skill检查清单
- SKILL.md with proper frontmatter
- Overview section with feature list
- Program IDs table (for Solana protocols)
- Quick Start with installation and setup
- Core operations with code examples
- Best practices section
- Resources with external links
- Skill structure diagram
- with API references
resources/ - with working code
examples/ - with starter template
templates/ - with common issues
docs/troubleshooting.md
- 包含正确前置元数据的SKILL.md
- 带有功能列表的概述章节
- 程序ID表格(针对Solana协议)
- 包含安装与配置步骤的快速入门
- 带有代码示例的核心操作章节
- 最佳实践章节
- 包含外部链接的资源章节
- Skill结构示意图
- 包含API参考的目录
resources/ - 包含可运行代码的目录
examples/ - 包含启动模板的目录
templates/ - 包含常见问题的
docs/troubleshooting.md
Skill Structure
Skill结构
example-skill/
├── SKILL.md # This file
├── resources/
│ └── api-reference.md # Example API reference format
├── examples/
│ └── basic/
│ └── example.ts # Example code file
├── templates/
│ └── setup.ts # Example template
└── docs/
└── troubleshooting.md # Example troubleshooting guideexample-skill/
├── SKILL.md # 本文件
├── resources/
│ └── api-reference.md # 示例API参考格式
├── examples/
│ └── basic/
│ └── example.ts # 示例代码文件
├── templates/
│ └── setup.ts # 示例模板
└── docs/
└── troubleshooting.md # 示例故障排查指南