← all artifacts
skillv1.0.0tested

Module Scaffolder

module-scaffolder

Build a well-bounded software module with a declared owner, typed surface, events, tests and a minimal view. Use after architectural placement is settled and it is time to create the actual files for a new module or bounded feature.

Provenance

Derived procedure. The source project remains authoritative for its own doctrine; nothing here governs it.

Source project
Atlas Project
Snapshot
02260d7e
Source paths
  • src/modules/ARCHITECTURE.md
  • src/modules/
  • src/routes/
Harvested
2026-09-10
Evidence standing
known
Predecessor
unknown
Supersedes
nothing
Superseded by
unknown

Compatibility and state

Compatible targets
GenericAtlasHTC HubAtlas Harmony Hub
Runtime needs
none declared
Dependencies
none
Tests
structural-and-fixtures-passing (last verified 2026-09-10)
Content hash
pending_export
Consumers
not_searched — No activation survey has been performed across target projects.
Transformation
Module shape inferred from repetition across 60+ Atlas modules; evidence class is observed_code plus inference, weaker than documented doctrine. Absorbed the proposed route-surface-builder as references/tanstack-route-surface.md so the skill itself stays framework-neutral.

Files in the artifact

  • SKILL.md
  • agents/openai.yaml
  • references/tanstack-route-surface.md

Agent metadata

display_name: Module Scaffolder
summary: Builds a bounded module — ownership declaration first, framework-free domain layer, deliberate exports, events, tests, thin route.
category: architecture
artifact_class: skill
includes_reference: references/tanstack-route-surface.md
when_to_use:
  - Creating the files for a new module or bounded feature
  - Adding a route surface over an existing module
  - Reviewing whether an existing module is properly bounded
when_not_to_use:
  - Placement, ownership or extend-versus-create is still open (use System Architect)
  - The concept may not deserve its own structure (use Registry Designer)

SKILL.md

Module Scaffolder

This skill runs after placement is decided. If ownership, spine layer and extend-versus-create are still open, stop and use system-architect first. Building files is the cheap part; building them in the wrong place is the expensive part.

A module is bounded when you can state what it owns, what it reads, what it emits, and what breaks if it is deleted — before any file exists.

Hard rules

  • One module, one owner, one purpose. Written down, in the module itself.
  • No duplicated truth. The module holds references to facts other modules own.
  • The export surface is deliberate. Everything else is internal.
  • Every module has tests that would fail if its core behaviour broke.
  • The view is minimal. A module is its domain logic; the screen is a window.
  • Registration is explicit where the architecture has a module registry — an unregistered module is an orphan.

Shape

src/modules/<module-name>/
  OWNERSHIP.md     owns / knows / emits / relates — four headings, no prose padding
  types.ts         the module's own types; imported types come from their owner
  <domain>.ts      domain logic, framework-free
  events.ts        event type definitions this module produces
  index.ts         the deliberate export surface
  __tests__/       behaviour tests
  references/      only when domain rules need explaining beyond the code

Adapt names to the project's existing convention — consistency with the codebase beats consistency with this list. What must survive adaptation: the ownership declaration, the framework-free domain layer, the deliberate export surface, and the tests.

Procedure

  1. Write `OWNERSHIP.md` first, before any code:
  2. Owns — the facts this module is the single source of truth for.
  3. Knows — what it reads from elsewhere, and from which owner.
  4. Emits — the events it publishes, with their consumers named.
  5. Relates — its foreign relationships, by reference. If any section reads "same as an existing module", stop and extend that module.
  6. Define types. Own only your own. Import the rest from their owner; a local copy of another module's type is duplicated truth in slow motion.
  7. Write the domain logic framework-free. No React, no router, no ORM in the domain layer. It should be testable without booting anything.
  8. Define events per event-spine-designer: past-tense, attributed, with named consumers.
  9. Curate `index.ts`. Export what other modules legitimately need. Everything else stays internal. A module that exports its whole directory has no boundary.
  10. Write the tests against behaviour: the invariant it protects, the boundary it refuses to cross, the event it emits. Not the getters.
  11. Add the minimal view. One route, reading through the module's public surface only. Framework specifics: references/tanstack-route-surface.md.
  12. Register the module wherever the architecture expects it.
  13. Delete-test it. If this module were removed, what breaks? "Nothing" means it should not exist. "Everything" means it is not bounded.

Route surface

Absorbed capability: the proposed route-surface-builder. It is a reference, not a skill, because framework conventions change faster than architecture and must not make a general skill framework-specific. See references/tanstack-route-surface.md for TanStack Start specifics. In another framework, the principles hold and the reference does not apply: routes are thin, they call the module's public surface, and they never contain domain logic.

Worked example

Task: a `compliance` module tracking certificate validity per property.

  1. OWNERSHIP.md. Owns: certificate records, validity assertions. Knows: properties (owner: property), documents (owner: provenance-intake). Emits: compliance.certificate_recorded, compliance.lapsed — consumed by scheduling and notifications. Relates: certificate → property, certificate → source document.
  2. Types. Certificate, ValidityWindow. Property is imported, not redefined. No property_address field — that is the property module's fact.
  3. Domain. isLapsedAt(certificate, instant) — a pure function, tested without a database.
  4. Events. compliance.lapsed is emitted by a scheduled evaluation, actor system:compliance-evaluator, carrying the certificate reference.
  5. Surface. index.ts exports the types, isLapsedAt, and a query for a property's certificates. The storage adapter stays internal.
  6. Tests. Lapse boundary at exactly the expiry instant; a certificate superseded by a renewal does not report lapsed; an unknown expiry returns unknown, not false.
  7. View. One route showing certificates for a property, reading only the public surface.
  8. Delete test. Removing it loses compliance tracking and two event consumers degrade — bounded, and it earns its place.

Pressure tests

  • Does OWNERSHIP.md name any fact another module also claims?
  • Can the domain layer be tested without a framework, a database or a network?
  • Does any type here duplicate a type another module owns?
  • Does index.ts export anything no other module actually imports?
  • Does any event have no consumer, or any consumer no producer?
  • Is there domain logic inside a route or component?
  • If deleted, does anything break — and does anyone find out?

Stop conditions

  • Placement is unsettled — use system-architect first.
  • OWNERSHIP.md cannot be written without claiming a fact someone else owns.
  • The module would need a copy of another module's data to function.
  • The module has no events and no owned facts — it is a utility, not a module; put it where utilities live.