Skip to content
Open
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
140 changes: 140 additions & 0 deletions .claude/commands/prp-core/prp-commit-batch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
description: Split working tree changes into multiple logical commits with smart grouping
argument-hint: [grouping strategy] (blank = auto-detect logical groups)
---

# Batch Commit

**Strategy**: $ARGUMENTS

---

## Your Mission

Analyze all uncommitted changes, determine the optimal number of logical commits, then create each commit using the `/prp-commit` workflow.

---

## Phase 1: ASSESS — Survey All Changes

```bash
git status --short
git diff --stat
git diff --cached --stat
```

If nothing to commit, stop.

---

## Phase 2: ANALYZE — Determine Logical Groups

Examine the changes and group them by logical unit. Consider:

### Grouping Strategies

| Strategy Input | Behavior |
|---------------|----------|
| (blank / auto) | Group by logical change unit (feature, fix, refactor, etc.) |
| `by-type` | Group by change type: feat, fix, refactor, docs, test, chore |
| `by-directory` | Group by top-level directory |
| `by-feature` | Group by feature/domain area |
| `atomic` | One commit per file |

### Auto-Detection Heuristic

When no strategy is specified, analyze the diff to identify:

1. **Distinct features**: New files + their tests + config changes = one group
2. **Refactors**: Renamed/moved files + import updates = one group
3. **Fixes**: Bug fix changes separate from feature work
4. **Docs**: Documentation-only changes
5. **Chore**: Config, dependency, tooling changes

**CRITICAL**: Each commit must leave the codebase in a valid state (compiles, passes lint).

---

## Phase 3: PROPOSE — Present Commit Plan

```markdown
## Batch Commit Plan

**Total changes**: {N} files ({additions}+ / {deletions}-)

I recommend **{N}** commits:

| # | Type | Message | Files | +/- |
|---|------|---------|-------|-----|
| 1 | feat | {message} | {file list or pattern} | +{N}/-{N} |
| 2 | fix | {message} | {file list or pattern} | +{N}/-{N} |
| 3 | refactor | {message} | {file list or pattern} | +{N}/-{N} |

**Order**: {explanation of commit order — dependencies first, features before tests, etc.}

Proceed? You can adjust grouping, merge, or split any items.
```

**GATE**: Wait for user approval or adjustments.

---

## Phase 4: EXECUTE — Create Each Commit

For each approved commit group:

1. **Reset staging area** (if needed):
```bash
git reset HEAD
```

2. **Stage only the files for this commit**:
```bash
git add {specific files}
```

3. **Verify staging is correct**:
```bash
git diff --cached --name-only
```

4. **Commit** with conventional message:
```bash
git commit -m "{type}: {description}"
```

5. **Confirm** before moving to next group

Repeat for each commit group in order.

---

## Phase 5: SUMMARIZE

```markdown
## Batch Commit Complete

**Commits created**: {N}

| # | Hash | Message | Files |
|---|------|---------|-------|
| 1 | {short-hash} | {type}: {message} | {N} files |
| 2 | {short-hash} | {type}: {message} | {N} files |
| 3 | {short-hash} | {type}: {message} | {N} files |

**Total**: {files} files changed, {insertions} insertions, {deletions} deletions

Next: `git push` or `/prp-pr`
```

---

## Examples

```
/prp-commit-batch # Auto-detect logical groups
/prp-commit-batch by-type # Group by conventional commit type
/prp-commit-batch by-directory # Group by directory
/prp-commit-batch by-feature # Group by feature domain
/prp-commit-batch atomic # One commit per file
```
136 changes: 136 additions & 0 deletions .claude/commands/prp-core/prp-plan-batch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
description: Generate implementation plans for multiple PRD phases or a list of features in batch
argument-hint: <path/to/prd.md | comma-separated feature list>
---

# Batch Plan Generator

**Input**: $ARGUMENTS

---

## Your Mission

Generate implementation plans for multiple features or PRD phases by invoking the `/prp-plan` workflow for each.

---

## Phase 1: ANALYZE — Determine What to Plan

### If input is a PRD file path:

Read the PRD and extract ALL pending phases from the Implementation Phases table:

```bash
cat "$ARGUMENTS"
```

Parse the phases table. Collect all phases with `Status: pending`.

**Respect dependencies**: Only plan phases whose dependencies are `complete` or are being planned in this batch (sequential execution handles ordering).

### If input is a feature list:

Split the input into individual features. Each becomes a standalone plan.

### Determine batch size:

| Scenario | Count |
|----------|-------|
| PRD with N pending phases | Plan all phases with met dependencies |
| Comma-separated features | One plan per feature |
| Single complex feature | 1 (redirect to `/prp-plan` directly) |

---

## Phase 2: PROPOSE — Present Plan to User

```markdown
## Batch Plan Generation

**Source**: {PRD file or feature list}

I'll generate **{N}** implementation plans:

| # | Plan | Source | Dependencies Met? | Can Parallelize? |
|---|------|--------|--------------------|------------------|
| 1 | {phase/feature name} | Phase 1 of PRD | Yes | - |
| 2 | {phase/feature name} | Phase 2 of PRD | Yes (depends on 1) | - |
| 3 | {phase/feature name} | Phase 3 of PRD | Yes | with 4 |
| 4 | {phase/feature name} | Phase 4 of PRD | Yes | with 3 |

**Generation order**: {sequence accounting for dependencies}

Proceed?
```

**GATE**: Wait for user approval.

---

## Phase 3: GENERATE — Create Each Plan

For each approved item, invoke the full `/prp-plan` workflow:

1. Process plans **sequentially** in dependency order
2. For each plan:
- If from a PRD: pass the PRD path and specify the target phase
- If from a feature list: pass the feature description directly
- Follow ALL phases of `/prp-plan` (Parse → Explore → Research → Design → Architect → Generate)
- The generated plan goes to `.claude/PRPs/plans/{name}.plan.md`
- If sourced from a PRD, update the PRD's Implementation Phases table (set status to `in-progress`, add PRP Plan link)
3. Brief confirmation after each plan before proceeding

### Cross-Plan Consistency

- Reference shared interfaces or contracts defined in earlier plans
- Use consistent naming for shared concepts
- Note cross-plan integration points explicitly in each plan

---

## Phase 4: SUMMARIZE — Batch Report

```markdown
## Batch Plan Generation Complete

**Source**: {input}
**Plans Generated**: {N}

| # | Plan | File | Tasks | Parallel? |
|---|------|------|-------|-----------|
| 1 | {name} | `.claude/PRPs/plans/{file}.plan.md` | {N} | - |
| 2 | {name} | `.claude/PRPs/plans/{file}.plan.md` | {N} | - |
| 3 | {name} | `.claude/PRPs/plans/{file}.plan.md` | {N} | with 4 |
| 4 | {name} | `.claude/PRPs/plans/{file}.plan.md` | {N} | with 3 |

### Execution Strategy

**Sequential plans** (have dependencies):
{List in order}

**Parallelizable plans** (independent):
{List groups that can run in separate worktrees}

### Next Steps

- **Implement first**: `/prp-implement .claude/PRPs/plans/{first-plan}.plan.md`
- **Ralph loop**: `/prp-ralph .claude/PRPs/plans/{first-plan}.plan.md --max-iterations 20`
- **Parallel worktrees** (for independent plans):
```bash
git worktree add -b {branch} ../{dir}
cd ../{dir} && claude "/prp-implement .claude/PRPs/plans/{plan}.plan.md"
```
```

---

## Examples

```
# All pending phases from a PRD
/prp-plan-batch .claude/PRPs/prds/user-auth.prd.md

# List of independent features
/prp-plan-batch "pagination API, search filters, CSV export"
```
Loading