claude-code-templates

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Claude Code Templates

Claude Code 模板

Starter templates for building Claude Code extensions.
用于构建Claude Code扩展的入门模板。

Template Selection

模板选择

BuildingTemplateKey Features
Expert persona
agent-template.md
Focus areas, quality checklist, references
Tool capability
skill-template.md
Commands, examples, triggers
User workflow
command-template.md
Execution flow, options
Automation
hook-script.sh
Input parsing, exit codes
构建类型模板核心特性
专家角色
agent-template.md
关注领域、质量检查清单、参考资料
工具能力
skill-template.md
命令、示例、触发条件
用户工作流
command-template.md
执行流程、选项
自动化
hook-script.sh
输入解析、退出码

Quick Start

快速开始

Create an Agent

创建Agent

bash
undefined
bash
undefined

Copy template

Copy template

cp ~/.claude/skills/claude-code-templates/assets/agent-template.md
~/.claude/agents/my-expert.md
cp ~/.claude/skills/claude-code-templates/assets/agent-template.md
~/.claude/agents/my-expert.md

Edit: name, description, focus areas, references

Edit: name, description, focus areas, references

undefined
undefined

Create a Skill

创建Skill

bash
undefined
bash
undefined

Create skill directory

Create skill directory

mkdir -p ~/.claude/skills/my-skill
mkdir -p ~/.claude/skills/my-skill

Copy template

Copy template

cp ~/.claude/skills/claude-code-templates/assets/skill-template.md
~/.claude/skills/my-skill/SKILL.md
cp ~/.claude/skills/claude-code-templates/assets/skill-template.md
~/.claude/skills/my-skill/SKILL.md

Edit: name, description, commands, examples

Edit: name, description, commands, examples

undefined
undefined

Create a Command

创建命令

bash
undefined
bash
undefined

Copy template

Copy template

cp ~/.claude/skills/claude-code-templates/assets/command-template.md
~/.claude/commands/my-command.md
cp ~/.claude/skills/claude-code-templates/assets/command-template.md
~/.claude/commands/my-command.md

Edit: name, description, execution flow

Edit: name, description, execution flow

undefined
undefined

Create a Hook Script

创建钩子脚本

bash
undefined
bash
undefined

Copy template

Copy template

cp ~/.claude/skills/claude-code-templates/assets/hook-script.sh
.claude/hooks/my-hook.sh
cp ~/.claude/skills/claude-code-templates/assets/hook-script.sh
.claude/hooks/my-hook.sh

Make executable

Make executable

chmod +x .claude/hooks/my-hook.sh
undefined
chmod +x .claude/hooks/my-hook.sh
undefined

Template Locations

模板位置

Templates are in
./assets/
:
FilePurpose
agent-template.md
Expert agent boilerplate
skill-template.md
Skill with YAML frontmatter
command-template.md
Slash command scaffold
hook-script.sh
Secure hook script template
模板位于
./assets/
目录下:
文件用途
agent-template.md
专家Agent脚手架
skill-template.md
带YAML前置内容的Skill
command-template.md
斜杠命令脚手架
hook-script.sh
安全钩子脚本模板

Naming Conventions

命名规范

TypePatternExample
Agent
{technology}-expert.md
react-expert.md
Skill
{tool-or-pattern}/SKILL.md
git-workflow/SKILL.md
Command
{action}.md
review.md
Hook
{event}-{action}.sh
pre-write-validate.sh
类型命名模式示例
Agent
{technology}-expert.md
react-expert.md
Skill
{tool-or-pattern}/SKILL.md
git-workflow/SKILL.md
命令
{action}.md
review.md
钩子
{event}-{action}.sh
pre-write-validate.sh

Validation

验证

bash
undefined
bash
undefined

Validate YAML frontmatter

Validate YAML frontmatter

head -20 my-extension.md
head -20 my-extension.md

Check name matches filename

Check name matches filename

grep "^name:" my-extension.md
grep "^name:" my-extension.md

Run project tests

Run project tests

just test
undefined
just test
undefined

Official Documentation

官方文档

Assets

资源文件

  • ./assets/agent-template.md
    - Expert agent scaffold
  • ./assets/skill-template.md
    - Skill with references pattern
  • ./assets/command-template.md
    - Slash command scaffold
  • ./assets/hook-script.sh
    - Secure bash hook template

See Also:
claude-code-debug
for troubleshooting extensions
  • ./assets/agent-template.md
    - 专家Agent脚手架
  • ./assets/skill-template.md
    - 带参考模式的Skill
  • ./assets/command-template.md
    - 斜杠命令脚手架
  • ./assets/hook-script.sh
    - 安全bash钩子模板

另请参阅:
claude-code-debug
用于排查扩展问题