plugins/linear-spec-plugin/skills/orchestrate/SKILL.md
Execute a Linear spec end-to-end with a coordinated agent team. Cycles through architect-version → build-stories → execute-task → validate-execution until the spec ships. Accepts a Linear identifier or text to search. A spec is shipped when the human signs off.
npx skillsauth add jaisonerick/spec-plugin orchestrateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a team lead. You take a spec from Linear backlog to shipped deliverables by coordinating specialized agents through a simple cycle.
architect-version → build-stories → [ execute-task → validate-execution ]* → human signs off
The inner cycle repeats until validation passes and the human confirms.
Scripts live in ${CLAUDE_PLUGIN_DIR}/scripts/linear/. Required: LINEAR_API_KEY. If it isn't set, fetch it from 1Password: export LINEAR_API_KEY="$(op read op://Environments/Linear/credential)".
The execution unit lives in Linear (issues, sub-issues, project documents, comments). Code lives in worktrees. Reasoning artifacts (briefings, ADRs, retrospectives) live on disk in the knowledge base.
State machine for the spec issue:
Backlog → Todo → In Progress → In Review → Done
State machine for each story sub-issue:
Backlog → Todo → In Progress → In Review → Done
Use agent definitions from this plugin (${CLAUDE_PLUGIN_DIR}/agents/) as subagent_type. Each agent knows its role — you provide task context.
Agent({ subagent_type: "<agent-name>", team_name: "<spec-identifier>",
name: "<instance-name>",
prompt: "<base branch (code-only), what to do, why, relevant Linear identifiers and document URLs>" })
Available types: architect, product-owner, engineer, designer, qa.
Agents that touch code call EnterWorktree (or create a manual worktree in the external code repo) — code goes through worktrees. Agents that only touch Linear and the knowledge base do not need a worktree; they read and write directly. The orchestrator decides which agents need worktrees based on the project type.
If the argument matches ^[A-Z]{2,5}-\d+$, treat as a Linear identifier and use directly.
Otherwise, run a search:
node "${CLAUDE_PLUGIN_DIR}/scripts/linear/search.js" --type issue --query "<text>" --label "type/spec" --limit 5
Render results as <identifier> · <title> · <project name> in AskUserQuestion. Never guess — keep asking until the user picks one.
node "${CLAUDE_PLUGIN_DIR}/scripts/linear/resolve-spec.js" "<identifier>" --require-spec-label
Capture:
spec_identifier (e.g. DIN-142), spec_url, spec_stateproject.id (project_id), project.name, project.urlteam.key (team_key)Spec vX.Y — Architecture document (if any) → arch_doc_idSpec vX.Y — Validation Report document (if any) → validation_doc_idThe Linear project description begins with Context: <path>. That path is the project briefing on disk.
code repository reference if any.EnterWorktree.Record code_repo (absolute path to the code repository, if any) and knowledge_base_root (absolute path of the briefing's containing folder).
If code_repo is set, record git -C <code_repo> branch --show-current as base_branch. This is the reference branch for ALL code-touching agents — they create worktrees from it, compare against it, and merge back to it. Never hardcode "main" — use whatever branch is current when /orchestrate runs.
From the resolve-spec response:
arch_doc_id exists → architect-version donestate.type = started/completed/canceled → some stories executedvalidation_doc_id exists → validation has run at least oncePresent state to user, confirm starting point.
TeamCreate({ team_name: "<spec-identifier>" })
Skip if arch_doc_id exists, the spec issue description is non-empty, and the user confirms to resume.
Spawn architect:
Agent({ subagent_type: "architect", team_name: "<spec-identifier>",
name: "architect",
prompt: "Run /architect-version <spec-identifier>.
Spec: <spec_url>.
Project: <project.url>.
Knowledge-base briefing: <briefing path on disk>.
${code_repo:+Code repository: <code_repo> (no worktree needed for this phase — architect writes Linear documents only).}
Context: <relevant decisions or preferences>" })
The architect writes two artifacts: the spec body to the issue description, and Spec vX.Y — Architecture as a Project Document. No code changes.
On completion: shut down the architect agent immediately → re-resolve the spec to confirm both artifacts exist → notify user with key decisions and the architecture doc URL.
Skip if sub-issues already exist and the user confirms to resume.
CRITICAL: The Spec Architecture document is a hard prerequisite. Before spawning the PO, verify arch_doc_id exists. If it doesn't, STOP and investigate — the architect phase may not have completed correctly. PO agents that work without the spec architecture produce stories that diverge from architectural decisions.
Spawn product-owner:
Agent({ subagent_type: "product-owner", team_name: "<spec-identifier>",
name: "product-owner",
prompt: "Run /build-stories <spec-identifier>.
REQUIRED FIRST STEP: Read the SPEC ARCHITECTURE DOCUMENT before doing anything else.
It is a Linear Project Document on project <project.id> titled 'Spec vX.Y — Architecture'.
Use list-documents.js --title-match to find its id, then read its content.
This document is your PRIMARY source for story breakdown — file manifest,
component breakdown, code sketches, test strategy, dependency graph.
If it doesn't exist or is empty, STOP and report back immediately.
Spec: <spec_url>.
Architecture document id: <arch_doc_id>.
Knowledge-base briefing: <briefing path on disk>.
Key decisions: <summarize 2-3 that affect decomposition>" })
The PO creates one sub-issue per story under the spec issue. No code changes.
On completion: shut down the product-owner agent immediately → re-list sub-issues via list-sub-issues.js <spec-identifier> → present the story list to the user → review stories against the spec architecture for divergences → ask to confirm execution order.
This is the core loop. It alternates between executing tasks and validating results until the spec ships.
List the spec's sub-issues:
node "${CLAUDE_PLUGIN_DIR}/scripts/linear/list-sub-issues.js" "<spec-identifier>"
Create a local task per non-Done sub-issue with blockedBy based on prerequisites stated in each story body.
Team composition — ask the user:
AskUserQuestion: dependency graph, parallel tracks, suggested team size/interface-design storiesDispatch loop — repeat until all stories complete:
Backlog/Todo)subagent_type to the story's Agent field in its body (engineer or designer)Code-only or code-with-knowledge-base — engineer/designer for code stories:
Agent({ subagent_type: "<agent-type>", team_name: "<spec-identifier>",
name: "<agent>-N",
prompt: "Run /execute-task <story-identifier>.
Base branch: <base_branch>.
Code repository: <code_repo>.
Enter worktree 'task-<story-identifier>' in the code repo before changing any code.
Story: <story_url>.
Spec: <spec_url>.
Architecture doc id: <arch_doc_id>.
Context: <prior completions, design outputs from earlier stories — quote the comment URLs>.
Before reporting back: clean commit history, merge to <base_branch> in the code repo (fast-forward only), remove the worktree.
Linear updates (state transitions, comments) happen via the bundled scripts — they do not need a worktree." })
Knowledge-base-only — engineer for non-code stories:
Agent({ subagent_type: "engineer", team_name: "<spec-identifier>",
name: "engineer-N",
prompt: "Run /execute-task <story-identifier>.
Story: <story_url>.
Spec: <spec_url>.
Architecture doc id: <arch_doc_id>.
Knowledge-base root: <knowledge_base_root>.
No worktree needed — write deliverables directly to the knowledge base.
Context: <prior completions, references to earlier deliverables>." })
In Review (if validation pending) or Done and posted the execution log as a comment. Shut down the agent immediately via SendMessage({ to: "<agent-name>", message: { type: "shutdown_request" } }).Design → Integration pairing: design story runs first, integration story becomes unblocked after merge.
Once all stories are In Review or Done (or after a fix round), spawn QA. Always spawn a fresh QA agent. Shut down the previous QA agent first if one exists.
Code-only or code-with-knowledge-base:
Agent({ subagent_type: "qa", team_name: "<spec-identifier>",
name: "qa-validate-N",
prompt: "Run /validate-execution <spec-identifier>.
Base branch: <base_branch>.
Code repository: <code_repo>.
Enter worktree 'validate-<spec-identifier>' in the code repo before running any tests.
Spec: <spec_url>.
Definition of Done is the primary validation source.
Before reporting back: clean commit history, merge any test additions to <base_branch> in the code repo (fast-forward only), remove the worktree.
The Validation Report Project Document and the back-link comment on the spec issue go through the bundled Linear scripts — they don't need a worktree.
<If re-run: 'This is a re-validation after fixes. Focus only on previously failed test cases.'>" })
Knowledge-base-only:
Agent({ subagent_type: "qa", team_name: "<spec-identifier>",
name: "qa-validate-N",
prompt: "Run /validate-execution <spec-identifier>.
Spec: <spec_url>.
Knowledge-base root: <knowledge_base_root>.
Definition of Done is the primary validation source. Validation is criteria-based — read each deliverable and evaluate.
No worktree needed.
<If re-run: 'This is a re-validation after fixes. Focus only on previously failed test cases.'>" })
After validation completes, fetch the spec issue's comments and the Validation Report:
node "${CLAUDE_PLUGIN_DIR}/scripts/linear/get-issue.js" "<spec-identifier>" --with-comments
/execute-task for each fix (back to Step 1, but only for fix story sub-issues — create them via create-sub-issue.js if no existing story owns the fix). Maximum 2 automated fix cycles.Present the Human Validation Guide to the user via AskUserQuestion:
If the user reports issues:
post-comment.js)/execute-task to fix (back to Step 1)If QA reports environment issues instead of test failures:
Once the human confirms the spec is good:
Done:
node "${CLAUDE_PLUGIN_DIR}/scripts/linear/transition-issue.js" "<spec-identifier>" --state "Done"
In Review story sub-issues, transition them to Done as well.TeamDelete to clean up./run-retrospective <spec-identifier> to capture lessons learned. Next spec: <next> from the project's issue list."Worktrees apply to code repositories only. Linear writes (descriptions, comments, documents, transitions) and knowledge-base writes (briefings, retrospectives, lessons) bypass worktrees — they go through scripts or direct disk edits.
All code-touching agents work relative to the base_branch recorded in Phase 0. Every code agent prompt MUST include the base branch. Agents create worktrees from it, merge back to it, and compare against it. Never hardcode "main".
git -C <code_repo> status and commit if needed before every Agent() call. Worktrees are created from HEAD — uncommitted files won't be visible.<code_repo>/scripts/setup-worktree.sh exists and instruct the agent to run it after git worktree add. If the script doesn't exist, instruct the agent to copy .env* and .tool-versions manually.Agent lifecycle: EnterWorktree({ name: "task-<story-id>" }) → work → clean up commit history → git checkout <base_branch> && git merge --ff-only worktree-<name> → ExitWorktree({ action: "remove" }) → script-based Linear updates → SendMessage to team lead.
EnterWorktree only isolates CWD — it doesn't help when the code lives elsewhere. Agents create worktrees in the code repository with git -C <code_repo> worktree add.
Agent prompt must include:
Base branch: <base_branch>
Code repository: <code_repo>
Create a worktree in the code repo before starting:
git -C <code_repo> worktree add .claude/worktrees/<name> -b worktree-<name> <base_branch>
Work from <code_repo>/.claude/worktrees/<name> for all code changes.
Linear updates (set-issue-description, post-comment, transition-issue) and knowledge-base writes do not need a worktree.
Before reporting back:
1. Clean up commit history (squash/rebase to minimal commits)
2. cd <code_repo> && git checkout <base_branch> && git pull --rebase && git merge --ff-only worktree-<name>
3. git worktree remove .claude/worktrees/<name>
No worktrees. Agents read/write the knowledge base directly. All persistence happens via Linear scripts and disk edits.
SendMessage({ to: "<agent-name>", message: { type: "shutdown_request" } })Do NOT leave idle agents running between phases. Shut them down as soon as they report back.
Every task MUST get a fresh agent. Never send a new task to an existing agent, even if it's the same agent type. The orchestrator must:
SendMessage with shutdown_request)engineer-1, engineer-2)This applies to ALL agents: engineers, designers, QA, architects, product-owners. No exceptions.
${CLAUDE_PLUGIN_DIR}/agents/ — orchestrator provides context, not role definitions.development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
tools
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
development
Convert documents and files to Markdown using markitdown. Use when converting PDF, Word (.docx), PowerPoint (.pptx), Excel (.xlsx, .xls), HTML, CSV, JSON, XML, images (with EXIF/OCR), audio (with transcription), ZIP archives, YouTube URLs, or EPubs to Markdown format for LLM processing or text analysis.
development
Validate a version's implementation against its Definition of Done. For code projects: runs automated tests against the live application. For non-code projects: reviews deliverables against acceptance criteria. Runs incrementally on re-runs. Ends with human validation guidance.