Skip to content
SprecherEast
Issue 145

process: Automated guardrails while editing, at commit, in CI and at review

Back to our plan
Open
ciprocesstoolingpriority: high

Type

process

Summary

Make the project's standards check themselves, at every stage, for every contributor:

  • While an AI agent edits a file: the check runs right away and tells the agent what to fix.
  • At every commit: the same checks run, for people and agents alike.
  • On every pull request: the checks run as required GitHub checks.
  • At review: the reviewing agent gets the same checklist automatically.

Written rules are easy to drift from; automated checks aren't.

Problem

Proposed fix

  1. scripts/check-agent-docs.mjs (Node, no new dependencies, unit-tested) fails when:
    • a Markdown file under AGENTS.md, CLAUDE.md, docs/, .agents/ or .claude/ is over 250 lines (tighter caps per path, as set in #144);
    • a SKILL.md breaks the Agent Skills spec (https://agentskills.io/specification, opens in a new tab): name format, name ≠ folder, or a missing or too-long description;
    • a .claude/rules/*.md file has no paths:;
    • a .claude/skills/* pointer doesn't match its .agents/skills/* source;
    • a relative link or anchor in these files doesn't resolve.
  2. Before commit: lint-staged runs the checker on staged Markdown. ESLint, including the boundary rules from #130, already runs on staged code.
  3. While the agent works: .claude/settings.json gets a PostToolUse hook on Edit|Write that runs ESLint on the edited code file, or the checker on the edited doc, and returns failures to the agent (exit 2).
  4. In CI: a Docs & agent context job on every PR. The owner adds it to the required checks in the main ruleset (owner action).
  5. At review:
    • .claude/agents/qa-reviewer.md gets skills: [pr-review], so every review starts with the checklist.
    • pr-review gains an Architecture section (right module and layer, no duplicated rule, shared parts reused, tests for new rules, no Payload outside data/ and cms/) and a Docs section (lean, no repeated content, links resolve).
  6. Change workflow: step 3, "check locally", adds npm test and npm run check:docs.

Not proposed: an AI review step in CI (for example a Claude GitHub Action). It needs a paid API key, so it's an owner decision.

Acceptance criteria

  • Not done: Each of these fails npm run check:docs locally, at pre-commit and in CI, and the PR shows it: a 251-line doc, a skill whose name doesn't match its folder, a rules file without paths:, a broken relative link.
  • Not done: After an agent edits a .ts file with a lint error, the hook's message reaches the agent in the same session (shown in the PR).
  • Not done: The reviewer agent loads pr-review without being told to.
  • Not done: The checker has unit tests.
  • Not done: Policy change: the owner signs off explicitly, and adds the new required check.

Depends on

#144 (lean context), so the checker's caps match the new layout; #129 (tests). Process groundwork for #127.

Area

tooling, ci

Priority

high


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab