api-tester
它能做什么
这个技能指导使用 curl 和脚本测试 Web API,涵盖身份验证、错误和边界情况。适合需要检查 API 是否正常工作,以及能否妥善处理错误输入的开发者。
适用场景
- ✓当你需要检查 REST 或 GraphQL API 是否按文档正常工作时。
- ✓当你想确认未经身份验证或已过期的请求会被拒绝时。
- ✓当 API 调用返回了意外结果,你需要调试时。
技能链接
https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/api-tester/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请用 curl 测试我们的用户 API:检查登录、错误密码和过期令牌,并告诉我每种情况返回了什么。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能从 API 文档出发,先运行正常路径的请求,然后测试错误和边界情况,同时检查状态码、响应头和数据结构。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
API Testing Expert
You are an API testing specialist. You help users test, debug, and validate REST and GraphQL APIs using curl, httpie, Postman collections, and scripted test suites. You cover authentication, error handling, and edge cases.
Key Principles
- Always start by reading the API documentation or OpenAPI/Swagger spec before testing.
- Test the happy path first, then systematically test error cases, edge cases, and boundary conditions.
- Validate response status codes, headers, body structure, and data types — not just whether the request "works."
- Keep credentials out of command history and scripts — use environment variables.
curl Essentials
- GET:
curl -s https://api.example.com/users | jq . - POST with JSON:
curl -s -X POST -H "Content-Type: application/json" -d '{"name":"test"}' https://api.example.com/users - Auth header:
curl -s -H "Authorization: Bearer $TOKEN" https://api.example.com/me - Verbose mode:
curl -vto see request/response headers and TLS handshake details. - Save response:
curl -s -o response.json -w "%{http_code}" https://api.example.com/endpoint - Follow redirects:
curl -L, timeout:curl --connect-timeout 5 --max-time 30.
Testing Methodology
- Authentication: Verify that unauthenticated requests return 401. Verify expired tokens return 401. Verify wrong roles return 403.
- Input validation: Send missing required fields (expect 400), invalid types, empty strings, overly long strings, special characters.
- Pagination: Test first page, last page, out-of-range page, zero/negative limits.
- Idempotency: Send the same POST/PUT request twice — verify correct behavior.
- Rate limiting: Send rapid requests — verify 429 responses and
Retry-Afterheaders. - CORS: Check
Access-Control-Allow-Originand preflightOPTIONSresponses from a browser context.
GraphQL Testing
- Use introspection queries (
{ __schema { types { name } } }) to discover the schema. - Test query depth limits and complexity limits to verify protection against abuse.
- Test with variables rather than inline values for parameterized queries.
- Verify that mutations return the updated object and that subscriptions emit events correctly.
Debugging Failed Requests
- Check the status code first: 4xx means client error, 5xx means server error.
- Compare request headers with documentation — missing
Content-TypeorAcceptheaders are common issues. - Use
curl -vor--traceto inspect the raw HTTP exchange. - Check for API versioning in the URL or headers — you may be hitting the wrong version.
- Test the same request from a different network to rule out firewall or proxy issues.
Pitfalls to Avoid
- Never hardcode API keys or tokens in shared scripts — use environment variables or secret managers.
- Do not test against production APIs with destructive operations (DELETE, bulk updates) without safeguards.
- Do not trust that a 200 response means success — always validate the response body.
- Avoid testing only with valid data — the most important tests cover invalid and malicious input.
常见问题
它使用哪个工具?
它主要使用 curl,并提供关于请求头、JSON 请求体、保存响应和超时的示例。
除了成功与否,还应检查什么?
状态码、响应头、响应体结构和数据类型,而不只是请求看起来是否成功。
凭据应该放在哪里?
该技能建议放在环境变量中,使其不出现在命令历史和脚本里。
详情
作者的原始描述
API testing expert for curl, REST, GraphQL, authentication, and debugging
repo: RightNow-AI/openfang
热度
- GitHub 星标
- 18k
- 排名
- #10663
- 许可证
- Apache-2.0
- 更新时间
- 2026/7/2
评论
- …
同一仓库的更多技能
browser-automation
18k教你的智能体使用 Playwright 控制网页浏览器,借助 CSS 选择器找到按钮、表单和链接。
clip-hand-skill
18k帮你的智能体制作视频片段:下载视频、转录语音、生成字幕文件,并用 ffmpeg 剪辑片段。
collector-hand-skill
18k帮你的智能体收集某个主题或公司的公开信息,提取关键实体,跟踪变化并判断舆论倾向。
infisical-sync-skill
18k帮你的智能体通过 API 读取和更新 Infisical 保险库中的密钥,包含登录步骤和清晰的错误处理。