change-areas
The procedure an agent follows when it runs change-areas. For people, the change-areas guide explains it.
A change-area catalog maps the repository’s paths to named areas, and each area to what a change there owes: the checks to run, the reviews to invoke, the tracker labels to apply, the actions to take after a deploy. This skill resolves a change against it and checks it. It is the runnable form of module M3. The human’s page is README.md.
The rule the catalog exists for: a path’s classification is stated once, in the catalog, and everything else reads it. Before you write a glob or a regular expression that decides whether a file is code, docs, a migration or an API, ask the resolver instead (§ Consume).
Paths and working directory
${CLAUDE_SKILL_DIR} in the commands below stands for the absolute path of the
directory containing this SKILL.md. Claude Code fills it in. In any other
harness, replace it with that path yourself before running a command: a shell
would expand the unset variable to an empty string.
Run every command from the root of the repository. The catalog is the
repository’s drive.change_areas_catalog
(configuration);
--catalog <path> names another. When neither is set the scripts exit 2 and
say so: ask the user where the catalog is, do not guess. A repository with
its own wrapper around these scripts (a composer, see the README) runs that
wrapper instead; use it when the repository’s instructions name one.
Impact: what does this change touch, and what must happen because of it?
Resolve the working tree’s change against the base branch, untracked files included (leaving them out under-reports a new file, often the one most in need of a gate):
bun "${CLAUDE_SKILL_DIR}/scripts/resolve.ts" --worktree --base origin/mainUse the repository’s base branch for origin/main. An empty list means
nothing changed, and owes no checks. The script reads the merge base, tracked
diff and untracked paths internally, keeps path bytes intact and stops on any
failed Git command. Other entry points:
--base <branch> (a pull request’s diff, origin/<branch>...HEAD), --event push (every commit since the push event’s before, or --before <sha>;
the last commit without one), --event workflow_dispatch --since <ref>
(every commit since <ref>). A flag that belongs to another event’s diff is
refused. The JSON:
| Field | Meaning |
|---|---|
seedAreas | Areas a changed file matches directly: what the change touched |
areas | The seeds plus every area their impliedBy closure reaches: the consequences |
reviewSkills | The review skills to invoke, each once (review says which area asked) |
postDeploy | Actions after the deploy, by area |
linear | Tracker labels and flags, from the seeds only |
validation | The checks to run (§ Validate) |
generated | The seed areas’ generators: outputs, source, command, check |
Report the seed and affected areas, the review skills, the post-deploy
actions and the labels. Invoke every skill in reviewSkills. Copy
postDeploy into the pull request description under ## Post-Deploy Actions.
Validate: what must run before commit and push?
The validation block of the same JSON. It derives from the seeds, never
the closure: a docs edit that implies a downstream service keeps the docs’
depth.
- Run every
validation.localCheckscommand, in order, before committing. - Run every
validation.verificationCheckscommand to verify the committed tree: before pushing, and after a review fix. - Treat the plan as a minimum. The repository’s hooks and its required CI
still run (
repositoryHooksRequired,githubCiRequired).
A changed file that matches no area fails closed to the deepest profile. An expensive plan for a cheap-looking change usually means a coverage gap: look for the file no area claims before suspecting the resolver.
Author: add or edit an area
Read the catalog first, then the field reference in the README. An area:
api-service: # kebab-case id
title: "API Service"
category: service # a grouping tag, never a build lane
paths: ["apps/api-service/**"]
workspace: ["apps/api-service"] # must exist and be covered by paths
impliedBy: [core-lib] # areas whose change implies THIS one
deployTier: primary
validation: { profile: deep, ownTests: "npm test --workspace api-service" }The rules that are wrong more often than not:
impliedByis one directed relation. Listing B in A’simpliedBymeans “a change in B implies A”. Never add the mirrored edge: that is a cycle, andcheck.tsrefuses it.- Never under-trigger. When unsure whether one area depends on
another, add the
impliedByedge: a redundant job is cheap, a skipped review is not. Overlappingpathsare fine: a file may belong to several areas. - A file matching no area fails closed to the deepest profile. Adding coverage is how a change gets cheaper; leaving a path uncovered is safe but expensive.
- A generator belongs to the area that owns its output. Its
generatedentry lists theoutputs(literal paths, inside the area’s ownpaths), thesourcepaths or globs whose change calls for a regeneration (they seed the area even from another area), thecommandthat regenerates and thecheckthat fails when stale. - Profiles are declared shallowest first under
profiles:, each with its checks; the last is the deepest and the default for an area without one, and lists at least one check (the catalog is refused otherwise). A shallower profile may list no checks: that is a deliberate “nothing to run” tier, and a change selecting only it gets a plan of just its areas’ regeneration checks and own tests, possibly empty. A change that selects a profileprofiles:does not define (or any change, in a catalog with noprofiles:) gets no validation plan: the JSON exits 2 rather than plan nothing, unless the repository’s composer supplies its own plan or the caller passes--no-validationbecause it reads only the routing (reviewSkills,postDeploy). - No area is keyed
<other>-seedwhen<other>is an area too: the GitHub outputs would collide.
Then check the catalog, and fix every problem it prints:
bun "${CLAUDE_SKILL_DIR}/scripts/check.ts"Exit 0 is valid, 1 a problem (each printed), 2 a catalog that cannot be
read, or a repository whose files cannot be listed.
It checks the schema (an unknown field is an error, so a typo cannot pass
silently), the impliedBy graph, the GitHub output names, each workspace
(a directory, every file in it matched by its own area’s paths), and each
generator’s outputs and sources against the repository’s files.
Consume: wire a job, a hook or a skill to the catalog
Read the resolver’s output instead of restating its globs:
- In CI,
--format ghaappends<area>=true|false(the closure) and<area>-seed=true|false(the direct match) to$GITHUB_OUTPUT; a job gates on the area’s name.--format json --output-ghawrites both from one git run. The per-area outputs say nothing about a changed file that matches no area, which should select every job: a repository adds that signal through its composer’sghaOutputs(acode=line fromhasUnmatchedFile, as Jig’s own script writes one), or keeps every file covered with a coverage check (uncoveredFiles). - For a workflow
paths:filter, which runs before any script can,--format dornyprints each area’s globs with those of every area that implies it: the filter matches exactly when the resolver would. --area-paths <area>prints one area’spaths, one per line (not its generators’ sources).
Reference an existing area by name; add the missing area to the catalog when none fits. Hand-write a path list only when nothing can run the resolver first, and say why beside it.
Fail closed
A resolution that cannot be made (a git command that fails, a missing base
or since ref, a CI event with no diff here, a git command past its
deadline) exits non-zero, never an empty change. An invalid catalog, in its
schema, its impliedBy graph or its output names, is refused with every
problem named and exit 2, as is a validation plan its profiles cannot make. An empty --files list is the
one empty change: it means nothing changed, so never feed it the output of a
git command that failed. Report such an error to the user as it is;
do not work around it.