creating-agent-skills

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Creating Agent Skills

创建Agent Skills

Agent Skills extend Claude's capabilities with specialized knowledge and workflows. This skill helps you create effective skills that follow best practices.
Use this skill when creating new skills, improving existing ones, or designing skill architecture for projects.
Supporting files: SPECIFICATION.md for format details, BEST-PRACTICES.md for authoring guidelines, TEMPLATES.md for starter templates.
Agent Skills通过专业知识和工作流程扩展Claude的能力。本技能可帮助你创建遵循最佳实践的高效技能。
适用场景:创建新技能、改进现有技能,或为项目设计技能架构时。
支持文件SPECIFICATION.md 提供格式细节,BEST-PRACTICES.md 提供编写指南,TEMPLATES.md 提供入门模板。

Quick Start

快速开始

Create a skill directory with SKILL.md:
my-skill/
├── SKILL.md          # Required: metadata + instructions
├── scripts/          # Optional: executable code
├── references/       # Optional: detailed docs
└── assets/           # Optional: templates, resources
创建包含SKILL.md的技能目录:
my-skill/
├── SKILL.md          # 必填:元数据 + 说明文档
├── scripts/          # 可选:可执行代码
├── references/       # 可选:详细文档
└── assets/           # 可选:模板、资源文件

SKILL.md Structure

SKILL.md 结构

yaml
---
name: skill-name          # lowercase, hyphens only, max 64 chars
description: What it does and when to use it.  # max 1024 chars
---
yaml
---
name: skill-name          # 仅小写字母和连字符,最多64字符
description: What it does and when to use it.  # 最多1024字符
---

Skill Title

技能标题

Brief intro and "Use this skill when..." statement.
简短介绍及“何时使用本技能...”说明。

Quick Start

快速开始

[Most common use case with example]
[最常见的使用场景及示例]

Core Features

核心功能

[Main capabilities organized by task]
[按任务划分的主要能力]

Support Files

支持文件

[Links to reference files for detailed info]
undefined
[指向详细信息的参考文件链接]
undefined

Naming Conventions

命名规范

Use gerund form (verb + -ing) for clarity:
  • processing-pdfs
    (preferred)
  • analyzing-data
    (preferred)
  • pdf-processor
    (acceptable)
Rules:
  • Lowercase letters, numbers, hyphens only
  • No consecutive hyphens (
    --
    )
  • Cannot start/end with hyphen
  • Max 64 characters
使用动名词形式(动词+ing)以保证清晰性:
  • processing-pdfs
    (推荐)
  • analyzing-data
    (推荐)
  • pdf-processor
    (可接受)
规则
  • 仅使用小写字母、数字和连字符
  • 禁止连续连字符(
    --
  • 不能以连字符开头或结尾
  • 最多64字符

Writing Descriptions

描述编写

Descriptions drive skill discovery. Include:
  1. What it does (actions/capabilities)
  2. When to use it (triggers/contexts)
Good:
yaml
description: Extracts text and tables from PDF files, fills forms, merges documents. Use when working with PDF files or when user mentions PDFs, forms, or document extraction.
Bad:
yaml
description: Helps with PDFs.  # Too vague
Always use third person (description is injected into system prompt).
描述是技能发现的关键,需包含:
  1. 功能(具体操作/能力)
  2. 使用场景(触发条件/适用情境)
示例(优秀)
yaml
description: Extracts text and tables from PDF files, fills forms, merges documents. Use when working with PDF files or when user mentions PDFs, forms, or document extraction.
示例(不佳)
yaml
description: Helps with PDFs.  # 过于模糊
始终使用第三人称(描述会被注入系统提示词)。

Progressive Disclosure

渐进式披露

Keep SKILL.md under 500 lines. Split content strategically:
  1. Metadata (~100 tokens): Loaded at startup for all skills
  2. SKILL.md body (<5000 tokens): Loaded when skill activates
  3. Reference files: Loaded only when needed
markdown
undefined
保持SKILL.md在500行以内,合理拆分内容:
  1. 元数据(约100 tokens):所有技能启动时加载
  2. SKILL.md主体(<5000 tokens):技能激活时加载
  3. 参考文件:仅在需要时加载
markdown
undefined

Detailed Topics

详细主题

Form filling: See FORMS.md API reference: See REFERENCE.md Examples: See EXAMPLES.md
undefined
表单填写:查看 FORMS.md API参考:查看 REFERENCE.md 示例:查看 EXAMPLES.md
undefined

Key Principles

核心原则

  1. Be concise: Claude is smart; only add context it doesn't have
  2. Test with all models: What works for Opus may need detail for Haiku
  3. Use workflows: Break complex tasks into clear, sequential steps
  4. Include feedback loops: Validate → fix → repeat for quality
  5. Avoid time-sensitive info: Use "old patterns" sections instead
  1. 简洁性:Claude具备智能,仅添加它不具备的上下文信息
  2. 多模型测试:在Opus上适用的内容可能需要为Haiku补充细节
  3. 工作流程化:将复杂任务拆分为清晰的连续步骤
  4. 包含反馈循环:验证→修复→重复以保证质量
  5. 避免时效性信息:改用“旧模式”章节替代

Checklist

检查清单

Before finalizing a skill:
  • Name uses lowercase/hyphens, matches directory name
  • Description explains what AND when
  • SKILL.md under 500 lines
  • Reference files for detailed content
  • Examples are concrete, not abstract
  • Tested with real usage scenarios
技能定稿前需确认:
  • 名称使用小写/连字符,与目录名一致
  • 描述说明清楚功能及使用场景
  • SKILL.md不超过500行
  • 详细内容存于参考文件
  • 示例具体明确,而非抽象描述
  • 已通过真实使用场景测试

Resources

资源