cross-repo-refactor
Coordinate a multi-repo refactor by fanning out subagents per repo, gathering changes onto a single feature branch named cook/refactor-<slug>-<short-sha>, and pushing for review. Pairs with the branch-guard PreToolUse hook to make pushes to main physically impossible.
What this skill does
# Cross-Repo Refactor
Coordinate a refactor that spans multiple repos. The orchestrating session reads the change description, plans the per-repo edits, fans out subagents to make them, collects the results onto a single feature branch in each repo, and pushes for review. The branch-guard hook ships alongside this skill — it physically prevents pushing to `main`/`master`/`develop` or any pre-existing branch.
## When to Use
- A refactor needs coordinated changes in 3+ repos (e.g., shared library bump + downstream consumer updates)
- The change is mechanical or systematic — no novel design decisions per repo
- You need the agent to do the legwork without supervision
## When NOT to Use
- The change touches only one repo — just edit and PR normally
- Different repos need different design decisions — handle each one in its own session
- You haven't decided on the new shape yet — explore in one repo first; come back to fan out
## How to Run
1. Confirm clean working trees in every target repo. The hook is the safety net, not the only one.
2. Provide Claude with: a change description, the list of repos, and (if relevant) the exact symbol/file pattern to find.
3. Tell Claude: "Run cross-repo-refactor in cook mode for `<repos>`. Slug: `<short-slug>`. Description: `<one-liner>`."
4. The orchestrating session derives a `<short-sha>` (typically from `date +%s | sha1sum | cut -c1-7` or a stable hash of the slug+date).
5. Per repo, the session fans out a subagent:
- Run `git checkout -b cook/refactor-<slug>-<short-sha>` (the branch-guard hook validates the name is fresh and matches the pattern)
- Make the edits
- Commit with a structured message: `refactor(<slug>): <one-line summary>`
- `git push -u origin cook/refactor-<slug>-<short-sha>`
6. The orchestrator collects per-repo branch URLs and writes a single summary message listing each.
## Branch naming
```
cook/refactor-<slug>-<short-sha>
```
- `<slug>` — kebab-case, alphanumeric + hyphens, ≤ 30 chars (e.g., `bump-zod-3.23`)
- `<short-sha>` — at least 7 hex characters (matches the regex `^[0-9a-f]{7,}$`)
The branch-guard hook regex is:
```
^cook/refactor-[a-z0-9-]+-[0-9a-f]{7,}$
```
Branches that don't match are rejected by the hook on `git checkout -b`. Pushes to `main`/`master`/`develop` are rejected outright. Pushes targeting `HEAD:main` (refspec form) are also rejected.
## TERMINATION
Stop when ALL of these are true:
- Each target repo has a feature branch matching the naming pattern
- Each branch contains the per-repo edits committed with the structured message
- Each branch has been pushed to `origin` successfully
- The orchestrator session has emitted a summary listing per-repo branch URLs (or a clear failure note for any repo where the change couldn't be made)
- The cooking marker file is removed
When termination triggers:
```bash
rm -f ~/.claude/cooking/active-$PID ~/.claude/cooking/iter-$PID
```
If iteration 10 hits before completing the fan-out, write a partial-progress note (which repos shipped, which didn't, why) and exit. Do not skip the structured-message format to "make it work."
## Anti-patterns
- **Don't** push to `main`. The hook will reject; if the agent retries with a different approach, retry will also be rejected. The fix is naming the branch correctly, not bypassing the hook.
- **Don't** reuse a pre-existing branch — every cook refactor gets a fresh branch. The hook enforces this on `git checkout -b`.
- **Don't** combine multiple unrelated refactors under one slug. One refactor, one slug, one set of branches.
- **Don't** edit `hooks/cooking/branch-guard.sh` to relax it during a session. The skill's safety boundary is the hook; relaxing it makes the skill silently dangerous.
## Host limitation
The branch-guard hook runs as a Claude Code PreToolUse Bash matcher (`hooks.json` `PreToolUse` matcher with `Bash` tool, command pattern). **Cursor does not expose an equivalent PreToolUse Bash hook today**, so under Cursor this enforcement is **skill prose only** — no runtime guard. Use this skill from Claude Code when correctness matters; from Cursor, audit the branch names before you push.
## Verification
`bash hooks/cooking/test/branch-guard.sh` covers 11 cases including push-to-main, push-to-master, push-to-HEAD:main, the cook-pattern accept path, the pre-existing-branch reject, and pattern mismatch. Run it after any branch-guard.sh edit.
## Related
- Branch guard: `hooks/cooking/branch-guard.sh`
- Stop hook: `hooks/cooking/stop-hook.sh`
- Status command: `/cook-status`
- Sibling skills: `test-fix-loop`, `investigation-loop`, `dreaming-consolidator`
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.