/spring-boot-skills:http-resiliencefrom Spring Boot Skills
Adds outbound HTTP resilience to Spring Boot 4 Maven projects using RestClient and Resilience4j for circuit breakers, retries, and timeouts, with tests for graceful degradation.
Ships in Spring Boot Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Adds outbound-call resilience to an existing Spring Boot 4 project: RestClient with explicit timeouts and Resilience4j fault tolerance around every downstream call.
SKILL_DIR = directory containing this SKILL.md file.
| Field | Required | Notes |
|---|---|---|
service | Yes | the downstream being called (e.g. payments, base URL) |
endpoints | Yes | which calls need protection |
failureMode | No | fallback value vs fail-fast (default: fail-fast with 502) |
Next: read the project.
cat pom.xml
grep -rn "RestClient\|RestTemplate\|WebClient\|@FeignClient" src/main/java/ | head -10
ls src/main/java/**/*client* 2>/dev/null
Confirm: Maven project on Boot 4. Find existing HTTP call sites — retrofit them rather than adding a parallel client.
Next: add Resilience4j.
Add to pom.xml:
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot4</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aspectj</artifactId>
</dependency>
The starter needs AspectJ on the classpath — Boot no longer pulls it transitively. (Boot 4 renamed
spring-boot-starter-aop to spring-boot-starter-aspectj; the old name stopped at 4.0.0-M2.)
Before writing, verify 2.4.0 is still the latest:
curl -s "https://repo1.maven.org/maven2/io/github/resilience4j/resilience4j-spring-boot4/maven-metadata.xml" \
| python3 -c "import sys,re; print(re.findall(r'<version>(.*?)</version>', sys.stdin.read())[-1])"
Next: the client.
Create or refactor the client (example: payment/PaymentClient.java):
package com.example.payment;
import java.time.Duration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestClient;
@Configuration
class PaymentClientConfig {
@Bean
RestClient paymentRestClient(RestClient.Builder builder) {
var factory = new SimpleClientHttpRequestFactory();
factory.setConnectTimeout(Duration.ofSeconds(2));
factory.setReadTimeout(Duration.ofSeconds(5));
return builder.baseUrl("http://localhost:9090").requestFactory(factory).build();
}
}
Rules:
RestClient bean per downstream, named after it.Next: wrap the calls.
Annotate the calling methods:
@CircuitBreaker(name = "payments", fallbackMethod = "fallbackCharge")
@Retry(name = "payments")
public ChargeResult charge(ChargeRequest request) {
return paymentRestClient.post().uri("/charges").body(request).retrieve()
.body(ChargeResult.class);
}
Externalize in application.yml:
resilience4j:
circuitbreaker:
instances:
payments:
sliding-window-size: 10
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
retry:
instances:
payments:
max-attempts: 3
wait-duration: 500ms
enable-exponential-backoff: true
Rules:
@TimeLimiter needs a CompletableFuture return type; skip it unless the user asks for async.Next: prove it degrades.
Integration test with a dead downstream (no mocking of Resilience4j itself):
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
@SpringBootTest
class PaymentClientResilienceIT {
@Autowired PaymentClient client;
@Test
void opensCircuitAfterFailures() {
// downstream unreachable: connection refused
for (int i = 0; i < 10; i++) {
assertThatThrownBy(() -> client.charge(new ChargeRequest(100)))
.isInstanceOf(Exception.class);
}
assertThatThrownBy(() -> client.charge(new ChargeRequest(100)))
.isInstanceOf(CallNotPermittedException.class); // circuit open, call not attempted
}
}
The assertion that matters: once the circuit is open, calls fail fast with
CallNotPermittedException instead of waiting on timeouts.
Next: report.
Report:
/actuator/health by adding management.health.circuitbreakers.enabled: trueWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
spring-boot, resilience4j, circuit-breaker, retry, restclient, http-resilience
17 skills in this plugin
/api-designAdd OpenAPI docs and REST conventions to an existing Spring Boot 4 Maven project — SpringDoc, API versioning, ProblemDetail error schemas, DTO conventions. Use when asked to add OpenAPI or Swagger, document or version an API, or define REST conventions. Not for auth — use spring-security./devops-scaffoldAdd or update Dockerfile, docker-compose.yml, and GitHub Actions CI for an existing Spring Boot Maven project; reads the project first. Use when asked to dockerize a project, add CI or GitHub Actions, or set up DevOps. Not for security scanning — use security-hardening. Not for new projects — use spring-scaffold./kafka-setupAdd Apache Kafka producers and consumers to an existing Spring Boot 4 Maven project — Spring Kafka config, JSON events, dead-letter topics, Testcontainers tests, compose wiring. Use when asked to add Kafka, Kafka topics, or event streaming. If messaging is requested without naming a broker, ask Kafka or RabbitMQ first.npx claudepluginhub dancan254/spring-boot-skills --plugin spring-boot-skillsOther plugins' skills for the same job