AgentSkillsCN

skill-authoring

创建全新的 Claude Code 技能。适用于被要求添加新技能、打造全新能力,或需要将可复用的工作流封装为技能时使用。

SKILL.md
--- frontmatter
name: skill-authoring
description: "Create new Claude Code skills. Use when asked to add a skill, create a capability, or when a reusable workflow should be packaged as a skill."

Skill Authoring

When to create a skill

  • User explicitly asks to create a skill
  • A workflow is repeated across multiple conversations
  • Domain-specific expertise should be packaged for reuse
  • Claude needs to be specialized for a particular task type

When NOT to create a skill

  • One-off tasks that won't be repeated
  • Simple instructions that fit in CLAUDE.md
  • Tasks better suited as commands (user-invoked) or agents (Task tool)

Skill vs Agent vs Command

TypeLocationTriggerUse case
Skill.claude/skills/*/SKILL.mdAuto-loaded when relevantDomain expertise, workflows
Agent.claude/agents/*.mdExplicit via Task toolSpecialized subprocesses
Command.claude/commands/*.mdUser invokes with /nameUser-triggered actions

Skill structure

Create a directory in .claude/skills/ with a SKILL.md file:

code
.claude/skills/my-skill/
├── SKILL.md          # Required: instructions with YAML frontmatter
├── templates/        # Optional: template files
└── scripts/          # Optional: executable scripts

Required SKILL.md format

yaml
---
name: my-skill-name
description: "Brief description of what this skill does and when to use it. Include trigger keywords."
---

# Skill Title

## When to use

[List specific situations that should trigger this skill]

## Instructions

[Step-by-step guidance for Claude to follow]

## Examples

[Optional: concrete examples of using this skill]

Field requirements

  • name: lowercase letters, numbers, hyphens only (max 64 chars)
  • description: must include what it does AND when to use it (max 1024 chars)

Best practices

  • Write clear trigger conditions in the description
  • Keep instructions concise - Claude reads them on-demand
  • Use progressive disclosure: main instructions in SKILL.md, details in separate files
  • Bundle scripts for deterministic operations (they run without loading into context)
  • Test the skill triggers correctly by describing a relevant scenario