---
name: step-00-init
description: Parse subcommand, skill name, scope, and resolve target directory
next_step: steps/step-01-design.md
---

# Step 0: Initialization

## MANDATORY EXECUTION RULES:
- ALWAYS parse subcommand first (create or update)
- ALWAYS validate skill name format
- ALWAYS resolve target directory before proceeding
- For UPDATE: verify skill exists before continuing

## YOUR TASK:
Parse input arguments, validate the skill name, and resolve the target directory.

---

## EXECUTION SEQUENCE:

### 1. Parse Input

```
Arguments from $ARGUMENTS:
  First word  → {subcommand} ("create" or "update")
  Second word → {skill_name} (lowercase, kebab-case)
  --scope X   → {scope} (default: "project")
  --type X    → {skill_type} (optional, skip type selection in step-01)

Valid subcommands: create, update
Valid scopes: project, global, templates
Valid types: simple, progressive, forked
```

If {subcommand} is missing or invalid:

```yaml
AskUserQuestion:
  header: "Action"
  question: "What do you want to do?"
  options:
    - label: "Create"
      description: "Create a new skill from scratch"
    - label: "Update"
      description: "Update an existing skill"
```

### 2. Validate Skill Name

If {skill_name} missing:

```yaml
AskUserQuestion:
  header: "Name"
  question: "What is the skill name? (lowercase, kebab-case, max 64 chars)"
```

Validation rules:
- Lowercase only
- Kebab-case (hyphens, no spaces or underscores)
- Max 64 characters
- No special characters except hyphens
- Must not conflict with existing built-in commands (/help, /clear, /compact, etc.)

### 3. Resolve Target Directory

```
Based on {scope}:

  "project" →
    {target_dir} = "{cwd}/.claude/skills/{skill_name}/"

  "global" →
    {target_dir} = "~/.claude/skills/{skill_name}/"
    Resolve ~ to actual home directory

  "templates" →
    {target_dir} = "{cwd}/templates/skills/{skill_name}/"
    Verify this is a SmartStack CLI project (templates/ exists)
```

### 4. Check Existing

**For CREATE:**
- Verify {target_dir} does NOT already exist
- If exists: warn and ask to overwrite or switch to update

**For UPDATE:**
- Verify {target_dir} exists and contains SKILL.md
- If missing: warn and ask to switch to create
- If exists: read SKILL.md and extract current frontmatter

### 5. Show Summary

```
Skill Configuration:

| Setting | Value |
|---------|-------|
| Action | {subcommand} |
| Name | {skill_name} |
| Scope | {scope} |
| Target | {target_dir} |
| Type | {skill_type} (if pre-set) |

→ Designing skill...
```

---

## SUCCESS METRICS:
- Subcommand correctly identified
- Skill name validated
- Target directory resolved and checked
- Summary displayed

## NEXT STEP:
After showing summary, proceed directly to `./step-01-design.md`
