Task
Add an automated check
Turn an agreed rule into a check the whole team can run.
Turn an agreed rule into a check the whole team can run.
Fetch https://ntent.app/r/task/add-a-check.json and follow it. Stop and ask me at any step that says to, and do not decide something on my behalf that the plan says is mine to decide.Reads https://ntent.app/r/task/add-a-check.json
The steps
Here so you can follow along, or do it yourself. Your agent gets the same list from the plan above.
- 01
Ask whether it can be impossible instead
Before writing a check, ask whether a type, a schema or the contract could stop the mistake being written at all. If one can, do that and stop here: there is nothing to run, nothing to waive and nothing to phase in.
How to tell it works: You can say in one sentence why a type or schema does not fit, or you did not need a check.
- 02
Choose a warning or a blocking check
Ask: could anyone on the team fix this failure on their own laptop, offline, from a fresh copy of the repo? If yes, the check can block the commit. If not, it should only warn.
How to tell it works: You can say whether it blocks the commit or only warns, and why.
- 03
Write the rule
For code conventions, like no hand-typed colours, sizes, or text, write a lint rule. Lint is the tool that reads your code and flags problems.
uses Design convention lint rules · eslint-rules.mjs
- 04
Prove it fires
Make a small file that breaks the rule on purpose (a probe). Run the check and make sure it fails. Then run it on code that follows the rule and make sure it passes, so you know it does not flag good code. Keep the probe: a rule with no failing line left in the probe file is refused.
uses Lint rule probes · check-probes.mjs
How to tell it works: Break the rule pattern on purpose and the probe check fails even though lint passes. Delete the rule’s FAIL line and it fails again, naming the rule.
- 05
Introduce the rule gradually
If lots of existing files already break the rule, start with a warning. Pick a date to fix them, and switch the rule to blocking on that date.
uses Gradual rule rollout
- 06
Wire a project check into the hook
A check that belongs to this project alone, such as a test for a business rule, goes in scripts/git-hooks/gates.local, not in the hook. One line per check: run_gate "name" "path-regex" "command" "what to fix" followed by any file the command needs. It runs after the built-in checks, only when a staged path matches the regex, and a failure blocks the commit and names the check and the fix. Commit the file.
How to tell it works: Stage a file the regex matches while the check fails and the commit is refused, naming your check. Fix it and the check appears on the "gates passed" line.
- 07
Document the rule and its command
In the project instructions file, write the rule with the command that checks it. If no script can check a rule, say a person has to.
uses Shared project instructions · AGENTS.md