Craftsman quality
When to Use
Any coding turn in a workspace where the craftsman plugin is enabled. The gate
runs on pre_verify: it scans everything the turn produced (worktree, new
files, commits) and refuses the conclusion while critical violations remain.
Advisory findings arrive once, as a nudge, and never block.
Procedure
- Write code that respects the families the gate enforces:
- Layers: Domain imports nothing from Infrastructure or Presentation.
Application imports Domain. Dependencies point inward, always.
- PHP:
declare(strict_types=1) first line, final classes, private
constructor plus a static create() factory, behaviour methods instead
of setters, no empty catch.
- TypeScript: no
any (use precise types or unknown), named exports,
readonly by default, no non-null assertion !.
- Security: no hardcoded secret, no dynamic
eval, no SQL built by
string concatenation.
- When the gate blocks, read the list it returns: one
file:line RULE
entry per finding. Fix every listed finding, then conclude again; the gate
re-runs and releases the turn when the scan is clean.
- Do not edit
.craft-rules.yml or .craft-config.yml to silence a rule:
the gate refuses any turn whose diff touches its own configuration. Rule
changes go through a reviewed commit by a human.
- Run
/craftsman at any point for an on-demand verdict on the worktree,
/craftsman status for the plugin's own state.
Pitfalls
- A clean
git status is not a clean turn: committed work is scanned too,
back to the branch point.
- Writing through the terminal (
sed -i, tee, redirects) does not evade
the gate; scope comes from git, not from the tool name.
- Suppressing with
// craftsman-ignore: RULE is recorded and counted; use
it for a documented exception, not as an exit.
- If the gate reports it "could not run", that is a blocked turn, not a
green one: say so instead of concluding.
Verification
Before concluding any coding turn, state what you ran to prove the change
works (test command and its result). The gate checks structure; only your
test run checks behaviour. A turn that ends with "done" and no evidence is
not done.
1---2name: craftsman-quality3description: How to write code that passes the craftsman gate, and how to answer it when it refuses a turn. Load when coding in a repository where the craftsman plugin is enabled.4---56# Craftsman quality78## When to Use910Any coding turn in a workspace where the craftsman plugin is enabled. The gate11runs on `pre_verify`: it scans everything the turn produced (worktree, new12files, commits) and refuses the conclusion while critical violations remain.13Advisory findings arrive once, as a nudge, and never block.1415## Procedure16171. Write code that respects the families the gate enforces:18 - **Layers**: Domain imports nothing from Infrastructure or Presentation.19 Application imports Domain. Dependencies point inward, always.20 - **PHP**: `declare(strict_types=1)` first line, `final` classes, private21 constructor plus a `static create()` factory, behaviour methods instead22 of setters, no empty `catch`.23 - **TypeScript**: no `any` (use precise types or `unknown`), named exports,24 `readonly` by default, no non-null assertion `!`.25 - **Security**: no hardcoded secret, no dynamic `eval`, no SQL built by26 string concatenation.272. When the gate blocks, read the list it returns: one `file:line RULE`28 entry per finding. Fix every listed finding, then conclude again; the gate29 re-runs and releases the turn when the scan is clean.303. Do not edit `.craft-rules.yml` or `.craft-config.yml` to silence a rule:31 the gate refuses any turn whose diff touches its own configuration. Rule32 changes go through a reviewed commit by a human.334. Run `/craftsman` at any point for an on-demand verdict on the worktree,34 `/craftsman status` for the plugin's own state.3536## Pitfalls3738- A clean `git status` is not a clean turn: committed work is scanned too,39 back to the branch point.40- Writing through the terminal (`sed -i`, `tee`, redirects) does not evade41 the gate; scope comes from git, not from the tool name.42- Suppressing with `// craftsman-ignore: RULE` is recorded and counted; use43 it for a documented exception, not as an exit.44- If the gate reports it "could not run", that is a blocked turn, not a45 green one: say so instead of concluding.4647## Verification4849Before concluding any coding turn, state what you ran to prove the change50works (test command and its result). The gate checks structure; only your51test run checks behaviour. A turn that ends with "done" and no evidence is52not done.