Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

write-skill

БесплатноБез исполняемых скриптовНе проверен

Create or improve a Claude Code skill/slash command with best practices for structure, dynamic context, and safety. Use for creating new skills, improving…

drnот drn★ 23 звезды на GitHub

Об этом скилле

Skill Author

Create or improve Claude Code skills (slash commands) following established patterns and avoiding known pitfalls.

Arguments

  • $ARGUMENTS - What the skill should do, or the name of an existing skill to improve

Context

  • Global skills: !find ~/.claude/commands -maxdepth 1 -name "*.md" -exec basename {} .md \; 2>/dev/null | sort | head -20
  • Project skills (Agent Skills standard): !find . -maxdepth 3 -path "*/skills/*/SKILL.md" 2>/dev/null | head -20
  • Project skills (Claude Code standard): !find . -path "./claude/commands/*.md" 2>/dev/null | head -20
  • Project type: !find . -maxdepth 1 \( -name go.mod -o -name Gemfile -o -name package.json -o -name Cargo.toml -o -name pyproject.toml \) 2>/dev/null | head -3

Instructions

Step 1: Understand the Request

Determine whether the user wants to:

  • Create a new skill from a description
  • Improve an existing skill (read it first, then apply changes)

If creating, ask the user what the skill should do if $ARGUMENTS is vague.

Step 2: Design the Skill

Plan the skill structure:

  1. Frontmatter (YAML between --- fences)
  2. Context section (dynamic context via shell commands)
  3. Instructions (what Claude should do when the skill is invoked)

Step 3: Write the Skill File

Detect the project skill convention from the context above:

  • If the project has skills matching */skills/*/SKILL.md (Agent Skills standard), create <skills-dir>/<name>/SKILL.md
  • Otherwise, create claude/commands/<name>.md (Claude Code standard)

Follow all rules below carefully.


Skill File Reference

Frontmatter

All fields are optional. Only description is strongly recommended.

---
description: One-line summary of what this skill does and when to use it
allowed-tools: Bash(git *), Bash(npm test)
---
Field Purpose
description Drives auto-activation and / menu. Write in third person. Max 1024 chars. Include trigger keywords.
allowed-tools Tools Claude can use without asking permission. Glob patterns supported.
context Set to fork to run in an isolated subagent (no conversation history).
agent Subagent type when context: fork (e.g., Explore, Plan).
model Override model (e.g., sonnet for cheaper tasks).
disable-model-invocation true to prevent auto-loading (manual /name only). Use for destructive skills.
user-invocable false to hide from / menu (background knowledge only).

Dynamic Context

Inject live data by writing an exclamation mark followed by a command wrapped in backticks. The command runs locally and its output replaces the placeholder before Claude sees the prompt.

In the examples below, !{command} represents the actual syntax (exclamation mark + backtick + command + backtick). Curly braces are used here to prevent this skill file from executing its own examples.

## Context

- Current branch: !{git branch --show-current}
- Git status: !{git status --short}
- Project type: !{command ls -1 go.mod package.json Cargo.toml 2>/dev/null | head -3}

CRITICAL: No $() Command Substitution

Claude Code blocks $() inside dynamic context expressions for security reasons. This is the single most common authoring mistake.

# BROKEN — $() is blocked
- Branch commits: !{DEFAULT=$(git symbolic-ref ...) && git log origin/$DEFAULT..HEAD}
- Changes: !{git diff --stat HEAD...$(git symbolic-ref ...)}

# FIXED — detect base branch portably, provide both branches
- Base ref: !{git branch -r 2>/dev/null | grep -oE 'origin/(main|master)' | head -1}
- Commits vs main: !{git log origin/main..HEAD --oneline 2>/dev/null | head -20}
- Commits vs master: !{git log origin/master..HEAD --oneline 2>/dev/null | head -20}
# Triple-dot direction matters: `base...HEAD` shows changes ON the branch.
# `HEAD...base` shows changes ON base since branch diverged — the reverse.
- Changes vs main: !{git diff --stat origin/main...HEAD 2>/dev/null | head -50}
- Changes vs master: !{git diff --stat origin/master...HEAD 2>/dev/null | head -50}

Alternatives to $():

  • Pipe chains: command1 | command2 | command3
  • Error suppression: command 2>/dev/null (empty output on failure is fine)
  • Detect base branch: git branch -r | grep -oE 'origin/(main|master)' | head -1 — portable, no custom tools needed
  • Provide both branches: include origin/main and origin/master variants — one will be empty, the agent uses whichever has output
  • Separate context lines: split a complex command into multiple simpler dynamic context lines

Output Size Management

Always bound output to avoid blowing up the context window:

# GOOD — bounded output
- Files: !{find . -maxdepth 3 -name "*.go" 2>/dev/null | head -20}
- Commits: !{git log --oneline -10}

# BAD — unbounded, could be massive
- Files: !{find . -name "*.go"}
- Log: !{git log}

When chaining find -name clauses with -o, group them

Полный SKILL.md на GitHub

Установить write-skill в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл write-skill?

Create or improve a Claude Code skill/slash command with best practices for structure, dynamic context, and safety. Use for creating new skills, improving existing ones, or learning skill authoring.

Как установить скилл write-skill?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл write-skill запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить write-skill с