当前位置: 首页 > Skill >

multi task

multi task

multi task

通过将工作拆分为独立单元并同时分配给多个子代理,实现批量任务的并行执行调度。使用此技能...

1.0.0 2026.11.20 434
获取Skill文件查看使用说明
作 者:陈宁 许可证: 更新时间:2026.11.20
本文目录展开

Multi-Task: Parallel Batch Orchestration

Overview

When users present tasks that decompose into multiple independent work units, serial execution wastes time. This skill guides you to identify batch opportunities, construct self-contained prompts for each unit, and dispatch them as parallel subagents via the Task tool — completing in minutes what would otherwise take much longer sequentially.

The core insight: a single message can contain multiple Task tool calls, and they all execute concurrently. Your job is to make each subagent's prompt fully self-contained (they cannot see this conversation) and to coordinate the results.

When to Use This Skill

Strong signals:

  • User says "process all files in X folder"
  • User provides a list: "do A, B, C, D for each of these..."
  • User mentions "batch", "bulk", "every", "each", "all N files"
  • A folder contains multiple files needing the same operation
  • User wants multiple pages/components/reports generated

Also consider using when:

  • User describes repetitive work that you'd otherwise do in a loop
  • The task involves 3+ independent units of similar type
  • Processing time per unit is non-trivial (reading/transforming documents, generating code, etc.)

Do NOT use when:

  • Tasks have strict sequential dependencies (output of task N feeds into task N+1)
  • There are fewer than 3 work units (overhead isn't worth it)
  • The task is a single complex operation that can't be decomposed
  • User explicitly asks for serial processing

The 6-Step Workflow

Step 1: ANALYZE — Understand the Work

Before dispatching anything, enumerate what needs to be done:

  1. List all work units — files to process, pages to build, items to transform
  2. Identify the operation — what happens to each unit (extract, convert, summarize, generate, etc.)
  3. Check for shared context — do all units need the same template, config, or reference data? If so, read it once now and include it in every subagent prompt.
  4. Detect dependencies — are any units dependent on others? If yes, read references/advanced-patterns.md for dependency handling strategies. If all units are independent (the common case), proceed directly.
  5. Count the units — this determines your dispatch strategy:
    • 3-10 units: single wave, all parallel
    • 11-50 units: dispatch in waves of 8-10
    • 50+ units: run 2-3 pilot tasks first to validate your prompt, then dispatch the rest in waves

Present your analysis to the user:

Found N work units: [brief list]
Operation: [what will happen to each]
Shared context: [any common dependencies]
Dependencies: [none / description]
Strategy: [single wave / M waves of ~K / pilot + waves]

Wait for user confirmation before dispatching, especially for large batches.

Step 2: PLAN — Decompose into Task Units

For each work unit, define:

  • task-ID: Sequential identifier (task-001, task-002, ...)
  • input: Absolute path(s) to input file(s) or data
  • operation: What the subagent should do
  • output: Absolute path for results (ensure no path conflicts between tasks)
  • recommended skill: If the task matches an installed skill (see Skill Matching below)

Output path strategy: Create a dedicated output directory to keep results organized:

<project-dir>/multi-task-output/
├── task-001/
├── task-002/
└── ...

Use mkdir -p to create the output directory structure before dispatching.

Step 3: PROMPT — Construct Subagent Prompts

Each subagent starts with a blank context — it cannot see this conversation. Every prompt must be completely self-contained. Use this template:

## Task [task-ID]: [Brief description]

### Skill Recommendation
[If a matching skill is available]:
You have access to the `/[skill-name]` skill which is ideal for this task.
Invoke it using the Skill tool with skill="[skill-name]" to get specialized
instructions before proceeding.

### Context
[Any shared context the subagent needs — project background, conventions,
templates, reference data. Include the actual content, not references to
"the conversation above".]

### Input
- File: [absolute path]
- [Any other inputs, with absolute paths]

### Instructions
[Clear, step-by-step instructions for what to do]
1. [Step 1]
2. [Step 2]
...

### Output
- Save results to: [absolute path to task-specific output directory]
- Expected deliverables: [list of output files]
- [Any format requirements]

### Important Notes
- Use absolute paths for all file operations
- Do not modify the input file(s)
- If you encounter an error, save error details to [output-dir]/error.log

Prompt quality checklist:

  • All paths are absolute
  • No references to "the conversation" or "as discussed"
  • Shared context is included verbatim, not by reference
  • Output paths are unique per task (no conflicts)
  • Instructions are specific enough for an agent with no prior context
  • Skill recommendation is included if applicable

Step 4: DISPATCH — Send Tasks in Parallel

The critical mechanism: Include multiple Task tool calls in a single message. This is what makes them parallel. If you send them in separate messages, they run serially.

For 3-10 tasks: Send all in one message:

[Single message containing:]
Task(subagent_type="general-purpose", prompt="## Task task-001: ...", description="Process file-001")
Task(subagent_type="general-purpose", prompt="## Task task-002: ...", description="Process file-002")
Task(subagent_type="general-purpose", prompt="## Task task-003: ...", description="Process file-003")
...

For 11-50 tasks: Dispatch in waves of 8-10. Wait for each wave to complete before starting the next:

Wave 1: task-001 through task-010 (single message, all parallel)
[Wait for completion, report progress]
Wave 2: task-011 through task-020 (single message, all parallel)
[Wait for completion, report progress]
...

For 50+ tasks: Run a pilot first:

  1. Pick 2-3 representative tasks (include edge cases if possible)
  2. Dispatch them as a pilot wave
  3. Verify results are correct
  4. If issues found, fix the prompt template and re-pilot
  5. Once validated, dispatch the remaining tasks in waves of 8-10

Subagent type selection:

  • Default: general-purpose (has access to all tools including Skill)
  • For pure shell/git tasks: Bash
  • For code exploration only: Explore

Run tasks in background when appropriate: For large batches, use run_in_background: true so you can monitor progress and report to the user incrementally.

Step 5: MONITOR — Track Progress

As results come back:

  1. Track completion — maintain a mental tally: "Wave 1: 8/10 complete"
  2. Check for failures — if a task fails:
    • Analyze the error
    • Fix the prompt if needed
    • Retry up to 2 times automatically
    • If still failing after 2 retries, mark as failed and continue with others
  3. Report progress to user after each wave:
    Wave 1 complete: 9/10 succeeded, 1 failed (task-007: [reason])
    Starting wave 2...
    
  4. Failure isolation — one task's failure must never block or affect other tasks

Step 6: MERGE — Collect and Present Results

After all waves complete:

  1. Sort results by task-ID — present in order regardless of completion time
  2. Summarize outcomes:
    Batch complete: N/M tasks succeeded
    
    Successful:
    - task-001: [output path] — [brief description]
    - task-002: [output path] — [brief description]
    ...
    
    Failed (if any):
    - task-007: [error reason] — [suggested fix]
    
  3. Handle failed tasks — offer to retry failed tasks or let user fix input and rerun
  4. Merge outputs if requested — some batch operations need a final merge step (e.g., combining extracted text into one document). Do this after all tasks complete.

Skill Matching

When planning tasks, match each work unit against installed skills. This dramatically improves subagent performance because skills provide specialized, tested instructions.

Matching rules:

Task involves... Recommend skill
PDF files (read, create, merge, extract) /pdf
Word documents (.docx read, create, edit) /docx
PowerPoint files (.pptx) /pptx
Spreadsheets (.xlsx, .csv, .tsv) /xlsx
Web pages, components, HTML/CSS /frontend-design
Visual design, posters, art /canvas-design
Styling artifacts with themes /theme-factory

How to include skill recommendations in prompts:

In each subagent's prompt, add the skill invocation instruction:

### Skill Recommendation
You have access to the `/pdf` skill. Before starting work, invoke it using
the Skill tool: Skill(skill="pdf"). This will load specialized instructions
for PDF processing that will help you complete this task more effectively.

If no installed skill matches, omit the skill recommendation section — the subagent will use its general capabilities.

Examples

Example 1: Batch PDF Text Extraction

User: "Extract text from all PDFs in /Users/me/reports/ and save as markdown files"

Analysis:

Found 12 PDF files in /Users/me/reports/
Operation: Extract text from each PDF, save as .md
Shared context: None
Dependencies: None
Strategy: 2 waves of 6

Subagent prompt (each task):

## Task task-001: Extract text from Q1-report.pdf

### Skill Recommendation
You have access to the `/pdf` skill. Invoke it using the Skill tool with
skill="pdf" to get specialized PDF processing instructions.

### Input
- File: /Users/me/reports/Q1-report.pdf

### Instructions
1. Read the PDF file and extract all text content
2. Preserve heading structure where possible
3. Format the output as clean Markdown
4. Include page breaks as horizontal rules (---)

### Output
- Save to: /Users/me/reports/multi-task-output/task-001/Q1-report.md
- Create the output directory if it doesn't exist

Example 2: Multi-Page Frontend Development

User: "Build 5 pages for our marketing site: Home, About, Pricing, Blog, Contact"

Analysis:

Found 5 work units: Home, About, Pricing, Blog, Contact pages
Operation: Generate frontend code for each page
Shared context: Brand guidelines, shared layout components, color scheme
Dependencies: None (each page is independent)
Strategy: Single wave, all 5 parallel

Key considerations:

  • Read any existing shared components/styles first
  • Include the full shared context (brand colors, fonts, layout patterns) in each prompt
  • Each subagent gets /frontend-design skill recommendation
  • Output to separate directories: pages/home/, pages/about/, etc.

Example 3: Batch Data Conversion

User: "Convert all CSV files in /data/raw/ to JSON format with proper types"

Analysis:

Found 25 CSV files in /data/raw/
Operation: Parse CSV, infer types, convert to JSON
Shared context: Type inference rules (dates, numbers, booleans)
Dependencies: None
Strategy: 3 waves of ~8-9

Key considerations:

  • Each subagent gets /xlsx skill recommendation (handles CSV)
  • Include type inference rules in every prompt
  • Standardize output format in the prompt template

Troubleshooting

Problem Cause Fix
Tasks run serially, not parallel Task calls sent in separate messages Put ALL Task calls in a single message
Subagent says "I don't have context" Prompt references conversation history Make prompt fully self-contained
File not found errors Relative paths used Use absolute paths everywhere
Output files overwrite each other Same output path for multiple tasks Use task-ID in output directory path
Subagent doesn't use recommended skill Skill instruction unclear Add explicit Skill(skill="name") call instruction
Too many tasks overwhelm the system Dispatching 50+ at once Use waves of 8-10
Results arrive in wrong order Relying on completion order Sort by task-ID, not completion time
One failure cascades to others Shared state between tasks Ensure full isolation — separate dirs, no shared files

Advanced Patterns

For handling tasks with dependencies (linear chains, fan-in/fan-out, partial dependencies), dynamic batch sizing, and conditional dispatch, read references/advanced-patterns.md.

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • Multi-Task: Parallel Batch Orchestration
    • Overview
    • When to Use This Skill
    • The 6-Step Workflow
      • Step 1: ANALYZE — Understand the Work
      • Step 2: PLAN — Decompose into Task Units
      • Step 3: PROMPT — Construct Subagent Prompts
      • Step 4: DISPATCH — Send Tasks in Parallel
      • Step 5: MONITOR — Track Progress
      • Step 6: MERGE — Collect and Present Results
    • Skill Matching
    • Examples
      • Example 1: Batch PDF Text Extraction
      • Example 2: Multi-Page Frontend Development
      • Example 3: Batch Data Conversion
    • Troubleshooting
    • Advanced Patterns
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期