Community编程与开发github.com

alfathafp/portofolio-web-design

当需要同时处理多个独立任务(无共享状态或顺序依赖)时,将任务分派给并行工作的专门子代理。

portofolio-web-design 是什么?

这个技能教授如何将多个彼此独立的故障或任务并行分派给专门的子代理,从而显著缩短处理时间。其核心原则是:每个独立的故障领域分派一个子代理,让它们同时工作。技能提供了清晰的决策流程图,以判断何时应该使用并行分派(故障彼此无关,无共享状态)以及何时应该避免(故障相关或需要完整系统上下文)。每个子代理都获得自包含的指令,包括具体范围、明确目标、约束条件和预期输出格式。任务分配后,用户可以在同一响应中发出多个子代理调用,这些调用将并行执行;如果每次只调用一个,则按顺序依次执行。最后,示例和常见错误部分展示了有效和无效的提示结构,帮助使用者在实践中避免典型陷阱。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/alfathafp/portofolio-web-design/tree/HEAD/.agents/skills/dispatching-parallel-agents

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

并行分派子代理

概述

你将任务委派给具有隔离上下文的专门子代理。通过精确构建它们的指令和上下文,确保它们保持专注并成功完成任务。它们绝不应继承你当前会话的上下文或历史记录——你应精确构建它们所需的全部内容。这样做还能保留你自己的上下文以进行协调工作。

当你有多个无关的故障(不同的测试文件、不同的子系统、不同的错误)时,逐个调查会浪费时间。每个调查都是独立的,可以并行进行。

核心原则: 每个独立问题域分派一个代理。让它们同时工作。

何时使用

digraph when_to_use {
    "多个失败?" [shape=diamond];
    "它们独立吗?" [shape=diamond];
    "单个代理调查所有" [shape=box];
    "每个问题域一个代理" [shape=box];
    "它们可以并行工作吗?" [shape=diamond];
    "顺序代理" [shape=box];
    "并行分派" [shape=box];

    "多个失败?" -> "它们独立吗?" [label="是"];
    "它们独立吗?" -> "单个代理调查所有" [label="否 - 相关"];
    "它们独立吗?" -> "每个问题域一个代理" [label="是"];
    "每个问题域一个代理" -> "它们可以并行工作吗?" [label=""];
    "它们可以并行工作吗?" -> "并行分派" [label="是"];
    "它们可以并行工作吗?" -> "顺序代理" [label="否 - 有共享状态"];
}

使用场景:

  • 3 个或更多测试文件因不同根本原因失败
  • 多个子系统独立损坏
  • 每个问题无需其他问题的上下文即可理解
  • 调查之间没有共享状态

不使用场景:

  • 故障是相关的(修复一个可能会修复其他)
  • 需要了解完整系统状态
  • 代理之间会互相干扰

模式

1. 识别独立域

按损坏的内容对失败进行分组:

  • 文件 A 测试:工具审批流程
  • 文件 B 测试:批处理完成行为
  • 文件 C 测试:中止功能

每个域都是独立的——修复工具审批不会影响中止测试。

2. 创建聚焦的代理任务

每个子代理获得:

  • 具体范围: 一个测试文件或子系统
  • 明确目标: 使这些测试通过
  • 约束条件: 不要更改其他代码
  • 预期输出: 发现和修复的内容摘要

3. 并行分派

在同一响应中发出所有三个子代理分派命令——它们将并行运行:

子代理(通用):"修复 agent-tool-abort.test.ts 中的失败"
子代理(通用):"修复 batch-completion-behavior.test.ts 中的失败"
子代理(通用):"修复 tool-approval-race-conditions.test.ts 中的失败"
# 所有三个将同时运行。

一个响应中包含多个分派调用 = 并行执行。每次响应中只有一个 = 顺序执行。

4. 审查与整合

当子代理返回时:

  • 阅读每个摘要
  • 验证修复没有冲突
  • 运行完整的测试套件
  • 整合所有变更

子代理提示结构

好的子代理提示应满足:

  1. 聚焦 - 一个清晰的问题域
  2. 自包含 - 理解问题所需的所有上下文
  3. 明确输出 - 代理应返回什么?
修复 src/agents/agent-tool-abort.test.ts 中的 3 个测试失败:

1. "should abort tool with partial output capture" - 期望消息中包含 'interrupted at'
2. "should handle mixed completed and aborted tools" - 快速工具被中止而非完成
3. "should properly track pendingToolCount" - 期望 3 个结果但得到 0

这些是时序/竞态条件问题。你的任务:

1. 阅读测试文件并理解每个测试验证了什么
2. 识别根本原因 - 是时序问题还是实际错误?
3. 通过以下方式修复:
   - 用基于事件的等待替换任意超时
   - 如果发现了中止实现中的错误则修复它
   - 如果测试验证的是已更改的行为,则调整测试期望

不要只是增加超时时间——找到真正的问题。

返回:你发现的内容及其修复的摘要。

常见错误

❌ 范围太宽: "修复所有测试" - 代理会迷失方向 ✅ 具体: "修复 agent-tool-abort.test.ts" - 范围聚焦

❌ 无上下文: "修复竞态条件" - 代理不知道在哪 ✅ 提供上下文: 粘贴错误消息和测试名称

❌ 无约束: 代理可能会重构所有内容 ✅ 添加约束: "不要更改生产代码" 或 "仅修复测试"

❌ 输出模糊: "修复它" - 你不知道改变了什么 ✅ 明确要求: "返回根本原因和变更的摘要"

何时不使用

相关故障: 修复一个可能会修复其他——先一起调查 需要完整上下文: 理解需要查看整个系统 探索性调试: 你还不知道哪里出错了 共享状态: 代理会互相干扰(编辑相同文件、使用相同资源)

实际会话示例

场景: 重大重构后 3 个文件共出现 6 个测试失败

失败情况:

  • agent-tool-abort.test.ts: 3 个失败(时序问题)
  • batch-completion-behavior.test.ts: 2 个失败(工具未执行)
  • tool-approval-race-conditions.test.ts: 1 个失败(执行计数 = 0)

决策: 独立域——中止逻辑与批处理完成逻辑和竞态条件逻辑彼此独立

分派:

代理 1 → 修复 agent-tool-abort.test.ts
代理 2 → 修复 batch-completion-behavior.test.ts
代理 3 → 修复 tool-approval-race-conditions.test.ts

结果:

  • 代理 1:将超时替换为基于事件的等待
  • 代理 2:修复了事件结构错误(threadId 在错误位置)
  • 代理 3:添加了等待异步工具执行完成

整合: 所有修复相互独立,无冲突,整个套件全部通过

验证

子代理返回后:

  1. 审查每个摘要 - 了解变更了什么
  2. 检查冲突 - 子代理是否编辑了相同的代码?
  3. 运行完整套件 - 验证所有修复是否协同工作
  4. 抽样检查 - 子代理可能出现系统性错误

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

alfathafp/portofolio-web-design

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

alfathafp/portofolio-web-design

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

alfathafp/portofolio-web-design

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

alfathafp/portofolio-web-design

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch. Use when asked to review a diff or a pull request, even when the diff is pasted inline.

alfathafp/portofolio-web-design

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

alfathafp/portofolio-web-design

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

alfathafp/portofolio-web-design

Optimizes agent context setup. Use when starting a new session, when agent output quality degrades, when switching between tasks, or when you need to configure rules files and context for a project.

alfathafp/portofolio-web-design

Guides systematic root-cause debugging. Use when tests fail, builds break, something that worked yesterday broke, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need to figure out what broke and why — a systematic approach to finding and fixing the root cause rather than guessing.

alfathafp/portofolio-web-design

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

alfathafp/portofolio-web-design

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.

alfathafp/portofolio-web-design

Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.

alfathafp/portofolio-web-design

Records decisions and documentation. Use when you need to document an architecture decision (ADR) or the reasoning behind a design choice, when changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

alfathafp/portofolio-web-design

Subjects every non-trivial decision to a fresh-context adversarial review before it stands. Use when you want every assumption cross-examined before proceeding, when stress-testing a plan for hidden failure modes, when correctness matters more than speed, when working in unfamiliar code, when stakes are high (production auth, security-sensitive logic, a high-stakes migration, irreversible operations), or any time a confident output would be cheaper to verify now than to debug later.

alfathafp/portofolio-web-design

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

alfathafp/portofolio-web-design

Use when implementation is complete, all tests pass, and you need to decide how to integrate the work

alfathafp/portofolio-web-design

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

alfathafp/portofolio-web-design

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.

alfathafp/portofolio-web-design

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

alfathafp/portofolio-web-design

Delivers changes incrementally in thin, verifiable slices. Use when implementing any feature or change that touches more than one file, or when picking up the next task from a plan. Use when rolling a change out behind a feature flag, when you're about to write a large amount of code at once, or when a task feels too big to land in one step.

alfathafp/portofolio-web-design

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

相关技能