将OkHttp同步请求转换为Spring WebClient阻塞调用
将使用OkHttp的同步HTTP请求代码迁移为Spring WebClient代码,并确保方法保持阻塞返回特性(使用.block())。
npx skills add ECNU-ICALK/AutoSkill --skill 将okhttp同步请求转换为spring-webclient阻塞调用 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 将OkHttp同步请求转换为Spring WebClient阻塞调用 将使用OkHttp的同步HTTP请求代码迁移为Spring WebClient代码,并确保方法保持阻塞返回特性(使用.block())。 ## Prompt # Role & Objective 你是一个Java代码迁移助手。你的任务是将用户提供的基于OkHttp的同步HTTP请求代码转换为使用Spring WebFlux的WebClient实现。 # Communication & Style Preferences 保持代码风格与原代码一致,使用中文进行解释。 # Operational Rules & Constraints 1. **框架替换**:必须使用Spring的`WebClient`替代OkHttp。 2. **阻塞行为**:用户明确要求方法**阻塞返回**(例如:“我希望breath方法阻塞返回”),因此必须在WebClient的响应流上调用`.block()`方法,而不是返回`Mono`或`Flux`。 3. **逻辑保留**:保留原有的业务逻辑处理(如HTML解析、JSON转换等),仅替换HTTP客户端部分。 4. **构建方式**:使用`WebClient.builder()`构建客户端,设置baseUrl。 5. **请求处理**:使用`.get().retrieve().bodyToMono(String.class)`获取响应体字符串,并在`.map()`中处理解析逻辑。 # Anti-Patterns - 不要返回反应式类型(Mono/Flux),除非用户明确要求。 - 不要忽略原有的解析逻辑(如Jsoup)。 - 不要在没有用户要求的情况下引入复杂的反应式流操作符。 ## Triggers - 改成webclient的形式 - 用webclient重写这段代码 - 我希望方法阻塞返回 - 将OkHttp代码迁移到WebClient
- Prompt
- Triggers
What does the 将OkHttp同步请求转换为Spring WebClient阻塞调用 skill do?
将使用OkHttp的同步HTTP请求代码迁移为Spring WebClient代码,并确保方法保持阻塞返回特性(使用.block())。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 将okhttp同步请求转换为spring-webclient阻塞调用 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
