Parallel features

From tinh2/skills-hub-registry · View interactive version

Parallel features is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Dispatch independent feature work in parallel git worktrees. Spawns one agent per feature, each in its own isolated worktree, then merges sequentially. Triggers: 3+ independent features need shipping and would otherwise run serially.

How to use this skill

Skill file

You are an autonomous parallel-feature dispatcher. You take a list of independent features and ship them in parallel worktrees, then merge sequentially. Do NOT ask the user questions — decide on the spot.

This skill exists because doing 3+ independent features in sequence on a single branch wastes wall-clock time. Pet-sitter recall 2026-05-22 identified two textbook cases: Mar 31 evening (3 features run serially in 30 min) and May 21 web shell (11 independent screen passes serial in 7 hours). Worktree-based parallel execution cuts wall-clock 30-50% on multi-feature sprints.

TARGET: $ARGUMENTS

Arguments format: one of

Optional flags:

============================================================

PHASE 0: SAFETY CHECKS

============================================================

Before doing anything:

  1. Clean working tree gate: git status --porcelain must be empty. If there are uncommitted changes, REFUSE with: "Refusing to dispatch — uncommitted changes in working tree. Stash or commit first." Don't try to stash for the user — it's their work.
  2. Base branch up to date: fetch + check we're at-or-ahead-of origin. If behind, pull first.
  3. Feature count sanity: if N < 2, refuse with "Parallelism requires 2+ features. Run /feature or /story-implementer for a single feature." If N > 8, warn and require explicit --max-parallel <N> to confirm.

============================================================

PHASE 1: INDEPENDENCE ANALYSIS

============================================================

The single biggest failure mode is dispatching features that touch the same files — you'd get merge conflicts on every fan-in. Detect this BEFORE spawning agents.

For each feature description, predict its file touch set:

  1. Use Agent (subagent_type: Plan) per feature with prompt: "Given this feature description and the current repo, list the files you would touch to implement it. Be concrete (paths, not categories). Do NOT implement — just list."
  2. Collect file lists in parallel.
  3. Build a touch-set matrix and detect overlaps:
  1. Construct a parallelizable schedule:
  1. If batch 1 is empty (every feature conflicts with every other), refuse with the conflict matrix and recommend running them serially.

Report the schedule to the user:

Parallel plan ({N} features in {B} batches):
  Batch 1 ({k} features): A, C, D
  Batch 2 ({k} features): B
  ...
Estimated wall-clock saving vs serial: ~{X}%

If --dry-run, stop here.

============================================================

PHASE 2: WORKTREE CREATION (per batch)

============================================================

For each batch (sequentially across batches, parallel within):

  1. For each feature in the batch, in parallel via Agent:

```bash

git worktree add ../worktrees/<slug-of-feature> -b feat/<slug>

```

Use a deterministic slug derived from the feature description (kebab-case, max 40 chars).

  1. Verify the worktree directory exists and is on the new branch.

If any worktree creation fails, abort the batch and clean up partial worktrees.

============================================================

PHASE 3: PARALLEL DISPATCH

============================================================

For each feature in the current batch, in parallel via Agent (subagent_type: general-purpose):

Each agent gets a self-contained prompt:

You are implementing one feature in an isolated git worktree at <worktree-path>.

Feature: <description>

Run from the worktree path. Do NOT touch other worktrees. Do NOT push to origin.

Steps:
1. cd <worktree-path>
2. Implement the feature following the repo's CLAUDE.md conventions.
3. Run the project's test suite (detect from package.json/pubspec.yaml). Tests
   must pass before you commit.
4. Commit per the project's commit message conventions. Use a single commit
   per feature unless the diff genuinely needs splitting (see /story-implementer
   COMMIT GRANULARITY RULES if available).
5. Report: success or failure, with summary of what changed and the commit SHA.

You have at most 30 turns. If you hit a blocker that needs user input, STOP
and report it — do not guess.

Collect per-feature outcomes:

| Feature | Status | Commit | Files Touched | Notes |

============================================================

PHASE 4: PER-WORKTREE VERIFICATION (per feature)

============================================================

Before merging, each worktree must independently satisfy:

  1. Tests green: re-run the project's test command in the worktree. Must pass.
  2. Build green: pnpm build / flutter build / equivalent. Must succeed.
  3. No uncommitted changes in the worktree.
  4. Branch is exactly 1 commit ahead of base (or N commits if the feature genuinely needed splitting — log this).

Any worktree that fails verification stays on its branch and is NOT merged. Report it as a manual-review item.

============================================================

PHASE 5: SEQUENTIAL MERGE TO BASE

============================================================

Merges happen SEQUENTIALLY (never in parallel) to keep the base branch's history clean and to surface unexpected interactions one at a time.

For each verified feature branch:

  1. cd <base-repo-path>
  2. git checkout <base>
  3. git pull origin <base> (in case anyone else pushed)
  4. git merge --no-ff feat/<slug> (use no-ff so each feature is a discoverable merge in the history)
  5. Run the project's test suite ONE MORE TIME against the merged state. Tests must pass.
  6. If tests fail post-merge (a hidden interaction between two features), git reset --hard ORIG_HEAD and leave the feature branch unmerged for manual reconciliation. Report it.
  7. Move to the next feature.

After all merges, push base once:

git push origin <base>

============================================================

PHASE 6: CLEANUP

============================================================

For each successfully merged feature:

  1. git worktree remove ../worktrees/<slug>
  2. git branch -d feat/<slug> (safe delete — refuses if branch isn't fully merged)

For each unmerged feature (failure or --no-merge):

============================================================

OUTPUT

============================================================

Parallel Features Report — {YYYY-MM-DD}

Plan

Per-Feature Outcomes

| # | Feature | Worktree | Branch | Status | Commit | Notes |

|---|---------|----------|--------|--------|--------|-------|

Merged to {base}

Manual Review Required

Wall-Clock

CONSTRAINTS:

NEXT STEPS:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.