mcpField
S
skill-creator

skill-creator

github.com/fearovex-labsAgent 工作流54 次安装
代码仓库

关于 skill-creator

skill-creator 是用于 Claude Code 的技能,可创建全局目录、特定项目或技术模板中的新技能。它会收集需求、确定格式,并在预览和确认后指导创建。

主要功能

  1. 01创建全局或项目专属技能
  2. 02支持技术技能模板
  3. 03收集需求与触发条件
  4. 04推断并确认技能格式
  5. 05创建前预览内容

适用场景

  1. 01为单个项目创建技能
  2. 02向全局目录添加可复用技能
  3. 03搭建特定技术的技能模板

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/fearovex-labs/agent-config --skill skill-creator

安装后在 Claude Code 中输入/skill-creator确认已加载。

详细介绍

skill-creator

创建新技能,可用于全局目录,也可专用于当前项目。

触发条件:skill:create、create skill、new skill、generate skill


模式 /skill-create <name>

创建技能。根据上下文决定放置位置(见下文的流程)——新建通用技能、项目专属技能或技术模板。询问技能类型:

  • 通用 → 放在 ~/.claude/skills/<name>/SKILL.md(适用于所有项目)
  • 项目专属 → 放在 .claude/skills/<name>/SKILL.md(仅适用于当前项目)

例外 — agent-config 仓库:此仓库就是 ~/.claude/ 的源目录。在此仓库中工作时:

  • “通用”放置位置 → 写入 <repo>/skills/<name>/SKILL.md(而不是 ~/.claude/skills/)。install.sh 会部署它。
  • “项目专属”不适用 — 此仓库自身没有 .claude/;它拥有的所有内容都是全局内容。
  • 绝不要从此仓库直接写入 ~/.claude/skills/;下次运行 install.sh 时会覆盖它。

流程:/skill-create

步骤 1 — 收集信息

上下文检测(显示放置位置提示前运行):

is_claude_config = (
  file_exists("install.sh")
  AND (
    project root contains install.sh AND skills/_shared/
    OR basename(cwd) == "agent-config"
  )
)

has_project_context = (
  dir_exists(".claude")
)

is_tech_skill = name matches any of:
  react*, vue*, angular*, svelte*, next*, nuxt*, remix*,
  prisma*, drizzle*, sequelize*, typeorm*, mongoose*,
  zod*, yup*, valibot*,
  tailwind*, bootstrap*, chakra*,
  typescript*, javascript*, node*,
  python*, django*, fastapi*, flask*,
  rails*, laravel*, spring*,
  go-*, rust-*, kotlin*, swift*,
  zustand*, redux*, jotai*, mobx*, recoil*,
  react-native*, expo*,
  playwright*, vitest*, jest*, cypress*, storybook*

if is_tech_skill AND NOT is_claude_config:
  default_placement = "project-local"      → option 1
  rationale = "Tech-specific skills belong in the consuming project's
               .claude/skills/, not the global catalog. See CLAUDE.md rule."
elif is_tech_skill AND is_claude_config:
  default_placement = "_templates/tech/"   → option 3 (template-only)
  rationale = "In agent-config repo, tech skills go to skills/_templates/tech/
               so skill-creator can scaffold them into consumer projects."
elif has_project_context AND NOT is_claude_config:
  default_placement = "project-local"      → option 1
else:
  default_placement = "global"             → option 2

提出创建实用技能所需的问题。 放置位置提示必须使用 [DEFAULT] 标记反映检测到的默认选项:

当 default_placement = "project-local" 时:

Is this skill for this specific project or for all your projects?
  1. This project only → .claude/skills/  [DEFAULT]
  2. Global catalog    → ~/.claude/skills/

What does this skill do? (one-sentence description)

When should it activate? (what situations trigger its use?)

Are there specific code patterns, commands, or processes it should know about?

当 default_placement = "global" 时:

Is this skill for this specific project or for all your projects?
  1. This project only → .claude/skills/
  2. Global catalog    → ~/.claude/skills/  [DEFAULT]

What does this skill do? (one-sentence description)

When should it activate? (what situations trigger its use?)

Are there specific code patterns, commands, or processes it should know about?

当 default_placement = "_templates/tech/"(agent-config 仓库内的技术技能)时:

This is a tech-specific skill. It will NOT be deployed globally.
Save as a template at `skills/_templates/tech/<name>/` so `skill-creator`
can scaffold it into consumer projects on demand.

Confirm [Y/n]:

当上下文不明确(has_project_context 和 is_claude_config 均不匹配)时:

Is this skill for this specific project or for all your projects?
  1. This project only → .claude/skills/
  2. Global catalog    → ~/.claude/skills/

What does this skill do? (one-sentence description)

When should it activate? (what situations trigger its use?)

Are there specific code patterns, commands, or processes it should know about?

用户可以按 Enter 或选择编号选项来接受默认值。 如果用户已在命令中提供足够的上下文,则跳过显而易见的问题。

步骤 1b — 选择格式类型

生成骨架前,确定技能的格式类型。先应用推断规则,然后始终向用户展示结果以供确认。

推断规则(按顺序应用;遇到首个匹配项即停止):

  1. 技能名称匹配 *-antipatterns 或 *-anti-patterns → 推断为 anti-pattern
  2. 技能名称是某种技术或库的名称(例如,包含已知框架名称、-19、-5、-4 等版本后缀,或语言名称)→ 推断为 reference
  3. 技能名称以动作动词开头,或匹配 SDD/元工具模式(例如 sdd-*、project-*、memory-*、deploy-*、run-*)→ 推断为 procedural
  4. 均不匹配 → 不作推断,直接询问用户

继续前始终向用户展示格式:

Format type for this skill:
  Inferred: [procedural | reference | anti-pattern | none — please select]

Available formats (full contract: docs/format-types.md):
  1. procedural   — orchestrates a sequence of steps (SDD phases, meta-tools, workflows)
  2. reference    — provides patterns and examples for a technology or library
  3. anti-pattern — catalogs things to avoid (use for anti-pattern-focused skills)

Confirm [1/2/3] or press Enter to accept inferred:

如果 docs/format-types.md 不存在:

⚠️ WARNING: docs/format-types.md not found — skill-format-types change may not be applied.
Defaulting to procedural format.

继续使用 procedural,不要阻止技能创建。

将确认的格式存储为 $SELECTED_FORMAT,供步骤 3 使用。

步骤 2 — 如果是项目技能:分析代码

阅读现有项目代码,以便:

  • 检测需要记录的实际模式
  • 查找可纳入技能的实际示例
  • 确定必须避免的现有反模式
步骤 3 — 生成技能

根据步骤 1b 中的 $SELECTED_FORMAT 生成骨架。每种骨架都在 YAML frontmatter 中包含 format: $SELECTED_FORMAT,并符合该格式的章节要求。 完整要求定义于 docs/format-types.md。

如果 $SELECTED_FORMAT 为 procedural:

---
name: [skill-name]
description: >
  [one-line description]
format: procedural
---

# [skill-name]

> [One-line description. What it does and what it is for.]

**Triggers**: [word1, word2, situation1, situation2]

---

## Process

### Step 1 — [step name]

[Explain what this step does.]

### Step 2 — [step name]

[Explain what this step does.]

---

## Rules

- [constraint or invariant for this skill]
- [another constraint]

如果 $SELECTED_FORMAT 为 reference:

---
name: [skill-name]
description: >
  [technology] patterns for [use case].
format: reference
---

# [skill-name]

> [technology] patterns for [use case].

**Triggers**: [technology name], [use-case keyword]

---

## Patterns

### [Pattern 1]: [Descriptive name]

[Explanation of the pattern]

```[language]
[real example code]
```

[模式 2]:[描述性名称]

[说明]

[example code]

完整示例

[场景 1]

[完整、可执行的代码]

[场景 2]

[完整、可执行的代码]

快速参考

任务模式 / 命令
[常见任务][解决方案]

规则

  • [需要避免的约束或反模式]

**If `$SELECTED_FORMAT` is `anti-pattern`:**

```markdown
---
name: [skill-name]
description: >
  [technology] anti-patterns: [brief description].
format: anti-pattern
---

# [skill-name]

> [technology] anti-patterns: [brief description].

**Triggers**: [technology name] antipatterns, code review, refactoring

---

## Anti-patterns

### ❌ [Anti-pattern 1]: [Descriptive name]

**Why it is problematic**: [explanation]

```[language]
// ❌ Bad
[bad code]
// ✅ Good
[corrected code]
❌ [反模式 2]:[描述性名称]

存在问题的原因:[说明]


规则

  • [此技能的适用范围或使用约束]

### Step 4 — Preview and confirm

Show the content to be created and confirm with the user before writing.

### Step 5 — Create and register

1. Create the file at the corresponding path
2. If it is a project skill, suggest adding it to the project `CLAUDE.md` in the skills section
3. If it is a generic skill, add it to the registry in `~/.claude/CLAUDE.md`

---

## Global Catalog Skills

Current catalog available in `~/.claude/skills/`:

### SDD Phase Skills

| Skill | Purpose |
|-------|---------|
| `sdd-explore` | SDD exploration phase |
| `sdd-propose` | SDD proposal phase |
| `sdd-spec` | SDD specifications phase |
| `sdd-design` | SDD technical design phase |
| `sdd-tasks` | SDD task plan phase |
| `sdd-apply` | SDD implementation phase |
| `sdd-verify` | SDD verification phase |
| `sdd-archive` | SDD archive phase |
| `sdd-init` | SDD initialization in a project |
| `sdd-status` | SDD active changes status |

### Infrastructure / Meta-tools

| Skill | Purpose |
|-------|---------|
| `project-setup` | Deploy SDD + memory structure in a new project |
| `project-audit` | Configuration audit |
| `project-fix` | Apply audit corrections |
| `project-onboard` | Diagnose and recommend onboarding sequence |
| `memory-manage` | Manage ai-context/ (init/update/maintain) |
| `codebase-teach` | Analyze bounded contexts and write ai-context/features/ docs |
| `feature-domain-expert` | Author and consume feature-level domain knowledge files |
| `config-export` | Export Claude config to Copilot, Gemini, Cursor formats |
| `skill-creator` | Skill creation |
| `smart-commit` | Conventional commit message generation |

### Workflow

| Skill | Purpose |
|-------|---------|
| `branch-pr` | PR creation workflow |
| `issue-creation` | GitHub issue creation workflow |
| `project-tracking` | GitHub Project board + Issues backlog management |
| `judgment-day` | Parallel adversarial review protocol |

### Stack-agnostic global skills

| Skill | Purpose |
|-------|---------|
| `solid-ddd` | Language-agnostic SOLID principles and DDD tactical patterns |
| `ai-media-generation` | Key-security and cost-control governance for AI image/video/audio generation |

### Tech skill templates (NOT deployed globally)

Located at `skills/_templates/tech/<name>/` in the agent-config repo. NOT
copied to `~/.claude/skills/` by `install.sh`. `skill-creator` copies them
into a consumer project's `.claude/skills/<name>/` on demand.

| Template | Purpose |
|----------|---------|
| `go-testing` | Go testing patterns including Bubbletea TUI testing |
| `nextjs-15` | Next.js 15 App Router, Server Actions, data fetching |
| `react-19` | React 19 with React Compiler, Server Components, use() hook |
| `react-native` | React Native with Expo, navigation, NativeWind |
| `tailwind-4` | Tailwind CSS 4, cn() utility, dynamic styles |
| `typescript` | TypeScript strict mode, utility types, advanced patterns |
| `zustand-5` | State management with Zustand 5, slices, persistence |
| `frontend-aesthetics` | Visual-design criteria: pick a concrete aesthetic direction before coding, avoid AI slop |

---

## Rules

- Always use real project code as examples when it is a project skill
- Never invent patterns — extract them from existing code
- Minimum 3 code examples per skill (reference and anti-pattern formats)
- Preview and confirm before writing
- Register the new skill in the corresponding CLAUDE.md
- The format-selection step (Step 1b) MUST always run before skeleton generation — a skeleton is never written without a confirmed format type
- The `format:` field MUST be present in the YAML frontmatter of every SKILL.md generated by this skill
- If `docs/format-types.md` does not exist, default all new skills to `procedural` and emit WARNING: "docs/format-types.md not found — skill-format-types change may not be applied"
- Inference is a convenience — the user MUST always confirm or override the inferred type before the skeleton is written

评论

支持 Markdown