| name | yarn-lock-conflict-resolution |
| description | Use this skill when resolving merge/rebase conflicts in yarn.lock. It standardizes taking yarn.lock from the target branch, reconciling it with yarn install, and reusing a successful resolution across repeated conflict rounds. |
Yarn.lock Conflict Resolution
When To Use
Use this skill when:
yarn.lock has merge/rebase conflicts;
- conflict resolution should be repeatable and low-risk;
- the same conflict appears in multiple rounds of one rebase/merge sequence.
Source Of Truth Policy
- Rebase: take
yarn.lock from the branch you rebase onto.
- Merge: take
yarn.lock from HEAD (current target branch).
- After taking baseline, run
yarn install to reconcile lock metadata with current manifests.
Required Rules
- Do not manually resolve conflict markers inside
yarn.lock.
- Replace
yarn.lock completely from the selected baseline.
- Reuse previous successful resolution for repeated rounds in the same sequence.
- If dependency updates were intentional in the rebased commit, replay dependency commands after conflict resolution.
Workflow
- Ensure conflict exists:
git status --short
- (Optional) Ensure Yarn config exists:
make .yarnrc.yml
- Resolve first conflict round for rebase:
ONTO=$(cat .git/rebase-merge/onto 2>/dev/null || cat .git/rebase-apply/onto)
git show "$ONTO:yarn.lock" > yarn.lock
yarn install
git add yarn.lock
cp yarn.lock .git/yarn-lock-resolution-base
- Resolve first conflict round for merge:
git show "HEAD:yarn.lock" > yarn.lock
yarn install
git add yarn.lock
cp yarn.lock .git/yarn-lock-resolution-base
- Resolve repeated rounds in the same sequence:
cp .git/yarn-lock-resolution-base yarn.lock
yarn install
git add yarn.lock
cp yarn.lock .git/yarn-lock-resolution-base
- Continue operation:
git rebase --continue
git merge --continue
- Cleanup after finish:
rm -f .git/yarn-lock-resolution-base
- If dependency updates must be replayed, run original dependency command and commit lockfile update with an English Conventional Commit message, for example:
yarn up <packages>
git add yarn.lock
git commit -m "chore: refresh yarn.lock"
Validation
git status --short has no unresolved conflicts for yarn.lock.
yarn.lock is staged before --continue.
- Resolution follows source-of-truth policy above.