---
name: step-04-validate
description: Validate generated skill structure and display final summary
---

# Step 4: Validate Skill

## MANDATORY EXECUTION RULES:
- Validate ALL generated files
- Check frontmatter completeness
- Verify step chaining (if progressive)
- Display actionable report if issues found

## YOUR TASK:
Validate the generated skill against official Claude Code conventions and display a final summary.

---

## EXECUTION SEQUENCE:

### 1. Read Generated Files

```
Read: "{target_dir}/SKILL.md"

If progressive:
  Glob: "{target_dir}/steps/step-*.md"
  Read each step file
```

### 2. Validate SKILL.md

**Frontmatter checks:**
- [ ] `name` exists, lowercase, max 64 chars
- [ ] `description` exists, non-empty
- [ ] `argument-hint` present (if skill accepts args)
- [ ] `disable-model-invocation` set for side-effect skills
- [ ] `model` is valid (inherit/haiku/sonnet/opus) or absent

**Content checks:**
- [ ] Has `<objective>` section
- [ ] Has `<quick_start>` with examples
- [ ] Line count < 500
- [ ] No unreplaced placeholders (e.g., `{placeholder}`)

**Progressive-specific checks:**
- [ ] Has `<entry_point>` pointing to first step
- [ ] Has `<step_files>` listing all steps
- [ ] Has `<state_variables>` documenting persistent state
- [ ] Has `<workflow>` describing high-level flow

### 3. Validate Step Files (if progressive)

For each step file:
- [ ] Has YAML frontmatter with `name` and `description`
- [ ] Has `next_step` (except last step)
- [ ] `next_step` path resolves to existing file
- [ ] Has sections: YOUR TASK, EXECUTION SEQUENCE, SUCCESS METRICS
- [ ] Last step has completion message (no next_step)

**Chain validation:**
```
step-00 → step-01 → step-02 → ... → step-N (final)
Verify: each next_step file exists
Verify: no circular references
Verify: no orphan steps (steps not in chain)
```

### 4. Validate File References

Check all file paths referenced in SKILL.md and step files:
- Templates referenced exist in `templates/`
- References referenced exist in `references/`
- Scripts referenced exist in `scripts/`

### 5. Display Validation Report

```
Skill Validation Report:

| Check | Status |
|-------|--------|
| Frontmatter complete | PASS/FAIL |
| Content sections | PASS/FAIL |
| Line count ({N} lines) | PASS/WARN |
| Step chaining | PASS/FAIL/N/A |
| File references | PASS/FAIL |

{If any FAIL: show specific issues and recommendations}
```

### 6. Display Final Summary

```
Skill Created Successfully!

| Property | Value |
|----------|-------|
| Name | {skill_name} |
| Type | {skill_type} |
| Location | {target_dir} |
| Invocation | /cc-skill {skill_name} |
| Files | {file_count} |

Files created:
  {target_dir}/SKILL.md
  {target_dir}/steps/step-00-init.md (if progressive)
  {target_dir}/steps/step-01-*.md (if progressive)
  ...

Next steps:
- Test the skill: /{skill_name}
- Add references: {target_dir}/references/
- Add templates: {target_dir}/templates/
- Run audit: /cc-audit
```

---

## SUCCESS METRICS:
- All validations pass (or issues clearly reported)
- Final summary displayed with file list
- Next steps provided to the user
- Skill is ready to use
