cli-anything-wiremock
它能做什么
这个技能让 AI 智能体控制 WireMock,这是一个在测试时代替网络服务的工具。适合需要虚假响应用于测试、又不想使用真实后端的开发者。
适用场景
- ✓当你想为测试环境设置一个虚假的 API 响应的时候。
- ✓当你需要检查模拟服务器实际收到了哪些请求的时候。
- ✓当你想录制真实后端流量,并将其重复用作模拟响应的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/skills/cli-anything-wiremock/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在测试服务器上设置一个虚假响应,让 /orders 页面返回状态码 200。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体向 WireMock 的管理接口发送命令,以创建、列出或删除存根映射,并检查请求。这些更改会应用到正在运行的模拟服务器上。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Overview
cli-anything-wiremock is a command-line interface that wraps the WireMock Admin REST API (/__admin/). It allows agents and developers to manage HTTP stub mappings, inspect served requests, control stateful scenarios, and record real backend traffic — all from the terminal or from agent tool calls.
WireMock is commonly used in integration testing environments to replace real HTTP backends with controllable mock responses.
Command Groups
stub — Manage HTTP stub mappings
| Command | Description |
|---|---|
stub list |
List all registered stubs |
stub get <id> |
Get details of a specific stub by UUID |
stub create <json> |
Create a stub from a JSON string |
stub quick M URL S |
Quickly create a stub: METHOD URL STATUS_CODE |
stub delete <id> |
Delete a stub by UUID |
stub reset |
Reset all stubs to the defaults on disk |
stub save |
Persist in-memory stubs to disk |
stub import <file> |
Import stubs from a JSON file |
request — Inspect served requests
| Command | Description |
|---|---|
request list |
List recent served requests |
request find <pattern> |
Find requests matching a JSON pattern |
request count <pattern> |
Count requests matching a JSON pattern |
request unmatched |
List requests that matched no stub (404s) |
request reset |
Clear the request journal |
scenario — Stateful scenario management
| Command | Description |
|---|---|
scenario list |
List all scenarios and current states |
scenario set N S |
Set scenario NAME to STATE |
scenario reset |
Reset all scenarios to their initial state |
record — Record traffic from a real backend
| Command | Description |
|---|---|
record start <url> |
Start proxying + recording to TARGET_URL |
record stop |
Stop recording, return captured stubs |
record status |
Check if currently recording |
record snapshot |
Snapshot in-memory requests as stubs |
settings — Global server settings
| Command | Description |
|---|---|
settings get |
Get current global WireMock settings |
settings version |
Show WireMock server version |
Top-level commands
| Command | Description |
|---|---|
status |
Check if WireMock is running |
reset |
Full reset: stubs + requests + scenarios |
shutdown |
Gracefully shut down the WireMock server |
Key Examples
# Check connectivity
cli-anything-wiremock status
# Create a stub using quick form
cli-anything-wiremock stub quick GET /api/users 200 --body '[{"id":1}]'
# Create a stub using full JSON
cli-anything-wiremock stub create '{
"request": {"method": "POST", "url": "/api/orders"},
"response": {"status": 201, "body": "{\"id\":99}"}
}'
# Verify a POST was made exactly once
cli-anything-wiremock --json request count '{"method":"POST","url":"/api/orders"}'
# → {"count": 1}
# Scenario: advance state
cli-anything-wiremock scenario set "cart-flow" "item-added"
# Record a real backend
cli-anything-wiremock record start https://api.example.com
# ... make requests ...
cli-anything-wiremock record stop
Agent Guidance
Always use --json in agent contexts
Use --json for all invocations in scripts or agent tool calls. JSON output varies by command type (these are distinct response types, no
常见问题
WireMock 需要处于运行状态吗?
需要。该技能与 WireMock 管理 API 通信,因此模拟服务器必须正在运行。
它可以把存根保存到磁盘吗?
可以。save 命令会把内存中的存根写入磁盘,import 命令则可以从文件中加载它们。
它可以处理随时间变化的响应吗?
可以。该技能包含有状态场景的命令,可以在一系列请求中改变响应。
详情
热度
- GitHub 星标
- 58k
- 排名
- #3255
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。