con un clic
worktree
Use git worktrees to isolate parallel agent tasks in this repository.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Use git worktrees to isolate parallel agent tasks in this repository.
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
Long-running (multi-hour) adversarial hunt for P0/P1/P2 bugs across the codebase. Mixes codebase observation, mechanical linting, real test + telemetry verification, and parallel skeptic sub-agents that must REFUTE each candidate before it is accepted. Fixes verified bugs on a branch off main with surgical per-bug commits, re-runs gates, and writes a dated report to the Desktop. Never pushes or merges. Use when you want a deep, autonomous bug-finding-and-fixing pass.
Diagnose and durably eliminate flaky/intermittent test failures (passes locally but fails CI, rotates between tests, red only under load). Reproduce under contention, instrument the real state instead of guessing, root-cause by signal not duration, fix at the source, validate multi-run. Use when a test is flaky, CI is intermittently red, or fixing one flake unmasks others.
Safely prune dead local branches, git worktrees, and remote branches in this repo. Use when asked to "prune dead branches", "clean up worktrees", "delete merged branches", "tidy up git", or after a batch of PRs has merged. Knows this repo merges via squash, so it verifies death by PR state, not just git ancestry.
Reduce test-suite wall-clock (dev + CI) without losing coverage or telemetry. Measure the phase breakdown first, then apply proven levers (parallelize turbo, narrow imports vs barrels, lazy-load heavy graphs, pool/worker config, DB pool sizing) and capture the before/after delta. Use when tests are slow, CI time is high, or to set/check a perf baseline. Composes with the read-only test-perf and test-census skills.
Census the repo's tests by TYPE, not by name. Classifies every tracked test file via content heuristics into unit / integration / react-component / e2e (plus a separate db pgTAP count), in precedence order so buckets are mutually exclusive. Use when the user asks "what kinds of tests do we have", "how many component vs integration tests", "what's our e2e coverage", or wants a per-area test-type breakdown.
Snapshot test-suite timings in this repo. Runs the unit and/or integration suites (or a single integration project) and reports wall-clock time, Vitest's own phase breakdown (transform/setup/import/tests/environment), and the slowest test files. Use when the user asks "how slow are the tests", "where does the test time go", wants a perf baseline, or wants to check the suite hasn't regressed.
| name | worktree |
| description | Use git worktrees to isolate parallel agent tasks in this repository. |
| metadata | {"short-description":"Git worktree workflow"} |
Use git worktrees for parallel agent changes. Each agent task gets an isolated copy of the repo.
<type>/<domain>-<short-description>
| Type | When |
|---|---|
feat/ | New feature, route, page, or domain entity |
fix/ | Bug fix |
refactor/ | Restructure without behavior change |
test/ | Test-only changes |
chore/ | Config, tooling, CI, docs |
Examples:
feat/tenancy-team-members-apifeat/tenancy-role-store-portfix/tenancy-auth-middleware-wiringrefactor/billing-credit-servicetest/tenancy-inv-ten-003-disabled-memberKeep names under 50 chars. Use the spec domain as prefix when working from a design doc.
# Runnable from the primary checkout OR from inside any existing worktree
./scripts/worktree/create.sh feat/tenancy-team-members-api
# Optional second arg: base branch (defaults to main)
./scripts/worktree/create.sh fix/billing-refund main
create.sh resolves the primary checkout via git rev-parse --git-common-dir,
runs git worktree add from there, and then calls setup.sh against the new
worktree. That single invocation gives you:
WORKTREE_PORT_OFFSET so every port (dev server, integration API,
web slots) is offset from its default..env (R2, Sentry, Resend,
etc.), with empty values healed on re-run. Non-empty worktree-local
overrides are preserved.DATABASE_URL, DATABASE_SCHEMA, API_PORT, WEB_PORT,
MOBILE_PORT, WORKER_INSPECT_PORT, TEMPORAL_TASK_QUEUE,
API_CORS_ORIGIN, API_BASE_URL.SENTRY_SPOTLIGHT=true, LOG_LEVEL=debug.run-migrations.sh, reset-worktree-schema.sh.Raw git worktree add is blocked for Claude and Codex agents. The
project-scoped hooks call .claude/hooks/block-raw-git-worktree-add.sh,
including commands like git -C <repo> worktree add, and deny them with
instructions to use create.sh instead. Other git worktree subcommands
(list, remove, prune, lock, unlock, move, repair) pass
through untouched. If you genuinely need the raw command for a recovery
scenario, set ALLOW_RAW_GIT_WORKTREE_ADD=1 in the environment.
Always use ./scripts/worktree/create.sh; do not invoke git worktree add
directly. A worktree created without setup.sh will have no port offset,
no seeded secrets, and no Postgres schema, and both pnpm dev and
pnpm test:integration will fail from it.
# Re-applies port allocations and pulls fresh secrets from the primary
./scripts/worktree/setup.sh .worktrees/team-members-api
setup.sh refuses to run against the primary checkout — that path uses
base ports and sources its .env via cp .env.example .env.
pnpm type-check freely — no shared state conflicts.pnpm dev works after running setup.sh — unique ports prevent conflicts with other worktrees.pnpm test:integration works in parallel across worktrees. The
shared API server in scripts/test/vitest-global-setup.ts binds to
4100 + WORKTREE_PORT_OFFSET, and each worktree gets its own Postgres
schema, so multiple worktrees can run integration tests at the same
time without stepping on each other. No lock file is involved.tx-agent-kit project name.pnpm type-check:quiet # must pass — zero errors
# From main worktree
git merge feat/tenancy-team-members-api
# Or cherry-pick specific commits
git cherry-pick <sha>
git worktree remove .worktrees/team-members-api
git branch -d feat/tenancy-team-members-api
main unless explicitly told otherwise.create.sh (never raw git worktree add). It allocates unique ports, seeds secrets, and creates the Postgres schema.Every port-scoped service uses base + WORKTREE_PORT_OFFSET, where the
offset is derived deterministically from the worktree name by
scripts/worktree/lib/ports.sh. The primary checkout has offset 0.
| Service | Base (primary) | Worktree | Shared? |
|---|---|---|---|
| Postgres | 5432 | 5432 | Yes — all worktrees share (separate schemas) |
| Redis | 6379 | 6379 | Yes |
| API dev server | 4000 | 4000 + offset | No — unique per worktree |
| Web dev server | 3000 | 3000 + offset | No — unique per worktree |
| Worker inspect | 9229 | 9229 + offset | No — unique per worktree |
| Shared integration API | 4100 | 4100 + offset | No — unique per worktree |
.env variables set by setup.shWORKTREE_PORT_OFFSET, DATABASE_URL (with schema), DATABASE_SCHEMA,
API_PORT, PORT, WEB_PORT, MOBILE_PORT, WORKER_INSPECT_PORT,
TEMPORAL_TASK_QUEUE, API_CORS_ORIGIN, API_BASE_URL,
NEXT_PUBLIC_API_BASE_URL, EXPO_PUBLIC_API_BASE_URL,
SENTRY_SPOTLIGHT, LOG_LEVEL, OTEL_EXPORTER_OTLP_ENDPOINT.
Non-worktree-scoped secrets (R2, Sentry DSNs, Resend, Temporal Cloud,
etc.) are seeded from the primary checkout's .env.
When an orchestrator launches multiple agents in parallel worktrees:
pnpm type-check, pnpm lint, pnpm test, and
pnpm test:integration freely in parallel — the WORKTREE_PORT_OFFSET
mechanism isolates each worktree's shared API server and Postgres schemapnpm test:integration on the merged result as a
post-merge sanity check