跳到正文
Skillpedia
测试58k · #3255

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/HKUDS/CLI-Anything/blob/main/skills/cli-anything-wiremock/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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 命令则可以从文件中加载它们。

它可以处理随时间变化的响应吗?

可以。该技能包含有状态场景的命令,可以在一系列请求中改变响应。

详情

作者的原始描述

Python CLI harness for WireMock HTTP mock server administration

repo: HKUDS/CLI-Anything

热度

GitHub 星标
58k
排名
#3255
许可证
Apache-2.0
更新时间
2026/9/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能