cross-branch-fix-porter
Cross-branch fix porting expert. Understands fix intent and re-implements the same fix goal in the current branch's code context when direct cherry-pick isn't feasible. Should be used when the user needs to apply a fix from one branch to another where code structures differ significantly. Distinguished from feature-port-doc-generator which documents changes, this skill actively re-implements fixes.
- License 许可
- MIT
- 最近更新
- 2026-04-18
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cross-branch-fix-porter
- boundary
- { "vs_feature-port-doc-generator": "feature-port-doc-generator documents changes for other teams, this skill actively re-implements fixes across branches" }
- category
- dev-tools
- description
- Cross-branch fix porting expert. Understands fix intent and re-implements the same fix goal in the current branch's code context when direct cherry-pick isn't feasible. Should be used when the user needs to apply a fix from one branch to another where code structures differ significantly. Distinguished from feature-port-doc-generator which documents changes, this skill actively re-implements fixes.
02 资源文件 2
- 参考文档references/analysis-template.md3.8 KB
- 参考文档references/workflow.md7.6 KB
03 SKILL.md 正文
Cross-Branch Fix Porting
Core Approach
Don't copy code — copy intent. First understand what problem the fix solves and why it was done that way, then re-implement the same fix goal within the current branch's code logic.
When to Use
- User provides a commit ID that needs to be ported to the current branch
- Two projects have significantly different structures (different frameworks, different directory layouts)
- Direct cherry-pick would produce many conflicts or logical errors
Workflow
Phase 1: Get Fix Information
Case A: User provided a commit ID
1. Get commit basic info (message, author, time)
2. Get commit code diff
3. Analyze diff, extract fix intent
Case B: From conversation context
1. Search conversation history for fix-related content
2. Extract already-analyzed fix content and intent
Phase 2: Analyze Fix Intent
After reading the diff, answer these questions:
1. [Root cause] What bug did this fix solve, or what requirement did it fulfill?
2. [Change scope] Which files are involved? What's the purpose of each file's change?
3. [Core logic] What's the key behavioral change (not code change)?
4. [Dependencies] Does the fix depend on specific utility functions, components, or type definitions?
Phase 3: Locate Corresponding Files in Current Branch
1. Based on the functional modules involved in the fix, search for corresponding files in the current branch
2. Read candidate file contents to confirm they handle the same functionality
3. If no corresponding file is found, inform the user and explain why
Phase 4: Determine if Direct Copy is Possible
Direct copy is only appropriate when all of these conditions are met:
- The file in the original commit diff is marked as "new file" (entirely new creation)
- No file at the same path or with the same functionality exists in the current branch
- The file content doesn't depend on modules or types that don't exist in the current branch
If conditions are met: copy the file directly. If not: proceed to Phase 5.
Phase 5: Re-implement the Fix
Use the current branch's logic as the source of truth. Don't copy the original code:
1. Read the current branch's corresponding file's complete logic
2. Understand the current branch's code style, encapsulation patterns, utility functions
3. "Translate" the fix intent into the current branch's implementation style
4. If the current branch already has similar logic, modify it in place
Porting principles:
| Principle | Description |
|---|---|
| Intent first | Reproduce the behavioral effect of the fix, not the code |
| Respect current style | Use the current branch's utility functions, types, and encapsulation |
| Minimal change | Only modify what's necessary, don't introduce unrelated changes |
| Consistency | Match the current branch's code style and conventions |
Output Report
## Cross-Branch Fix Porting Report
### Fix Intent Summary
[One-sentence description of the problem the fix solves]
### File Mapping
| Original fix file | Current branch file | Handling |
| ----------------- | ------------------- | -------------- |
| src/a.ts | src/b.ts | Re-implemented |
| src/new.ts | — | Direct copy |
### Key Differences
[Structural differences, implementation differences]
### Applied Changes
- [Change 1]
- [Change 2]
### Items Requiring User Confirmation (if any)
- [Confirmation item]
Important Notes
- Don't blindly copy code — Original code may depend on utility functions or types that don't exist in the current branch
- Analyze before acting — Complete intent analysis before modifying any files
- Ask when uncertain — If the intent of a change is ambiguous, confirm with the user
- Go step by step for large structural differences — Port core logic first, then handle edge cases
04 同仓库更多 Skills
meeting-minutes
Generate concise, actionable meeting minutes for internal meetings. Includes metadata, attendees, agenda, decisions, action items (owner + due date), and follow-up steps.
documentation-writer
Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by the principles and structure of the Diátaxis technical documentation authoring framework.
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
code-review-workflow
Executes comprehensive 4-phase code review: basic review, quality check, bundle analysis, and test coverage. Should be used when the user mentions comprehensive code review, checking code quality, or reviewing staged changes with multi-phase analysis. This is the comprehensive review workflow, distinct from focused skills like frontend-code-review, staged-code-review, or code-change-test-designer.
code-change-test-designer
Analyzes code changes and designs comprehensive test cases. Reads diffs, summarizes capability changes, and designs test cases covering main flows and edge cases. Should be used when the user mentions test coverage, designing tests for code changes, or analyzing diff/commit for testing purposes. Distinguished from code-review-workflow which provides comprehensive review, this skill focuses on test case design for code changes.
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.