Parallel Agent Contracts

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Parallel Agent Type Contracts

AI 產生的概覽

提供提示詞範本與標準型別對照表,讓平行編碼代理避免重複定義 TypeScript 型別。

功能
這個技能為多個代理平行實作程式碼時的提示詞撰寫提供指引。它規定提示詞必須包含的部分:使用 TypeScript 編譯器的驗證指令、建立前用 grep 檢查型別是否已存在,以及一份標準型別對照表,說明每個共用型別由哪個檔案負責以及如何匯入。它也提供可重複使用的提示詞範本,並簡要說明這種做法為何有效。
適用情境
當需要在同一個 TypeScript 程式碼庫上協調多個代理、避免型別定義衝突或重複時使用。它適合平行實作工作的提示詞撰寫,而非單一代理的編碼工作。
執行需求
不隨附指令碼,僅為說明性內容。所述流程假定有 TypeScript 專案,並可在環境中使用 npx tsc 指令與 grep。

Parallel Agent Type Contracts

When launching parallel agents for code implementation, prevent type duplication.

Required in Every Agent Prompt

1. Verification Command (MANDATORY)

markdown
## Before Marking CompleteRun verification:\`\`\`bashnpx tsc --noEmit 2>&1 | head -20\`\`\`If ANY type errors exist, fix them before completing.

2. Grep-Before-Create

markdown
## Before Creating Any Type/InterfaceFirst check if it exists:\`\`\`bashgrep -r "interface YourTypeName\|type YourTypeName" src/\`\`\`If found, import it. NEVER duplicate existing types.

3. Canonical Type Map

Include relevant entries from this map in agent prompts:

TypeOwner FileImport From
NormalizedToolsrc/sdk/agent.ts'./agent'
ToolCallsrc/sdk/agent.ts'./agent'
ToolResultsrc/sdk/agent.ts'./agent'
ToolDefinitionsrc/sdk/agent.ts'./agent'
Messagesrc/sdk/types.ts'./types'
ContentBlocksrc/sdk/types.ts'./types'
TokenUsagesrc/sdk/types.ts'./types'
ProviderAdaptersrc/sdk/providers/index.ts'./providers'
RiggClientsrc/sdk/client.ts'./client'

Prompt Template

When spawning implementation agents:

markdown
# Task: [Description]
## Type Ownership (DO NOT recreate)- [List relevant types from canonical map]
## Before Creating New TypesRun: `grep -r "interface TypeName" src/` - if exists, import it.
## Before Marking CompleteRun: `npx tsc --noEmit 2>&1 | head -20`Fix all type errors before completing.
## Your Implementation[Actual task description]

Why This Works

  1. Type checker is the contract - tsc catches conflicts automatically
  2. Grep is fast - 1 second to check if type exists
  3. Explicit ownership - No ambiguity about where types live
  4. Fail fast - Agent can't claim "done" with broken types

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/parallel-agent-contracts提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架