scoped-checks
Skill4 starsChanged 9 days agoMITView on GitHub
Run tests, lint, format and typecheck on the files a change touches instead of the whole project. Lint and format take the changed file paths, tests run the tests related to them, typecheck and build run on the packages that hold them. A full run is kept for config changes, the final gate on a repo with no CI, or when the user asks. Includes `checks.py --changed`, which builds the scoped commands for npm, pnpm, yarn, bun, Python and Go projects, and an optional hook that blocks full runs. Use this skill whenever about to run tests, a linter, a formatter, a type checker or the project's checks after editing code, verifying a fix or finishing a change, even if the user does not say "scoped".
In this repository15 other files it gives its agents.
- changesetsSkill
- docs-siteSkill
- goal-debateSkill
- issue-authorSkill
- landing-pageSkill
- parallel-roadmapSkill
- perf-passSkill
- plain-writingSkill
- pr-authorSkill
- pr-reviewSkill
- repo-setupSkill
- root-causeSkill
- security-fixSkill
- ts-styleSkill
- ui-styleSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
After each edit, check only that edit:
- Very specific: line 26
Run the linter and formatter on the edited files.
- Very specific: line 27
Run the test file that covers the edit, for example pnpm exec vitest run src/a.test.ts.
- Very specific: line 32
Run checks.py <dir> --run --changed <base> once.
- Distinctive: line 64
When one of these matters for the change, run that check in full.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Scoped checks
A full test suite, typecheck or lint run after a small edit spends minutes and reads files the change never touched. Check what the change touches. Run the full set only when a reason below applies.
Scripts
python3 <skill>/scripts/checks.py <dir> # list the detected checks
python3 <skill>/scripts/checks.py <dir> --changed <base> # show the scoped commands
python3 <skill>/scripts/checks.py <dir> --run --changed <base> # run them
python3 <skill>/scripts/checks.py <dir> --run --changed --only test # one kind, against the default branch
python3 <skill>/scripts/checks.py <dir> --run [--install] # the full set--changed reads the files changed since the merge base with <base>, plus uncommitted and untracked files. Without a value it uses the default branch.
While editing
After each edit, check only that edit:
- Run the linter and formatter on the edited files. Take the command from the lint or format script and pass the paths, for example
pnpm exec oxlint --type-aware src/a.tsorpnpm exec oxfmt --check src/a.ts. - Run the test file that covers the edit, for example
pnpm exec vitest run src/a.test.ts. When you do not know which tests cover a file, runvitest related --run src/a.tsorjest --findRelatedTests src/a.ts. - Skip typecheck and build after each edit. Run them once when the change is done.
When the change is done
Run checks.py <dir> --run --changed <base> once. It scopes each check:
| Check | Scope |
| lint, format | the changed files with an extension the tool reads |
| test | vitest related, jest --findRelatedTests, or the test files named after a changed file (pytest, node --test) |
| typecheck, build | the packages that hold a changed file, and their dependents in a pnpm workspace |
| Go | the packages that hold a changed .go file |
The script falls back to a full run of a check when:
- a config file changed (package.json, a lockfile, tsconfig,
*.config.*,.*rc, pyproject.toml, Cargo.toml, go.mod). A config at the root runs everything. A config in a package runs that package. - the script cannot be scoped, such as one that chains commands with
&&. - more than 400 files changed.
- the project type has no scoping (Cargo, Makefile).
A check with no related files is skipped.
When to run the full set
- The user asks for it.
- This is the last check before merge, and the change touches a module other packages import. The repo also has no CI that runs the full set (a private repo, or no check workflow).
- A test outside the module graph may depend on the change, such as an end-to-end test or a snapshot of generated output.
Say in the report or PR which checks ran scoped and which ran in full.
What scoping misses
- Outside a pnpm workspace, typecheck does not cover the packages that depend on a changed one.
- pytest and
node --testfind tests by file name only. A test with another name that imports the changed file does not run. - Go runs the changed packages, not the packages that import them.
When one of these matters for the change, run that check in full.
Hook
scripts/hook.py is a PreToolUse hook on Bash that stops a full run of tests, lint, format or a workspace-wide typecheck. A run counts as full when it names no file and no single package: pnpm test, vitest run, eslint ., pytest, go test ./..., or checks.py --run without --changed. It is off by default. Turn it on with SCOPED_CHECKS_HOOK=block (or warn). To run a full check on purpose, prefix the command with SCOPED_CHECKS=full.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

