Hurl 标志

Hurl

社区
damusix
hurl

使用 Hurl 的纯文本格式编写并运行 HTTP API 测试。适用于测试 REST/GraphQL API、为 HTTP 端点编写集成测试或冒烟测试、串联请求并捕获值、轮询异步 API、将 curl 命令转换为易维护的测试,或生成可执行的 API 文档。遇到 .hurl 文件、hurl 或 hurlfmt CLI、jsonpath/xpath 响应断言,或任何使用简单文本工具“测试 API”的请求时,都应启用此技能。

Add to TypingMind

概览

发布者damusix
代码仓库skills
技能名称hurl
星标数
63
复刻数
3
附带文件
6
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 damusix 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Hurl AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/damusix/skills/tree/main/hurl
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/damusix/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/hurl .claude/skills/hurl
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Hurl,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Hurl。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Hurl 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Hurl

Hurl runs HTTP requests defined in a plain-text format and asserts on the responses. One binary (hurl, built on libcurl), one readable file format: a .hurl file is a sequence of entries, each a request plus an optional response spec with asserts and captures. The same files work as smoke tests, integration tests, CI gates, and living API documentation — they read like the API contract they verify.

Current version: 8.0.1. Reference material in this skill is verified against hurl.dev for that release.

A minimal entry:

GET https://api.example.org/health
HTTP 200
[Asserts]
jsonpath "$.status" == "RUNNING"

Entries in one file run sequentially and share cookies and captured variables (session behavior). Files are independent and run in parallel under --test. That asymmetry drives all suite design: one user flow per file.

  1. Header vs section placement changes meaning. key: value lines directly after the URL are request headers — no section name. The same line inside [Query] is a query parameter. Body always comes last; [Form]/[Multipart] are the body and exclude a literal one.
  2. Use current section names [Query], [Form], [Multipart]. The legacy [QueryStringParams]/[FormParams]/[MultipartFormData] still parse — recognize them, don't write them.
  3. Predicates are typed. == true is a boolean check, == "true" a string check; == 458 number, == "458" string. Same rule for templates: == {{count}} compares typed, == "{{count}}" as string. matches on a non-string is a runtime error — convert with toInt/toString first.
  4. HTTP 200 is itself an assert (any version, status 200). HTTP/2 200 also asserts the protocol. Use HTTP * plus explicit status >= 200 asserts for ranges. Asserts run with or without --test — test mode only changes output and adds the recap.
  5. Redirects are not followed by default. Either assert each hop as its own entry, or set [Options] location: true (or --location) and assert on the final response — then redirects count/redirects nth 0 location audit the chain and url gives the final URL.
  6. retry turns asserts into wait conditions. [Options] retry: 10 + retry-interval: 500ms re-runs the entry until its asserts pass — the polling primitive for async jobs and server-readiness gates. Retries trigger on assert, capture, and runtime errors.
  7. Option precedence is env < CLI flag < [Options] section. [Options] applies to its entry only, except variable: which persists to later entries. skip: true exists only in [Options]; --test, --report-*, --variables-file, --secret are CLI-only.
  8. Secrets, not variables, for credentials. --secret name=value, HURL_SECRET_name, or a trailing redact on a capture redacts the value from logs and reports. Redaction is exact-match (register transformed variants separately) and does NOT apply to stdout or JSON-report response dumps.
  9. Reports accumulate. Every --report-html/json/junit/tap appends to an existing report. Clean the report path at the start of each CI run.
  10. Regex literals beat quoted patterns. /^\d{4}$/ needs no double escaping; "^\\d{4}$" does. The regex query and filter assert/extract the first capture group — a pattern without a group fails.
  11. Templates resolve variables only — {{host}}, {{newUuid}}, {{newDate}}; no arithmetic or expressions. Compute in shell and inject with --variable or HURL_VARIABLE_name. Raw XML bodies are not template-aware; fence them as ```xml multiline strings to template them.
  12. 8.0 changes to honor: JSONPath engine is now RFC 9535 (edge cases differ from pre-8.0), --interactive was removed (use --from-entry/--to-entry, per-entry [Options] verbose: true, --curl replay), env vars are HURL_VARIABLE_name (old bare HURL_name form is gone), decode/format filters are deprecated for charsetDecode/dateFormat.

Build files incrementally — each step is runnable, so verify as you go.

  1. Smoke first. One entry, status only: GET {{host}}/health + HTTP 200. Run it: hurl --variable host=http://localhost:3000 health.hurl.
  2. Add asserts. Tighten the contract with [Asserts]: jsonpath/xpath/header queries, typed predicates. Prefer explicit asserts over an exact body literal unless you want golden-file equality.
  3. Chain the flow. Capture what later entries need ([Captures] token: jsonpath "$.access_token" redact), use it via {{token}}. Cookies flow automatically.
  4. Handle async. Entries that poll get [Options] retry: N + retry-interval, with the completion condition as an assert.
  5. Parameterize. Replace hosts and credentials with {{variables}}; create per-environment variables files (vars/local.env, vars/staging.env); pass tokens as secrets.
  6. Run as a suite. hurl --test tests/ (parallel files, recap, exit code 4 on assert failure). Add --error-format long so failures log the actual response.
  7. Wire CI. --report-junit for ingestion, --report-html for humans; clean report paths first; gate readiness with a stdin one-liner: printf 'GET %s\nHTTP 200' "$URL" | hurl --retry 60 --retry-interval 2s.

When a file fails: re-run with --very-verbose --to-entry N to isolate the entry with full bodies on stderr, or hurl --curl repro.txt file.hurl to export the exact requests as curl commands.

POST {{host}}/api/login
{"username": "{{user}}", "password": "{{password}}"}
HTTP 200
[Captures]
token: jsonpath "$.access_token" redact

GET {{host}}/api/me
Authorization: Bearer {{token}}
HTTP 200
[Asserts]
jsonpath "$.username" == "{{user}}"

Run: hurl --variable host=http://localhost:3000 --variable user=bob --secret password=$PASS login.hurl

POST {{host}}/jobs
HTTP 201
[Captures]
job_id: jsonpath "$.id"

GET {{host}}/jobs/{{job_id}}
[Options]
retry: 10
retry-interval: 500ms
HTTP 200
[Asserts]
jsonpath "$.state" == "COMPLETED"
rm -rf build/hurl-report build/hurl-junit.xml
hurl --test \
     --variables-file vars/staging.env \
     --error-format long \
     --report-junit build/hurl-junit.xml \
     --report-html build/hurl-report \
     tests/
echo "curl -X POST https://api.example.org/users -H 'Content-Type: application/json' -d '{\"name\":\"bob\"}'" | hurlfmt --in curl

References

  • File Format -- Entries, request/response anatomy, all sections and body types, templating, grammar gotchas
  • Asserting -- Every query type and predicate, implicit vs explicit asserts, typing rules
  • Captures and Filters -- Capture syntax and scope, the full filter table, chaining, secrets and redaction
  • CLI -- hurl and hurlfmt: invocation, test mode, all option groups, reports, exit codes, [Options] precedence
  • Testing Workflows -- Suite layout, retry-until polling, environments, CI integration, debugging, executable-docs export
  • Recipes -- 30 complete runnable examples: auth flows, chained requests, uploads, GraphQL, CI snippets

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Hurl AI 技能有什么作用?

使用 Hurl 的纯文本格式编写并运行 HTTP API 测试。适用于测试 REST/GraphQL API、为 HTTP 端点编写集成测试或冒烟测试、串联请求并捕获值、轮询异步 API、将 curl 命令转换为易维护的测试,或生成可执行的 API 文档。遇到 .hurl 文件、hurl 或 hurlfmt CLI、jsonpath/xpath 响应断言,或任何使用简单文本工具“测试 API”的请求时,都应启用此技能。

为什么在 TypingMind 中使用 Hurl?

因为您只需安装一次,就能搭配任何模型使用。Hurl 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Hurl?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/damusix/skills/tree/main/hurl。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Hurl?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Hurl 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Hurl 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Hurl AI 技能免费吗?

damusix 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇