Chunk

<!-- Synced from glaude. Do not edit in project repos. --

rbriski updated 4mo ago
Claude CodeGeneric
View source ↗
<!-- Synced from glaude. Do not edit in project repos. -->
# /chunk — Work on a Single Bead

Pick from `bd ready`, implement, validate, get code review, commit, and close.

## Usage

/chunk # Pick from ready beads interactively /chunk # Work on specific bead /chunk --next # Auto-pick lowest-priority ready bead


## What This Does

Single-bead workflow:
1. **Show ready beads** (unblocked, not completed)
2. **User selects** (or auto-pick with --next)
3. **Display bead details** (acceptance criteria, files, notes)
4. **Claim bead** (mark as in_progress)
5. **Implement changes** (follow project conventions from .claude/rules/)
6. **Validate** (project validation commands)
7. **Code review** (4 perspectives)
8. **CodeRabbit review** (if available)
9. **Commit** (<TICKET-ID>: <chunk description>)
10. **Close bead** (mark as completed)
11. **Propose next chunk** (if more ready beads exist)

## Steps

### Step 1: Show Ready Beads

```bash
bd ready

Present the list to the user with bead ID, title, files, and complexity.

Step 2: User Selects Bead

  • Interactive mode: User picks from the list
  • Auto-pick mode (--next): Lowest-ID ready bead
  • Specific bead (/chunk <id>): Use the given bead

Step 3: Display Bead Details

bd show <bead-id>

Show full bead content: acceptance criteria, files to modify, implementation notes, validation commands.

Step 4: Claim Bead

bd update <bead-id> --status=in_progress

Step 5: Implement Changes

  1. Read CLAUDE.md and .claude/rules/ for project conventions
  2. Read the files listed in the bead
  3. Implement the changes following project patterns
  4. Keep changes focused on this bead only

Step 6: Validate

Run the project's validation commands. Discover from:

  1. CLAUDE.md — look for ## Validation or ## Quality Gates
  2. .claude/rules/ — testing/validation rules
  3. Makefilelint, test, check targets
  4. pyproject.tomluv run ruff check . && uv run pytest
  5. package.jsonnpm run lint && npm test
  6. Cargo.tomlcargo clippy && cargo test

If validation fails, fix the issues and re-validate.

Step 7: Code Review (4 Perspectives)

Run 4 code-review passes using the Task tool (subagent_type=general-purpose):

Pass 1: Architecture Review

  • Layer separation respected
  • Dependency direction correct
  • No business logic in wrong layer
  • Patterns match existing code

Pass 2: Security Review

  • Auth/permission checks in place
  • Input validated
  • No secrets exposed
  • No injection vectors

Pass 3: Testing Review

  • Key paths tested (happy + error)
  • Edge cases covered
  • Mock strategy appropriate
  • Test quality good

Pass 4: Code Quality Review

  • Language idioms followed
  • Type hints/annotations present
  • Error handling appropriate
  • Code clarity good

Address all findings from each pass before proceeding.

Step 8: CodeRabbit Review (if available)

Run CodeRabbit on uncommitted changes via the coderabbit:code-review skill. Fix any real issues or document false positives.

Step 9: Commit

git add <changed-files>
git commit -m "<TICKET-ID>: <bead subject>"

Step 10: Close Bead

bd close <bead-id>

Step 11: Propose Next Chunk

Check bd ready for newly unblocked beads:

Next Ready Beads:
1. <bead-id>: <title>
2. <bead-id>: <title>

Continue? /chunk --next

Chunk Guidelines

Size:

  • ~1-2 files modified per bead
  • ~50-200 lines of code
  • ~30-60 minutes of work

Verifiability:

  • Each bead independently verifiable
  • Validation must pass after each bead
  • Tests should pass (or be added)

Dependencies:

  • Mark dependencies explicitly (blocked_by)
  • Bottom-up ordering (data layer before business logic)
  • Avoid circular dependencies

When to Use

Use /chunk for:

  • Step-by-step implementation (one bead at a time)
  • Learning the codebase (slower, more deliberate)
  • Complex beads (need focus on one thing)
  • When you want tight feedback loops

Use /ralph-run for:

  • Parallel execution (multiple beads at once)
  • Simple beads (low complexity, known patterns)
  • Speed (faster overall completion)
  • When beads are independent

Maintain Chunk?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Chunk on getagentictools](https://getagentictools.com/loops/rbriski-chunk-work-on-a-single-bead?ref=badge)