用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ForceInjection/domain-driven-design-skills --skill merge-agent-work命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Conduct deep academic research for philosophy, neuroscience, cognitive science, and theoretical computer science (computability, complexity, AI theory, logic). Use when user asks to: research academic topics, find scholarly papers, conduct literature reviews, analyze citations, synthesize research findings, explore philosophical arguments, investigate consciousness/cognition, study computability/decidability/Turing machines, or analyze academic debates. Triggers on: 'research papers', 'literature review', 'academic sources', 'scholarly articles', 'philosophy of mind', 'computability theory', 'neuroscience studies', 'find papers on', 'what does the research say'.
Create clear action plans with steps, success criteria, and risk awareness. Use before implementing features, making changes, starting projects, or anytime you need a roadmap to success. Triggers on "plan this", "how should we approach", "what's the strategy", "steps to complete", or when facing complex multi-step work.
Add keyboard navigation to a feature using CommandRegistryService. Use when implementing keyboard shortcuts, vim-style navigation, or hotkeys for a page or component.
基于 SOC 职业分类
| name | merge-agent-work |
| description | Merge agent work from agent branch to task branch with validation |
| allowed-tools | Bash, Read |
Purpose: Safely merge agent work from agent branch to task branch with proper validation and state tracking.
Performance: Reduces merge errors, ensures work properly integrated
# Check agent status
STATUS=$(jq -r '.status' /workspace/tasks/{task}/agents/{agent}/status.json)
if [ "$STATUS" != "completed" ]; then
echo "Agent not completed: $STATUS"
exit 1
fi
# Must merge in task worktree
cd /workspace/tasks/{task-name}/code
# Merge agent branch to task branch
git merge {task-name}-{agent} --no-ff --no-edit
# Verify merge succeeded
- No conflicts
- Files added/modified as expected
- Build still succeeds (optional)
- Commit created
# Update task.json
jq '.agents.{agent}.merged = true | .agents.{agent}.merge_time = "timestamp"' \
task.json > tmp.json
mv tmp.json task.json
# After architect agent completes
TASK_NAME="implement-formatter-api"
AGENT="architect"
/workspace/main/.claude/scripts/merge-agent-work.sh \
--task "$TASK_NAME" \
--agent "$AGENT"
# Merge and validate build succeeds
TASK_NAME="implement-formatter-api"
AGENT="tester"
/workspace/main/.claude/scripts/merge-agent-work.sh \
--task "$TASK_NAME" \
--agent "$AGENT" \
--validate-build true \
--build-command "mvn test"
# Merge all completed agents
TASK_NAME="implement-formatter-api"
for agent in architect tester formatter; do
STATUS=$(jq -r '.status' /workspace/tasks/$TASK_NAME/agents/$agent/status.json)
if [ "$STATUS" = "completed" ]; then
/workspace/main/.claude/scripts/merge-agent-work.sh \
--task "$TASK_NAME" \
--agent "$agent"
fi
done
On any error:
Recovery: Can retry after fixing issues
IMPLEMENTATION state: All agents working in parallel
↓
Agent 1 completes (status: completed)
↓
[merge-agent-work: Agent 1 → task branch]
↓
Agent 2 completes (status: completed)
↓
[merge-agent-work: Agent 2 → task branch]
↓
Agent 3 completes (status: completed)
↓
[merge-agent-work: Agent 3 → task branch]
↓
All agents merged, transition to VALIDATION
Agent implements feature (round 1)
↓
[merge-agent-work: Agent → task]
↓
Validation finds issues
↓
Re-invoke agent for fixes (round 2)
↓
[merge-agent-work: Agent → task]
↓
Validation passes
Script returns JSON:
{
"status": "success",
"message": "Agent work merged successfully",
"task_name": "implement-formatter-api",
"agent_name": "architect",
"agent_branch": "implement-formatter-api-architect",
"task_branch": "implement-formatter-api",
"merge_commit": "abc123def456",
"files_changed": 15,
"insertions": 450,
"deletions": 23,
"build_validation": "passed",
"timestamp": "2025-11-11T12:34:56-05:00"
}
# Creates merge commit (preserves agent work history)
git merge {agent-branch} --no-ff
# Benefit: Clear history of agent contributions
# Result: Merge commit shows what agent did
# Linear history (no merge commit)
git merge {agent-branch} --ff-only
# Benefit: Cleaner history
# Risk: Loses agent contribution visibility
# Squashes all agent commits into one
git merge {agent-branch} --squash
# Problem: Loses agent work history
# Use case: Only if agent made many tiny commits
# For simple conflicts, skill can auto-resolve:
- Both added same file → Use agent's version
- Both modified same file → Use agent's version (if main agent made no changes)
# Skill reports conflict, main agent must resolve:
- Both modified same lines
- Complex merge conflicts
- Semantic conflicts (code compiles but behavior conflicts)
# Quick validation:
- Merge completed
- No conflicts
- Commit created
# More thorough:
- Minimal validation
- File count reasonable (not empty merge)
- Diff size reasonable (not huge merge)
# Complete validation:
- Standard validation
- Build succeeds
- Tests pass
- No Checkstyle/PMD violations
# Check agent status
jq -r '.status' /workspace/tasks/{task}/agents/{agent}/status.json
# Possible statuses:
# - "in_progress" → Wait for completion
# - "failed" → Investigate agent error
# - "not_started" → Agent never invoked
# Wait for completion or re-invoke agent
# View conflicts
cd /workspace/tasks/{task-name}/code
git status
# Resolve manually:
# 1. Edit conflicted files
# 2. Stage resolved files: git add <file>
# 3. Complete merge: git commit
# 4. Update state tracking
# Merge succeeded but build broken
# Options:
# 1. Revert merge: git reset --hard HEAD~1
# 2. Re-invoke agent with fix requirements
# 3. Main agent fixes in VALIDATION state (if compilation error)
# After fix, retry merge
# Must be in task worktree, not agent worktree
# Verify current directory
pwd
# Should be: /workspace/tasks/{task-name}/code
# NOT: /workspace/tasks/{task-name}/agents/{agent}/code
# Switch to task worktree
cd /workspace/tasks/{task-name}/code
# Merge agents one at a time, validate each
merge architect → validate → merge tester → validate → merge formatter
# Merge all completed agents, then validate once
merge architect → merge tester → merge formatter → validate all
# Merge agent, test, fix if needed, repeat
merge agent → test → if fail: fix → merge again
The merge-agent-work script performs:
Validation Phase
Merge Preparation Phase
Merge Execution Phase
Merge Validation Phase
State Update Phase
Reporting Phase