---
name: update-spec-kit
description: Update the spec-kit repository, CLI tool, and all project templates to the latest version. Use when the user asks to update spec-kit, upgrade spec-kit templates, refresh spec-kit projects, or sync spec-kit to latest.
---

# Update Spec-Kit

This skill updates the spec-kit ecosystem to the latest version across three levels:

1. **Spec-kit repository** - Pull latest commits from upstream
2. **Specify CLI tool** - Upgrade the installed CLI to latest
3. **Project templates** - Update all projects using spec-kit to latest templates

## When to Use

Invoke this skill when the user requests:
- "Update spec-kit"
- "Upgrade spec-kit to latest"
- "Refresh spec-kit templates in my projects"
- "Sync all spec-kit projects"
- "Make sure spec-kit is up to date"

## Process

### Step 1: Update Spec-Kit Repository

Navigate to the spec-kit repository and update:

```bash
cd ~/proj/spec-kit
git fetch origin
git log --oneline main..origin/main  # Show what's new
git pull --ff-only origin main
```

Report the number of new commits and releases to the user.

### Step 2: Update Specify CLI Tool

Update the globally installed CLI:

```bash
uv tool install specify-cli --force --from git+https://github.com/github/spec-kit.git
```

Verify the installation:

```bash
specify --help
```

### Step 3: Update All Project Templates

Find all projects with spec-kit installed and update them:

```bash
~/.claude/skills/update-spec-kit/scripts/update-all-projects.sh
```

This script:
- Finds all directories with `.specify` folders
- Detects which AI agent each project uses (claude, cursor, copilot, etc.)
- Runs `specify init --here --force --ai <agent>` in each project
- Preserves all user work (specs, code, settings)
- Only updates template files (commands, scripts)

## Important Notes

**Safe Operations:**
- Templates are merged/overwritten
- User work in `.specify/specs/` is never touched
- Source code and git history are preserved
- `.vscode/settings.json` is smart-merged (not replaced)

**What Gets Updated:**
- Slash command files (`.claude/commands/*.md`, `.opencode/command/*.md`)
- Helper scripts (`.specify/scripts/`)
- Template files (`.specify/templates/`)

**What Stays:**
- All your specifications (`.specify/specs/`)
- Your source code
- Git history
- Custom VS Code settings (merged intelligently)

## Output Format

After completion, report:
1. Number of commits pulled from upstream
2. New version tags/releases available
3. List of projects updated
4. Brief summary of major changes (check CHANGELOG.md)

## Error Handling

If updates fail:
- Check internet connectivity
- Verify git repository is clean (no uncommitted changes)
- Ensure `uv` is installed and working
- Check that projects have `.specify` directories

## Examples

**User Request:**
> "Update spec-kit and all my projects"

**Skill Action:**
1. Navigate to ~/proj/spec-kit
2. Pull latest changes
3. Show: "Pulled 28 new commits (v0.0.72 → v0.0.79)"
4. Upgrade CLI tool
5. Find 7 projects with spec-kit
6. Update each project to v0.0.79
7. Report: "Updated: klmgraph, talu, ops-red, ops-jrz1, wifi-tester, delbaker"

---

**User Request:**
> "Are my spec-kit projects current?"

**Skill Action:**
1. Check spec-kit repo status
2. Compare installed CLI version
3. Compare one project's templates with latest
4. Report status and suggest update if needed

## Requirements

- Spec-kit repository at `~/proj/spec-kit`
- `uv` package manager installed
- `specify` CLI tool installed
- Projects with `.specify` directories in `~/proj`

## Helper Scripts

### update-all-projects.sh

**Purpose**: Batch update all projects using spec-kit

**Location**: `~/.claude/skills/update-spec-kit/scripts/update-all-projects.sh`

**What it does**:
1. Finds all projects with `.specify` directories
2. Detects AI agent for each project
3. Updates templates using `specify init --force`
4. Reports results

**Agent Detection**:
- Checks for `.claude/` directory → `claude`
- Checks for `.cursor/` directory → `cursor-agent`
- Checks for `.gemini/` directory → `gemini`
- Checks for `.github/copilot-instructions.md` → `copilot`
- Defaults to `claude` if unclear
