Agent skill
ln-1000-pipeline-orchestrator
Drives a Story through full pipeline (tasks, validation, execution, quality). Use when executing a Story end-to-end from kanban board.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ln-1000-pipeline-orchestrator-levnikolaevich-claude-code-skills
SKILL.md
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Pipeline Orchestrator
Drives a selected Story through the full pipeline (task planning -> validation -> execution -> quality gate) by invoking coordinators as Skill() calls in a single context.
Purpose & Scope
- Parse kanban board and show available Stories for user selection
- Ask business questions in ONE batch before execution; make technical decisions autonomously
- Drive selected Story through 4 stages: ln-300 -> ln-310 -> ln-400 -> ln-500
- Write stage notes + checkpoints after each stage for reporting and recovery
- Handle failures, retries, rework cycles, and escalation to user
- Generate pipeline report with branch name, git stats, agent review info
Hierarchy
L0: ln-1000-pipeline-orchestrator (sequential Skill calls, single context)
+-- Skill("ln-300") — task decomposition (internally manages its own workers)
+-- Skill("ln-310") — validation (internally launches Codex/Gemini agents)
+-- Skill("ln-400") — execution (internally dispatches Agent(ln-401/403/404), Skill(ln-402))
+-- Skill("ln-500") — quality gate (internally runs ln-510/ln-520, verdict, finalization)
Key principle: ln-1000 invokes coordinators via Skill tool. Each coordinator manages its own internal worker dispatch. ln-1000 does NOT modify existing skills — it calls them exactly as a human operator would.
Task Storage Mode
MANDATORY READ: Load shared/references/tools_config_guide.md and shared/references/storage_mode_detection.md
Extract: task_provider = Task Management -> Provider (linear | file).
When to Use
- One Story ready for processing — user picks which one
- Need end-to-end automation: task planning -> validation -> execution -> quality gate
- Want controlled Story processing with pipeline report
Pipeline: 4-Stage State Machine
MANDATORY READ: Load references/pipeline_states.md for transition rules and guards.
Backlog --> Stage 0 (ln-300) --> Backlog --> Stage 1 (ln-310) --> Todo
(no tasks) create tasks (tasks exist) validate |
| NO-GO |
v v
[retry/ask] Stage 2 (ln-400)
|
v
To Review
|
v
Stage 3 (ln-500)
| |
PASS FAIL
| v
Done To Rework -> Stage 2
(branch pushed) (max 2 cycles)
| Stage | Skill | Input Status | Output Status |
|---|---|---|---|
| 0 | ln-300-task-coordinator | Backlog (no tasks) | Backlog (tasks created) |
| 1 | ln-310-multi-agent-validator | Backlog (tasks exist) | Todo |
| 2 | ln-400-story-executor | Todo / To Rework | To Review |
| 3 | ln-500-story-quality-gate | To Review | Done / To Rework |
Workflow
Phase 0: Recovery Check
IF .pipeline/state.json exists AND complete == false:
# Previous run interrupted — resume from saved state
1. Read .pipeline/state.json -> restore: selected_story_id, story_state,
quality_cycles, validation_retries, story_results,
stage_timestamps, git_stats, pipeline_start_time, readiness_scores
2. Read .pipeline/checkpoint-{selected_story_id}.json -> get last completed stage
3. Re-read kanban board -> verify selected story still exists
4. IF worktree_dir exists (.worktrees/story-{selected_story_id}): cd {worktree_dir}
5. Jump to Phase 4, starting from stage AFTER checkpoint.stage
IF .pipeline/state.json NOT exists OR complete == true:
# Fresh start — proceed to Phase 1
Phase 1: Discovery, Kanban Parsing & Story Selection
MANDATORY READ: Load references/kanban_parser.md for parsing patterns.
- Auto-discover
docs/tasks/kanban_board.md(or Linear API via storage mode operations) - Extract project brief from target project's CLAUDE.md (NOT skills repo):
project_brief = { name: <from H1 or first line>, tech: <from Development Commands / tech references>, type: <inferred: "CLI", "API", "web app", "library">, key_rules: <2-3 critical rules> } IF not found: project_brief = { name: basename(project_root), tech: "unknown" } - Parse all status sections: Backlog, Todo, In Progress, To Review, To Rework
- Extract Story list with: ID, title, status, Epic name, task presence
- Filter: skip Stories in Done, Postponed, Canceled
- Detect task presence per Story:
- Has
_(tasks not created yet)_-> no tasks -> Stage 0 - Has task lines (4-space indent) -> tasks exist -> Stage 1+
- Has
- Determine target stage per Story (see
references/pipeline_states.mdStage-to-Status Mapping) - Show available Stories and ask user to pick ONE:
Project: {project_brief.name} ({project_brief.tech}) Available Stories: | # | Story | Status | Stage | Skill | Epic | |---|-------|--------|-------|-------|------| | 1 | PROJ-42: Auth endpoint | To Review | 3 | ln-500 | Epic: Auth | | 2 | PROJ-55: CRUD users | Backlog (no tasks) | 0 | ln-300 | Epic: Users | | 3 | PROJ-60: Dashboard | Todo | 2 | ln-400 | Epic: UI | AskUserQuestion: "Which story to process? Enter # or Story ID." - Store selected story. Extract story brief for selected story only:
description = get_issue(selected_story.id).description story_briefs[id] = parse <!-- ORCHESTRATOR_BRIEF_START/END --> markers IF no markers: story_briefs[id] = { tech: project_brief.tech, keyFiles: "unknown" }
Phase 2: Pre-flight Questions (ONE batch)
- Load selected Story description (metadata only)
- Scan for business ambiguities -- questions where:
- Answer cannot be found in codebase, docs, or standards
- Answer requires business/product decision (payment provider, auth flow, UI preference)
- Collect ALL business questions into single AskUserQuestion
- Technical questions -- resolve using project_brief:
- Library versions: MCP Ref / Context7 (for
project_brief.techecosystem) - Architecture patterns:
project_brief.key_rules - Standards compliance: ln-310 Phase 2 handles this
- Library versions: MCP Ref / Context7 (for
Skip Phase 2 if no business questions found. Proceed directly to Phase 3.
Phase 3: Pipeline Setup
3.0 Linear Status Cache (Linear mode only)
IF storage_mode == "linear":
statuses = list_issue_statuses(teamId=team_id)
status_cache = {status.name: status.id FOR status IN statuses}
REQUIRED = ["Backlog", "Todo", "In Progress", "To Review", "To Rework", "Done"]
missing = [s for s in REQUIRED if s not in status_cache]
IF missing: ABORT "Missing Linear statuses: {missing}. Configure workflow."
3.1 Pre-flight: Settings Verification
Verify .claude/settings.local.json in target project:
defaultMode="bypassPermissions"(required for Agent workers spawned by coordinators)
3.2 Initialize Pipeline State
pipeline_dir = "$(pwd)/.pipeline"
Write .pipeline/state.json:
Initialize: complete=false, selected_story_id,
all counters=0, empty collections,
business_answers from Phase 2, storage_mode, project_brief, story_briefs,
status_cache (Linear) or {} (file), pipeline_dir
3.3 Sleep Prevention (Windows only)
IF platform == "win32":
Bash: cp {skill_repo}/ln-1000-pipeline-orchestrator/references/hooks/prevent-sleep.ps1 .pipeline/prevent-sleep.ps1
Bash: powershell -ExecutionPolicy Bypass -WindowStyle Hidden -File .pipeline/prevent-sleep.ps1 &
sleep_prevention_pid = $!
3.4 Worktree Isolation
MANDATORY READ: Load shared/references/git_worktree_fallback.md
branch_check = git branch --show-current
IF branch_check matches feature/* / optimize/* / upgrade/* / modernize/*:
worktree_dir = CWD
project_root = CWD
ELSE:
story_slug = slugify(selected_story.title)
branch = "feature/{selected_story_id}-{story_slug}"
worktree_dir = ".worktrees/story-{selected_story_id}"
project_root = CWD
changes = git diff HEAD
IF changes not empty:
git diff HEAD > .pipeline/carry-changes.patch
git fetch origin
git worktree add -b {branch} {worktree_dir} origin/master
IF .pipeline/carry-changes.patch exists:
git -C {worktree_dir} apply .pipeline/carry-changes.patch && rm .pipeline/carry-changes.patch
IF apply fails: WARN user "Patch conflicts -- continuing without uncommitted changes"
cd {worktree_dir} # All subsequent Skill calls inherit this CWD
Coordinators self-detect feature/* on startup -> skip their own worktree creation (ln-400 Phase 1 step 5).
Phase 4: Pipeline Execution
MANDATORY READ: Load references/phases/phase4_flow.md for ASSERT guards, stage notes, context recovery, and error handling.
MANDATORY READ: Load references/checkpoint_format.md for checkpoint schema.
# --- INITIALIZATION ---
id = selected_story.id
quality_cycles = 0 # FAIL->retry counter, limit 2
validation_retries = 0 # NO-GO retry counter, limit 1
story_state = "QUEUED"
story_results = {} # {stage0: "...", stage1_agents: "...", ...}
stage_timestamps = {}
git_stats = {}
readiness_scores = {}
pipeline_start_time = now()
target_stage = determine_stage(selected_story) # pipeline_states.md guards
# --- PROGRESS TRACKER (survives compaction) ---
TodoWrite([
{content: "Stage 0: Task Decomposition (ln-300)", status: "pending", activeForm: "Decomposing tasks"},
{content: "Stage 1: Validation (ln-310)", status: "pending", activeForm: "Validating story"},
{content: "Stage 2: Execution (ln-400)", status: "pending", activeForm: "Executing tasks"},
{content: "Stage 3: Quality Gate (ln-500)", status: "pending", activeForm: "Running quality gate"},
{content: "Pipeline Report + Cleanup", status: "pending", activeForm: "Generating report"}
])
# Mark each in_progress -> completed as stages execute. Items survive context compaction.
# --- STAGE 0: Task Decomposition ---
IF target_stage <= 0:
stage_timestamps.stage_0_start = now()
Skill(skill: "ln-300-task-coordinator", args: "{id}")
Re-read kanban -> ASSERT tasks exist under Story, count IN 1..8
IF ASSERT fails: PAUSED, ESCALATE
stage_timestamps.stage_0_end = now()
Write stage notes: .pipeline/stage_0_notes_{id}.md (Key Decisions, Artifacts)
Write checkpoint(stage=0)
Update .pipeline/state.json
# --- STAGE 1: Validation ---
IF target_stage <= 1:
stage_timestamps.stage_1_start = now()
Skill(skill: "ln-310-multi-agent-validator", args: "{id}")
Re-read kanban -> ASSERT Story status = Todo
Extract readiness_score from ln-310 output
IF NO-GO AND validation_retries < 1:
validation_retries++
Skill(skill: "ln-310-multi-agent-validator", args: "{id}") # retry
Re-read kanban -> ASSERT Story status = Todo
IF still NOT Todo: PAUSED, ESCALATE
readiness_scores[id] = readiness_score
Extract agents_info from .agent-review/review_history.md or ln-310 output
stage_timestamps.stage_1_end = now()
Write stage notes: .pipeline/stage_1_notes_{id}.md (Verdict, Agent Review, Key Decisions)
Write checkpoint(stage=1)
Update .pipeline/state.json
# --- STAGE 2+3 LOOP (rework cycle) ---
# COMPACTION GUARD: if vars lost after auto-compaction, recover from disk
IF quality_cycles is undefined OR story_state is undefined:
Read .pipeline/state.json -> restore all vars
Read .pipeline/checkpoint-{id}.json -> get last completed stage
Re-read this SKILL.md (full) -> restore Phase 4 flow
Resume from checkpoint.stage + 1
WHILE quality_cycles < 2:
# STAGE 2: Execution
IF target_stage <= 2 OR quality_cycles > 0:
stage_timestamps.stage_2_start = now()
Skill(skill: "ln-400-story-executor", args: "{id}")
Re-read kanban -> ASSERT Story status = To Review AND all tasks = Done
IF ASSERT fails: PAUSED, ESCALATE, BREAK
git_stats[id] = parse `git diff --stat origin/master..HEAD`
stage_timestamps.stage_2_end = now()
Write stage notes: .pipeline/stage_2_notes_{id}.md (Key Decisions, Git commits)
Write checkpoint(stage=2)
Update .pipeline/state.json
# STAGE 3: Quality Gate (IMPOSSIBLE TO SKIP — next line after Stage 2)
stage_timestamps.stage_3_start = now()
Skill(skill: "ln-500-story-quality-gate", args: "{id}")
Re-read kanban -> check Story status
Extract quality verdict, score from ln-500 output
Extract agents_info from .agent-review/review_history.md or ln-500 output
stage_timestamps.stage_3_end = now()
Write stage notes: .pipeline/stage_3_notes_{id}.md (Verdict, Score, Agent Review, Branch)
Write checkpoint(stage=3, verdict, score)
Update .pipeline/state.json
IF Story status = Done:
story_state = "DONE"
BREAK
IF Story status = To Rework:
quality_cycles++
IF quality_cycles >= 2:
story_state = "PAUSED"
ESCALATE: "Quality gate failed {quality_cycles} times. Manual review needed."
BREAK
target_stage = 2 # loop back to Stage 2
CONTINUE
story_state = story_state OR "DONE" # default if loop exits normally
Stop Conditions (Quality Cycle)
| Condition | Action |
|---|---|
| All tasks Done + Story = Done | STOP — Story completed successfully |
quality_cycles >= 2 |
STOP — ESCALATE: "Quality gate failed after max cycles. Manual review needed." |
| Validation retry fails (NO-GO after retry) | STOP — ESCALATE: ask user for direction |
| Stage 2 precondition fails | STOP — ESCALATE: "Stage 2 incomplete, manual intervention needed" |
Phase 5: Cleanup & Report
# 0. Signal pipeline complete
Write .pipeline/state.json: { "complete": true, ... }
# 1. Self-verify against Definition of Done
verification = {
story_selected: selected_story_id is set
story_processed: story_state IN ("DONE", "PAUSED")
}
IF ANY verification == false: WARN user with details
# 2. Read stage notes
stage_notes = {}
FOR N IN 0..3:
IF .pipeline/stage_{N}_notes_{id}.md exists:
stage_notes[N] = read file content
ELSE:
stage_notes[N] = "(no notes captured)"
# 3. Extract branch info
branch_name = git branch --show-current
git_stats_final = git diff --stat origin/master..HEAD (if not already captured)
# 4. Finalize pipeline report
durations = {N: stage_timestamps.stage_{N}_end - stage_timestamps.stage_{N}_start
FOR N IN 0..3 IF both timestamps exist}
Write docs/tasks/reports/pipeline-{date}.md:
# Pipeline Report -- {date}
**Story:** {id} -- {title}
**Branch:** {branch_name}
**Final State:** {story_state}
**Duration:** {now() - pipeline_start_time}
## Task Planning (ln-300)
| Tasks | Plan Score | Duration |
|-------|-----------|----------|
| {N} created | {score}/4 | {durations[0]} |
{stage_notes[0]}
## Validation (ln-310)
| Verdict | Readiness | Agent Review | Duration |
|---------|-----------|-------------|----------|
| {verdict} | {score}/10 | {agents_info} | {durations[1]} |
{stage_notes[1]}
## Implementation (ln-400)
| Status | Files | Lines | Duration |
|--------|-------|-------|----------|
| {result} | {files_changed} | +{added}/-{deleted} | {durations[2]} |
{stage_notes[2]}
## Quality Gate (ln-500)
| Verdict | Score | Agent Review | Rework | Duration |
|---------|-------|-------------|--------|----------|
| {verdict} | {score}/100 | {agents_info} | {quality_cycles} | {durations[3]} |
{stage_notes[3]}
## Pipeline Metrics
| Wall-clock | Rework cycles | Validation retries |
|------------|--------------|-------------------|
| {total_duration} | {quality_cycles} | {validation_retries} |
# 5. Show pipeline summary to user
Pipeline Complete:
| Story | Branch | Planning | Validation | Implementation | Quality Gate | State |
|-------|--------|----------|------------|----------------|-------------|-------|
| {id} | {branch} | {stage0} | {stage1} | {stage2} | {stage3} | {story_state} |
Report saved: docs/tasks/reports/pipeline-{date}.md
# 6. Worktree cleanup
cd {project_root}
IF story_state == "PAUSED" AND worktree_dir exists AND worktree_dir != project_root:
git -C {worktree_dir} add -A
git -C {worktree_dir} commit -m "WIP: {id} pipeline paused" --allow-empty
git -C {worktree_dir} push -u origin {branch}
git worktree remove {worktree_dir} --force
Display: "Partial work saved to branch {branch} (remote). Worktree cleaned."
IF story_state == "DONE" AND worktree_dir exists AND worktree_dir != project_root:
# ln-500 committed + pushed in Phase 7. Clean worktree only.
git worktree remove {worktree_dir} --force
# 7. Stop sleep prevention (Windows)
IF sleep_prevention_pid:
kill $sleep_prevention_pid 2>/dev/null || true
# 8. Remove pipeline state files
Delete .pipeline/ directory
# 9. Report results location to user
Kanban as Single Source of Truth
- Re-read board after each stage completion for fresh state. Never cache
- Coordinators (ln-300/310/400/500) update Linear/kanban via their own logic. Lead re-reads and ASSERTs expected state transitions
- Update algorithm: Follow
shared/references/kanban_update_algorithm.mdfor Epic grouping and indentation
Error Handling
| Situation | Detection | Action |
|---|---|---|
| ln-300 task creation fails | Skill returns error | Escalate to user: "Cannot create tasks for Story {id}" |
| ln-310 NO-GO (Score <5) | Re-read kanban, status != Todo | Retry once. If still NO-GO -> ask user |
| Task in To Rework 3+ times | ln-400 reports rework loop | Escalate: "Task X reworked 3 times, need input" |
| ln-500 FAIL | Re-read kanban, status = To Rework | Fix tasks auto-created by ln-500. Stage 2 re-entry. Max 2 quality cycles |
| Skill call error | Exception from Skill() | Read checkpoint -> re-invoke same Skill (kanban handles task-level resume) |
| Context compression | PostCompact hook or manual detection | Read .pipeline/state.json -> re-read SKILL.md -> restore vars -> resume |
Critical Rules
- Single Story processing. User selects which Story to process
- Coordinators via Skill. Lead invokes ln-300/ln-310/ln-400/ln-500 via Skill tool. Each coordinator manages its own internal worker dispatch (Agent/Skill)
- Skills as-is. Never modify or bypass existing skill logic
- Kanban verification. After EVERY Skill call, re-read kanban and ASSERT expected state. Lead never caches kanban state
- Quality cycle limit. Max 2 quality FAILs per Story (original + 1 rework). After 2nd FAIL, escalate to user
- Worktree lifecycle. ln-1000 creates worktree in Phase 3.4. Branch finalization (commit, push) by ln-500. Worktree cleanup by ln-1000 in Phase 5 (lead is in worktree, so ln-500 skips cleanup)
- Stage notes. Lead writes
.pipeline/stage_N_notes_{id}.mdafter each stage for Pipeline Report - Checkpoints. Lead writes
.pipeline/checkpoint-{id}.jsonafter each stage for recovery
Known Issues
| Symptom | Likely Cause | Self-Recovery |
|---|---|---|
| Lead outputs generic text after long run | Context compression destroyed SKILL.md + state | Follow Context Recovery in phase4_flow.md: read state.json -> read SKILL.md -> resume |
| ln-400 stuck on same task | Task in rework loop | ln-400 handles internally; escalates after 3 reworks |
Anti-Patterns
- Skipping quality gate after execution (Stage 3 is the next line after Stage 2 -- impossible to skip)
- Caching kanban state instead of re-reading after each Skill call
- Running mypy/ruff/pytest directly instead of letting coordinators handle it
- Processing multiple stories without user selection
- Creating worktrees outside Phase 3.4 (coordinators self-detect feature/*)
- Modifying coordinator internal dispatch (ln-400's Agent/Skill pattern is correct as-is)
Plan Mode Support
When invoked in Plan Mode, show available Stories and ask user which one to plan for:
- Parse kanban board (Phase 1 steps 1-7)
- Show available Stories table
- AskUserQuestion: "Which story to plan for? Enter # or Story ID."
- Execute Phase 2 (pre-flight questions) if business ambiguities found
- Resolve
skill_repo_path-- absolute path to skills repo root - Show execution plan for selected Story
- Write plan to plan file (using format below), call ExitPlanMode
Plan Output Format:
## Pipeline Plan for {date}
> **BEFORE EXECUTING -- MANDATORY READ:** Load `{skill_repo_path}/ln-1000-pipeline-orchestrator/SKILL.md` (full file).
> After reading SKILL.md, start from Phase 3 (Pipeline Setup) using the context below.
**Story:** {ID}: {Title}
**Current Status:** {status}
**Target Stage:** {N} ({skill_name})
**Storage Mode:** {file|linear}
**Project Brief:** {name} ({tech})
**Business Answers:** {answers from Phase 2, or "none"}
**Skill Repo Path:** {skill_repo_path}
### Execution Sequence
1. Read full SKILL.md + references (Phase 3 prerequisites)
2. Setup worktree + state.json (Phase 3)
3. Execute stages sequentially via Skill() calls (Phase 4)
4. Generate pipeline report (Phase 5)
5. Cleanup worktree + state files (Phase 5)
Definition of Done (self-verified in Phase 5)
- User selected Story (
selected_story_idis set) - Business questions resolved (stored OR skip)
- Story processed to terminal state (
story_state IN ("DONE", "PAUSED")) - Per-stage ASSERT verifications passed (kanban re-read after each stage)
- Stage notes written for each completed stage
- Pipeline report generated (file exists at
docs/tasks/reports/) - Pipeline summary shown to user
- Worktree cleaned up (Phase 5 step 6)
- Meta-Analysis run (Phase 6)
Phase 6: Meta-Analysis
MANDATORY READ: Load shared/references/meta_analysis_protocol.md and references/phases/phase6_meta_analysis.md
Skill type: execution-orchestrator. Runs after Phase 5. Pipeline-specific implementation (recovery map, trend tracking, assumption audit, report format) in phase6_meta_analysis.md.
Reference Files
Phase 4-6 Procedures (Progressive Disclosure)
- Pipeline flow:
references/phases/phase4_flow.md(ASSERT guards, stage notes, context recovery, error handling) - Meta-analysis:
references/phases/phase6_meta_analysis.md(Recovery map, trend tracking, report format)
Core Infrastructure
- MANDATORY READ:
shared/references/git_worktree_fallback.md - MANDATORY READ:
shared/references/research_tool_fallback.md - Pipeline states:
references/pipeline_states.md - Checkpoint format:
references/checkpoint_format.md - Kanban parsing:
references/kanban_parser.md - Kanban update algorithm:
shared/references/kanban_update_algorithm.md - Settings template:
references/settings_template.json - Sleep prevention:
references/hooks/prevent-sleep.ps1 - Tools config:
shared/references/tools_config_guide.md - Storage mode operations:
shared/references/storage_mode_detection.md - Auto-discovery patterns:
shared/references/auto_discovery_pattern.md
Delegated Skills
../ln-300-task-coordinator/SKILL.md../ln-310-multi-agent-validator/SKILL.md../ln-400-story-executor/SKILL.md../ln-500-story-quality-gate/SKILL.md
Version: 3.0.0 Last Updated: 2026-03-19
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?