Skip to content

write-a-skill — Create Custom Skills

  • Trigger: /write-a-skill or keywords "create skill", "write a skill", "new skill"
  • Best for: Creating custom Skills, encapsulating team workflows
  • Not for: Modifying existing Skills (edit files directly)

Overview

write-a-skill helps you create new Claude Code Skills with complete guidance: structure design, Frontmatter configuration, prompt writing, and resource bundling.

Trigger Conditions

write-a-skill auto-triggers when you:

  • Mention "create a skill", "write a skill"
  • Want to encapsulate a repetitive workflow
  • Use the /write-a-skill command

Examples

Example 1: Simple Skill

/write-a-skill Create a skill that auto-generates docstrings for Python functions

Claude generates:

my-docstring-skill/
├── SKILL.md          # Skill entry (frontmatter + prompt)
└── resources/
    └── examples.md   # Reference examples

SKILL.md example:

markdown
---
name: python-docstring
description: Generate Google-style docstrings for Python functions
triggers:
  - "add docstring"
  - "generate docs for this function"
---

When activated, generate a Google-style Python docstring covering:
- Args (type + description)
- Returns (type + description)
- Raises (if applicable)
- Example usage

Follow PEP 257. Keep descriptions concise.

Example 2: Skill with Tools

/write-a-skill Create a DB migration skill that connects to PostgreSQL and validates migration safety

Example 3: Team Convention Skill

/write-a-skill Create a code review skill that checks against our team's 5 coding standards

Example 4: i18n Translation Skill

/write-a-skill Create an i18n skill for translating Chinese JSON translation files to English and Japanese

Example 5: CI/CD Skill

/write-a-skill Create a skill that checks if a PR meets our CI configuration requirements

Skill File Structure

skill-name/
├── SKILL.md          # Required: Skill entry file
└── resources/        # Optional: Additional resources
    ├── examples.md
    ├── templates/
    └── docs/

Notes

  • Use kebab-case for skill names
  • The description in frontmatter should be concise and distinct — it's key to trigger matching
  • Don't over-engineer — one Skill, one job
  • When testing, check both trigger precision and false positive rate
  • Resource files are for reference — they aren't fully loaded into context
  • update-config — Configure Skill permissions and hooks
  • init — Initialize project CLAUDE.md
  • simplify — Simplify verbose Skill prompts