execute-layer
FreeNo executable scriptsNot checkedHandles one layer of task execution. Groups ready tasks into batches, spawns batch agents, and processes merge queue after each batch.
by vinzenz★ 56 GitHub starsAbout this skill
Layer Execution Agent
You manage the execution of a single layer. You build the ready queue, group tasks into batches, spawn batch agents, and coordinate merges.
Input Arguments
Parse these from the prompt:
| Argument | Required | Description |
|---|---|---|
--tasks-path <path> |
Yes | Path to tasks directory |
--layer <name> |
Yes | Layer to execute (e.g., "1-foundation") |
--project-path <path> |
Yes | Main project directory |
--worktree-dir <path> |
Yes | Directory for worktrees |
--max-parallel <N> |
No | Max concurrent tasks (default: 3) |
Execution Flow
Step 1: Load Layer Plan
Read layer_plan.json to get dependency graph:
cat {tasks_path}/layer_plan.json
Extract:
dependency_graph: Map of task_id → list of dependency task_idslayers: List of layer definitions with task lists
Step 2: Load State
Read execute-state.json:
cat {tasks_path}/execute-state.json
Get:
completed: List of completed task IDsfailed: List of failed task IDsabandoned: List of abandoned task IDstasks: Individual task status detailsmerge_queue: Current merge queue
Step 3: Build Ready Queue
Find tasks that are ready to execute:
def build_ready_queue(layer, dependency_graph, state):
ready = []
for task in layer["tasks"]:
task_id = task["id"]
# Skip completed
if task_id in state["completed"]:
continue
# Skip abandoned
if task_id in state["abandoned"]:
continue
# Check dependencies
deps = dependency_graph.get(task_id, [])
all_deps_complete = all(d in state["completed"] for d in deps)
if all_deps_complete:
ready.append(task_id)
return ready
Step 4: Update Layer Status
Mark layer as in_progress in state:
{
"layers": {
"{layer}": {
"status": "in_progress",
"started_at": "{now}",
"tasks_total": 6,
"tasks_completed": 0,
"tasks_failed": 0
}
},
"current_layer": "{layer}"
}
Step 5: Execute Batches Loop
While there are ready tasks:
5a. Build Batch
Group ready tasks up to max_parallel:
batch = ready_queue[:max_parallel]
Assign batch number:
batch_number = current_batch + 1
state["current_batch"] = batch_number
5b. Spawn Batch Agent
Invoke /execute-batch skill:
/execute-batch --tasks-path {tasks_path} --task-ids {comma_separated_ids} --project-path {project_path} --worktree-dir {worktree_dir} --batch-number {batch_number} --layer {layer}
Wait for batch completion.
5c. Handle Batch Result
Parse batch result:
{
"batch_number": 1,
"verified": ["L1-001", "L1-002"],
"failed": ["L1-003"],
"abandoned": [],
"should_stop": false
}
If should_stop: true:
- A task was abandoned (max 5 retries)
- Report to orchestrator immediately
- Do NOT process more batches
5d. Process Merge Queue
After each batch, merge verified tasks in order:
for item in merge_queue:
if item["status"] == "ready":
# Invoke merge
invoke_merge(item["task_id"])
item["status"] = "merged"
Call /execute-merge for each ready task:
/execute-merge --task-id {task_id} --project-path {project_path} --worktree-path {worktree_path} --task-file {task_file}
IMPORTANT: Merge tasks sequentially in priority order to avoid conflicts.
5e. Re-evaluate Ready Queue
After batch completes and merges finish:
- Some tasks may now have all dependencies satisfied
- Rebuild ready queue with fresh state
- Continue loop if tasks remain
Step 6: Update Layer Completion
When no more ready tasks:
{
"layers": {
"{layer}": {
"status": "completed",
"completed_at": "{now}",
"tasks_completed": 6,
"tasks_failed": 0
}
}
}
Step 7: Report Layer Result
Output structured result for orchestrator:
{
"layer": "1-foundation",
"status": "completed",
"tasks_total": 6,
"tasks_completed": 6,
"tasks_failed": 0,
"tasks_abandoned": 0,
"batches_executed": 3,
"should_stop": false
}
If a task was abandoned:
{
"layer": "2-backend",
"status": "stopped",
"tasks_total": 9,
"tasks_completed": 5,
"tasks_failed": 0,
"tasks_abandoned": 1,
"abandoned_task": "L2-006",
"batches_executed": 2,
"should_stop": true,
"stop_reason": "Task L2-006 abandoned after 5 attempts"
}
Batch Construction Algorithm
Basic Batching
def build_batches(ready_tasks, max_parallel):
batches = []
remaining = list(ready_tasks)
while remaining:
batch = remaining[:max_parallel]
remaining = remaining[max_parallel:]
batches.append(batch)
return batches
Example
Ready queue: [L1-001, L1-002, L1-006, L1-003, L1-004, L1-005]
Max parallel: 3
Batch 1: [L1-001, L1-002, L1-006]
Batch 2: `[
Install execute-layer in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
ReadWriteBashSkillGlobFAQ
What does the execute-layer skill do?
Handles one layer of task execution. Groups ready tasks into batches, spawns batch agents, and processes merge queue after each batch.
How do I install the execute-layer skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the execute-layer skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
by Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
by Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
by Anthropic