Install
$ agentstack add skill-lg-labs-pentagon-lg5-spring-agent-os-lg5-new-service ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ● Network access Used
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Recipe: Create a new lg5-spring microservice
> Source template: https://github.com/lg-labs/blank-service (locally at /tmp/lg5-study/blank-service/). > Reference implementation to imitate: /tmp/lg5-study/food-ordering-system/order-service/.
Prerequisites
- JDK 21, Maven 3.9+, Docker,
make. lg5-spring-parentpublished to local.m2at version1.0.0-alpha.(runmake publish-localin/tmp/lg5-study/lg5-spring).- The blank-service repo cloned. If missing:
``bash git clone --depth 1 https://github.com/lg-labs/blank-service.git /tmp/lg5-study/blank-service ``
Decisions to confirm with the user before generating code
- Service name (kebab-case, e.g.
inventory-service). - Java base package (e.g.
com.acme.inventory). - Aggregate root name (e.g.
Inventory,Reservation). - Does it consume Kafka events? (yes → needs
-message). - Does it produce Kafka events? (yes → needs Outbox + scheduler).
- Does it call third-party HTTP APIs? (yes → needs
-externalwith Feign). - Persistence: PostgreSQL via JPA (default). Other → discuss.
Step 1 — Copy the skeleton
TARGET=/path/to/workspace/-service
cp -R /tmp/lg5-study/blank-service "$TARGET"
cd "$TARGET"
rm -rf .git
Step 2 — Rename modules and packages
For each occurrence of blank substitute the new service name; for each occurrence of com.blanksystem substitute the chosen base package.
| What to rename | Where | |---|---| | Directories blank-* → -* | top level | | blank-* | every pom.xml | | com.blanksystem → new groupId | every pom.xml | | Java packages com.blanksystem.* → .* | every .java source | | BlankApplication → Application | -container/src/main/java/.../BlankApplication.java | | application.yaml keys blank-service.* → -service.* | -container/src/main/resources/application*.yaml |
Do this with a scripted sed/find-replace pass. Verify with grep -ri "blank" . afterward — only the README/CHANGELOG should mention the origin.
Step 3 — Pin the lg5-spring parent SHA
In root pom.xml:
com.lg5.spring
lg5-spring-parent
1.0.0-alpha.
Get the SHA via:
git -C /tmp/lg5-study/lg5-spring log -1 --format=%h
Step 4 — Define the domain (no Spring!)
In -domain/-domain-core/src/main/java//domain/:
- Aggregate root: extend
com.labs.lg.pentagon.common.domain.entity.AggregateRoot>. - Identity: extend
BaseId. - Value Objects: immutable, override
equals/hashCode. Use Javarecordwhen no behavior is needed. - Domain events: implement
DomainEvent, namededEvent(past tense). - Domain services: stateless, named
DomainServicewith an interface +Impl. - Domain exceptions:
DomainException extends DomainException.
Package layout:
domain/
├── entity/
├── valueobject/
├── event/
├── exception/
└── service/
Step 5 — Define ports in application-service
In -domain/-application-service/src/main/java//application/:
ports/
├── input/
│ ├── service/ # Use case interfaces (e.g. ApplicationService)
│ └── message/listener// # Kafka response listener interfaces
└── output/
├── repository/ # Aggregate repository ports
├── message/publisher// # Kafka publisher ports
└── outbox// # Outbox port (read/save)
Implement input ports in .application.service package (e.g. ApplicationServiceImpl).
Step 6 — Adapters
| Layer | Module | Implements | |---|---|---| | REST in | -api | input port ApplicationService via @RestController | | JPA out | -data-access | output port repositories via @Repository adapters wrapping Spring Data | | Kafka out | -message/-message-core | output port publishers via KafkaProducer | | Kafka in | -message/-message-core | input port listeners via @KafkaListener | | Feign out | -external | output port HTTP clients via @FeignClient(configuration = FeignClientConfiguration.class) |
Always:
- Use
finalon locals & params. - Use records for
*Command/*ResponseDTOs. - Map between adapter DTOs and domain via dedicated
*DataMapperbeans. - REST controllers
produces = "application/vnd.api.v1+json".
Step 7 — Container module (the only Spring Boot app)
-container/:
pom.xmldepends on all sibling modules +lg5-spring-starter+lg5-spring-logger+jib-maven-plugin.Application.javaannotated@SpringBootApplication,@EnableJpaRepositories,@EntityScanpointing at.dataaccess.application.yamlincludes:
``yaml server: port: 8181 spring: datasource: url: jdbc:postgresql://localhost:5432/?currentSchema=&binaryTransfer=true&reWriteBatchedInserts=true&stringtype=unspecified username: postgres password: admin jpa: hibernate.ddl-auto: validate open-in-view: false scheduling: enabled: true -service: outbox-scheduler-fixed-rate: 10000 outbox-scheduler-initial-delay: 10000 # topic names… kafka-config: bootstrap-servers: localhost:19092,localhost:29092,localhost:39092 schema-registry-url-key: schema.registry.url schema-registry-url: http://localhost:8081 kafka-producer-config: … kafka-consumer-config: … ``
application-test.yamlandapplication-local.yamlfor ATDD profile overrides.
Step 8 — Wire Kafka & Outbox (only if needed)
- Add Avro schemas in
-message-model/src/main/resources/avro/.avscwith namespace.message.model.avro. make run-avro-modelregenerates classes.- Implement Outbox per
lg5-outboxskill. - Implement publisher/listener per
lg5-kafka-avroskill. - Implement Sagas (if multi-step orchestration) per
lg5-sagaskill.
Step 9 — Local infra
In -support/ mirror food-ordering-system/infrastructure/:
docker-compose-kafka.ymldocker-compose-postgres.ymldocker-compose-schema-registry.yml
Wire Make targets kafka-up, ddbb-up, docker-up, docker-down.
Step 10 — ATDD bootstrap
Per lg5-atdd skill:
- Create
-acceptance-test/src/test/java//acceptance/boot/: AcceptanceTestCase.java(JUnit Platform Suite)CucumberHooks.javaextendingLg5TestBootPortNone,@Import(TestContainersLoader.class),@CucumberContextConfiguration.TestContainersLoader.java@Importing the four*ContainerCustomConfigs plus dynamic env wiring.src/test/resources/features/*.feature(Gherkin).src/test/resources/application-test.yamlenabling required testcontainers.
Step 11 — Build & smoke test
make install-skip-test
make docker-up
make run-app # or run-apps if multi-service
curl -i -X POST http://localhost:8181/ -H 'Content-Type: application/vnd.api.v1+json' -d '{…}'
Step 12 — CI / hooks
- Copy
hooks/pre-pushfrom blank-service (runsmvn clean test). - Optionally copy
checkstyle.xmland the maven-checkstyle-plugin config.
Common pitfalls
- ❌ Adding
@Component/@Servicein-domain-core— domain must stay Spring-free. - ❌ Forgetting
@Versionon outbox JPA entities → race conditions in saga. - ❌ Rethrowing
OptimisticLockingFailureExceptionfrom Kafka listener → infinite redelivery. - ❌ Inventing a non-existent SHA for
lg5-spring-parentversion. - ❌ Putting
@SpringBootApplicationoutside-container. - ❌ Producing Kafka payloads as JSON / POJO instead of Avro
SpecificRecordBase. - ❌ Skipping
produces = "application/vnd.api.v1+json"on controllers.
Validation checklist before declaring "done"
- [ ]
mvn clean installgreen from project root. - [ ]
mvn -pl -container spring-boot:runstarts without errors against local infra. - [ ]
make run-acceptance-testgreen (at least one happy-path feature). - [ ]
-domain-core/pom.xmlhas zero Spring dependencies. - [ ] No
blank/com.blanksystemstrings remain in source. - [ ] All controllers produce
application/vnd.api.v1+json. - [ ] Outbox tables include
versioncolumn with@Version. - [ ] Saga steps catch
OptimisticLockingFailureExceptionand short-circuit on missing outbox row.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: lg-labs-pentagon
- Source: lg-labs-pentagon/lg5-spring-agent-os
- License: MIT
- Homepage: https://lg-labs-pentagon.github.io/lg5-spring-agent-os/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.