Moves a repo to a new factory core version and opens one update PR with the diff. Compares .factory/core.lock with the new core, lists locally edited core files first and stops until the person decides to keep, upstream or discard each one, pins the new version in factory.yaml, and lists what changed in the PR body. Never edits overlay files and never merges. Use when the user says "/factory-update", "update the factory", "pull the new core" or "upgrade the factory", or when a factory release should reach this repo. For a first install use factory-init.
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Medium
Suggest reviewing before use
The core in this repo is a copy, never edited here (../factory-compound/references/upstream.md):
it changes in the factory repo and arrives as one reviewable PR per version. You decide and talk to the person; the
helper factory-update in the new core's core/bin/ does the writing, and it calls that core's
factory-install apply for every copy and for the lock. Never use this repo's .factory/bin/ copies for an update:
they are the old version.
| Step | What | Rules in |
|---|---|---|
| 1 | Find the source of the new version, check the repo | below |
| 2 | Compare; edited core files first | below |
| 3 | Derive the answers | below |
| 4 | Run the update in a worktree | below |
| 5 | Labels: create the missing ones, keep the project's | below |
| 6 | Commit, push, open the PR | references/pr-body.md |
Rules that hold throughout:
factory.yaml
(apart from the version in its factory: pin), AGENTS.md, CLAUDE.md, role files, the review checklist, the
voice or hunter file, the PR template, settings, links or a domain skill, even when one is missing. The helper
runs the installer on a staging copy and writes into the repo only the files the new lock lists; everything else
the installer would add or change (a missing overlay file, new rules sections, a settings merge) lands in the
proposals folder with its diff and in the PR, for a person to take or leave.This repo. git rev-parse --show-toplevel; gh repo view --json nameWithOwner,defaultBranchRef. Read the
default branch's .factory/core.lock: its version: is the installed core, its upstream: the factory repo
updates come from. No lock: the factory is not installed; point the person to /factory-init and stop.
The source of the new version: a folder that holds core/ and .claude-plugin/plugin.json, whose
"version" is the new core version. Take the first that applies:
…/cache/<marketplace>/<plugin>/<version>; claude plugin marketplace list --json names the
marketplace, and /plugin marketplace update fetches a newer one when the person asks);upstream: repo in your scratch folder:
git clone --depth 1 [--branch <tag>] https://github.com/<upstream> <scratch>/factory-source, with the tag the
person asked for (or the release tag of the version they named), else the default branch. Note its commit
(git -C <clone> rev-parse HEAD) for the PR.The source root is the repo's plugin/ folder, not the repo root. plugin/ holds .claude-plugin/plugin.json
and core/ (with recipes/ and runtime/, and packs/ when it exists) as links to the repo's own folders, so
it is the folder to pass as --source. The same holds for a git archive of a tag: extract the whole archive
(the links point outside plugin/, so an archive of plugin/ alone has dangling ones) and take its plugin/.
The helper is sh <source>/core/bin/factory-update. A source without it is older than this skill: stop and say so.
One PR per update. gh pr list --state open --search "chore: update factory in:title" --json number,title,headRefName.
An open update PR to the same version: tell the person, link it, and stop (to refresh it, run step 4 on its branch
and push there). One to an older version: ask the person whether this update replaces it; never close it yourself.
Run in the root checkout (it reads only): sh <source>/core/bin/factory-update check --source <source> --target <repo root>.
| Exit | Means | You |
|---|---|---|
| 4 | current: the source has the version the lock records | Tell the person the factory is current. No branch, no PR. Stop. |
| 3 | edited lines: core files changed in this repo (edited, missing, or a symlink) | Stop and ask, below. |
| 0 | update <old> -> <new> | Go on. |
| 1, 2 | the message says what is wrong (no lock, a pin that disagrees with the lock, an older source, a bad lock line) | Tell the person; fix nothing in the overlay yourself. |
Edited core files come first. Show every edited line with its diff against the old core
(git diff shows nothing here, so diff it against the old version in the upstream repo, or show the file) and ask
per file, one at a time, with a recommendation:
../factory-compound/references/upstream.md says (filing it waits for
gate H9). Until the core carries it, keep the edit (next option). Recommend this when the edit is a general fix.factory-doctor keeps reporting the file as edited. Pass --keep <path>.--discard <path>. Recommend this when
the edit is project-specific: move its content into the overlay (rules file, role file, review checklist or a
domain skill) first, in the same PR, as a visible overlay change, only when the person agrees.A missing file or a symlink can only be discarded. Run check again with the decisions until it exits 0. Never pick
for the person; a person who does not answer means no update.
What changed between the two versions. There are no release notes yet, so read the history of the factory repo
with its release tags v<old> and v<new>. That needs a clone with full history: a --depth 1 clone, a folder the
person named without a .git, or the plugin cache has none, so make one in your scratch folder just for this
(git clone https://github.com/<upstream> <scratch>/factory-history, no --depth). Then
git -C <clone> log --oneline v<old>..v<new> -- plugin/ lists one commit per merged change to the core, since every
such change raises the version in plugin/.claude-plugin/plugin.json. For the changes that break a project, run
python3 -I <source>/core/bin/factory-release-check check --from <old sha> --to <new sha> in that clone (the shas of
the two tags: git rev-parse v<old>^{commit}) and read its breaking: lines. The factory repo names no migration
globs, so leave --migrations out: there are no migration: lines to expect. Put the list and the breaking: lines
in the PR body, right after its first paragraph, so the reviewer can see what the update brings. When no full clone
can be made (no network, say), write that in the PR body instead and name the two versions, so the reviewer knows the
list is missing.
factory-install apply renders some core files (the CI workflows, deploy recipes' files) from answers, and the
update renders them again. Write a fresh values folder in your scratch folder as the new source's
core/skills/factory-init/references/values.md describes, derived from this repo's files, as a factory-init re-run
does: factory.yaml (project.repo, languages, mode, commands, ci, deploy, packs), AGENTS.md, the
role files, the lock's upstream: as UPSTREAM, and ~/.factory/machine.yaml for TEST_WORKERS when it exists.
Ask the person only for an answer the files do not give (a key the new core requires, for example), with a
recommended value. The helper sets RULES_MERGE and, when the lock records a factory workflow, CI_WORKFLOWS.
git fetch origin, then
git worktree add -b chore/factory-update-<new> <scratch>/factory-update origin/<default>. <target> is that
worktree. The branch name is a default: when the lead or the runtime that started you names the branch itself,
use that name (in this step and in step 6), as long as the PR's title and body follow this skill.
sh <source>/core/bin/factory-update run --source <source> --target <target> --values <values> --state <scratch>/factory-update-state
with the same --keep and --discard as the last check. The state folder is new, outside the repo.
| Exit | Means | You |
|---|---|---|
| 0 | done; <state>/summary.md is written | Go on. |
| 4 | current (the default branch moved since step 2) | Remove the worktree; no PR. |
| 3 | an edit appeared since step 2 | Back to step 2. |
| 1 | the target is as it was: a failure while staging writes nothing there, and a failure while writing is played back from <state>/journal; the message says why | Fix the answer and run again with a new state folder, or tell the person. If the helper itself was killed, run factory-update rollback --target <target> --state <state> first. |
Check what changed: git -C <target> status --short and git -C <target> diff --stat. Expect only core paths
(.claude/skills/factory-*, .claude/agents/factory-*, .factory/ apart from the overlay files, the
factory-* workflows), .factory/core.lock and the version in factory.yaml's pin line. Anything else: stop and
tell the person. The summary's "Proposed, not written" table lists what the installer would add or change in
project files; show the person those proposals in the PR, and apply one in the PR only when they ask, as a
visible overlay change.
Rendered files. A changed factory-* workflow or recipe file must come from the new core's template, not from
an answer you derived differently: read its diff. A hunk the core did not cause means a wrong answer; fix the
values and run again (new worktree, new state folder).
sh <source>/core/bin/factory-install check --target <target> prints ok, apart from files you kept.
A new core may add labels. They live on GitHub, not in the PR, so this step changes the repo right away; it only ever adds a label. An existing label's colour and description are the project's: the update never changes them unless a person names that label.
sh <source>/core/bin/factory-install labels --source <source> --repo <owner/name> --values <values> --keep-existing --dry-run,
with the values folder of step 3. would created lines are the labels the new core adds; would kept lines are
existing labels whose colour or description differ from the factory's, each with the project's and the factory's
values. Keep this output for the PR.--dry-run. It creates the missing labels and keeps every
existing one. Never run labels without --keep-existing on an update.--keep-existing --use-factory <name> once per label they named; the
updated line gives the old values, so the change can be put back.<target>: git add -A, commit chore: update factory <old> → <new>, then
git push -u origin chore/factory-update-<new>. A push refused because the token may not change workflows: the
commit is ready; ask the person to push the branch from their own terminal.<target> before the PR is
opened (on the committed branch) and keep the real output for "Checks run":
sh <target>/.factory/bin/factory-doctor --target <target> --source <source>. A failing check that a listed
proposal fixes (a settings merge that wires a hook, say) is the expected state until a person applies that
proposal: the criterion is ticked, and its line names each such check and the proposal that fixes it. Any other
failure leaves the criterion unticked (see "A criterion left open" in references/pr-body.md).factory.yaml line may carry a warning that the repo has its own workflows and ci.external is
empty. That is not a failure, and the update never edits factory.yaml for it. Put it in the PR's "Own
workflows" section (references/pr-body.md) and name it in step 7.commands.verify, as factory-implement step 5 runs it (factory.yaml › commands.setup first
when it is set and the worktree has no installed dependencies, under that skill's setup rules;
FACTORY_TEST_WORKERS=<cap> sh -c "<verify>"). A failing verify leaves its criterion unticked.Closes #N and its "Acceptance criteria" list, so the update needs an
issue, titled exactly the update title of item 1 (chore: update factory <old> → <new>). Look for one with a
search on the title (gh issue list --state open --search "update factory in:title" --limit 200 --json number,title,labels),
which only finds candidates: reuse one only when its title equals the update title character for character, its
labels include neither agent:human nor status:needs-human, and no open PR already closes it
(gh pr list --state open --limit 200 --json number,closingIssuesReferences, then look for the issue's number).
A busy repo has more than 200 open issues, so never rely on the newest 200 alone, and never pick one by search
words alone or make the PR close any other issue. When none matches, open one with that title
and a line saying it tracks this update.Closes #<that issue> and the "Acceptance criteria" list
exactly as it shows them. It goes through the repo's normal review, and a person merges it. Every criterion has a
step that produces its evidence (the factory-install check of the update, the doctor and verify item above, and
the proposals): you tick one only when that step ran and its output is in "Checks run". A person ticks the proposals criterion; with no proposals you tick it and write
"None." under "Proposals". A criterion left open follows the one rule in references/pr-body.md: after the PR is
open, create an issue for its gap and link it from that criterion.git worktree remove <target>) and any clone you made. Keep the state folder until the PR is
open: it holds the proposals the body links.In a few lines: the PR link, the version change, what waits for them (kept edits, proposals, labels that differ, new
keys, the own-workflows warning with its ci.external fix, a human-gate or process change that needs the owner's OK), and the upstream drafts waiting for H9, if any.
Name the update's issue next to the PR link.
filiplh/vervanging
2a535b7
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.