xiaohongshu
xiaohongshu
merge-resolver
Resolve merge conflicts by analyzing git history and commit intent. Use when PR has conflicts with base branch, can't merge due to conflicts, or need to fix merge conflicts systematically with session protocol validation.
Full skill instructions
Resolve merge conflicts by analyzing git history and commit intent.
Use this skill when you encounter:
resolve merge conflicts for PR #123PR has conflicts with maincan't merge - conflicts detectedfix the merge conflicts in this branchhelp me resolve conflicts for this pull request| Step | Action | Verification |
|---|---|---|
| 1.1 | Fetch PR metadata | JSON response received |
| 1.2 | Checkout PR branch | git branch --show-current matches |
| 1.3 | Attempt merge with base | Conflict markers created |
| 1.4 | List conflicted files | git diff --name-only --diff-filter=U output |
| Step | Action | Verification |
|---|---|---|
| 2.1 | Classify files (auto-resolvable vs manual) | Classification logged |
| 2.2 | Auto-resolve template/session files | Accept --theirs successful |
| 2.3 | For manual: Run git blame, analyze intent | Commit messages captured |
| 2.4 | Apply manual resolutions per strategy | Conflict markers removed |
| 2.5 | Stage all resolved files | git diff --check clean |
| Step | Action | Verification |
|---|---|---|
| 3.1 | Verify session log exists | File at .agents/sessions/ |
| 3.2 | Run session protocol validator | Exit code 0 |
| 3.3 | Run markdown lint | No errors |
| 3.4 | Commit merge resolution | Commit SHA recorded |
| 3.5 | Push to remote | Push successful |
# Get PR metadata
gh pr view <number> --json title,body,commits,headRefName,baseRefName
# Checkout the PR branch
gh pr checkout <number>
# Attempt merge with base (creates conflict markers)
git merge origin/<base-branch> --no-commit
# List conflicted files
git diff --name-only --diff-filter=U
# Show conflict details
git status --porcelain | grep "^UU"
For each conflicted file:
# View the conflict
git diff --check
# Get blame for conflicting lines (base version)
git blame <base-branch> -- <file> | grep -n "<line-content>"
# Get blame for conflicting lines (head version)
git blame HEAD -- <file> | grep -n "<line-content>"
# Show commits touching this file on each branch
git log --oneline <base-branch>..<head-branch> -- <file>
git log --oneline <head-branch>..<base-branch> -- <file>
# View specific commit details
git show --stat <commit-sha>
Classify each side's changes:
| Type | Indicators | Priority |
|---|---|---|
| Bugfix | "fix", "bug", "patch", "hotfix" in message; small, targeted change | Highest |
| Security | "security", "vuln", "CVE" in message | Highest |
| Refactor | "refactor", "cleanup", "rename"; no behavior change | Medium |
| Feature | "feat", "add", "implement"; new functionality | Medium |
| Style | "style", "format", "lint"; whitespace/formatting only | Lowest |
Decision Framework:
Resolution Commands:
# Accept theirs (base branch)
git checkout --theirs <file>
# Accept ours (PR branch)
git checkout --ours <file>
# Manual edit then mark resolved
git add <file>
For manual resolution:
<<<<<<<, =======, >>>>>>>)# Stage all resolved files
git add <resolved-files>
# Verify no remaining conflicts
git diff --check
# Show staged changes
git diff --cached --stat
MUST complete before pushing. This step prevents CI failures from incomplete session logs.
Session protocol validation is a CI blocking gate. Pushing without completing session requirements causes:
# 1. Ensure session log exists
SESSION_LOG=$(ls -t .agents/sessions/*.md 2>/dev/null | head -1)
if [ -z "$SESSION_LOG" ]; then
echo "ERROR: No session log found. Create one before pushing."
exit 1
fi
# 2. Run session protocol validator
pwsh scripts/Validate-SessionJson.ps1 -SessionLogPath "$SESSION_LOG"
# 3. If validation fails, fix issues before proceeding
if [ $? -ne 0 ]; then
echo "ERROR: Session protocol validation failed."
echo "Complete all MUST requirements in your session log before pushing."
exit 1
fi
Before pushing, verify your session log contains:
| Req | Step | Status |
|---|---|---|
| MUST | Complete session log (all sections filled) | [ ] |
| MUST | Update Serena memory (cross-session context) | [ ] |
| MUST | Run markdown lint | [ ] |
| MUST | Route to qa agent (feature implementation) | [ ] |
| MUST | Commit all changes (including .serena/memories) | [ ] |
| MUST NOT | Update .agents/HANDOFF.md directly | [ ] |
| Error | Cause | Fix |
|---|---|---|
E_TEMPLATE_DRIFT | Session checklist outdated | Copy canonical checklist from SESSION-PROTOCOL.md |
E_QA_EVIDENCE | QA row checked but no report path | Add QA report or use "SKIPPED: docs-only" for docs-only sessions |
E_DIRTY_WORKTREE | Uncommitted changes | Stage and commit all files including .agents/ |
See references/strategies.md for detailed patterns:
Code Conflicts:
Infrastructure Conflicts:
Documentation Conflicts:
For automated conflict resolution in CI/CD, use scripts/Resolve-PRConflicts.ps1:
# Resolve conflicts for a PR
pwsh .claude/skills/merge-resolver/scripts/Resolve-PRConflicts.ps1 \
-PRNumber 123 \
-BranchName "fix/my-feature" \
-TargetBranch "main"
The following files are automatically resolved by accepting the target branch version:
| Pattern | Rationale |
|---|---|
.agents/* | Session artifacts, constantly changing |
.serena/* | Serena memories, auto-generated |
.claude/skills/*/*.md | Skill definitions, main is authoritative |
.claude/commands/* | Command definitions, main is authoritative |
.claude/agents/* | Agent definitions, main is authoritative |
templates/* | Template files, main is authoritative |
src/copilot-cli/* | Platform agent definitions |
src/vs-code-agents/* | Platform agent definitions |
src/claude/* | Platform agent definitions |
.github/agents/* | GitHub agent configs |
.github/prompts/* | GitHub prompts |
package-lock.json, yarn.lock, pnpm-lock.yaml | Lock files, regenerate from main |
Returns JSON:
{
"Success": true,
"Message": "Successfully resolved conflicts for PR #123",
"FilesResolved": [".agents/HANDOFF.md"],
"FilesBlocked": []
}
| Code | Meaning |
|---|---|
| 0 | Success - conflicts resolved and pushed |
| 1 | Failure - conflicts in non-auto-resolvable files |
ADR-015 compliance:
| Criterion | Evidence |
|---|---|
| All conflicts resolved | git diff --check returns empty |
| No merge markers remain | grep -r "<<<<<<" . returns nothing |
| Session protocol valid | Validate-SessionJson.ps1 exits 0 |
| Markdown lint passes | npx markdownlint-cli2 exits 0 |
| Push successful | Remote ref updated |
git add)git status --porcelain.agents/sessions/YYYY-MM-DD-session-NN.json| Anti-Pattern | Why It Fails | Instead |
|---|---|---|
| Push without session validation | CI blocks with MUST violations | Run Validate-SessionJson.ps1 first |
| Manual edit of generated files | Changes lost on regeneration | Edit template, run generator |
| Accept --ours for HANDOFF.md | Branch version often stale | Accept --theirs (main is canonical) |
| Merge lock files manually | JSON corruption, broken deps | Accept base, regenerate with npm/yarn |
| Skip git blame analysis | Wrong intent inference | Always check commit messages |
| Resolve before fetching | Missing context, wrong base | Always gh pr view first |
| Forget to stage .agents/ | Dirty worktree CI failure | Include all .agents/ changes |
Add patterns to $script:AutoResolvableFiles in Resolve-PRConflicts.ps1:
$script:AutoResolvableFiles += @(
'your/custom/path/*',
'another/pattern/**'
)
Create new entries in references/strategies.md for domain-specific conflicts:
The script supports GitHub Actions via environment detection:
# In workflow YAML
- name: Resolve conflicts
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
pwsh .claude/skills/merge-resolver/scripts/Resolve-PRConflicts.ps1 \
-PRNumber "$env:PR_NUMBER" \
-BranchName "$env:HEAD_REF" \
-TargetBranch "$env:BASE_REF"
Use -WhatIf for testing without side effects:
pwsh scripts/Resolve-PRConflicts.ps1 -PRNumber 123 -BranchName "fix/test" -WhatIf
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience