Claude
Skills
Sign in
Back

ship

Included with Lifetime
$97 forever

Team-orchestrated implement → verify → fix → archive cycle

Code Review

What this skill does


Ship a change through team-orchestrated implementation, dual verification, leader-driven fixing, and archival.

**Input**: Optionally specify a change name (e.g., `/opsx:ship my-feature`). If omitted, prompt for selection.

**Team Structure**

| Role | Agent Type | Phase | Responsibility |
|------|-----------|-------|----------------|
| Leader | Main agent (you) | All | Orchestration, OpenSpec verify, direct fix, archive |
| implementer | general-purpose | 1 | Task implementation (apply methodology) |
| reviewer | general-purpose | 2, 3 | Codex code review (spawned on-demand at Phase 2) |

**Steps**

1. **Select the change**

   If name provided, use it. Otherwise run `openspec list --json` and use **AskUserQuestion** to let the user select.

   **IMPORTANT**: Do NOT guess or auto-select. Always let the user choose if not provided.

2. **Verify prerequisites**

   ```bash
   openspec status --change "<name>" --json
   ```

   Confirm the tasks artifact exists. If tasks don't exist, suggest running `/opsx:continue` first and stop.

   **Codex availability check:**

   ```bash
   which codex
   ```

   If `codex` is not installed, use **AskUserQuestion** to present options:
   1. "Install Codex, then re-run `/opsx:ship`" — stop workflow
   2. "Proceed without Codex (OpenSpec verify only, skip code review)" — continue with `CODEX_AVAILABLE=false`
   3. "Abort" — stop workflow

   Store the result as `CODEX_AVAILABLE` (true/false) for use in later phases.

3. **Create team and spawn implementer**

   **TeamCreate**:
   - `team_name`: `ship-<change-name>`
   - `description`: `Ship change: <change-name>`

   Spawn **only the implementer** using the **Task** tool (reviewer is spawned later in Phase 2):

   **implementer** teammate:
   - `subagent_type`: `general-purpose`
   - `team_name`: `ship-<change-name>`
   - `name`: `implementer`
   - `mode`: `bypassPermissions`
   - `run_in_background`: `true`
   - `prompt`:
     ```
     You are the **implementer** in team "ship-CHANGENAME".

     Your job: implement all tasks from OpenSpec change "CHANGENAME".

     ## How to implement

     Read planning artifacts for context:
     - openspec/changes/CHANGENAME/proposal.md — intent and scope
     - openspec/changes/CHANGENAME/design.md — technical approach
     - openspec/changes/CHANGENAME/specs/ — requirements
     - openspec/changes/CHANGENAME/tasks.md — implementation checklist

     Read project patterns from CLAUDE.md.

     For each unchecked task (`- [ ]`) in tasks.md:
     1. Understand the task from context
     2. Make the code changes required
     3. Keep changes minimal and focused
     4. Mark task complete: `- [ ]` → `- [x]`
     5. Send progress to leader via SendMessage: "Task N/M complete: <description>"

     After all tasks complete:
     - Send final summary to leader via SendMessage listing all completed tasks

     ## Workflow

     1. Check TaskList for assigned tasks
     2. When you have an implement task, run the implementation
     3. Send progress updates to leader via SendMessage
     4. Mark TaskList task completed via TaskUpdate
     5. Check TaskList for next work

     IMPORTANT: Follow project patterns from CLAUDE.md.
     IMPORTANT: Always communicate progress to the leader via SendMessage.
     IMPORTANT: If a task is unclear or blocked, report to leader instead of guessing.
     ```

   Replace `CHANGENAME` in the prompt with the actual change name before spawning.

4. **Phase 1: Implement**

   - **TaskCreate**: subject "Implement all tasks for <change-name>"
   - **TaskUpdate**: assign owner to `implementer`
   - **SendMessage** to `implementer`: "Implement all tasks for change <change-name>. Read artifacts, implement each task, mark checkboxes, and send me progress updates."

   Wait for implementer to complete. The implementer will send progress messages and a final summary.

   **Error handling**: If implementer fails or crashes:
   - Read `openspec/changes/<name>/tasks.md` to assess partial progress
   - Report to user: "Implementer failed. N/M tasks completed. Remaining: [list]"
   - Use **AskUserQuestion**: "Continue with leader implementing remaining tasks?" / "Abort and retry later"
   - If user chooses to continue, leader implements remaining tasks directly

   After implementer reports completion:
   - Read tasks.md to verify all checkboxes are checked
   - If incomplete tasks remain, send implementer back to finish them
   - Report progress to user: "Phase 1 complete: N/N tasks implemented"

   **Shutdown implementer immediately after Phase 1:**
   - **SendMessage** type `shutdown_request` to `implementer`
   - Do not wait — proceed to Phase 2 while shutdown processes

5. **Phase 2: Dual Verify**

   **a. Spawn and start reviewer (background, if CODEX_AVAILABLE)**

   Only if `CODEX_AVAILABLE=true`:

   Spawn **reviewer** teammate using the **Task** tool:
   - `subagent_type`: `general-purpose`
   - `team_name`: `ship-<change-name>`
   - `name`: `reviewer`
   - `mode`: `bypassPermissions`
   - `run_in_background`: `true`
   - `prompt`:
     ```
     You are the **reviewer** in team "ship-CHANGENAME".

     Your job: run Codex code review against the implementation for change "CHANGENAME".

     ## How to review

     When you receive a review task:

     1. Read the review prompt template: .codex/prompts/code-review.md
     2. Identify files changed for this change by reading:
        - openspec/changes/CHANGENAME/tasks.md (completed tasks reference files)
        - openspec/changes/CHANGENAME/design.md (affected files listed)
     3. Run Codex review:

        ```bash
        codex exec \
          --dangerously-bypass-approvals-and-sandbox \
          -m gpt-5.3-codex \
          "Review the code changes for OpenSpec change CHANGENAME. Follow the review methodology in .codex/prompts/code-review.md. Read the change artifacts at openspec/changes/CHANGENAME/ for context. Write the full review report."
        ```

     4. Parse the Codex output and write structured review to:
        openspec/changes/CHANGENAME/review-report.md

     5. Send summary to leader via SendMessage:
        Include CRITICAL/WARNING/SUGGESTION counts and overall assessment.

     6. Mark task completed via TaskUpdate
     7. Check TaskList for next work

     ## Output Format

     Write review to: openspec/changes/CHANGENAME/review-report.md

     ```
     # Code Review: CHANGENAME

     ## Summary
     | Dimension       | Finding Count | Max Severity |
     |-----------------|---------------|--------------|
     | Security        | N             | ...          |
     | Performance     | N             | ...          |
     | Correctness     | N             | ...          |
     | Maintainability | N             | ...          |

     ## CRITICAL
     - [finding] — `file.ts:line` — Recommendation: ...

     ## WARNING
     - [finding] — `file.ts:line` — Recommendation: ...

     ## SUGGESTION
     - [finding] — `file.ts:line` — Recommendation: ...

     ## Assessment
     [Summary of overall code quality and readiness]
     ```

     IMPORTANT: Only review, do NOT modify code.
     IMPORTANT: Always communicate results to the leader via SendMessage.
     ```

   Replace `CHANGENAME` in the prompt with the actual change name before spawning.

   Then:
   - **TaskCreate**: subject "Code review for <change-name>"
   - **TaskUpdate**: assign owner to `reviewer`
   - **SendMessage** to `reviewer`: "Run Codex code review for change <change-name>. Write review-report.md and send me the summary."

   **b. Leader runs OpenSpec verify (foreground)**

   Follow the verification methodology from `.claude/commands/opsx/verify.md` (steps 2-8):
   - Read all change artifacts
   - Verify Completeness (task + spec coverage)
   - Verify Correctness (requirement implementation, scenario coverage)
   - Verify Coherence (design adherence, pattern consistency)
   - Write report to `openspec/changes/<name>/verify-report.md`

   **c. Collect and merge results

Related in Code Review