mismagent-realize-aggregate

Implements a DDD Aggregate root with confined invariants and invariant tests.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/lucolucus/mismagent --skill mismagent-realize-aggregate-lucolucus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mismagent-realize-aggregate
Source: https://github.com/lucolucus/mismagent/tree/main/codex/skills/mismagent-realize-aggregate
Command: npx skills add https://github.com/lucolucus/mismagent --skill mismagent-realize-aggregate-lucolucus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Domain invariants often get scattered across services and controllers, duplicated, or bypassed through public setters, causing inconsistent state and oversell-style concurrency bugs. This Skill guides the implementation of a single Aggregate root that owns its invariants in one place, tested once. ## Core Features & Use Cases - Aggregate realization: Builds one Aggregate root plus its value objects with private setters, named predicates instead of raw invariant fields, soft-delete only, and primitive/Published Language identity at the boundary. - Invariant testing: Translates natural-language tests (tests_nl) into one invariant-test per declared invariant, including genuinely multi-threaded contention tests for concurrency claims and JVM-safe INV-n test naming. - §14 gate compliance: Enforces that invariant-bearing state stays captive of the root, verified by the worker's gate before merge. - Use Case: When a building-block manifest marks a block as type = aggregate, the worker loads this Skill to implement, for example, a Product aggregate whose "cannot sell a deactivated product" rule becomes a failing-then-passing invariant test. ## Quick Start Ask the mismAgent worker to realize the aggregate block from your building-blocks manifest, for example: implement the Product aggregate block with its invariants and invariant tests.

Frequently Asked Questions about mismagent-realize-aggregate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a DDD Aggregate root with invariants?

Place every invariant inside the Aggregate root as a method with private setters, so mutation only happens through the root. Write one invariant-test per declared invariant and expose named predicates instead of raw state fields.

How to test concurrency invariants like preventing oversell?

Write a genuinely multi-threaded test: release N threads or coroutines from a start barrier against the same instance, proven fail-before and pass-after synchronization. Guard the implementation against check-then-act (TOCTOU) with an atomic all-or-nothing operation.

Should an Aggregate expose its internal state fields to consumers?

No. Invariant-bearing fields stay private and are referenced only inside the Aggregate. Consumers use a named predicate such as vendibile instead of re-deciding from a raw field like attivo, keeping the rule in one place.

Can an Aggregate depend on a database or framework?

No. The Aggregate is pure domain logic whose invariants must hold in milliseconds without persistence. Database access belongs to a separate adapter block, which also enforces that no INSERT, UPDATE, or DELETE bypasses the root.

Why do invariant test names need an INV-n prefix?

The INV-n prefix makes per-block coverage checks a mechanical grep. Names must be JVM-safe, so brackets, dots, semicolons, slashes, and angle brackets are avoided because they do not compile in JVM method names.