$npx -y skills add giuseppe-trisciuoglio/developer-kit --skill spring-boot-actuatorProvides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services. Use when setting up monitoring, health checks, or metrics for Spring Boot applications.
| 1 | # Spring Boot Actuator Skill |
| 2 | |
| 3 | ## Overview |
| 4 | - Deliver production-ready observability for Spring Boot services using Actuator endpoints, probes, and Micrometer integration. |
| 5 | - Standardize health, metrics, and diagnostics configuration while delegating deep reference material to `references/`. |
| 6 | - Support platform requirements for secure operations, SLO reporting, and incident diagnostics. |
| 7 | |
| 8 | ## When to Use |
| 9 | - Trigger: "enable actuator endpoints" – Bootstrap Actuator for a new or existing Spring Boot service. |
| 10 | - Trigger: "secure management port" – Apply Spring Security policies to protect management traffic. |
| 11 | - Trigger: "configure health probes" – Define readiness and liveness groups for orchestrators. |
| 12 | - Trigger: "export metrics to prometheus" – Wire Micrometer registries and tune metric exposure. |
| 13 | - Trigger: "debug actuator startup" – Inspect condition evaluations and startup metrics when endpoints are missing or slow. |
| 14 | |
| 15 | ## Quick Start |
| 16 | ```xml |
| 17 | <!-- Maven --> |
| 18 | <dependency> |
| 19 | <groupId>org.springframework.boot</groupId> |
| 20 | <artifactId>spring-boot-starter-actuator</artifactId> |
| 21 | </dependency> |
| 22 | ``` |
| 23 | ```gradle |
| 24 | // Gradle |
| 25 | dependencies { |
| 26 | implementation "org.springframework.boot:spring-boot-starter-actuator" |
| 27 | } |
| 28 | ``` |
| 29 | After adding the dependency, verify endpoints respond: |
| 30 | ```bash |
| 31 | curl http://localhost:8080/actuator/health |
| 32 | curl http://localhost:8080/actuator/info |
| 33 | ``` |
| 34 | |
| 35 | ## Instructions |
| 36 | |
| 37 | ### 1. Add Actuator Dependency |
| 38 | Include `spring-boot-starter-actuator` in your build configuration. |
| 39 | > **Validate**: Restart the service and confirm `/actuator/health` and `/actuator/info` respond with `200 OK`. |
| 40 | |
| 41 | ### 2. Expose Required Endpoints |
| 42 | - Set `management.endpoints.web.exposure.include` to the precise list or `"*"` for internal deployments. |
| 43 | - Adjust `management.endpoints.web.base-path` (e.g., `/management`) when the default `/actuator` conflicts with routing. |
| 44 | - Review detailed endpoint semantics in `references/endpoint-reference.md`. |
| 45 | > **Validate**: `curl http://localhost:8080/actuator` returns the list of exposed endpoints. |
| 46 | |
| 47 | ### 3. Secure Management Traffic |
| 48 | - Apply an isolated `SecurityFilterChain` using `EndpointRequest.toAnyEndpoint()` with role-based rules. |
| 49 | - Combine `management.server.port` with firewall controls or service mesh policies for operator-only access. |
| 50 | - Keep `/actuator/health/**` publicly accessible only when required; otherwise enforce authentication. |
| 51 | > **Validate**: Unauthenticated requests to protected endpoints return `401 Unauthorized`. |
| 52 | |
| 53 | ### 4. Configure Health Probes |
| 54 | - Enable `management.endpoint.health.probes.enabled=true` for `/health/liveness` and `/health/readiness`. |
| 55 | - Group indicators via `management.endpoint.health.group.*` to match platform expectations. |
| 56 | - Implement custom indicators by extending `HealthIndicator` or `ReactiveHealthContributor`; sample implementations in `references/examples.md#custom-health-indicator`. |
| 57 | > **Validate**: `/actuator/health/readiness` returns `UP` with all mandatory components before promoting to production. |
| 58 | |
| 59 | ### 5. Publish Metrics and Traces |
| 60 | - Activate Micrometer exporters (Prometheus, OTLP, Wavefront, StatsD) via `management.metrics.export.*`. |
| 61 | - Apply `MeterRegistryCustomizer` beans to add `application`, `environment`, and business tags for observability correlation. |
| 62 | - Surface HTTP request metrics with `server.observation.*` configuration when using Spring Boot 3.2+. |
| 63 | > **Validate**: Scrape `/actuator/prometheus` and confirm required meters (`http.server.requests`, `jvm.memory.used`) are present. |
| 64 | |
| 65 | ### 6. Enable Diagnostics Tooling |
| 66 | - Turn on `/actuator/startup` (Spring Boot 3.5+) and `/actuator/conditions` during incident response to inspect auto-configuration decisions. |
| 67 | - Register an `HttpExchangeRepository` (e.g., `InMemoryHttpExchangeRepository`) before enabling `/actuator/httpexchanges` for request auditing. |
| 68 | - Consult `references/endpoint-reference.md` for endpoint behaviors and limits. |
| 69 | > **Validate**: `/actuator/startup` and `/actuator/conditions` return valid JSON payloads. |
| 70 | |
| 71 | ## Examples |
| 72 | |
| 73 | ### Basic – Expose health and info safely |
| 74 | ```yaml |
| 75 | management: |
| 76 | endpoints: |
| 77 | web: |
| 78 | exposure: |
| 79 | include: "health,info" |
| 80 | endpoint: |
| 81 | health: |
| 82 | show-details: never |
| 83 | ``` |
| 84 | |
| 85 | ### Intermediate – Readiness group with custom indicator |
| 86 | ```java |
| 87 | @Component |
| 88 | public class PaymentsGatewayHealth implements HealthIndicator { |
| 89 | |
| 90 | private final PaymentsClient client; |
| 91 | |
| 92 | public PaymentsGatewayHealth(PaymentsClient client) { |
| 93 | this.client = client; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public Health health() { |
| 98 | boolean reachable = client.ping(); |
| 99 | return reachable ? Health.up().withDetail("latencyMs", client.latency()).build() |
| 100 | : Heal |