Skills.MD
# Creating a New Skill
Follow this workflow when creating a new Claude Code Skill.
## 0) Fetch latest best practices (REQUIRED)
Before writing any skill content, you MUST fetch and read the latest documentation:
1. **Skills overview**: https://code.claude.com/docs/en/skills
2. **Best practices**: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/best-practices
Use WebFetch to retrieve these pages and extract key guidelines before proceeding.
## 1) Gather requirements
Ask the user:
- What task should this skill automate?
- What triggers should activate this skill? (keywords, file types, contexts)
- Should it be project-scoped (`.claude/skills/`) or personal (`~/.claude/skills/`)?
- What tools does it need? (Read, Grep, Glob, Bash, WebFetch, Write, etc.)
## 2) Review existing skills for patterns
Check existing skills in the project for naming conventions and structure:
```bash
ls -la .claude/skills/
```
Read similar skills if they exist to maintain consistency.
## 3) Create skill structure
### Directory structure
```
.claude/skills/<skill-name>/
├── SKILL.md # Main instructions (required)
├── reference/ # Optional: detailed docs
│ └── *.md
└── scripts/ # Optional: utility scripts
└── *.py|*.sh
```
### SKILL.md format (required fields)
```yaml
---
name: skill-name-in-kebab-case
description: Brief description of what this Skill does and when to use it. Include specific trigger keywords.
allowed-tools: Read, Grep, Glob # Optional: restrict tool access
---
# Skill Title
## Instructions
Clear, step-by-step guidance...
```
## 4) Apply best practices checklist
### Naming
- [ ] **REQUIRED**: Use `1k-` prefix for all OneKey project skills: `1k-date-formatting`, `1k-transaction-handling`
- [ ] Use gerund form after prefix: `1k-processing-pdfs`, `1k-analyzing-code`, `1k-creating-commits`
- [ ] Max 64 chars, lowercase letters/numbers/hyphens only
- [ ] No reserved words: "anthropic", "claude"
### Description
- [ ] Write in third person ("Processes...", not "I can help..." or "You can use...")
- [ ] Include what it does AND when to use it
- [ ] Include specific trigger keywords users would say
- [ ] Max 1024 chars
### Content
- [ ] Keep SKILL.md body under 500 lines
- [ ] Be concise - Claude is already smart
- [ ] Use progressive disclosure: put detailed content in separate files
- [ ] Keep file references one level deep from SKILL.md
- [ ] Use Unix-style paths (forward slashes)
- [ ] Avoid time-sensitive information
### Structure
- [ ] Provide concrete examples, not abstract descriptions
- [ ] Use consistent terminology throughout
- [ ] Include workflows for complex tasks
- [ ] Add validation/feedback loops for quality-critical tasks
## 5) Output the skill
After gathering requirements and applying best practices:
1. Create the skill directory
2. Write SKILL.md with proper frontmatter
3. Add reference files if needed (for content > 500 lines)
4. Summarize what was created
## Example: Simple skill
```yaml
---
name: 1k-generating-commit-messages
description: Generates clear commit messages from git diffs. Use when writing commit messages or reviewing staged changes.
---
# Generating Commit Messages
## Instructions
1. Run `git diff --staged` to see changes
2. Suggest a commit message with:
- Summary under 50 characters
- Detailed description
- Affected components
## Best practices
- Use present tense
- Explain what and why, not how
```
> **Note**: All OneKey project skills MUST use the `1k-` prefix in the skill name.
## Anti-patterns to avoid
- Vague descriptions like "Helps with documents"
- Multiple approaches without clear defaults
- Assuming packages are installed without listing them
- Windows-style paths (`\` instead of `/`)
- Deeply nested file references (keep one level deep)
- Over-explaining what Claude already knows
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「new-skill」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次