mcpField
E
example-skill

example-skill

github.com/sendaifunAgent 工作流131123 次安装13 周前更新
代码仓库

关于 example-skill

example-skill 是供技能作者使用的模板与编写指南,说明技能的标准目录结构。内容涵盖核心文档、API 参考、示例、模板和故障排查资料。

主要功能

  1. 01规定技能目录结构
  2. 02提供 SKILL.md 元数据与章节规范
  3. 03组织 API 参考资料
  4. 04指导编写可运行示例
  5. 05提供起始模板与故障排查指南

适用场景

  1. 01搭建新技能的文件结构
  2. 02编写协议或工具文档
  3. 03准备可运行的 TypeScript 示例
  4. 04按清单检查技能完整性

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/sendaifun/skills --skill example-skill

安装后在 Claude Code 中输入/example-skill确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

docs/
troubleshooting.md
examples/basic/
example.ts
resources/
api-reference.md
templates/
setup.ts

详细介绍

示例 Skill 模板

此 Skill 用作创建新 Skill 的模板和指南,展示了本代码库中所有 Skill 所采用的标准结构和最佳实践。

概述

每个 Skill 都应提供:

  • 核心文档 - 在 SKILL.md 中介绍主要概念和快速入门指南
  • API 参考 - 在 resources/ 中提供详细的方法/函数文档
  • 代码示例 - 在 examples/ 中提供可运行的代码示例
  • 入门模板 - 在 templates/ 中提供可直接使用的配置文件
  • 故障排除 - 在 docs/ 中介绍常见问题及解决方案

必需结构

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

SKILL.md 格式

Frontmatter(必需)

每个 SKILL.md 都必须以 YAML frontmatter 开头:

---
name: skill-name
description: Brief description of what this skill covers. Should be 1-2 sentences explaining the protocol/tool and main features.
---
推荐章节
# Protocol Name Development Guide

Brief introduction paragraph.

## Overview

Bullet points of main features:
- **Feature 1** - Description
- **Feature 2** - Description

## Program IDs (for Solana protocols)

| Program | Address |
|---------|---------|
| Main Program | `address` |

## Quick Start

### Installation

\`\`\`bash
npm install package-name
\`\`\`

### Basic Setup

\`\`\`typescript
// Setup code example
\`\`\`

## 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

## Skill Structure

Show the actual file structure of this skill.

编写指南

代码示例
  1. 始终包含导入语句 - 展示完整且可运行的代码
  2. 使用 TypeScript - 优先使用带有适当类型的 .ts 文件
  3. 添加注释 - 解释不明显的逻辑
  4. 处理错误 - 展示恰当的错误处理模式
  5. 使用真实地址 - 使用实际的程序 ID,而非占位符
文档风格
  1. 简洁明了 - 直奔主题
  2. 使用表格 - 用于列出方法、地址和参数
  3. 重展示,少讲解 - 优先使用代码示例,而非冗长的说明
  4. 保持更新 - 包含版本信息和更新日期
资源文件

在 resources/ 中创建单独的文件,用于存放:

  • 完整的 API 方法参考
  • 程序地址和 PDA
  • 配置选项
  • 类型定义
示例文件

examples/ 中的示例应:

  • 独立完整且可运行
  • 注释完善
  • 覆盖常见用例
  • 包含错误处理
模板文件

templates/ 中的模板应:

  • 可直接复制使用
  • 包含配置选项
  • 清楚标明占位值
  • 包含所有必需的导入语句

示例协议 Skill

以下展示了典型 Solana 协议 Skill 的结构:

---
name: protocol-name
description: Complete guide for Protocol Name - description of what it does.
---

# Protocol Name Development Guide

## Overview

Protocol Name provides:
- **Feature A** - What it does
- **Feature B** - What it does

## Program IDs

| Program | Address |
|---------|---------|
| Main | \`ProgramAddress111111111111111111111\` |

## Quick Start

### Installation

\`\`\`bash
npm install @protocol/sdk
\`\`\`

### Basic Setup

\`\`\`typescript
import { Protocol } from '@protocol/sdk';

const protocol = new Protocol(connection);
\`\`\`

## Core Operations

### Operation 1

\`\`\`typescript
// Code example
\`\`\`

### Operation 2

\`\`\`typescript
// Code example
\`\`\`

## Best Practices

- Practice 1
- Practice 2

## Resources

- [Official Docs](https://docs.protocol.com)
- [GitHub](https://github.com/protocol/sdk)

## Skill Structure

\`\`\`
protocol-name/
├── SKILL.md
├── resources/
│   ├── api-reference.md
│   └── program-addresses.md
├── examples/
│   └── basic/
│       └── example.ts
├── templates/
│   └── setup.ts
└── docs/
    └── troubleshooting.md
\`\`\`

新建 Skill 检查清单

  • 包含格式正确的 frontmatter 的 SKILL.md
  • 包含功能列表的概述章节
  • 程序 ID 表格(适用于 Solana 协议)
  • 包含安装和设置说明的快速入门
  • 包含代码示例的核心操作
  • 最佳实践章节
  • 包含外部链接的资源
  • Skill 结构示意图
  • 包含 API 参考的 resources/
  • 包含可运行代码的 examples/
  • 包含入门模板的 templates/
  • 包含常见问题的 docs/troubleshooting.md

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 guide

评论

支持 Markdown