Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"plugins": [
{
"name": "dev-workflow",
"description": "Complete development workflow: brainstorming, planning, TDD, debugging, subagent execution, code review, PR merge",
"description": "Complete development workflow: brainstorming, planning, TDD, debugging, agent team execution, subagent fallback, code review, PR merge",
"source": "./"
}
]
Expand Down
3 changes: 2 additions & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dev-workflow",
"version": "2.2.0",
"description": "Complete development workflow: brainstorming, planning, TDD, debugging, subagent execution, code review, PR merge",
"description": "Complete development workflow: brainstorming, planning, TDD, debugging, agent team execution, subagent fallback, code review, PR merge",
"author": {
"name": "Tom Baker",
"url": "https://github.com/tombakerjr"
Expand All @@ -12,6 +12,7 @@
"keywords": [
"workflow",
"code-review",
"agent-teams",
"subagent",
"implementation",
"development"
Expand Down
8 changes: 6 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ claude-code-pr-workflow/
│ ├── pr-merge.md # /pr-merge
│ └── context-recovery.md # /context-recovery
├── skills/ # Workflow skills
│ ├── subagent-driven-development/ # Execute implementation plans
│ ├── agent-team-development/ # Parallel agent teams (preferred)
│ ├── subagent-driven-development/ # Sequential subagent execution (fallback)
│ ├── test-driven-development/ # TDD workflow
│ ├── systematic-debugging/ # Debug root cause analysis
│ ├── writing-plans/ # Create implementation plans
Expand All @@ -37,6 +38,7 @@ claude-code-pr-workflow/
│ ├── hooks.json # Hook configuration
│ ├── run-hook.cmd # Cross-platform wrapper
│ ├── git-guard.py # PreToolUse: block main push
│ ├── task-completed-gate.py # TaskCompleted: review gate for agent teams
│ └── stop-check.sh # Stop: warn on uncommitted
├── CLAUDE.md
└── README.md
Expand Down Expand Up @@ -105,7 +107,8 @@ Skills provide structured workflows for common development tasks:
- "Use dev-workflow:brainstorming" - Start design dialogue for new features
- "Use dev-workflow:systematic-debugging" - Debug with root cause analysis
- "Use dev-workflow:writing-plans" - Create implementation plan with tasks
- "Use dev-workflow:subagent-driven-development" - Execute implementation plans with independent tasks
- "Use dev-workflow:agent-team-development" - Execute plans with parallel agent teams (preferred, falls back to subagent-driven-development)
- "Use dev-workflow:subagent-driven-development" - Execute implementation plans with sequential subagents (fallback)
- "Use dev-workflow:test-driven-development" - TDD workflow with test-first approach
- "Use dev-workflow:using-git-worktrees" - Isolated git worktrees for complex features

Expand All @@ -123,6 +126,7 @@ When compacting conversation history, preserve:
- Git branch and last commit SHA
- Any blockers or review feedback not yet addressed
- PR number if one exists
- Active teammate names and worktree paths (if using agent teams)

Discard:
- Full file contents (can re-read)
Expand Down
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ A comprehensive Claude Code plugin for feature development, bug fixes, and PR wo
## Features

- **Upfront planning** - Brainstorming and structured implementation plans before code
- **Subagent execution** - Parallelized work with fresh context per task
- **Agent team execution** - True parallel implementation with multiple agents, dedicated reviewer, and mailbox communication
- **Subagent execution** - Sequential execution with fresh context per task (fallback)
- **Git worktree support** - Isolated workspaces for parallel development
- **Pre-commit verification** - Type checking, security scans, debug code detection
- **PR merge checklist** - CI verification, delayed comment detection, blocker scanning
Expand All @@ -20,17 +21,24 @@ This plugin enforces three core principles:
### 1. Planning Before Implementation
Features start with **brainstorming** (Socratic exploration of requirements and design), followed by **writing plans** that break work into bite-sized, verifiable tasks. This catches issues early and provides clear success criteria.

### 2. Subagents for Context Hygiene
Implementation uses **subagent-driven development** where:
### 2. Agent Teams for True Parallelism
When agent teams are enabled, **agent-team-development** provides:
- Multiple implementers working simultaneously in separate git worktrees
- Dedicated reviewer communicating feedback directly via mailbox
- Lead coordinator in delegate mode for orchestration-only
- Automatic fallback to subagent-driven-development when teams aren't available

### 3. Subagents for Context Hygiene
**Subagent-driven development** (fallback) provides:
- Main conversation stays clean (planning and orchestration)
- Each task gets fresh context (implementer subagent reads files it needs)
- Prevents context bloat from 50k+ token file dumps
- Enables independent work verification

### 3. Parallelization Through Isolation
**Git worktrees** + subagents enable true parallel development:
### 4. Parallelization Through Isolation
**Git worktrees** + agents enable true parallel development:
- Multiple features/experiments in isolated workspaces
- Subagents work independently without blocking
- Agents work independently without blocking
- Easy cleanup (delete worktree, no branch pollution)

## Complete Development Workflow
Expand All @@ -44,9 +52,13 @@ flowchart TD
D --> E[Create isolated workspace]
E --> F[Writing-plans skill]
F --> G["Break into tasks with acceptance criteria"]
G --> H[Subagent-driven-development skill]
H --> I["Parallel execution with fresh context"]
I --> J["/pr-create"]
G --> H{Agent teams enabled?}
H -->|Yes| I1[Agent-team-development skill]
I1 --> I2["Parallel implementers + reviewer in worktrees"]
H -->|No| I3[Subagent-driven-development skill]
I3 --> I4["Sequential execution with fresh context"]
I2 --> J["/pr-create"]
I4 --> J
J --> K[PR ready]
end

Expand Down Expand Up @@ -84,7 +96,7 @@ flowchart TD
| **1. Design** | `brainstorming` | Socratic exploration of requirements and design trade-offs |
| **2. Isolate** | `using-git-worktrees` | Create isolated workspace (optional, for parallel work) |
| **3. Plan** | `writing-plans` | Break feature into bite-sized tasks with acceptance criteria |
| **4. Execute** | `subagent-driven-development` | Parallel execution with fresh context per task |
| **4. Execute** | `agent-team-development` | Parallel agent teams (falls back to `subagent-driven-development`) |
| **5. PR** | `/pr-create` | Typecheck, push, create PR |
| **6. Merge** | `/pr-merge` | Full checklist with delayed comment detection |

Expand Down Expand Up @@ -112,10 +124,11 @@ The plugin prevents common mistakes:

When executing implementation plans (from `writing-plans` or similar), this plugin enforces:

- **Use**: `dev-workflow:subagent-driven-development`
- **Preferred**: `dev-workflow:agent-team-development` - parallel agent teams with worktree isolation
- **Fallback**: `dev-workflow:subagent-driven-development` - sequential subagents (when agent teams not enabled)
- **Not**: Alternative execution methods that cause context bloat

Subagent-driven development keeps work in the current session with fresh context per task, avoiding context bloat from long-running executions.
Agent-team-development automatically detects whether agent teams are enabled and falls back to subagent-driven-development when they aren't.

## Installation

Expand Down Expand Up @@ -165,7 +178,8 @@ Then restart Claude Code.

| Skill | Description |
|-------|-------------|
| `subagent-driven-development` | Execute implementation plans with parallel subagents and fresh context |
| `agent-team-development` | Execute plans with parallel agent teams, dedicated reviewer, and worktree isolation (preferred) |
| `subagent-driven-development` | Execute implementation plans with sequential subagents and fresh context (fallback) |
| `test-driven-development` | Red-green-refactor discipline for features and bug fixes |
| `systematic-debugging` | 4-phase root cause analysis: gather, hypothesize, verify, fix |
| `writing-plans` | Create bite-sized task plans with acceptance criteria |
Expand All @@ -177,8 +191,9 @@ Then restart Claude Code.
| Hook | Event | Function |
|------|-------|----------|
| `git-guard.py` | PreToolUse:Bash | Blocks commits on main/master, blocks push to main/master, warns on raw `gh pr merge` |
| `task-completed-gate.py` | TaskCompleted | Prevents implementation tasks from being marked complete before review |
| `stop-check.sh` | Stop | Warns about uncommitted changes, open PRs, changes on main |
| `workflow-preferences.sh` | SessionStart | Injects execution preferences (use subagent-driven-development) |
| `workflow-preferences.sh` | SessionStart | Injects execution preferences (use agent-team-development) |

## The Merge Checklist

Expand Down
11 changes: 11 additions & 0 deletions hooks/hooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@
]
}
],
"TaskCompleted": [
{
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" task-completed-gate.py",
"timeout": 5
}
]
}
],
"SessionStart": [
{
"hooks": [
Expand Down
110 changes: 110 additions & 0 deletions hooks/task-completed-gate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#!/usr/bin/env python3
"""
Task Completed Gate Hook - TaskCompleted hook for agent team development.
Prevents implementation tasks from being marked complete before review.

When a teammate marks a task as complete, this hook checks whether
the task appears to be an implementation task that hasn't been reviewed.
If so, it blocks completion with a message directing review.

Usage: Configure in hooks/hooks.json as a TaskCompleted hook.
"""
import json
import os
import sys
import re


# Patterns indicating an implementation task (matched against lowercased text)
IMPL_PATTERNS = [
r'\b(implement|create|add|build|write|update|refactor|fix|migrate)\b',
r'\btask\s+\d+\.\d+\b',
]

# Patterns indicating the task is primarily a review/meta task (not subject to review gate)
# These are narrow to avoid false negatives on implementation tasks containing "check" etc.
REVIEW_PATTERNS = [
r'^review\b',
r'\breview\s+(this|the|task|code|changes|implementation)\b',
r'\bready\s+for\s+review\b',
r'^(meta|setup|cleanup|housekeeping)\b',
r'\b(spec|quality|staff)\s+review\b',
]

# Patterns indicating task has already been reviewed (matched against lowercased text)
REVIEWED_INDICATORS = [
r'\breviewed\b',
r'\bapproved\b',
r'\bpass\b',
r'\breview\s+passed\b',
]


def is_implementation_task(subject, description):
"""Check if the task looks like an implementation task."""
text = f"{subject} {description}".lower()

# Check if subject primarily matches review/meta patterns (exclude from gate)
subject_lower = subject.lower()
for pattern in REVIEW_PATTERNS:
if re.search(pattern, subject_lower):
return False

# Check if it matches implementation patterns
for pattern in IMPL_PATTERNS:
if re.search(pattern, text):
return True

return False


def is_already_reviewed(subject, description):
"""Check if the task shows signs of having been reviewed."""
text = f"{subject} {description}".lower()

for pattern in REVIEWED_INDICATORS:
if re.search(pattern, text):
return True

return False


def main():
# Only enforce review gate when agent teams are active
if not os.environ.get("CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS"):
sys.exit(0)

try:
input_data = json.load(sys.stdin)
except (json.JSONDecodeError, IOError):
# Graceful fallback - don't block if we can't parse input
sys.exit(0)

# Extract task information from the hook payload
tool_input = input_data.get("tool_input", {})
subject = tool_input.get("subject", "")
description = tool_input.get("description", "")

# If we can't determine task details, don't block
if not subject and not description:
sys.exit(0)

# Check if this is an implementation task
if not is_implementation_task(subject, description):
sys.exit(0)

# Check if it's already been reviewed
if is_already_reviewed(subject, description):
sys.exit(0)

# Block completion - implementation task needs review first
print(
"Task requires review before completion. "
"Reviewer: please review this task before marking it complete.",
file=sys.stderr
)
sys.exit(2)


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion hooks/workflow-preferences.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cat << 'EOF'
{
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": "Use subagent-driven-development for plan execution. Never commit to main. For new features: dev-workflow:brainstorming. For bugs: dev-workflow:systematic-debugging."
"additionalContext": "Use agent-team-development for plan execution (falls back to subagent-driven-development if agent teams not enabled). Never commit to main. For new features: dev-workflow:brainstorming. For bugs: dev-workflow:systematic-debugging."
}
}
EOF
Loading