From ship
Performs adversarial pre-coding planning: host and peer agents independently investigate codebase, diff specs, and validate plan with execution drill. Use for 'plan this', 'design approach', or scoping before coding.
npx claudepluginhub heliohq/ship --plugin shipThis skill is limited to using the following tools:
```bash
Guides pre-coding design process: explore context, challenge assumptions, propose approaches, present for approval, set up git worktrees. Enforces HARD-GATE against premature implementation.
Share bugs, ideas, or general feedback.
SHIP_PLUGIN_ROOT="${SHIP_PLUGIN_ROOT:-$(ship-plugin-root 2>/dev/null || echo "$HOME/.codex/ship")}"
SHIP_SKILL_NAME=design source "${SHIP_PLUGIN_ROOT}/scripts/preflight.sh"
You ARE the planner. You read code, investigate, write spec and plan. You must read the code yourself — delegating investigation loses the context needed to write a good plan. A peer agent investigates independently and produces its own spec for adversarial comparison.
See ../shared/runtime-resolution.md for the host/peer concept and
dispatch commands. In /ship:design, the peer plays two roles:
investigator (Phase 2) and drill agent (Phase 6). Both use the
same dispatch pattern from the shared reference.
The prompt may specify Scope mode: full (default) or
Scope mode: refactor. It controls how much adversarial validation runs:
| Phase | full | refactor |
|---|---|---|
| 1 Init | ✅ | ✅ |
| 2 Investigate (host + peer) | ✅ | ✅ |
| 3 Write spec | ✅ | ✅ (behavior-contract template) |
| 4 Diff & verify | ✅ | ✅ |
| 5 Write plan | ✅ | ✅ |
| 6 Execution drill | ✅ | ⏭ skipped |
Why refactor mode skips Phase 6: for behavior-preserving changes (refactor, simplify, rename, extract, dedupe), the plan steps are usually small, mechanical code movements. The drill's "is every step implementable" check earns little here while adding a full peer round-trip. Peer investigation and diff stay on because they catch the real refactor failure mode — "moved complexity instead of removing it."
If no scope mode is specified (e.g. standalone /ship:design invocation),
default to full.
Phase 1 Init resolve task_id, create .ship/tasks/<id>/plan/
Phase 2 Investigate dispatch peer (parallel) ─┐
you read the code │
↓ │
Phase 3 Write spec write host spec.md ←─── peer writes peer-spec.md
vague? ask user → re-investigate
↓
Phase 4 Diff & verify compare specs → resolve each divergence
disagree? → debate peer (max 2 rounds)
still open? → escalate to user
critical gap? → re-investigate (max 1 loop)
↓
Phase 5 Write plan write plan.md with executable tasks
self-review against spec
↓
Phase 6 Execution drill dispatch peer (fresh session) to validate plan
BLOCKED step? → escalate
UNCLEAR step? → revise plan (max 1 loop)
all CLEAR → ready for execution
| Phase | Who | Why |
|---|---|---|
| Investigation (read code, trace paths) | Host + peer (parallel) | Independent investigation catches different blind spots |
| Write spec (host version) | You | Investigation context must not be lost |
| Write spec (peer version) | Peer agent | Independence requires separation |
| Diff & verify divergences | You | You have the context + code access to judge |
| Write plan.md | You | Spec context must flow into plan |
| Execution Drill | Peer agent (fresh session) | Fresh eyes test implementability |
| Gate | Condition | Fail action |
|---|---|---|
| Investigation → Spec | All claims trace to file:line you read | Re-investigate |
| Spec → Diff | spec.md has flexible sections scaled to complexity, self-reviewed | Revise |
| Diff → Plan | Zero escalated items (resolved by evidence or debate, or user resolved them) | Ask user |
| Plan → Drill | plan.md has TDD tasks, checkbox steps, complete code, no placeholders | Revise |
| Drill → Ready | Zero BLOCKED steps, zero UNCLEAR steps | Revise plan (max 1 loop) |
No artifact passes to the next phase without meeting its gate.
Use TodoWrite to track your own progress through the design phases.
After Phase 1 (init), create todos that reflect the actual work ahead.
Adapt the items to what you discover — skip items for phases that don't
apply, add items for loops you enter (re-investigation, drill revision).
Principle: one todo per major phase the user would care about.
Update activeForm to reflect what's happening within a phase.
Example (full run with peer available):
TodoWrite([
{ content: "Investigate codebase (host + peer)", status: "in_progress", activeForm: "Investigating codebase" },
{ content: "Write spec", status: "pending", activeForm: "Writing spec" },
{ content: "Diff host vs peer specs", status: "pending", activeForm: "Diffing specs" },
{ content: "Write implementation plan", status: "pending", activeForm: "Writing implementation plan" },
{ content: "Execution drill", status: "pending", activeForm: "Running execution drill" }
])
Adaptations (not exhaustive — use judgment):
in_progressin_progressNever:
.ship/tasks/<task_id>/plan/ directory.task_id using the shared script:
TASK_ID=$(bash "${SHIP_PLUGIN_ROOT:-$(ship-plugin-root 2>/dev/null || echo "$HOME/.codex/ship")}/scripts/task-id.sh" "<description>")
Artifacts go to .ship/tasks/<task_id>/plan/. The Write tool creates
directories automatically — no mkdir needed.
Check if spec.md already exists with content:
[ -s .ship/tasks/<task_id>/plan/spec.md ] && echo 'SPEC_EXISTS' || echo 'NO_SPEC'
If SPEC_EXISTS:
spec.md. This was written by an upstream skill (e.g. refactor).NO_SPEC.plan.md. You may append an ## Investigation section
to the existing spec if it lacks one, but preserve all existing sections.full, skipped in refactor).If NO_SPEC: proceed to Phase 2.
This is the most important phase. Do not rush it.
Kick off the peer investigation before you start investigating. The peer works in parallel while you read code.
Read independent-investigator.md for the dispatch pattern and
prompt template. Fill in the task description, task_id, and repo root.
Dispatch the resolved peer runtime and save the returned thread or
session id as INVESTIGATION_THREAD_ID when the runtime provides one
— needed for debate in Phase 4.
If peer dispatch fails, self-produce the second spec:
peer-spec.md with any changed conclusions or additionsWARNING: Second spec was self-generated, not independentRead write-spec.md for investigation methodology and spec authoring.
Investigate the codebase, then write spec.md. The reference covers
investigation strategy (bug fixes, new features, all tasks), vagueness
checks, spec structure, and self-review.
If investigation reveals hidden dependencies or cross-cutting concerns not apparent from the task description, note them for the spec.
Covered by write-spec.md — follow the spec writing and self-review
guidance there.
Read peer-spec.md (written by the peer investigation dispatched in Phase 2).
Compare it against your spec.md.
Only record divergences and their resolutions. If both specs agree on something, there's nothing to record — move on.
For each divergence, write what happened: what each side claimed, what code evidence was cited during debate, and the final disposition (patched / proven-false / conceded / escalated).
spec.md with all patched and conceded items.escalated items exist:
user-resolved and what they decided. Update spec.md accordingly.Read write-plan.md for plan structure, task granularity, no-placeholder
rules, and self-review.
Translate the validated spec.md into an executable plan.md. The reference covers the plan template, bite-sized steps, code completeness guidance, and the self-review checklist.
Skip this phase when Scope mode: refactor. Record in the report
card that the drill was skipped due to refactor scope, then finish.
Behavior-preserving plans rarely contain ambiguous steps, and the peer
round-trip doesn't earn its cost here.
For full scope (default), run the drill as below.
The final gate. Give the plan to the peer agent and ask it to validate every step is implementable.
Read execution-drill.md for the dispatch pattern, role, and
prompt template. Use a new peer session, not the investigation
thread. Save the returned thread or session id as DRILL_THREAD_ID
when the runtime provides one — needed for revision reruns.
If peer dispatch fails, dispatch a fresh fallback Agent to perform the
drill instead. The Agent gets the same prompt from execution-drill.md
— it reads spec.md and plan.md with no prior context, providing the
best available independent review. Add a warning:
WARNING: Drill was fallback-Agent-performed, not peer-agent
DRILL_THREAD_ID with: "Tasks N, M were revised. Re-read plan.md
and re-evaluate ONLY those tasks using the same criteria. Report
CLEAR/UNCLEAR/BLOCKED."execution-drill.md prompt scoped to the revised tasks only.blocked..ship/tasks/<task_id>/
plan/
spec.md — final merged spec (flexible sections, brainstorming style)
peer-spec.md — peer agent's independent spec
plan.md — how to build it (TDD tasks, writing-plans style)
diff-report.md — host spec vs peer spec divergences and resolutions
| Error | Action |
|---|---|
| Peer agent unavailable | Self-produce second spec + fallback drill with warning |
| Peer output unparseable | Retry once with format reminder, then fall back to fallback drill |
| Timeout | Abort, preserve artifacts, summarize honestly |
| Re-investigation needed | Maximum 1 loop back to Phase 2 |
| Drill revision needed | Maximum 1 revision loop |
blockedVerify spec.md and plan.md are non-empty on disk, then output the report card
(read skills/shared/report-card.md for the standard format):
## [Design] Report Card
| Field | Value |
|-------|-------|
| Status | DONE |
| Summary | <task title> — <N> stories planned |
### Metrics
| Metric | Value |
|--------|-------|
| Scope mode | <full | refactor> |
| Files traced | <N> |
| Divergences resolved | <N> (<M> by evidence, <K> by debate) |
| Drill steps CLEAR | <N>/<total> (or `skipped — refactor scope`) |
| Stories | <N> |
### Artifacts
| File | Purpose |
|------|---------|
| .ship/tasks/<task_id>/plan/spec.md | Merged spec |
| .ship/tasks/<task_id>/plan/peer-spec.md | Peer spec |
| .ship/tasks/<task_id>/plan/plan.md | Executable plan |
| .ship/tasks/<task_id>/plan/diff-report.md | Divergence resolutions |
### Next Steps
1. **Full pipeline (recommended)** — /ship:auto to implement, review, QA, and ship
2. **Implement only** — /ship:dev to execute this plan
3. **Review the plan** — read the artifacts and give feedback
[Design] BLOCKED
REASON: <what failed and why>
ATTEMPTED: <what was tried>
UNRESOLVED: <escalated items from diff or drill>
RECOMMENDATION: <what the user should do next>