---
description: Create a SmartStack skill extension project with multi-phase workflow
argument-hint: <name> [phases] [description]
---

# Create Skill Extension

Scaffold a complete SmartStack **skill** extension with multi-phase workflow.

## What is a Skill?

A skill is a complex multi-phase orchestrator:
- Manages workflows with multiple phases
- Each phase can use different models (cost optimization)
- Contains templates, questionnaires, validation gates
- Produces structured output (documentation, code, etc.)

## Arguments

Parse from `$ARGUMENTS`:
- **name** (required): Skill name in kebab-case
- **phases** (optional): Number of phases (default: 5)
- **description** (optional): What the skill does

## Project Structure

```
smartstack-{name}/
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── README.md
├── .gitignore
├── src/
│   └── index.ts
└── templates/
    └── skills/
        └── {name}/
            ├── SKILL.md           # Main skill definition
            ├── 1-setup.md         # Phase 1
            ├── 2-analyze.md       # Phase 2
            ├── 3-design.md        # Phase 3
            ├── 4-execute.md       # Phase 4
            ├── 5-validate.md      # Phase 5
            └── templates.md       # Shared templates
```

## Generated SKILL.md

```markdown
---
name: {name}
description: |
  {description}
  Use when:
  - User needs {name} functionality
  - User mentions related keywords
---

# {PascalCaseName} Skill

{description}

## Overview

Multi-phase workflow for {name} operations.

## Phase Summary

| Phase | Command | Description | Model | Cost |
|-------|---------|-------------|-------|------|
| 1 | `/{name}:1-setup` | Initial setup and configuration | Haiku | ~$0.02 |
| 2 | `/{name}:2-analyze` | Analysis and discovery | Sonnet | ~$0.10 |
| 3 | `/{name}:3-design` | Design and planning | Sonnet | ~$0.10 |
| 4 | `/{name}:4-execute` | Implementation | Opus | ~$0.30 |
| 5 | `/{name}:5-validate` | Validation and testing | Sonnet | ~$0.10 |
| **Total** | | | | ~$0.62 |

## Workflow Diagram

╔═══════════╗     ╔═══════════╗     ╔═══════════╗
║  1-SETUP  ║ ──▶ ║ 2-ANALYZE ║ ──▶ ║ 3-DESIGN  ║
║  (Haiku)  ║     ║ (Sonnet)  ║     ║ (Sonnet)  ║
╚═══════════╝     ╚═══════════╝     ╚═══════════╝
                                          │
      ╔═══════════╗     ╔═══════════╗     ▼
      ║ COMPLETE  ║ ◀── ║ 5-VALIDATE║ ◀── ╔═══════════╗
      ║           ║     ║ (Sonnet)  ║     ║ 4-EXECUTE ║
      ╚═══════════╝     ╚═══════════╝     ║  (Opus)   ║
                                          ╚═══════════╝

## Output Location

Generated files go to:
- Working directory: `./{name}/`
- Or specified output path

## Available Commands

| Command | Description |
|---------|-------------|
| `/{name}` | Run complete workflow (all phases) |
| `/{name}:1-setup` | Run setup phase only |
| `/{name}:2-analyze` | Run analysis phase only |
| `/{name}:3-design` | Run design phase only |
| `/{name}:4-execute` | Run execution phase only |
| `/{name}:5-validate` | Run validation phase only |

## Absolute Rules

1. **NEVER** skip phases in sequence mode
2. **ALWAYS** validate before proceeding
3. **PRESERVE** existing configurations
4. **DOCUMENT** all decisions
5. **COST-OPTIMIZE** model selection

## Context Variables

Available in all phases:
- `$NAME` - Skill name
- `$PHASE` - Current phase number
- `$OUTPUT_DIR` - Output directory
- `$ARGUMENTS` - User arguments

## Priority

Quality > Cost > Speed
```

## Generated Phase Template (example: 1-setup.md)

```markdown
---
description: Phase 1 - Setup and configuration
argument-hint: [output-dir]
---

# Phase 1: Setup

## Objective

Initialize the {name} workflow environment.

## Prerequisites

- None (this is the first phase)

## Steps

### 1.1 Parse Arguments
- Extract output directory from `$ARGUMENTS`
- Default to `./{name}/` if not specified

### 1.2 Create Directory Structure
```
{output-dir}/
├── config/
├── output/
└── logs/
```

### 1.3 Initialize Configuration
- Create default config file
- Set up logging

## Output

- Directory structure created
- Configuration initialized
- Ready for Phase 2

## Validation Checklist

- [ ] Output directory exists
- [ ] Config file created
- [ ] No errors encountered

## Next Phase

Proceed to: `/{name}:2-analyze`

---

User: $ARGUMENTS
```

## Workflow

1. Parse arguments (name, phases, description)
2. Validate name format
3. Create project directory
4. Generate SKILL.md
5. Generate each phase template
6. Generate templates.md
7. Display success message

---

User: $ARGUMENTS
