Copied from kriscendobot/garden skills/yarn-lock-separate-commit/SKILL.md (only that file) at commit 74eee479382f70fe54f668b92c531b834c85b5a5: https://github.com/kriscendobot/garden/blob/74eee479382f70fe54f668b92c531b834c85b5a5/skills/yarn-lock-separate-commit/SKILL.md
1.8 KiB
1.8 KiB
created, updated, author
| created | updated | author |
|---|---|---|
| 2026-05-13 | 2026-05-13 | liaison |
Skill: yarn-lock-separate-commit
Adopted from references/endo-but-for-bots/skills/yarn-lock-separate-commit.md.
Every change that touches yarn.lock ships in its own commit, separate from the package.json change that caused the update, with the message chore: Update yarn.lock.
Why
A separate lockfile commit can be dropped and regenerated cleanly on rebase. A combined commit turns lockfile churn into merge conflicts that have to be resolved by re-running yarn install and hand-stitching, which is error-prone and pollutes history.
Procedure
After making the dep change in package.json:
git add packages/foo/package.json
git commit -m "feat(foo): add bar dependency (#NNNN)"
npx corepack yarn install
git add yarn.lock
git commit -m "chore: Update yarn.lock"
When force-pushing a rebased branch, the order of the two commits matters: put the lockfile commit after the package.json commit, so a reviewer dropping the lockfile commit lands at a still-coherent state.
Pitfalls
git commit --amendon the package.json commit silently drags the lockfile in if staged. Stage and commit the lockfile last.- Accidental combining. If caught on review,
git reset HEAD~1, re-stage selectively, and recommit as two. - Package renames invalidate the lockfile. Renaming a workspace's directory or
package.json:namechanges the workspace key ("@scope/<name>@workspace:packages/<dir>") insideyarn.lock. Still ships in its ownchore: Update yarn.lockcommit, regenerated by re-runningnpx corepack yarn installafter all renames are in place. Don't hand-edit the workspace key; the install produces the canonical form.
Notes from the field
- 2026-05-13: adopted from the reference. Session example from PR 71 lives in the journal, not here.