generate-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Generate Skill - Interactive Skill Builder

Generate Skill - 交互式Skill构建器

Overview

概述

This skill guides users through creating high-quality Claude Code skills using proven patterns from top community skills (obra/superpowers, Anthropic, Vercel). It asks targeted questions to understand requirements, then generates a complete SKILL.md file with appropriate structure, documentation, and best practices.
Core principle: Generate skills that activate reliably, enforce processes effectively, and consume context efficiently.
本技能会引导用户利用顶级社区技能(obra/superpowers、Anthropic、Vercel)的成熟模式,创建高质量的Claude Code技能。它会提出针对性问题以了解需求,然后生成结构合理、文档完善且遵循最佳实践的完整SKILL.md文件。
核心原则: 生成的技能需能可靠激活、有效执行流程并高效利用上下文。

When to Use

使用场景

Always use when user asks to:
  • "Create a skill for [topic]"
  • "Generate a SKILL.md for [workflow]"
  • "Build me a skill that does [task]"
  • "Help me make a custom skill"
  • "Turn these instructions into a skill"
Useful for:
  • Capturing team workflows as reusable skills
  • Documenting methodology enforcement (TDD, debugging, code review)
  • Creating automation skills (deployment, testing, setup)
  • Building domain-specific guidance (architecture, security, performance)
Avoid when:
  • User just wants general help (not skill creation)
  • Requirement is too vague to create useful skill
  • Task is better solved with existing skills
当用户提出以下请求时,务必使用本技能:
  • "为[主题]创建一个skill"
  • "为[工作流]生成SKILL.md"
  • "帮我构建一个能完成[任务]的skill"
  • "帮我制作自定义skill"
  • "将这些指令转化为skill"
适用场景:
  • 将团队工作流转化为可复用的skill
  • 记录需强制执行的方法论(TDD、调试、代码审查)
  • 创建自动化skill(部署、测试、环境搭建)
  • 构建特定领域的指导skill(架构、安全、性能)
避免使用场景:
  • 用户仅需一般性帮助(而非创建skill)
  • 需求过于模糊,无法创建有用的skill
  • 任务使用现有skill能更好地解决

The Skill Generation Process

Skill生成流程

Phase 1: Discovery - Understanding Requirements

阶段1:需求探索 - 理解用户需求

You MUST gather this information through AskUserQuestion:
  1. Skill purpose and triggers
    • What should this skill help with?
    • When should Claude activate it?
    • What user phrases should trigger it?
  2. Skill type identification
    • Methodology enforcement? (TDD, debugging process, code review)
    • Technical implementation? (project setup, build automation, deployment)
    • Rule-based auditing? (code quality, performance, accessibility)
    • Automation/integration? (browser testing, API calls, CI/CD)
    • Reference/knowledge? (library patterns, architecture, best practices)
  3. Content requirements
    • Existing documentation to incorporate?
    • Specific rules or checklists?
    • Code examples needed?
    • Scripts or automation required?
  4. Enforcement level
    • Strict methodology with "Iron Laws"?
    • Flexible guidance with recommendations?
    • Checklist-based verification?
Ask these questions interactively:
markdown
Use AskUserQuestion tool with these questions:

Question 1: "What task or workflow should this skill help with?"
- Header: "Purpose"
- Options:
  1. Enforce a development methodology (TDD, debugging, code review)
  2. Automate technical tasks (setup, deployment, testing)
  3. Audit code against rules (performance, accessibility, security)
  4. Provide reference knowledge (patterns, architecture, APIs)
  5. Integrate external tools (browsers, services, CI/CD)

Question 2: "What should trigger this skill?"
- Header: "Triggers"
- Options:
  1. Specific user phrases (list them)
  2. File types or patterns (e.g., *.tsx files)
  3. Project characteristics (e.g., Next.js projects)
  4. Development phases (e.g., before implementing features)

Question 3: "How strict should enforcement be?"
- Header: "Enforcement"
- Options:
  1. Strict - Iron Laws with mandatory phases
  2. Guided - Clear recommendations with Red Flags
  3. Flexible - Best practices and suggestions
  4. Reference only - Information when needed
Verification before proceeding:
  • Skill purpose clearly defined
  • Activation triggers identified
  • Skill type determined
  • Enforcement level chosen
  • User provided any existing documentation or rules
你必须通过AskUserQuestion工具收集以下信息:
  1. Skill用途与触发条件
    • 这个skill要解决什么问题?
    • Claude应在何时激活它?
    • 用户的哪些表述应触发它?
  2. Skill类型识别
    • 方法论强制执行类?(TDD、调试流程、代码审查)
    • 技术实现类?(项目搭建、构建自动化、部署)
    • 规则审计类?(代码质量、性能、可访问性)
    • 自动化/集成类?(浏览器测试、API调用、CI/CD)
    • 参考/知识类?(库模式、架构、最佳实践)
  3. 内容要求
    • 是否需要整合现有文档?
    • 是否有特定规则或检查清单?
    • 是否需要代码示例?
    • 是否需要脚本或自动化功能?
  4. 执行严格程度
    • 带「铁律」的严格方法论?
    • 带建议的灵活指导?
    • 基于检查清单的验证?
通过以下交互式问题收集信息:
markdown
使用AskUserQuestion工具提出以下问题:

问题1:「这个skill要帮助完成什么任务或工作流?」
- 标题:「用途」
- 选项:
  1. 强制执行开发方法论(TDD、调试、代码审查)
  2. 自动化技术任务(搭建、部署、测试)
  3. 按规则审计代码(性能、可访问性、安全)
  4. 提供参考知识(模式、架构、API)
  5. 集成外部工具(浏览器、服务、CI/CD)

问题2:「什么条件下应激活这个skill?」
- 标题:「触发条件」
- 选项:
  1. 特定用户表述(列出具体内容)
  2. 文件类型或模式(例如:*.tsx文件)
  3. 项目特征(例如:Next.js项目)
  4. 开发阶段(例如:功能实现前)

问题3:「执行的严格程度应为?」
- 标题:「执行力度」
- 选项:
  1. 严格 - 带强制阶段的铁律
  2. 引导式 - 明确建议与红色预警
  3. 灵活 - 最佳实践与建议
  4. 仅参考 - 按需提供信息
进入下一阶段前的验证项:
  • Skill用途已明确定义
  • 激活触发条件已确定
  • Skill类型已明确
  • 执行严格程度已选定
  • 用户已提供现有文档或规则(如有)

Phase 2: Pattern Selection

阶段2:模式选择

Based on skill type, select the appropriate pattern:
PatternUse WhenKey Sections
A: MethodologyTDD, debugging, code review, quality gatesPhases, Iron Laws, Red Flags, Verification Checklist
B: TechnicalProject setup, build automation, deploymentQuick Start, Configuration, Troubleshooting
C: AuditingCode quality, performance, accessibilityRule Categories, Output Format, Quick Reference
D: AutomationBrowser testing, API integration, CI/CDAuto-Detection, Configuration, Helper Functions
E: ReferenceLibrary patterns, architecture, best practicesCore Concepts, Patterns Library, Common Mistakes
For full pattern templates with complete structure skeletons, see Pattern Templates.
Verification before proceeding:
  • Pattern matches skill type
  • Pattern supports enforcement level
  • Pattern includes necessary sections
根据Skill类型选择合适的模式:
模式适用场景核心章节
A: 方法论类TDD、调试、代码审查、质量关卡阶段、铁律、红色预警、验证检查清单
B: 技术实现类项目搭建、构建自动化、部署快速开始、配置、故障排除
C: 审计类代码质量、性能、可访问性规则分类、输出格式、快速参考
D: 自动化类浏览器测试、API集成、CI/CD自动检测、配置、辅助函数
E: 参考类库模式、架构、最佳实践核心概念、模式库、常见错误
完整的模式模板与结构框架,请查看 模式模板
进入下一阶段前的验证项:
  • 模式与Skill类型匹配
  • 模式支持选定的执行严格程度
  • 模式包含所需章节

Phase 3: Content Generation

阶段3:内容生成

Generate SKILL.md with these 10 required components:
生成包含以下10个必填组件的SKILL.md文件:

1. Frontmatter (CRITICAL)

1. 前置元数据(至关重要)

yaml
---
name: skill-name-kebab-case
description: |
  Use when [trigger phrase 1], when asked to "[user phrase]",
  or when [situation]. Include multiple trigger variations for
  better activation. Be specific about WHEN to activate.
license: MIT
metadata:
  author: [author-name]
  version: "1.0.0"
  argument-hint: <optional-args>
tags: [relevant, tags, here]
hooks:                           # Optional: automation triggers
  post_tool_use:
    - Action after Write/Edit operations
  stop:
    - Action before session ends
---
Required fields:
  • name
    - kebab-case skill identifier (used in
    /skill-name
    )
  • description
    - Trigger-rich activation text (see best practices below)
Optional fields:
  • license
    - License type (default: MIT)
  • metadata.author
    - Creator name
  • metadata.version
    - Semantic version (e.g., "1.0.0")
  • metadata.argument-hint
    - Hint shown for skill arguments (e.g.,
    <branch-name>
    )
  • tags
    - Array of categorization tags
  • hooks
    - Automation triggers (post_tool_use, stop, etc.)
Description field best practices:
  • Include 3-5 specific trigger phrases
  • Use "when" clauses for situations
  • Include user language ("when asked to 'do X'")
  • Be concrete, not vague
  • Avoid: "A skill for..." (too vague) or single generic descriptions
Hooks field (advanced): Use hooks to automate actions at specific points:
  • post_tool_use
    - Runs after Write, Edit, or other tools
  • stop
    - Runs before session ends (verification, cleanup)
yaml
---
name: skill-name-kebab-case
description: |
  Use when [trigger phrase 1], when asked to "[user phrase]",
  or when [situation]. Include multiple trigger variations for
  better activation. Be specific about WHEN to activate.
license: MIT
metadata:
  author: [author-name]
  version: "1.0.0"
  argument-hint: <optional-args>
tags: [relevant, tags, here]
hooks:                           # 可选:自动化触发条件
  post_tool_use:
    - Action after Write/Edit operations
  stop:
    - Action before session ends
---
必填字段:
  • name
    - 短横线命名的Skill标识符(用于
    /skill-name
  • description
    - 包含多个触发条件的激活文本(详见下方最佳实践)
可选字段:
  • license
    - 许可证类型(默认:MIT)
  • metadata.author
    - 创建者名称
  • metadata.version
    - 语义化版本(例如:"1.0.0")
  • metadata.argument-hint
    - Skill参数提示(例如:
    <branch-name>
  • tags
    - 分类标签数组
  • hooks
    - 自动化触发条件(post_tool_use、stop等)
Description字段最佳实践:
  • 包含3-5个特定触发表述
  • 使用「当...时」的句式描述场景
  • 包含用户常用表述(例如:「当用户要求‘完成X’时」)
  • 表述具体,避免模糊
  • 避免:「用于...的skill」(过于模糊)或单一通用描述
Hooks字段(进阶): 使用hooks在特定节点自动执行操作:
  • post_tool_use
    - 在执行Write、Edit或其他工具后运行
  • stop
    - 在会话结束前运行(验证、清理)

2. Overview Section

2. 概述章节

Include 1-2 sentence description plus a Core principle one-liner.
包含1-2句描述,加上一句核心原则

3. When to Use Section

3. 使用场景章节

Include three subsections: "Always use when" (specific triggers), "Useful for" (broader use cases), and "Avoid when" (anti-cases with alternatives).
包含三个子章节:「务必使用场景」(特定触发条件)、「适用场景」(更广泛的使用案例)、「避免使用场景」(反例与替代方案)。

4. Main Content (Pattern-Specific)

4. 核心内容(模式专属)

Insert the selected pattern structure. See Pattern Templates for full skeletons.
插入选定的模式结构。完整框架请查看 模式模板

5. Quick Reference (if applicable)

5. 快速参考(如适用)

Add a summary table or command cheat sheet for fast lookup.
添加摘要表格或命令速查表,方便快速查阅。

6. Red Flags (for methodology skills)

6. 红色预警(方法论类Skill)

List 3-5 warning signs that indicate the user is going off-track. End with: "ALL of these mean: STOP. Return to Phase 1."
列出3-5个表明用户偏离正轨的预警信号。结尾需添加:「出现以上任意情况:立即停止。返回阶段1。」

7. Examples Section

7. 示例章节

Include at least 2 Good/Bad code comparisons using
<Good>
and
<Bad>
tags. Show real-world scenarios with clear explanations.
至少包含2组使用
<Good>
<Bad>
标签的优劣代码对比。展示真实场景并附上清晰说明。

8. Troubleshooting Section

8. 故障排除章节

Include 3-5 common problems with structured Problem / Cause / Solution format.
包含3-5个常见问题,采用问题 / 原因 / 解决方案的结构化格式。

9. Integration Section

9. 集成章节

Document what the skill enables, what it pairs with, and what calls it.
记录该Skill支持的功能、可搭配的工具以及调用方式。

10. References Section

10. 参考章节

Include source links: inspiration, official docs, and community resources.
Verification checklist:
  • All 10 components included
  • Trigger-rich description field
  • Clear examples with Good/Bad comparisons
  • Phase-based workflow (if methodology)
  • Troubleshooting section complete
  • Integration points documented
包含来源链接:灵感来源、官方文档、社区资源。
验证检查清单:
  • 已包含全部10个组件
  • Description字段包含多个触发条件
  • 示例包含优劣对比
  • (方法论类)包含分阶段工作流
  • 故障排除章节完整
  • 集成点已记录

Phase 4: Finalization and Output

阶段4:定稿与输出

Before presenting skill to user:
  1. Run quality checklist:
    • Description field has 3+ trigger phrases
    • Overview explains core principle clearly
    • Examples include Good/Bad comparisons
    • Troubleshooting section addresses common issues
    • Appropriate pattern for skill type
    • Under 500 lines or uses progressive disclosure
    • Integration points documented
    • References included
  2. Validate against anti-patterns:
    • Vague description ("provides testing")
    • No examples
    • Missing troubleshooting
    • No clear triggers
    • Monolithic structure (>1000 lines without reference/)
    • No verification checklists (for methodology skills)
  3. Generate folder structure suggestion:
skill-name/
├── SKILL.md              # Core skill (generated)
├── reference/            # Optional: extended docs
│   ├── STANDARDS.md
│   └── EXAMPLES.md
├── scripts/              # Optional: automation
│   ├── setup.sh
│   └── execute.sh
└── lib/                  # Optional: helpers
    └── helpers.js
  1. Present complete output:
    • Write full SKILL.md content
    • Include folder structure
    • Include installation instructions
    • Include usage examples
Final verification:
  • Complete SKILL.md generated
  • Quality checklist passed
  • Installation instructions provided
  • Usage examples included
  • No anti-patterns present
向用户展示Skill前:
  1. 运行质量检查清单:
    • Description字段包含3个以上触发表述
    • 概述清晰说明核心原则
    • 示例包含优劣代码对比
    • 故障排除章节覆盖常见问题
    • 模式与Skill类型匹配
    • 内容少于500行或采用渐进式披露
    • 集成点已记录
    • 已包含参考资料
  2. 验证是否存在反模式:
    • 模糊的描述(例如:「提供测试功能」)
    • 无示例
    • 缺少故障排除章节
    • 无明确触发条件
    • 单体结构(超过1000行且未拆分至reference/目录)
    • (方法论类Skill)缺少验证检查清单
  3. 生成文件夹结构建议:
skill-name/
├── SKILL.md              # 核心Skill(已生成)
├── reference/            # 可选:扩展文档
│   ├── STANDARDS.md
│   └── EXAMPLES.md
├── scripts/              # 可选:自动化脚本
│   ├── setup.sh
│   └── execute.sh
└── lib/                  # 可选:辅助工具
    └── helpers.js
  1. 展示完整输出:
    • 写入完整的SKILL.md内容
    • 包含文件夹结构
    • 包含安装说明
    • 包含使用示例
最终验证:
  • 已生成完整的SKILL.md
  • 已通过质量检查清单
  • 已提供安装说明
  • 已包含使用示例
  • 无反模式问题

Deep Reference

深度参考

For detailed guides, load these files when needed:
  • Pattern Templates - Full structure templates for all 5 skill patterns
  • Advanced Topics - Multi-file skills, scripts, templates, integration patterns
Only load these when specifically needed to save context.
如需详细指南,按需加载以下文件:
  • 模式模板 - 全部5种Skill模式的完整结构模板
  • 进阶主题 - 多文件Skill、脚本、模板、集成模式
仅在需要时加载这些文件,以节省上下文资源。

Red Flags During Generation

生成过程中的红色预警

If you catch yourself:
  • Generating without asking questions - Need user input first!
  • Using vague description field - Add specific triggers
  • Skipping examples section - Always include Good/Bad examples
  • No troubleshooting - Users will encounter issues
  • Wrong pattern for skill type - Review pattern selection
  • Over 500 lines without progressive disclosure - Split into reference/
  • No verification checklist for methodology skills - Required for enforcement
ALL of these mean: STOP. Return to appropriate phase.
如果你发现自己:
  • 未提问就直接生成 - 先获取用户输入!
  • 使用模糊的Description字段 - 添加具体触发条件
  • 跳过示例章节 - 务必包含优劣对比示例
  • 未添加故障排除章节 - 用户一定会遇到问题
  • 使用与Skill类型不匹配的模式 - 重新选择模式
  • 内容超过500行且未采用渐进式披露 - 拆分至reference/目录
  • (方法论类Skill)未添加验证检查清单 - 这是强制执行的必要项
出现以上任意情况:立即停止。返回对应阶段。

Examples of Generated Skills

生成的Skill示例

Example 1: Methodology Skill

示例1:方法论类Skill

User: "Create a skill for enforcing commit message conventions"
  • Pattern A (Methodology Enforcement)
  • Iron Law: "No commit without following format"
  • Phases: Validate, Format, Verify
  • Red Flags, Verification Checklist, Good/Bad commit message examples
用户请求:「创建一个强制执行提交信息规范的skill」
  • 采用模式A(方法论强制执行)
  • 铁律:「提交必须遵循格式规范,否则禁止提交」
  • 阶段:验证、格式化、确认
  • 包含红色预警、验证检查清单、提交信息优劣示例

Example 2: Automation Skill

示例2:自动化类Skill

User: "Make a skill that runs database migrations safely"
  • Pattern D (Automation/Integration)
  • Auto-detect: Database type, migration tool
  • Workflow: Backup, Dry run, Execute, Verify
  • Scripts: setup.sh, migrate.sh, rollback.sh
用户请求:「制作一个能安全运行数据库迁移的skill」
  • 采用模式D(自动化/集成)
  • 自动检测:数据库类型、迁移工具
  • 工作流:备份、试运行、执行、验证
  • 包含脚本:setup.sh、migrate.sh、rollback.sh

Example 3: Auditing Skill

示例3:审计类Skill

User: "Build a skill to check Python code for security issues"
  • Pattern C (Rule-Based Auditing)
  • Rule categories: CRITICAL, HIGH, MEDIUM, LOW
  • Output format:
    file.py:123 CRITICAL: SQL injection risk
  • Quick reference table, vulnerable-to-secure examples
用户请求:「构建一个检查Python代码安全问题的skill」
  • 采用模式C(规则审计)
  • 规则分类:CRITICAL、HIGH、MEDIUM、LOW
  • 输出格式:
    file.py:123 CRITICAL: SQL injection risk
  • 包含快速参考表、不安全代码到安全代码的示例

Troubleshooting Skill Generation

Skill生成故障排除

Problem: User request is too vague

问题:用户请求过于模糊

Example: "Make me a skill for React"
Solution: Use AskUserQuestion to clarify: What aspect of React? What should it enforce or guide? When should it activate? What's the primary goal?
示例:「帮我做一个React相关的skill」
解决方案: 使用AskUserQuestion工具澄清:是React的哪个方面?要强制执行或指导什么?何时激活?主要目标是什么?

Problem: Skill type unclear

问题:Skill类型不明确

Example: "Create a skill for deployment"
Solution: Determine if it's Automation (Pattern D) for scripted deployment, Methodology (Pattern A) for process enforcement, or Reference (Pattern E) for best practices. Ask: "Should this automate deployment or guide the process?"
示例:「创建一个部署相关的skill」
解决方案: 确定它是用于脚本化部署的自动化类(模式D)、流程强制执行的方法论类(模式A)还是最佳实践参考类(模式E)。可提问:「这个skill是要自动化部署还是指导部署流程?」

Problem: Generated skill too long

问题:生成的Skill过长

Cause: Too much content in SKILL.md
Solution: Keep SKILL.md under 500 lines. Move extensive content to reference/. Use progressive disclosure pattern. Link to reference files with clear descriptions.
原因: SKILL.md中内容过多
解决方案: 保持SKILL.md内容在500行以内。将大量内容移至reference/目录。采用渐进式披露模式。通过清晰描述链接到参考文件。

Problem: Description doesn't trigger activation

问题:Description字段无法触发激活

Cause: Description too generic
Solution: Include specific phrases users actually say. Bad: "A skill for testing". Good: "Use when writing tests, implementing TDD, creating test suites, or when asked to 'test my code' or 'add test coverage'"
原因: 描述过于通用
解决方案: 包含用户实际会使用的具体表述。错误示例:「用于测试的skill」。正确示例:「当用户编写测试、实现TDD、创建测试套件,或要求‘测试我的代码’、‘添加测试覆盖率’时使用」

Problem: No clear examples

问题:无清晰示例

Cause: Skill too abstract
Solution: Always include at least 2 Good/Bad code comparisons, real-world scenarios, before/after examples, and common use cases.
原因: Skill过于抽象
解决方案: 务必至少包含2组优劣代码对比、真实场景、前后示例以及常见使用案例。

Meta: This Skill's Structure

元信息:本Skill的结构

This skill itself follows Pattern B (Technical Implementation):
  • Phase 1: Discovery (questions to user)
  • Phase 2: Pattern Selection (match type to structure)
  • Phase 3: Content Generation (create SKILL.md)
  • Phase 4: Finalization (quality check and output)
  • Advanced topics: Available in Advanced Topics
本Skill自身遵循模式B(技术实现):
  • 阶段1: 探索(向用户提问)
  • 阶段2: 模式选择(匹配类型与结构)
  • 阶段3: 内容生成(创建SKILL.md)
  • 阶段4: 定稿(质量检查与输出)
  • 进阶主题: 详见进阶主题

References

参考资料

Integration

集成

This skill enables:
  • Custom skill creation for any workflow
  • Capturing team processes as skills
  • Extending Claude Code capabilities
  • Documenting methodologies
Pairs with:
  • Existing skills as examples
  • Git workflows for versioning skills
  • Team documentation processes
Use this skill to create:
  • Methodology enforcement skills
  • Technical automation skills
  • Audit and validation skills
  • Domain knowledge skills
  • Tool integration skills
本Skill支持:
  • 为任意工作流创建自定义Skill
  • 将团队流程转化为Skill
  • 扩展Claude Code的能力
  • 记录方法论
可搭配使用的工具/流程:
  • 现有Skill作为示例
  • Git工作流用于Skill版本控制
  • 团队文档流程
可使用本Skill创建:
  • 方法论强制执行Skill
  • 技术自动化Skill
  • 审计与验证Skill
  • 领域知识Skill
  • 工具集成Skill",