Go modular bricks
Establish project rules first
Read the project's agent instructions and documented coding standards before
selecting examples. Follow their pointers to affected interface contracts and
accepted ADRs. Use the project's document paths, not assumed filenames. Record the local
rules for ownership, errors, private functions, comments, wiring, and tests.
These rules override generic recipes throughout the skill. Nearby code does not
authorize a violation. Consult architecture exceptions
for unresolved conflicts or undocumented departures.
Classify before choosing a package
For each new or extracted responsibility, state its behavior, owner, intended
file, and selected contract before editing. For review, classify each affected
responsibility before judging it. A requested name, existing package, receiver,
number of callers, or use of I/O does not determine ownership.
| Behavior |
Owner / contract |
| Public business operation and orchestration |
Use case; application router |
| Simple operation-local input shape constraint |
Use-case input validation; application router |
| Reusable acceptance/rejection rule, including checks requiring external data |
validator/ plus consumer-owned ports/<name>_validator.go; validators |
| Convert one representation into another, including parsing and collection assembly |
Boundary-owned mapper/; mappers |
| Persist data, adapt a remote protocol, or integrate a vendor |
Repository, client, or provider respectively; application router |
| Reusable capability not owned by a more specific category above |
service/; services |
A loader owns I/O and delegates reusable checks to a validator and extracted
conversions to a mapper. Private methods must implement the receiver's own
responsibility. Adding a receiver or moving methods to another file in service/
does not make validation or mapping service-owned.
Route by responsibility
Identify the boundary being changed, diagnosed, or reviewed from the task and
owning code. A SQL fix behind an endpoint is a persistence task, not automatically
a REST task. If the owner is unknown, trace the failing path before selecting
specialists.
| Responsibility in scope |
Router |
| HTTP DTOs, handlers, routes, middleware, collection queries, API documentation |
REST |
| Cobra business commands, server or migration-command behavior |
CLI |
| Use cases, types, mapping, ports, adapters, schema, Fx, configuration, ownership, resources, telemetry, tests |
Application |
Read data flow when changing or judging dependency
direction, representation boundaries, or application/entry-point orchestration.
Local implementation or content fixes need only their specialists.
Loading boundaries
- Select matching rows and triggered companions, taking the union for mixed
tasks. Paths resolve relative to the document containing them. Read selected
contracts in full before editing or judging their boundary.
- Inspect callers and dependencies without automatically loading their
specialists. Expand only for an affected responsibility or a specific
unverified guarantee, such as absence semantics or transaction participation.
Stop at unchanged boundaries whose relevant guarantees are verified.
- Links are conditional pointers, not a recursive reading list. Load only the
selected runtime profile's example; reuse contracts already in context.
- Test-only work selects the proof seam and asserted behavior's specialist.
Documentation-only work selects its subject. Reviews select every boundary
being judged, including unchanged ones explicitly in scope.
Verify ownership before finishing
Reclassify every added or changed function and method by its body, including
private methods and helper-only files. Match each to the owner and file selected
above; extract misplaced validation and mapping before declaring completion.
Then verify public representations, affected runtime registration, project error
patterns, and the project-selected test seam. Re-select contracts if the diff
expands.
Run the required lint, architecture checks, tests, and independent review that
the project configures. Report each as passed, failed, or not run, with evidence
or a blocker. Missing tools cannot produce a pass. Self-review cannot substitute
for independent review. Keep the task incomplete until all required checks pass
and every affected boundary satisfies its contract. Fix the implementation;
changing approval rules or weakening tests requires explicit authorization.
1---2name: go-modular-bricks3description: Develop, maintain, or review Go services using Bricks modular architecture.4---56# Go modular bricks78## Establish project rules first910Read the project's agent instructions and documented coding standards before11selecting examples. Follow their pointers to affected interface contracts and12accepted ADRs. Use the project's document paths, not assumed filenames. Record the local13rules for ownership, errors, private functions, comments, wiring, and tests.14These rules override generic recipes throughout the skill. Nearby code does not15authorize a violation. Consult [architecture exceptions](references/adr-exceptions.md)16for unresolved conflicts or undocumented departures.1718## Classify before choosing a package1920For each new or extracted responsibility, state its behavior, owner, intended21file, and selected contract before editing. For review, classify each affected22responsibility before judging it. A requested name, existing package, receiver,23number of callers, or use of I/O does not determine ownership.2425| Behavior | Owner / contract |26| --- | --- |27| Public business operation and orchestration | Use case; application router |28| Simple operation-local input shape constraint | Use-case input validation; application router |29| Reusable acceptance/rejection rule, including checks requiring external data | `validator/` plus consumer-owned `ports/<name>_validator.go`; [validators](references/validators.md) |30| Convert one representation into another, including parsing and collection assembly | Boundary-owned `mapper/`; [mappers](references/mappers.md) |31| Persist data, adapt a remote protocol, or integrate a vendor | Repository, client, or provider respectively; application router |32| Reusable capability not owned by a more specific category above | `service/`; [services](references/services.md) |3334A loader owns I/O and delegates reusable checks to a validator and extracted35conversions to a mapper. Private methods must implement the receiver's own36responsibility. Adding a receiver or moving methods to another file in `service/`37does not make validation or mapping service-owned.3839## Route by responsibility4041Identify the boundary being changed, diagnosed, or reviewed from the task and42owning code. A SQL fix behind an endpoint is a persistence task, not automatically43a REST task. If the owner is unknown, trace the failing path before selecting44specialists.4546| Responsibility in scope | Router |47| --- | --- |48| HTTP DTOs, handlers, routes, middleware, collection queries, API documentation | [REST](references/flows/rest.md) |49| Cobra business commands, server or migration-command behavior | [CLI](references/flows/cli.md) |50| Use cases, types, mapping, ports, adapters, schema, Fx, configuration, ownership, resources, telemetry, tests | [Application](references/flows/application.md) |5152Read [data flow](references/data-flow.md) when changing or judging dependency53direction, representation boundaries, or application/entry-point orchestration.54Local implementation or content fixes need only their specialists.5556## Loading boundaries5758- Select matching rows and triggered companions, taking the union for mixed59 tasks. Paths resolve relative to the document containing them. Read selected60 contracts in full before editing or judging their boundary.61- Inspect callers and dependencies without automatically loading their62 specialists. Expand only for an affected responsibility or a specific63 unverified guarantee, such as absence semantics or transaction participation.64 Stop at unchanged boundaries whose relevant guarantees are verified.65- Links are conditional pointers, not a recursive reading list. Load only the66 selected runtime profile's example; reuse contracts already in context.67- Test-only work selects the proof seam and asserted behavior's specialist.68 Documentation-only work selects its subject. Reviews select every boundary69 being judged, including unchanged ones explicitly in scope.7071## Verify ownership before finishing7273Reclassify every added or changed function and method by its body, including74private methods and helper-only files. Match each to the owner and file selected75above; extract misplaced validation and mapping before declaring completion.76Then verify public representations, affected runtime registration, project error77patterns, and the project-selected test seam. Re-select contracts if the diff78expands.7980Run the required lint, architecture checks, tests, and independent review that81the project configures. Report each as passed, failed, or not run, with evidence82or a blocker. Missing tools cannot produce a pass. Self-review cannot substitute83for independent review. Keep the task incomplete until all required checks pass84and every affected boundary satisfies its contract. Fix the implementation;85changing approval rules or weakening tests requires explicit authorization.