一键导入
async-workflow
Async workflow pipeline for use case preparation and implementation. Auto-invokes for feature planning and complex task preparation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Async workflow pipeline for use case preparation and implementation. Auto-invokes for feature planning and complex task preparation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Resolve ambiguous user prompts by choosing whether to answer now, answer with assumptions, ask 1–2 high-value clarification questions, replan, or stop. Use when the best response depends on hidden intent, audience, scope, constraints, risk, output format, or desired depth.
Analyzes an approved plan and decomposes it into a dependency-ordered task graph via a two-phase TaskCreate and TaskUpdate pass. Detects linear DEPENDS ON chains (shared worktree), identifies independent work streams (parallelized), and executes the full worktree-isolated run. Also handles Branch B (learnings from session context). **AUTOMATICALLY INVOKE** only when: - The PostToolUse(ExitPlanMode) hook has injected its schedule-tasks nudge in this turn (i.e., the user just approved a plan), AND the user has not signaled they want to defer execution. - /schedule-plan-tasks is invoked explicitly. - The user explicitly says "schedule tasks", "execute the plan", "decompose plan into tasks" — only when a plan exists at ~/.claude/plans/*.md AND ExitPlanMode has already been approved in this session. **DO NOT auto-invoke** while plan mode is active, while review-plan is iterating, or before the user has approved ExitPlanMode. **References:** JIT-loaded from `${CLAUDE_SKILL_DIR}/references/`
Headless `claude -p` test harness V2 — runs a fixture's literal prompt through real Claude sessions (k replicas in parallel), grades each replica on five string views plus structured tool-call / tool-result / run-health / LLM-judge condition families, then quorum-aggregates row verdicts. Use when an LLM-driven prompt needs behavioral verification beyond contract-string parser tests.
Universal plan review: senior-engineer directive + deterministic count-based severity rule. AUTOMATICALLY INVOKE when: - MANDATORY_PRE_EXIT_PLAN directive applies (before ExitPlanMode) - User says "review plan", "check plan", "plan ready?" - Any plan file needs review NOT for: Code review of existing files (use /gas-suite:gas-review or /review-fix)
Compare an agent or skill prompt against its test harness skill for phase-model, skip-condition, and wiring consistency. Reports mismatches and identifies which file is authoritative.
TDD-based prompt migration — given a target agent/skill prompt and a remediation list from prompt-audit, writes failing tests first, then updates the prompt to make them pass, and commits both in a single atomic commit.
| name | async-workflow |
| description | Async workflow pipeline for use case preparation and implementation. Auto-invokes for feature planning and complex task preparation. |
This skill provides background preparation and implementation workflows for use cases, features, and complex tasks.
v2 Architecture: Replaced bash scripts with native Claude Code Task capabilities for improved reliability and cross-platform compatibility.
| Aspect | /todo | /bg |
|---|---|---|
| Preparation | ASYNC | ASYNC |
| Implementation | SYNC (user does it) | ASYNC (agent does it) |
| Review | ASYNC | ASYNC |
| Use case | User wants control | User trusts agent |
| MCP available | YES (user implements) | NO (background agent) |
AUTOMATICALLY INVOKE this skill when user mentions:
DO NOT INVOKE when:
/todo <request> [flags] - Async Prep, Sync ImplementationQueue a task for async preparation. User implements synchronously after prep completes.
Flags:
--fast - Use Haiku for all phases--deep - Use Sonnet/Opus (default)--tactical - Research-only lightweight modeClassification (Auto-Detected):
Workflow:
User → /todo "feature" → ASYNC prep → Todo added → User implements SYNC → ASYNC review
/bg <request> [flags] - Fully Fire-and-ForgetLaunch a task that runs entirely in the background. Agent implements automatically.
Flags:
--fast - Use Haiku for all phases--deep - Use Sonnet/Opus (default)Workflow:
User → /bg "feature" → ASYNC (prep + implement + review) → Notified when done
When to use /bg:
When to use /todo instead:
/todo-cleanup [--dry-run] - MaintenanceClean up abandoned and old tasks.
| Aspect | v1 (bash) | v2 (Task-native) |
|---|---|---|
| ID Generation | Python + xxd | python3 time + os.urandom |
| File Operations | bash cat/echo | Write tool (atomic) |
| Locking | mkdir-based | Not needed (Task handles) |
| Date Handling | macOS/Linux specific | JavaScript (universal) |
| JSON Operations | jq (external) | JSON.parse/stringify |
| Status Updates | async-utils.sh | Read/Write JSON |
| Error Handling | bash trap | Agent try/catch |
| Component | v1 Lines | v2 Lines | Reduction |
|---|---|---|---|
| async-utils.sh | 527 | 0 | -100% |
| todo-expansion-agent.md | 500 | 0 | -100% (uses built-in agents) |
| Command files | 0 | ~300 | New |
| Total | ~1,200 | ~500 | -58% |
All 13 edge cases from the original test suite are handled:
| # | Edge Case | v2 Solution |
|---|---|---|
| 1 | Empty/Invalid Task ID | Regex validation |
| 2 | Path Traversal Attack | Reject .. and / + startsWith containment |
| 3 | ID Collision | python3 os.urandom() |
| 4 | Invalid Date Parsing | Number.isNaN() check (not || Infinity) |
| 5 | Meta.json Corruption | try/catch + skip |
| 6 | Large Content (>100KB) | Write tool (no limits) |
| 7 | File Descriptor Leak | No FDs (Task manages) |
| 8 | Concurrent Generation | TaskCreate atomic |
| 9 | Invalid jq Filter | No jq in command files (hook requires jq, checks at startup) |
| 10 | Symbolic Link Safety | Read tool validation |
| 11 | Cross-Platform Dates | JavaScript Date |
| 12 | Lock Stale/Timeout | Not needed for commands (hook ops use file-level atomicity) |
| 13 | Crashed RUNNING Tasks | RUNNING status + 1hr grace period in cleanup |
During expansion, the agent validates with 5 key questions:
Outcomes: PROCEED | FLAG_FOR_CLARIFICATION | HALT
After implementation, review runs with 5 questions:
If issues found, agent fixes and re-reviews (max 3 iterations).
User → /todo "feature" [--fast|--deep|--tactical]
│
├── Parse flags → Classify request
├── Generate task ID → Write meta.json
│
└── Background agent:
├── Phase 0: Set status → RUNNING
├── Phase 1: Expand use cases → expansion.md
├── Phase 1.5: Validation gate (PROCEED/FLAG/HALT)
├── Phase 2: Research codebase (Glob/Grep)
├── Phase 3: Create implementation plan → plan.md
├── Phase 4: Write checklist → checklist.md
└── Phase 5: Set status → READY
↓
User reads checklist.md → Implements (MCP available)
↓
Marks "Run quality review" → Hook detects → User/LLM runs review
User → /bg "feature" [--fast|--deep]
│
├── Parse flags
├── Generate task ID → Write meta.json
│
└── Background agent:
├── Phase 0: Set status → RUNNING
├── Phase 1: Expand use cases → expansion.md
├── Phase 1.5: Validation gate (PROCEED/FLAG/HALT)
├── Phase 2: Research codebase
├── Phase 3: Plan implementation → plan.md
├── Phase 4: IMPLEMENT (Edit files)
├── Phase 5: Quality review (max 3 iterations) → review.md
├── Phase 6: Write completion summary → checklist.md
└── Phase 7: Set status → COMPLETED
PENDING → RUNNING → READY (/todo: prep complete, user implements)
→ COMPLETED (/bg: agent finished implementation)
→ NEEDS_USER_ACTION (/bg: MCP tools required)
→ FAILED (any unrecoverable error)
→ FLAG_FOR_CLARIFICATION (ambiguous request)
→ HALT (destructive/dangerous request)
Any status → ABANDONED (via /todo-cleanup after 7-day timeout)
ABANDONED → [deleted] (via /todo-cleanup after 30-day cleanup_at)
Tasks stored in ~/.claude/plugins/data/async-suite/{task-id}/:
| File | Description |
|---|---|
meta.json | Task metadata (status, timestamps) — written by agent |
.hook-state.json | TodoWrite content tracking — written by hook only |
expansion.md | Use cases, edge cases, acceptance criteria |
plan.md | Implementation steps, patterns, risks |
checklist.md | Implementation checklist (/todo) or completion summary (/bg) |
implementation.log | Step-by-step progress log (/bg only) |
review.md | Post-implementation review (/bg only) |
error.log | Error details (if failed) |
Background agents (spawned with run_in_background: true) have constraints:
| Phase | Execution | MCP Available? |
|---|---|---|
| Expansion | Background agent | No |
| User Implementation | Foreground (user) | Yes |
| Quality Review | Main conversation | Yes |
Instead of slash commands, use natural language:
| Request | Action |
|---|---|
| "show me the full plan for [task-id]" | Read .md files from task directory |
| "what's the status of my async tasks?" | List tasks from ~/.claude/plugins/data/async-suite/ |
| "retry task [task-id]" | Check failed phase, relaunch |
| "clean up old async tasks" | Run /todo-cleanup |
| "review my implementation" | Launch review manually |
The hook (detect-quality-review.sh) monitors TodoWrite for the "Run quality review" checkbox:
afterToolCallThe hook does NOT automatically launch a review agent. It outputs instructions that the LLM should follow to run the review.
v2 replaced all bash infrastructure (async-utils.sh, agents/ directory, test scripts) with Task-native command files. See CLEANUP_GUIDE.md for migration details.