example-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Example Skill

示例技能

Purpose: This skill exists to demonstrate the Skills-as-Containers pattern introduced in PAI v1.2.0. Use it as a template for creating your own skills.
用途: 本技能用于展示PAI v1.2.0中引入的Skills-as-Containers模式。你可以将其作为创建自有技能的模板。

Architecture Overview

架构概述

Skills in PAI v1.2.0 are organized as self-contained containers with:
PAI v1.2.0中的技能以独立容器的形式组织,包含以下部分:

Core Components

核心组件

  • SKILL.md - Core skill definition with routing logic (you're reading it now!)
  • workflows/ - Specific task workflows for discrete operations
  • assets/ - Templates, references, and helper files
  • SKILL.md - 包含路由逻辑的核心技能定义(你现在正在阅读的就是这个文件!)
  • workflows/ - 用于独立操作的特定任务工作流
  • assets/ - 模板、参考资料和辅助文件

Progressive Disclosure

渐进式加载机制

  1. Metadata (always loaded) - Name, description, triggers
  2. Instructions (loaded when triggered) - This SKILL.md content
  3. Resources (loaded as needed) - Individual workflow and asset files
  1. 元数据(始终加载)- 名称、描述、触发词
  2. 说明文档(触发时加载)- 本SKILL.md的内容
  3. 资源文件(按需加载)- 单个工作流和资源文件

Included Workflows

包含的工作流

This skill includes three example workflows demonstrating different complexity levels:
本技能包含三个示例工作流,展示了不同的复杂程度:

1. simple-task.md

1. simple-task.md

Purpose: Basic single-step workflow Trigger: User says "simple example", "basic task" Demonstrates: Minimal workflow structure
用途: 基础单步骤工作流 触发词: 用户说出“简单示例”、“基础任务” 展示内容: 极简工作流结构

2. complex-task.md

2. complex-task.md

Purpose: Multi-step workflow with dependencies Trigger: User says "complex example", "multi-step task" Demonstrates: Structured workflow with validation
用途: 带依赖关系的多步骤工作流 触发词: 用户说出“复杂示例”、“多步骤任务” 展示内容: 带验证机制的结构化工作流

3. parallel-task.md

3. parallel-task.md

Purpose: Agent orchestration for parallel execution Trigger: User says "parallel example", "parallel task" Demonstrates: Multi-agent coordination pattern
用途: 用于并行执行的Agent编排 触发词: 用户说出“并行示例”、“并行任务” 展示内容: 多Agent协作模式

Routing Logic

路由逻辑

Natural language automatically routes to the right workflow:
User Intent → Skill Activation → Workflow Selection → Execution

Example Flow:
"Show me a simple example"
    ↓ (matches trigger)
example-skill loads
    ↓ (analyzes intent: "simple")
simple-task.md selected
Workflow executes
自然语言会自动路由到对应的工作流:
用户意图 → 技能激活 → 工作流选择 → 执行

示例流程:
"给我看一个简单示例"
    ↓(匹配触发词)
example-skill 加载
    ↓(分析意图:“简单”)
选择simple-task.md
工作流执行

Assets

资源文件

This skill includes example assets in the
assets/
directory:
  • template.md
    - Example template file
  • reference.md
    - Example reference material
These demonstrate how to organize supporting resources.
本技能在
assets/
目录中包含示例资源文件:
  • template.md
    - 示例模板文件
  • reference.md
    - 示例参考资料
这些文件展示了如何组织辅助资源。

Usage Examples

使用示例

Basic Usage

基础用法

User: "Show me a simple example"
→ Loads example-skill
→ Executes simple-task.md workflow
→ Returns basic workflow demonstration
用户:“给我看一个简单示例”
→ 加载example-skill
→ 执行simple-task.md工作流
→ 返回基础工作流演示

Complex Usage

复杂用法

User: "I need a complex multi-step example"
→ Loads example-skill
→ Executes complex-task.md workflow
→ Returns structured multi-step demonstration
用户:“我需要一个复杂的多步骤示例”
→ 加载example-skill
→ 执行complex-task.md工作流
→ 返回结构化多步骤演示

Parallel Usage

并行用法

User: "How do I parallelize work?"
→ Loads example-skill
→ Executes parallel-task.md workflow
→ Returns agent orchestration demonstration
用户:“我如何并行处理工作?”
→ 加载example-skill
→ 执行parallel-task.md工作流
→ 返回Agent编排演示

Creating Your Own Skill

创建自有技能

Use this skill as a template:
  1. Copy the structure:
    bash
    cp -r ~/.claude/skills/example-skill ~/.claude/skills/your-skill-name
  2. Update SKILL.md:
    • Change name and description in frontmatter
    • Update trigger phrases
    • Replace example content with your skill's purpose
  3. Create workflows:
    • Add workflow files in workflows/ directory
    • Each workflow = one specific task
    • Name workflows descriptively
  4. Add assets (optional):
    • Templates, references, helper scripts
    • Keep organized in assets/ directory
  5. Test activation:
    • Test trigger phrases
    • Verify workflow routing
    • Ensure natural language works
将本技能作为模板使用:
  1. 复制结构:
    bash
    cp -r ~/.claude/skills/example-skill ~/.claude/skills/your-skill-name
  2. 更新SKILL.md:
    • 修改YAML前置元数据中的名称和描述
    • 更新触发词
    • 用自有技能的用途替换示例内容
  3. 创建工作流:
    • 在workflows/目录中添加工作流文件
    • 每个工作流对应一个特定任务
    • 给工作流起描述性的名称
  4. 添加资源文件(可选):
    • 模板、参考资料、辅助脚本
    • 统一组织在assets/目录中
  5. 测试激活:
    • 测试触发词
    • 验证工作流路由
    • 确保自然语言功能正常

Best Practices

最佳实践

Skill Organization

技能组织

  • ✅ One skill per domain/topic area
  • ✅ Multiple workflows within a skill
  • ✅ Clear trigger phrases
  • ❌ Don't create skills for one-off tasks
  • ❌ Don't duplicate knowledge across skills
  • ✅ 每个技能对应一个领域/主题
  • ✅ 一个技能内包含多个工作流
  • ✅ 使用清晰的触发词
  • ❌ 不要为一次性任务创建技能
  • ❌ 不要在多个技能间重复知识

Workflow Design

工作流设计

  • ✅ Self-contained with clear steps
  • ✅ Focused on ONE specific task
  • ✅ Include trigger phrases
  • ❌ Don't make workflows too granular
  • ❌ Don't duplicate skill context
  • ✅ 独立封装且步骤清晰
  • ✅ 专注于单个特定任务
  • ✅ 包含触发词
  • ❌ 不要让工作流过于细碎
  • ❌ 不要重复技能上下文

Natural Language Routing

自然语言路由

  • ✅ Use descriptive trigger phrases
  • ✅ Test with variations
  • ✅ Think like a user
  • ❌ Don't require exact phrase matching
  • ❌ Don't make users memorize commands
  • ✅ 使用描述性的触发词
  • ✅ 测试不同的表述方式
  • ✅ 站在用户的角度思考
  • ❌ 不要要求完全匹配短语
  • ❌ 不要让用户记住命令

Technical Details

技术细节

File Structure

文件结构

example-skill/
├── SKILL.md              # This file (core definition)
├── workflows/            # Specific task workflows
│   ├── simple-task.md
│   ├── complex-task.md
│   └── parallel-task.md
├── assets/               # Supporting resources
│   ├── template.md
│   └── reference.md
└── README.md             # Overview documentation
example-skill/
├── SKILL.md              # 本文件(核心定义)
├── workflows/            # 特定任务工作流
│   ├── simple-task.md
│   ├── complex-task.md
│   └── parallel-task.md
├── assets/               # 辅助资源
│   ├── template.md
│   └── reference.md
└── README.md             # 概述文档

Loading Behavior

加载行为

  1. Skill metadata always loaded (YAML frontmatter)
  2. SKILL.md body loaded when skill activates
  3. Individual workflows loaded when selected
  4. Assets loaded when referenced
  1. 技能元数据始终加载(YAML前置元数据)
  2. 技能激活时加载SKILL.md主体内容
  3. 选择工作流时加载对应的单个工作流
  4. 引用资源文件时加载对应文件

Integration Points

集成点

  • Natural Language: Trigger phrases activate skill
  • Other Skills: Can reference this skill's workflows
  • Agents: Can invoke specific workflows
  • Commands: Can route to this skill's workflows
  • 自然语言: 触发词激活技能
  • 其他技能: 可以引用本技能的工作流
  • Agents: 可以调用特定工作流
  • 命令: 可以路由到本技能的工作流

Documentation

文档

  • Architecture: See
    ~/Projects/PAI/docs/ARCHITECTURE.md
  • Migration Guide: See
    ~/Projects/PAI/docs/MIGRATION.md
  • Skill Development: See
    ~/.claude/skills/create-skill/
  • 架构: 查看
    ~/Projects/PAI/docs/ARCHITECTURE.md
  • 迁移指南: 查看
    ~/Projects/PAI/docs/MIGRATION.md
  • 技能开发: 查看
    ~/.claude/skills/create-skill/

References

参考资料


This is a template skill - customize it for your needs!

这是一个模板技能 - 根据你的需求进行自定义!