agentleFS
TairitsuaTairitsua/Monica/skills/monica-application-building-block-development/SKILL.md

monica-application-building-block-development

Skill18 starsChanged 7 months agoMITView on GitHub

Apply Monica building block contracts when implementing, refactoring, or reviewing handlers, entities, repositories, events, jobs, options and their support types. Load monica-application and the project specification first.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 3 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When adding or refactoring application EventBus events and consumers, including outbox or inbox adoption, load the event contract and …

    line 16
  2. Very specific:

    Prefer Monica-native types.

    line 20
  3. Very specific:

    Keep persistence concerns in repositories and persistence classes, not in request handlers.

    line 21
  4. Very specific:

    Keep repository implementations in the owning subdomain or service infrastructure boundary.

    line 22
  5. Distinctive:

    Keep contracts stable: requests, DTOs, and events are not persistence entities.

    line 23
  6. Very specific:

    Add explicit [BuildingBlockMetadata] to each application-authored discovered building block and [BuildingBlockRequirement] for applicable …

    line 24
  7. Distinctive:

    Keep metadata, description, and requirement traceability explicit.

    line 25
  8. Very specific:

    Do not add MVC [Http*], [Route], or [From*] attributes to generated ApplicationRequestHandler endpoints.

    line 30
  9. Very specific:

    Use transport-independent ApplicationRequestHandler for use cases.

    line 31
  10. Very specific:

    Use monica-application-microservice for split deployment and migration from legacy service hosts.

    line 55
  11. Very specific:

    Use monica-application-modular-monolith for combined deployment and migration from merged legacy contexts.

    line 56

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Monica Application Building Block Development

Overview

Use this skill to implement application building blocks in Monica-based DDD projects. Before changing or reviewing building blocks, load $monica-application and the repository-designated project specification, even when this skill was invoked directly. The shared specification defines rule strength; specification evolution governs concrete architectural gaps and rule changes, not ordinary combinations of these building blocks.

Workflow

Use the unified architecture and the solution to locate the owning domain core or role library. Apply any local placement rule from the project skill. Use building block overview and composition map when the feature's building blocks are unclear; load only the matching building block reference below. Keep invariants on entities. For a multi-step business operation within one domain, use the DomainService template to decide what belongs in the service and what belongs at the request boundary. Check the support-type boundary before extracting business behavior into a separately registered class.

When adding or refactoring application EventBus events and consumers, including outbox or inbox adoption, load the event contract and handler templates before changing their delivery configuration.

Ground Rules

  • Prefer Monica-native types. Follow the type naming, source filename, placement, boundary, and project-level extension rules when selecting a reusable specialization. Keep the application's concrete names and adopted extension families in its local guidance.
  • Keep persistence concerns in repositories and persistence classes, not in request handlers. Use $monica-infra-persistence for the current operation, transaction, and provider contracts.
  • Keep repository implementations in the owning subdomain or service infrastructure boundary. Do not move a repository or adapter to Platform just because it uses an external library; only project-common reusable infrastructure belongs in Platform.
  • Keep contracts stable: requests, DTOs, and events are not persistence entities.
  • Add explicit [BuildingBlockMetadata] to each application-authored discovered building block and [BuildingBlockRequirement] for applicable actual requirement IDs, following the metadata and coverage-debt rules. Do not inherit metadata or invent a requirement merely to fill the catalog.
  • Keep metadata, description, and requirement traceability explicit. Resolve optional ownership through the metadata rules.
  • Construct result outcomes explicitly with Result.Success(data), Result.Failure<T>(message, status), or Result.FromFailure<T>(source). Messages use WithMessage; success does not guarantee non-null data. Follow the result contract.
  • Make HTTP contracts request-owned. Put [ApiEndpoint] on the request type and keep route, verb, and binding off the ApplicationRequestHandler handler.
  • A request is published for generated API clients only when it is attributed source in the exact namespace *.PublishedLanguages.Domain{DomainName}.Requests. Attributed requests outside that boundary remain local HTTP endpoints.
  • Generate interfaces in Protocol independently of placement. The complete [ApplicationHost] generates per-operation clients and owned receivers; ordinary calls prefer Local and RunOnRole is reserved for a real execution requirement. See unified architecture and API generation.
  • Do not add MVC [Http*], [Route], or [From*] attributes to generated ApplicationRequestHandler endpoints. The request contract is the single endpoint authority.
  • Use transport-independent ApplicationRequestHandler for use cases. [ApiEndpoint(ApiHttpMethod, route)] publishes a domain interface for UI and application callers while retaining HTTP metadata without exposing receivers. Unattributed requests and plain IRequestHandler remain internal mediator operations.
  • For capability setup and runtime behavior, use $monica-infra-configuration, $monica-infra-jobs, $monica-infra-messaging, and $monica-infra-web as applicable. This skill owns the application building block's shape and placement.

Reference Navigation

  • Building Block catalog and responsibilities: 00-building-block-overview.md
  • Naming, placement, boundaries, and project-level extensions: 01-building-block-naming-and-boundaries.md
  • Building Block selection by feature shape: 02-building-block-composition-map.md
  • Metadata, ownership, and requirement traceability: 03-building-block-context-metadata.md
  • Bounded CRUD, seeders, hosted services, controllers, internal mediator handlers, Facades, and support types: 04-adapters-lifecycle-and-support-types.md
  • ApplicationRequestHandler templates: 10-application-request-handler-template.md
  • DomainService templates: 11-domain-service-template.md
  • Entity, request, and event templates: 12-entity-request-event-template.md
  • Repository and DbContext templates: 13-repository-and-persistence-template.md
  • Event handler templates: 14-event-handler-template.md
  • Job templates: 15-job-template.md
  • Continuous consumers, scoped work items, and shutdown: 18-hosted-service-template.md
  • Aggregate concurrency and Actor replacement: 19-aggregate-concurrency.md
  • Configuration templates: 16-configuration-template.md
  • Connected request, handler, entity, and repository example: 17-connected-use-case-example.md

Scope Notes

  • This skill is architecture-agnostic. It explains building block design, not solution topology.
  • Use monica-application-microservice for split deployment and migration from legacy service hosts.
  • Use monica-application-modular-monolith for combined deployment and migration from merged legacy contexts.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.