mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-18 18:48:48 +08:00
Refactor agent spawning and delegation check mechanisms
- Updated agent spawning from `Task()` to `Agent()` across various files to align with new standards. - Enhanced the `code-developer` agent description to clarify its invocation context and responsibilities. - Introduced a new `delegation-check` skill to validate command delegation prompts against agent role definitions, ensuring content separation and conflict detection. - Established comprehensive separation rules for command delegation prompts and agent definitions, detailing ownership and conflict patterns. - Improved documentation for command and agent design specifications to reflect the updated spawning patterns and validation processes.
This commit is contained in:
@@ -165,14 +165,14 @@ Generate a complete command file with:
|
||||
3. **`<process>`** — numbered steps (GSD workflow style):
|
||||
- Step 1: Initialize / parse arguments
|
||||
- Steps 2-N: Domain-specific orchestration logic
|
||||
- Each step: banner display, validation, agent spawning via `Task()`, error handling
|
||||
- Each step: banner display, validation, agent spawning via `Agent()`, error handling
|
||||
- Final step: status display + `<offer_next>` with next actions
|
||||
4. **`<success_criteria>`** — checkbox list of verifiable conditions
|
||||
|
||||
**Command writing rules:**
|
||||
- Steps are **numbered** (`## 1.`, `## 2.`) — follow `plan-phase.md` and `new-project.md` style
|
||||
- Use banners for phase transitions: `━━━ SKILL ► ACTION ━━━`
|
||||
- Agent spawning uses `Task(prompt, subagent_type, description)` pattern
|
||||
- Agent spawning uses `Agent({ subagent_type, prompt, description, run_in_background })` pattern
|
||||
- Prompt to agents uses `<objective>`, `<files_to_read>`, `<output>` blocks
|
||||
- Include `<offer_next>` block with formatted completion status
|
||||
- Handle agent return markers: `## TASK COMPLETE`, `## TASK BLOCKED`, `## CHECKPOINT REACHED`
|
||||
@@ -286,7 +286,7 @@ Set `$TARGET_PATH = $SOURCE_PATH` (in-place conversion) unless user specifies ou
|
||||
| `<process>` with numbered steps | At least 3 `## N.` headers |
|
||||
| Step 1 is initialization | Parses args or loads context |
|
||||
| Last step is status/report | Displays results or routes to `<offer_next>` |
|
||||
| Agent spawning (if complex) | `Task(` call with `subagent_type` |
|
||||
| Agent spawning (if complex) | `Agent({` call with `subagent_type` |
|
||||
| Agent prompt structure | `<files_to_read>` + `<objective>` or `<output>` blocks |
|
||||
| Return handling | Routes on `## TASK COMPLETE` / `## TASK BLOCKED` markers |
|
||||
| `<offer_next>` | Banner + summary + next command suggestion |
|
||||
|
||||
@@ -4,7 +4,7 @@ Guidelines for Claude Code **agent definition files** (role + domain expertise).
|
||||
|
||||
## Content Separation Principle
|
||||
|
||||
Agents are spawned by commands via `Task()`. The agent file defines WHO the agent is and WHAT it knows. It does NOT define WHEN or HOW it gets invoked.
|
||||
Agents are spawned by commands via `Agent()`. The agent file defines WHO the agent is and WHAT it knows. It does NOT define WHEN or HOW it gets invoked.
|
||||
|
||||
| Concern | Belongs in Agent | Belongs in Command |
|
||||
|---------|-----------------|-------------------|
|
||||
|
||||
@@ -153,15 +153,15 @@ Display banners before major phase transitions (agent spawning, user decisions,
|
||||
|
||||
## Agent Spawning Pattern
|
||||
|
||||
Commands spawn agents via `Task()` with structured prompts:
|
||||
Commands spawn agents via `Agent()` with structured prompts:
|
||||
|
||||
```markdown
|
||||
Task(
|
||||
prompt=filled_prompt,
|
||||
subagent_type="agent-name",
|
||||
model="{model}",
|
||||
description="Verb Phase {X}"
|
||||
)
|
||||
```javascript
|
||||
Agent({
|
||||
subagent_type: "agent-name",
|
||||
prompt: filled_prompt,
|
||||
description: "Verb Phase {X}",
|
||||
run_in_background: false
|
||||
})
|
||||
```
|
||||
|
||||
### Prompt Structure for Agents
|
||||
|
||||
@@ -49,7 +49,7 @@ Conversion Summary:
|
||||
| `## Auto Mode` / `## Auto Mode Defaults` | `<auto_mode>` section |
|
||||
| `## Quick Reference` | Preserve as-is within appropriate section |
|
||||
| Inline `AskUserQuestion` calls | Preserve verbatim — these belong in commands |
|
||||
| `Task()` / agent spawning calls | Preserve verbatim within process steps |
|
||||
| `Agent()` / agent spawning calls | Preserve verbatim within process steps |
|
||||
| Banner displays (`━━━`) | Preserve verbatim |
|
||||
| Code blocks (```bash, ```javascript, etc.) | **Preserve exactly** — never modify code content |
|
||||
| Tables | **Preserve exactly** — never reformat table content |
|
||||
|
||||
@@ -49,12 +49,13 @@ allowed-tools: {tools} # omit if unrestricted
|
||||
|
||||
{Construct prompt with <files_to_read>, <objective>, <output> blocks.}
|
||||
|
||||
```
|
||||
Task(
|
||||
prompt=filled_prompt,
|
||||
subagent_type="{agent-name}",
|
||||
description="{Verb} {target}"
|
||||
)
|
||||
```javascript
|
||||
Agent({
|
||||
subagent_type: "{agent-name}",
|
||||
prompt: filled_prompt,
|
||||
description: "{Verb} {target}",
|
||||
run_in_background: false
|
||||
})
|
||||
```
|
||||
|
||||
## 4. Handle Result
|
||||
|
||||
Reference in New Issue
Block a user