---
name: cc-skill
description: |
  Create or update Claude Code skills based on official documentation.
  Use this skill when:
  - Creating a new skill from scratch
  - Updating an existing skill's structure or content
  - Converting a simple skill to progressive step loading
argument-hint: "<create|update> [name] [--scope project|global|templates]"
disable-model-invocation: true
---

<objective>
Create or update Claude Code skills following official conventions. Guides the user through skill design, generates properly structured files, and validates the result.
</objective>

<quick_start>

```bash
# Create a new skill
/cc-skill create my-skill
/cc-skill create my-skill --scope project
/cc-skill create my-skill --scope global
/cc-skill create my-skill --scope templates

# Update an existing skill
/cc-skill update my-skill
/cc-skill update my-skill --scope global
```

</quick_start>

<parameters>

<subcommands>
| Command | Description | Workflow |
|---------|-------------|----------|
| `create` | Create a new skill from scratch | init → design → generate → steps → validate |
| `update` | Update an existing skill | init → analyze → apply → validate |
</subcommands>

<flags>
| Flag | Description |
|------|-------------|
| `--scope project` | Target `.claude/skills/` (default) |
| `--scope global` | Target `~/.claude/skills/` |
| `--scope templates` | Target `templates/skills/` (SmartStack CLI) |
| `--type simple` | Skip interactive type selection |
| `--type progressive` | Skip interactive type selection |
| `--type forked` | Skip interactive type selection |
</flags>

<examples>
```bash
# Create a simple skill in current project
/cc-skill create lint-check --type simple

# Create a progressive skill for SmartStack templates
/cc-skill create my-workflow --scope templates --type progressive

# Update an existing skill
/cc-skill update gitflow

# Create a forked research skill
/cc-skill create code-search --type forked
```
</examples>

</parameters>

<workflow>
**Create flow:**
1. Parse subcommand, name, scope, flags
2. Design skill (type, frontmatter, structure)
3. Generate SKILL.md with proper sections
4. Generate step files (if progressive)
5. Validate structure and conventions

**Update flow:**
1. Parse subcommand, name, scope
2. Read and analyze existing skill
3. Apply requested changes
4. Validate structure and conventions
</workflow>

<state_variables>
| Variable | Type | Description |
|----------|------|-------------|
| `{subcommand}` | string | create or update |
| `{skill_name}` | string | Skill name (lowercase, max 64 chars) |
| `{scope}` | string | project, global, or templates |
| `{target_dir}` | string | Resolved target directory |
| `{skill_type}` | string | simple, progressive, or forked |
| `{description}` | string | Skill description |
| `{user_invocable}` | boolean | Visible in /menu |
| `{disable_model_invocation}` | boolean | Manual only |
| `{allowed_tools}` | string | Tools without permission |
| `{model}` | string | Model override |
| `{argument_hint}` | string | Autocomplete hint |
| `{step_count}` | number | Number of steps (if progressive) |
| `{steps}` | object[] | Step definitions (name, description) |
</state_variables>

<entry_point>

**FIRST ACTION:** Load `steps/step-00-init.md`

</entry_point>

<step_files>
| Step | File | Purpose |
|------|------|---------|
| 00 | `steps/step-00-init.md` | Parse subcommand, name, scope, resolve target directory |
| 01 | `steps/step-01-design.md` | Choose skill type, gather frontmatter info via questions |
| 02 | `steps/step-02-generate.md` | Generate SKILL.md from template |
| 03 | `steps/step-03-steps.md` | Generate step files (progressive only) |
| 04 | `steps/step-04-validate.md` | Validate structure, display summary |
</step_files>

<execution_rules>
- **Load one step at a time** - Progressive loading
- **Ask before generating** - Confirm design choices with user
- **Use templates** - Load from `templates/` directory for generation
- **Follow official conventions** - Based on Claude Code documentation
- **Validate at the end** - Check all generated files
</execution_rules>

<success_criteria>
- Skill directory created with correct structure
- SKILL.md has valid frontmatter and sections
- Step files properly chained (if progressive)
- All file references valid
- Skill follows official Claude Code conventions
</success_criteria>
