一键导入
analyze-branch-for-extraction
Analyze a branch to identify independently extractable changes that can be split into separate PRs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyze a branch to identify independently extractable changes that can be split into separate PRs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Merges completed work back to main through a protected-branch pull request workflow.
Set up a new git worktree and install dependencies.
Merges completed work back to main through a protected-branch pull request workflow.
Set up a new git worktree and install dependencies.
Prepares a Python package for PyPI release by updating the version, building, and verifying the distribution.
Prepare a release by updating the version, building, and verifying the distribution.
| name | analyze-branch-for-extraction |
| description | Analyze a branch to identify independently extractable changes that can be split into separate PRs. |
Analyze a branch to identify independently extractable changes that can be split into separate PRs, especially refactorings that support a feature but are valuable on their own.
$ARGUMENTS
Gather the following information from the user-provided context:
git branch --show-current)git log main..HEAD --oneline)If the branch is clear from context, proceed. If the main feature is clear from git history, state your understanding. If anything is unclear or ambiguous, ask the user for clarification.
Always verify your understanding of the main feature with the user before proceeding with categorization.
git log main..HEAD --oneline
Review all commits to understand:
If the branch has merge commits FROM main (e.g., Merge remote-tracking branch 'origin/main' into ...), examine what came in via those merges. Changes that were developed on this branch but already merged to main via a separate PR are not extractable—they're already extracted!
# Find merge commits from main
git log main..HEAD --oneline --merges
# For each merge commit, check what it brought in
git show <merge-sha> --stat --oneline
Also check main's recent history for PRs that may have originated from this branch's work:
git log main --oneline -20
This prevents recommending extractions for changes that have already been merged, and ensures you don't propose changes that would override refinements made after merging to main.
git log main..HEAD --stat
Identify all distinct concerns/changes in the branch:
Group concerns (not commits) into categories based on extractability:
Category A: Independent Refactorings
Category B: Independent Tooling/Process Improvements
Category C: Main Feature and Everything Directly Related
For each potential extraction (Categories A & B), verify:
Can it work without the main feature?
Is it valuable independently?
Is it cleanly extractable?
For each extraction candidate, provide:
Title: Brief description of what this extraction contains
Commits involved: List the commit SHAs and messages
Files changed: Summary of what files are modified/added
Independence verification: Why this can be extracted independently
Extraction complexity:
Extraction prompt: A ready-to-use prompt for /extract-pr formatted for direct copy-paste into mekara /start <prompt>:
/extract-pr <short description>
<detailed instructions>
- What to include (specific files/changes)
- What to exclude (main feature, other extractions, feature-specific docs)
- Key distinctions (why this is valuable independently)
The format must be /extract-pr <descr>\n... so users can copy the entire block directly.
If one extraction is a prerequisite for another (e.g., Extraction A is a refactor that Extraction B's code depends on), recommend landing A before B and explain the dependency. In general, B is dependent on A if and only if it simplifies things greatly to extract B after A.
If the extractions are independent, do NOT recommend an order — they can be run in parallel. Never create artificial sequencing for changes that don't actually depend on each other.
For each extraction, verify:
1. Independence is the key criterion: A change is extractable only if it provides value and works correctly without the main feature.
2. Prerequisite refactors are often independently valuable: If you refactored code structure to enable a feature, that refactor often improves the codebase even without the feature.
3. Generic tooling belongs separately from specific features: Commands, workflows, and tools developed alongside a feature are often reusable and should be extracted if they don't depend on the feature's domain logic.
4. Group related process improvements together: Don't split documentation commands, workflow updates, and related tooling across multiple PRs. Group them as one coherent process improvement extraction.
5. Main feature includes its documentation and tests: Feature-specific documentation, tests, and configuration all belong with the main feature in Category C, even if they were created using extracted tools or follow extracted patterns.
6. Verify don't assume: Don't assume a refactor is independent just because it was committed first. Check the actual code dependencies and value proposition.
7. Consider review complexity: Smaller, focused PRs are easier to review and merge. If a large feature branch can be split into 2-3 clean PRs, that's often worth doing.
Pattern: State Management Refactor
Pattern: Generic Tooling + Feature Documentation
Pattern: Infrastructure + Implementation
Pattern: Multiple Independent Improvements