Skip to content
SprecherEast
Issue 138

process: Agent skills that keep new code inside the architecture (placement, reuse, tests)

Back to our plan
Done
processtoolingpriority: high

Type

process

Summary

Give every contributor, human or AI, step-by-step instructions for the common jobs: where new code goes, how to find and reuse the shared building blocks before writing new ones, and how to write tests. That way new code and fixes follow the same architecture and patterns instead of drifting.

Problem

The repo has two agent skills (change-workflow, pr-review) that cover the process (issue → PR → review → merge), but nothing that guides the code itself. The rules in .claude/rules/ say how to style things, not where code belongs or what already exists. That is how the current duplication happened: the "upcoming" rule in 3 files, category labels in 4 places, sign-in calls by hand in 4 files.

Proposed fix

Add skills in the open Agent Skills format under .agents/skills/ (with pointer copies in .claude/skills/, as for the existing two):

  1. code-placement: decide which module and layer a change belongs to (domain/, data/, cms/, ui/, entry files, platform/), how to add a feature to a module, how to start a new module, naming conventions, and what the boundary lint enforces.
  2. reuse-first: before writing anything, search the catalogue of shared components, utilities and module entry points; extend or compose rather than copy; when a second use appears, move the code to the right shared place, test it there, and replace the copy. Includes how to keep the catalogue (docs/architecture/catalogue.md) current.
  3. write-tests: what to unit-test (domain rules, guards, data mappers), what not to (framework behavior, styling), file placement and naming, fixtures, fixed dates, mocked fetch, test doubles for interfaces.

Update pr-review with an Architecture checklist: right module and layer, no duplicated logic, reused shared parts, tests for new rules, no Payload calls outside data/ and cms/.

Each skill links to docs/architecture/ (#128) rather than repeating it.

Owner's request (2026-10-21)

Summary of the owner's request (Claude Code session, text): write his preferred coding patterns down as an agent skill, so that whenever code is generated the skill loads into the agent's context through progressive disclosure. In the same session he asked for domain-driven design with bounded contexts, avoiding anti-patterns such as modules that reference other modules. Code should plug easily into different themes and different CMS systems, and should neither reinvent existing solutions nor be overengineered.

Revised plan: one skill, write-code, whose short SKILL.md loads when code is written or reviewed, with three reference files loaded only when needed (placement, reuse, tests). That's progressive disclosure, and it keeps the agent context lean (#144). The docs/architecture/catalogue.md idea is dropped: a hand-kept list goes stale, so the reuse reference says how to search instead. Decision record 0008 records his no-module-to-module rule.

Acceptance criteria

  • Not done: A write-code skill with valid frontmatter (name, a description that says when to use it), under about 150 lines, with reference files for placement, reuse and tests, pointing to docs/architecture/ for details.
  • Not done: Pointer copies in .claude/skills/ so Claude Code discovers them.
  • Not done: pr-review has the architecture checklist.
  • Not done: AGENTS.md lists the new skills under "How to do it".
  • Not done: Policy change: the owner asked for it (summarized above).

Depends on

#128 (architecture docs) and #129 (tests), so the skills point at real files. Step 3 of #127.

Area

tooling

Priority

high


Generated by Claude Code, opens in a new tab

See it on GitHub, opens in a new tab