context-scaffold
Skill1 starsChanged 7 months agoMITView on GitHub
Scaffold new modules, commands, queries, events, or viewstore entities within an existing legacy cpp-context-* WildFly service. LEGACY ONLY — must not be applied to new Spring Boot work.
In this repository15 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- api-contract-checkSkill
- architecture-designSkill
- context-service-guideSkill
- cpp-test-authoringSkill
- dependency-auditSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- pipeline-debugSkill
- review-prSkill
- springboot-api-from-templateSkill
- springboot-service-from-templateSkill
- terraform-validateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 12 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
When the user wants to add a new command:
- Very specific: line 32
Follow existing naming: {context}.command.{verb}-{noun}.json
- Distinctive: line 37
Must validate invariants via the aggregate
- Distinctive: line 38
Must produce domain events on success
- Distinctive: line 49
When the user wants to add a new query:
- Very specific: line 57
Must use readOnly=true transactions
- Distinctive: line 79
Follow sequential numbering from existing changesets
- Distinctive: line 101
When this service needs to react to events from another bounded context:
- Distinctive: line 114
Must be idempotent — check if event already processed
- Distinctive: line 119
Ask the user what component they want to add
- Distinctive: line 120
Read the existing repo structure to understand naming patterns and conventions
- Distinctive: line 121
Read at least one existing example of the same component type in the repo
- Distinctive: line 123
If adding a viewstore entity, also generate the Liquibase migration
- Distinctive: line 124
If adding a command, also create the corresponding domain event(s)
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
⚠️ Legacy WildFly context services only. The CQRS scaffolding here —
-command-api,-query-api,-domain-event, viewstore + Liquibase, subscriptions-descriptor — is specific to the WildFly-eracpp-context-*stack. Do not copy these patterns into a Spring Boot service. Spring Boot services are layered (Controller → Service → Repository with MapStruct), not CQRS.For new Spring Boot services, use
skills/springboot-service-from-template/. For new HMCTS Marketplace API specs, useskills/springboot-api-from-template/. If a domain genuinely needs CQRS in a new Spring Boot service, that is an ADR-worthy deviation — raise it explicitly rather than importing this skill's patterns.
Context Service Scaffold
Generates boilerplate for new CQRS components within an existing cpp-context-* repository — commands, queries, domain events, viewstore entities, and Liquibase migrations.
When to Use
- User asks to "add a new command", "create a query", "add a domain event"
- User wants to add a new aggregate or entity to the domain
- User needs a new viewstore table with Liquibase migration
- User wants to add event subscription from another context
Component Templates
New Command
When the user wants to add a new command:
- Command API (
{name}-command/{name}-command-api/)- RAML definition under
src/raml/ - JSON schema under
src/raml/json/schema/ - Follow existing naming:
{context}.command.{verb}-{noun}.json
- RAML definition under
- Command Handler (
{name}-command/{name}-command-handler/)- Handler class implementing the command processing
- Follow pattern:
{Verb}{Noun}CommandHandler.java - Must validate invariants via the aggregate
- Must produce domain events on success
Example command schema naming:
hearing.command.schedule-hearing.json
hearing.command.update-hearing-details.json
hearing.command.cancel-hearing.jsonNew Query
When the user wants to add a new query:
- Query API (
{name}-query/{name}-query-api/)- RAML definition
- Response JSON schema
- Query Handler (
{name}-query/{name}-query-handler/)- Handler class that reads from the viewstore
- Must use
readOnly=truetransactions - Never modify state
New Domain Event
- Event Schema (
{name}-domain/{name}-domain-event/src/main/resources/json/schema/)- JSON schema file:
{context}.events.{noun}-{past-tense-verb}.json - Example:
hearing.events.hearing-scheduled.json,hearing.events.hearing-cancelled.json
- JSON schema file:
- Event naming convention: Events are past-tense facts — something that happened.
material-added(notadd-material)hearing-scheduled(notschedule-hearing)defendant-validation-passed(notvalidate-defendant)
New Viewstore Entity
- JPA Entity (
{name}-viewstore/)- Entity class with
@Entity,@Tableannotations - Repository interface extending
JpaRepository
- Entity class with
- Liquibase Migration (
{name}-viewstore-liquibase/)- New changeset in
db/changelog/ - Follow sequential numbering from existing changesets
- Include rollback section
- New changeset in
Example Liquibase changeset:
<changeSet id="YYYYMMDD-01" author="developer-name">
<createTable tableName="new_entity">
<column name="id" type="uuid">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="created_at" type="timestamp with time zone">
<constraints nullable="false"/>
</column>
</createTable>
<rollback>
<dropTable tableName="new_entity"/>
</rollback>
</changeSet>New Event Subscription (from another context)
When this service needs to react to events from another bounded context:
- Add dependency in root
pom.xml:<dependency> <groupId>uk.gov.moj.cpp.{other-context}</groupId> <artifactId>{other-context}-event</artifactId> <version>${other-context.version}</version> </dependency> - Event source handler in
{name}-event-sources/:- Handler method annotated to process the external event
- Must be idempotent — check if event already processed
- Transform external event data into local viewstore updates
Process
- Ask the user what component they want to add
- Read the existing repo structure to understand naming patterns and conventions
- Read at least one existing example of the same component type in the repo
- Generate the new component following the exact same patterns
- If adding a viewstore entity, also generate the Liquibase migration
- If adding a command, also create the corresponding domain event(s)
- Remind the user to run
mvn clean installto verify the build
Validation
After scaffolding, verify:
mvn clean compile— all modules compilemvn test -pl {affected-module}— existing tests still pass- JSON schemas validate against the framework's meta-schema
- RAML files reference the correct schemas
- Liquibase changesets have unique IDs and include rollback
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
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.

