agentleFS
matheuscoimbramatheuscoimbra/skills/spring-webflux-webclient/SKILL.md

spring-webflux-webclient

Skill0 starsChanged 6 months agoMITView on GitHub

Expert guidance for Spring WebFlux and WebClient development. Use when working with reactive HTTP clients, non-blocking APIs, WebClient configuration, Mono/Flux operations, error handling with retry/circuit breaker, or optimizing reactive microservices. Covers Spring Boot 3.5.x, Spring Framework 6.2.x, and Project Reactor 2025.0.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    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
  1. Very specific:

    Never .block() in reactive code (only tests)

    line 18
  2. Distinctive:

    When user needs detailed information, read the appropriate reference file:

    line 69
  3. Distinctive:

    Read when user asks about:

    line 72
  4. Distinctive:

    When NOT to use WebFlux

    line 128
  5. Very specific:

    Always provide concise answer from SKILL.md first.

    line 140

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spring WebFlux & WebClient Expert

Specialized knowledge for reactive, non-blocking applications with Spring WebFlux and WebClient (Spring Boot 3.5, Framework 6.2.x, Reactor 2025.0).

Core Principles

Reactive Programming: Non-blocking, asynchronous with backpressure. WebClient uses Project Reactor (Mono/Flux).

  • Mono<T>: 0 or 1 element (like Optional/CompletableFuture)
  • Flux<T>: 0 to N elements (stream)

Critical Rules:

  • Never .block() in reactive code (only tests)
  • Always configure timeouts
  • Reuse WebClient instances (connection pool)
  • Return Mono/Flux from services
  • Retry only transient errors (5xx, timeouts - NOT 4xx)

Quick Examples

Configuration (Spring Boot 3.5+)

@Bean
public WebClient webClient(WebClient.Builder builder) {
    return builder
        .baseUrl("https://api.example.com")
        .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
        .build();
}

// Properties
spring.webclient.connect-timeout=5s
spring.webclient.read-timeout=30s

Requests

// GET
Mono<User> user = webClient.get().uri("/users/{id}", id).retrieve().bodyToMono(User.class);

// POST
Mono<User> created = webClient.post().uri("/users").bodyValue(newUser).retrieve().bodyToMono(User.class);

Error Handling + Retry

.retrieve()
.onStatus(HttpStatus::is5xxServerError, res -> Mono.error(new ServerException()))
.bodyToMono(User.class)
.retryWhen(Retry.backoff(3, Duration.ofSeconds(1)).filter(this::isTransient))
.onErrorResume(ex -> Mono.just(User.GUEST_USER));

Operators

users.map(User::getName);                                    // sync transform
users.flatMap(u -> getOrders(u.getId()));                   // async transform
users.filter(User::isActive);                               // filter
Mono.zip(user, profile, orders).map(tuple -> new Dashboard(...)); // combine

Reference Files

When user needs detailed information, read the appropriate reference file:

references/webclient-basics.md

Read when user asks about:

  • WebClient configuration and setup
  • Timeouts (connect, read, write, response)
  • Connection pooling optimization
  • Headers, cookies, filters
  • Properties configuration (Spring Boot 3.5)
  • Multiple WebClient instances
  • SSL/TLS setup
  • Debugging with wiretap

Examples of when to read: "how to configure timeout", "connection pool tuning", "setup WebClient with SSL", "configure multiple clients"

references/webclient-requests.md

Read when user asks about:

  • HTTP methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS)
  • URI building with query parameters
  • Request headers and cookies
  • Form data and multipart uploads
  • Streaming and SSE
  • Concurrent requests with limits
  • Response types (Mono, Flux, Entity, List)

Examples of when to read: "how to do POST request", "upload file", "query parameters", "concurrent requests", "streaming data"

references/error-handling.md

Read when user asks about:

  • Error handling with onStatus
  • Retry strategies (simple, backoff, conditional)
  • Circuit breaker pattern
  • Timeout handling
  • Fallback mechanisms
  • WebClient exception hierarchy
  • Combining resilience patterns

Examples of when to read: "handle 4xx errors", "implement retry", "circuit breaker", "fallback strategy", "timeout recovery"

references/reactor-fundamentals.md

Read when user asks about:

  • Mono vs Flux differences
  • Creating publishers (just, empty, defer, etc)
  • Operators: map, flatMap, filter, zip, merge, concat
  • Schedulers and threading
  • Backpressure with limitRate
  • Context and subscription
  • Collecting results (collectList, reduce)

Examples of when to read: "difference between map and flatMap", "how to combine Mono and Flux", "backpressure", "schedulers", "operators"

references/best-practices.md

Read when user asks about:

  • Code review checklist
  • Anti-patterns to avoid
  • Performance optimization
  • Testing strategies
  • Security considerations
  • Memory management
  • When NOT to use WebFlux

Examples of when to read: "review my code", "best practices", "common mistakes", "optimization", "anti-patterns", "testing reactive code"

When to Read References

  • Configuration issues → webclient-basics.md
  • Making HTTP calls → webclient-requests.md
  • Errors, retries, resilience → error-handling.md
  • Reactive operators, Mono/Flux → reactor-fundamentals.md
  • Code review, optimization → best-practices.md

Always provide concise answer from SKILL.md first. Read reference files only when user needs detailed explanation or you need specific implementation details.


Versions: Spring Boot 3.5.x | Framework 6.2.x | Reactor 2025.0

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.