.claude/skills/task-batch/SKILL.md
Autonomous batch task execution with PRD parsing, task decomposition, and continuous execution until all tasks complete. Uses /orchestrator internally. Stops only for major failures (no internet, token limit, system crash). Use when: (1) processing task lists autonomously, (2) PRD-driven development, (3) batch feature implementation. Triggers: /task-batch, 'batch tasks', 'process PRD', 'run task queue'.
npx skillsauth add alfredolopez80/multi-agent-ralph-loop task-batchInstall 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.
Continuous autonomous execution of task lists with PRD parsing, automatic task decomposition, and completion validation. Runs until ALL tasks reach VERIFIED_DONE or major failure occurs.
Based on research from:
# From PRD file
/task-batch docs/prd/feature-x.prq.md
# From task list file
/task-batch tasks/sprint-backlog.md
# Inline tasks (semicolon-separated)
/task-batch "Add authentication; Implement user profile; Add password reset"
# With priority ordering
/task-batch tasks/features.md --priority
# With specific teammates
/task-batch tasks/backend.md --teammates coder,reviewer,tester
| Condition | Action | |-----------|--------| | All tasks VERIFIED_DONE | STOP - Output summary, delete team | | No internet connectivity | STOP - Report error, save state | | Token limit reached | STOP - Save progress, report position | | System crash/error | STOP - Emergency save, report diagnostics | | Max iterations reached | FAIL - CRITICAL ERROR: This indicates infinite loop, report all incomplete tasks | | Tasks remaining at exit | FAIL - CRITICAL ERROR: NEVER exit with pending tasks unless critical failure | | Normal user questions | CONTINUE - Queue for end-of-batch response |
The skill MUST NEVER report success with incomplete tasks.
❌ WRONG: "Completed 10 of 17 tasks" → Summary → Exit 0
✅ RIGHT: "Completed 10 of 17 tasks" → Continue execution until ALL 17 done
✅ RIGHT: "Cannot continue due to [critical failure]" → Report error → Exit 1
If execution cannot continue (blocked dependencies, critical failure), the skill MUST:
CRITICAL: This skill handles MULTIPLE tasks, not just one task.
+------------------------------------------------------------------+
| TASK-BATCH EXECUTION MODEL |
| (MULTIPLE TASKS - DEFAULT MODE) |
+------------------------------------------------------------------+
| |
| +----------+ +-------------+ +----------------+ |
| | PARSE |--->| PRIORITIZE |--->| DECOMPOSE | |
| | Input | | (optional) | | Complex Tasks | |
| +----------+ +-------------+ +-------+--------+ |
| | |
| +------------------------------------------v---------------+ |
| | TASK QUEUE (N TASKS) | |
| | | |
| | [Task1] [Task2] [Task3] [Task4] [TaskN] | |
| | Criteria Criteria Criteria Criteria Criteria | |
| | ✅ ✓✓✓ ✅ ✓✓✓ ⏳ ... ⏳ ... ⏳ ... | |
| +---------------------------+-------------------------------+ |
| | |
| +---------------------------v-------------------------------+ |
| | EXECUTION LOOP (FOR EACH TASK) | |
| | | |
| | FOR EACH task IN task_queue: | |
| | +--------+ +------------+ +---------------+ | |
| | | VALIDATE|-->| ORCHESTRATE|-->|CHECK CRITERIA| | |
| | | Criteria| | (10-step) | | (ALL must ✓) | | |
| | +--------+ +------------+ +-------+-------+ | |
| | | | |
| | ALL MET? <--YES--NO--> | |
| | | RETRY | |
| | v | |
| | +---------------+ | |
| | | VERIFIED_DONE | | |
| | | + NEXT TASK | | |
| | +---------------+ | |
| +------------------------------------------------------------+ |
+------------------------------------------------------------------+ |
| | YES<--+-->NO | |
| | | | | |
| | +--------------+ | | |
| | v v | |
| | +-----------+ +------------+ | |
| | | AUTO-COMMIT| | RETRY | | |
| | | + NEXT | | (max 3) | | |
| | +-----------+ +------------+ | |
| | | |
| +------------------------------------------------------------+ |
| |
+------------------------------------------------------------------+
# Feature: User Authentication
## Priority: HIGH
## Overview
Implement OAuth2 authentication with Google provider.
## Tasks
- [ ] P1: Create OAuth2 service module
- [ ] P1: Add Google OAuth provider configuration
- [ ] P2: Implement login callback handler
- [ ] P2: Add session management
- [ ] P3: Create authentication middleware
- [ ] P3: Write unit tests
## Dependencies
- P2 tasks depend on P1 tasks completion
## Acceptance Criteria
- Users can login with Google
- Sessions persist for 7 days
- All tests pass
# Sprint Backlog - Week 12
## Backend Tasks
1. [P1] Implement rate limiting with Redis
2. [P1] Add input validation to all endpoints
3. [P2] Create API documentation with OpenAPI
4. [P2] Add request logging middleware
## Frontend Tasks
5. [P1] Fix login form validation
6. [P2] Add loading states to buttons
7. [P3] Implement dark mode toggle
/task-batch "Add user schema; Create CRUD endpoints; Add validation"
{
"batch_name": "auth-feature",
"tasks": [
{
"id": "auth-001",
"description": "Create OAuth2 service",
"priority": 1,
"dependencies": [],
"acceptance_criteria": ["Module exists", "Exports configured client"]
},
{
"id": "auth-002",
"description": "Add Google provider",
"priority": 1,
"dependencies": ["auth-001"],
"acceptance_criteria": ["Google OAuth configured", "Test passes"]
}
],
"config": {
"max_retries": 3,
"auto_commit": true,
"stop_on_failure": false
}
}
Parse input into structured task list:
# Parse logic
Input Type Detection:
- .prq.md or .md ending → PRD Parser
- .json ending → JSON Parser
- tasks/ directory → Multi-file Parser
- Inline text → Inline Parser
Task Extraction:
- Extract task descriptions
- Parse priority markers (P1/P2/P3 or HIGH/MEDIUM/LOW)
- Identify dependencies
- Extract acceptance criteria
When --priority flag is set:
Priority Rules:
1. Explicit priority markers (P1 > P2 > P3)
2. Dependency order (dependencies first)
3. File order (as listed in input)
4. Estimated effort (smaller tasks first when same priority)
For tasks with complexity > 6:
Decomposition Rules:
- Split into subtasks if:
- Task has multiple deliverables
- Task spans multiple files
- Task requires different expertise
- Create subtask dependencies
- Preserve original acceptance criteria
--slices) (v3.0)When invoked with --slices, decompose features into vertical slices instead of horizontal layers:
/task-batch tasks.md --slices
Each slice includes ALL layers for ONE feature:
Example: "user login" becomes:
Each slice is independently deployable and testable.
Invoke /spec for each slice if complexity > 6.
# Pseudocode for execution loop
task_queue = parse_and_prioritize(input)
completed_tasks = []
failed_tasks = []
iteration = 0
max_iterations = len(task_queue) * 5 # Safety limit
while task_queue and iteration < max_iterations:
# Rate limit check
if rate_limit_detected():
sleep(exponential_backoff())
continue
# Select next task (respecting dependencies)
task = select_next_task(task_queue, completed_tasks)
if task is None:
# All remaining tasks blocked - THIS IS A FAILURE
blocked_tasks = identify_blocked_reasons(task_queue, completed_tasks)
report_failure("BLOCKED", blocked_tasks)
exit 1 # FAILURE - cannot continue
# Fresh context per task (via new subagent)
result = execute_with_orchestrator(task)
if result == VERIFIED_DONE:
completed_tasks.append(task)
task_queue.remove(task)
auto_commit(task)
# Update dependent tasks
update_dependencies(task_queue, task)
else:
if task.retry_count < MAX_RETRIES:
task.retry_count += 1
# Re-queue with feedback
task.feedback = result.errors
else:
failed_tasks.append(task)
# DO NOT break - continue with remaining tasks
# Unless stop_on_failure is explicitly set
if config.stop_on_failure:
break
iteration++
# ══════════════════════════════════════════════════════════════════
# CRITICAL: FINAL VALIDATION - NO PARTIAL SUCCESS ALLOWED
# ══════════════════════════════════════════════════════════════════
if len(task_queue) > 0:
# THERE ARE STILL PENDING TASKS - THIS IS A FAILURE
print("❌ BATCH FAILED: Incomplete tasks remain")
print(f" Completed: {len(completed_tasks)}")
print(f" Pending: {len(task_queue)}")
print(f" Failed: {len(failed_tasks)}")
for task in task_queue:
print(f" - {task.id}: {task.description}")
exit 1 # EXPLICIT FAILURE
if len(failed_tasks) > 0:
# SOME TASKS FAILED AFTER MAX RETRIES
print("❌ BATCH FAILED: Tasks exceeded max retries")
for task in failed_tasks:
print(f" - {task.id}: {task.description}")
print(f" Error: {task.last_error}")
exit 1 # EXPLICIT FAILURE
# ALL TASKS COMPLETED SUCCESSFULLY
output_summary(completed_tasks, [])
exit 0 # SUCCESS
Summary Output:
- Total tasks: N
- Completed: M
- Failed: X
- Skipped: Y (blocked by failures)
- For each task:
- Status: VERIFIED_DONE | FAILED | SKIPPED
- Duration: XX minutes
- Files modified: [list]
- Commits: [sha1, sha2, ...]
- For failed tasks:
- Error details
- Retry attempts
- Suggested fixes
# Automatic on skill invocation
TeamCreate:
team_name: "task-batch-{timestamp}"
description: "Batch execution: {batch_name}"
agent_type: "orchestrator"
# Create tasks in shared list
TaskCreate:
subject: "{task_description}"
description: "{full_task_details}"
activeForm: "Executing: {task_description}"
metadata:
priority: "{priority}"
dependencies: ["{dep_task_ids}"]
acceptance_criteria: ["{criteria}"]
# Assign to appropriate teammate
TaskUpdate:
taskId: "{id}"
owner: "ralph-coder" # or ralph-reviewer, ralph-tester
# Spawn teammates based on task type
Task:
subagent_type: "ralph-coder"
team_name: "task-batch-{timestamp}"
name: "batch-coder"
prompt: |
Execute task: {task_description}
Acceptance Criteria:
{acceptance_criteria}
Context: Fresh execution, no prior context.
Execute until VERIFIED_DONE or max retries reached.
| Hook | Purpose | Exit 2 Behavior |
|------|---------|-----------------|
| teammate-idle-quality-gate.sh | Quality check before idle | Keep working with feedback |
| task-completed-quality-gate.sh | Validate before completion | Prevent completion, retry |
| ralph-subagent-start.sh | Load Ralph context | - |
| batch-progress-tracker.sh | Track batch progress | Continue if tasks remain |
# Progress file: .ralph/batch/{batch_id}/progress.json
{
"batch_id": "batch-20260215-123456",
"started": "2026-02-15T12:00:00Z",
"total_tasks": 10,
"completed": 5,
"failed": 1,
"current_task": "auth-006",
"estimated_completion": "2026-02-15T14:30:00Z"
}
Rate Limit Detection:
- API response: 429 Too Many Requests
- Error message contains "rate limit"
- Timeout exceeded
Recovery:
- Initial backoff: 60 seconds
- Max backoff: 300 seconds (5 minutes)
- Backoff multiplier: 2x
- Max retries: 5
On max retries exceeded:
- Save state
- Report error
- STOP batch execution
Task Failure Options:
stop_on_failure: false # Continue with remaining tasks
stop_on_failure: true # Stop entire batch
Failure Recovery:
1. Log error details
2. Capture current state
3. If retry_count < MAX_RETRIES:
- Add feedback to task
- Re-queue for retry
4. Else:
- Mark as FAILED
- Skip dependent tasks
Critical Failures (STOP immediately):
- No network connectivity (ping failed)
- Token limit reached (>95% context used)
- System crash (unhandled exception)
- Authentication failure
- Repository corruption
Non-Critical Failures (CONTINUE):
- Single task failure (if stop_on_failure=false)
- Test failure (triggers retry)
- Lint errors (triggers retry)
- Type errors (triggers retry)
# Basic batch execution
ralph batch tasks/features.md
# With priority ordering
ralph batch tasks/sprint.md --priority
# Stop on first failure
ralph batch tasks/critical.md --stop-on-failure
# Resume interrupted batch
ralph batch --resume batch-20260215-123456
# Check batch status
ralph batch --status batch-20260215-123456
# List running batches
ralph batch --list
# Cancel running batch
ralph batch --cancel batch-20260215-123456
# ~/.ralph/config/batch.yaml
batch:
max_iterations_multiplier: 5 # max_iter = task_count * multiplier
max_retries_per_task: 3
auto_commit: true
stop_on_failure: false
priority_enabled: false
rate_limits:
initial_backoff_seconds: 60
max_backoff_seconds: 300
backoff_multiplier: 2
max_retries: 5
teammates:
default: [coder, reviewer]
complex: [coder, reviewer, tester]
critical: [coder, reviewer, tester, security]
hooks:
progress_tracking: true
quality_gates: true
# In task file frontmatter
---
batch:
max_retries: 5
stop_on_failure: true
teammates: [coder, tester]
---
Each task requires ALL:
Requires ALL:
❌ WRONG BEHAVIOR:
Output: "Completed Tasks (10 of 17)"
Output: "Remaining Tasks (7)"
Action: Exit 0 (success)
✅ CORRECT BEHAVIOR:
Option A: Continue execution until ALL 17 tasks complete
Option B: If cannot continue:
Output: "❌ BATCH FAILED: Cannot continue"
Output: "Completed: 10, Pending: 7, Failed: 0"
Output: "Reason: [blocked dependency | critical error | token limit]"
Exit: 1 (failure)
If you find yourself about to output a summary with remaining tasks:
| Feature | /task-batch | /orchestrator | /iterate | |---------|-------------|---------------|-------| | Input | Multiple tasks | Single task | Single task | | Execution | Continuous until all done | Single workflow | Iterative refinement | | User Interaction | Minimal (critical only) | Full clarification | Iteration prompts | | Stop Condition | All complete OR critical failure | VERIFIED_DONE | VERIFIED_DONE or max iter | | Task Decomposition | Automatic | Manual (in plan) | N/A | | PRD Support | Native | Via clarify | N/A | | Priority Ordering | Yes | No | No | | Best For | Batch features, PRD execution | Complex single tasks | Quality refinement |
Optimal Scenario: Integrated (Agent Teams + Custom Subagents)
| Hook | Event | Purpose |
|------|-------|---------|
| teammate-idle-quality-gate.sh | TeammateIdle | Prevent idle if tasks remain |
| task-completed-quality-gate.sh | TaskCompleted | Validate task before marking complete |
| ralph-subagent-stop.sh | SubagentStop | Quality gate when teammate stops |
| batch-progress-tracker.sh | PostToolUse | Update batch progress file |
Exit 2 Behavior: Hooks return exit 2 to force continuation when:
/orchestrator - Base 10-step workflow (used internally)/iterate - Iterative refinement pattern/gates - Quality validation gates/clarify - Requirement clarification (used for PRD parsing)/retrospective - Post-batch analysisEsta skill genera reportes automáticos completos para trazabilidad:
Cuando esta skill completa, se genera automáticamente:
docs/actions/task-batch/{timestamp}.md.claude/metadata/actions/task-batch/{timestamp}.jsonCada reporte incluye:
# Listar todos los reportes de esta skill
ls -lt docs/actions/task-batch/
# Ver el reporte más reciente
cat $(ls -t docs/actions/task-batch/*.md | head -1)
# Buscar reportes fallidos
grep -l "Status: FAILED" docs/actions/task-batch/*.md
source .claude/lib/action-report-lib.sh
start_action_report "task-batch" "Task description"
# ... ejecución ...
complete_action_report "success" "Summary" "Recommendations"
Action Reports System - Documentación completa
action-report-lib.sh - Librería helper
action-report-generator.sh - Generador
Sugar - Autonomous AI Coding
Daedalus/Talos - Task Queue Daemon
Continuous Autonomous Task Loop Pattern
claude-queue - Priority Task Queuing
Awesome Agentic Patterns
Unified Architecture v2.88
Claude Code Agent Teams Documentation
See master table: docs/reference/anti-rationalization.md
| Excuse | Rebuttal | |---|---| | "Partial success is acceptable" | Each task has completion criteria. Meet them. | | "This task depends on another, skipping" | Document the dependency, don't skip. | | "The PRD doesn't have completion criteria" | No criteria = task rejected. Ask for them. | | "I'll batch-commit at the end" | Auto-commit after EACH completed task. | | "The context is too stale, starting fresh" | Fresh context per task is built in. Use it. | | "This task is a duplicate of a previous one" | Verify with the PRD before skipping. Duplicates have different scopes. | | "The batch is taking too long, trimming scope" | Scope is set by the PRD. Trim with user approval only. |
development
Living knowledge base management. Actions: search (query vault), save (store learning), index (update indices), compile (raw->wiki->rules graduation), init (create vault structure). Follows Karpathy pipeline: ingest->compile->query. Use when: (1) searching accumulated knowledge, (2) saving learnings, (3) compiling raw notes into wiki, (4) initializing a new vault. Triggers: /vault, 'vault search', 'knowledge base', 'save learning'.
testing
Produce a verifiable technical specification before coding. 6 mandatory sections: Interfaces, Behaviors, Invariants (from Aristotle Phase 2), File Plan, Test Plan, Exit Criteria (executable bash commands + expected results). Use when: (1) before implementing features with complexity > 4, (2) as Step 1.5 in orchestrator workflow, (3) when requirements need formalization. Triggers: /spec, 'create spec', 'write specification', 'technical spec'.
testing
Pre-launch shipping checklist orchestrating /gates, /security, /browser-test, /perf. Ensures nothing ships without passing all quality checks. Use when: (1) before deploying, (2) before merging to main, (3) before release. Triggers: /ship, 'ship it', 'ready to deploy', 'pre-launch check'.
development
Performance optimization skill. Core Web Vitals via Lighthouse, bundle size analysis, metrics tracking over time. Use when: (1) optimizing frontend performance, (2) analyzing bundle size, (3) tracking metrics regression. Triggers: /perf, 'performance audit', 'core web vitals', 'bundle size'.