home / skills / hoangnguyen0403 / agent-skills-standard / microservices
This skill helps you implement Spring Boot microservices with synchronized and asynchronous messaging, enforcing best practices and robust contracts.
npx playbooks add skill hoangnguyen0403/agent-skills-standard --skill microservicesReview the files below or copy the command above to add this skill to your agents.
---
name: Spring Boot Microservices
description: Standards for synchronous (Feign) and asynchronous (Cloud Stream) communication
metadata:
labels: [spring-boot, microservices, feign, kafka]
triggers:
files: ['**/*Client.java', '**/*Consumer.java']
keywords: [feign-client, spring-cloud-stream, rabbitmq, resilience4j]
---
# Spring Boot Microservices Standards
## **Priority: P0**
## Implementation Guidelines
### Sync Communication (REST)
- **Clients**: Use **Spring Cloud OpenFeign** or **Http Interfaces** (Spring 6).
- **Resilience**: Wrap calls with **Resilience4j** (Circuit Breaker).
- **Contracts**: Define DTOs in a **Shared Library** (Maven BOM).
- **Versioning**: Enforce **Semantic Versioning** on shared libs.
### Async Communication (Event-Driven)
- **Cloud Stream**: Use `java.util.function.Consumer<T>` composition.
- **Idempotency**: Consumers MUST handle duplicates (DB constraints).
- **Evolution**: Add fields only. Never rename/remove used fields.
## Anti-Patterns
- **Direct DB Access**: `**No Shared DB**: Use APIs/Events.`
- **Coupled Entities**: `**No Shared Entities**: Use DTOs.`
- **Dist. Monolith**: `**No Sync Chains**: Use Async.`
## References
- [Implementation Examples](references/implementation.md)
This skill codifies standards for building Spring Boot microservices with clear guidelines for synchronous (Feign/HTTP Interfaces) and asynchronous (Spring Cloud Stream) communication. It focuses on resilient client calls, event-driven consumers, and safe evolution of shared contracts to reduce coupling and operational risk. The guidance is framework- and practice-focused so agents can recommend consistent, maintainable designs.
The skill inspects service-to-service interaction patterns and enforces use of OpenFeign or Spring Http Interfaces for REST clients, wrapped with Resilience4j circuit breakers. For async messaging, it recommends Spring Cloud Stream function composition using java.util.function.Consumer<T> and mandates idempotent consumer behavior. It also checks for contract management: DTOs in a shared library and semantic versioning for shared artifacts.
Why prefer shared DTOs over shared entities?
DTOs decouple service boundaries, prevent schema leakage, and allow each service to evolve independently while keeping contracts explicit and versioned.
How should I handle schema changes for events?
Follow additive changes only: add optional fields, keep existing names and types, and bump the shared library version using semantic versioning so consumers can opt into new data safely.