Community程式設計與開發github.com

alfathafp/portfolio-web-design

當面臨兩個以上可獨立執行的任務,且這些任務之間沒有共享狀態或連續依賴時使用

portfolio-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="否 - 共享狀態"];
}

使用時機:

  • 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)

決策: 獨立領域 - 中止邏輯不同於批次完成,也不同於競爭條件

分派:

Agent 1 → 修復 agent-tool-abort.test.ts
Agent 2 → 修復 batch-completion-behavior.test.ts
Agent 3 → 修復 tool-approval-race-conditions.test.ts

結果:

  • Agent 1:將超時替換為基於事件的等待
  • Agent 2:修復事件結構錯誤(threadId 位置錯誤)
  • Agent 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.

相關技能