[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75GS2BZF3CRPFBZNSEK29MM":3,"skill-same:01M75GS2BZF3CRPFBZNSEK29MM":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M75GS2BZF3CRPFBZNSEK29MM","api-dev",null,"Scaffold, test, document, and debug REST and GraphQL APIs. Use when the user needs to create API endpoints, write integration tests, generate OpenAPI specs, test with curl, mock APIs, or troubleshoot HTTP issues.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgitgoodordietrying\u002Fapi-dev\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: api-dev\ndescription: Scaffold, test, document, and debug REST and GraphQL APIs. Use when the user needs to create API endpoints, write integration tests, generate OpenAPI specs, test with curl, mock APIs, or troubleshoot HTTP issues.\nmetadata: {\"clawdbot\":{\"emoji\":\"🔌\",\"requires\":{\"anyBins\":[\"curl\",\"node\",\"python3\"]},\"os\":[\"linux\",\"darwin\",\"win32\"]}}\n---\n\n# API Development\n\nBuild, test, document, and debug HTTP APIs from the command line. Covers the full API lifecycle: scaffolding endpoints, testing with curl, generating OpenAPI docs, mocking services, and debugging.\n\n## When to Use\n\n- Scaffolding new REST or GraphQL endpoints\n- Testing APIs with curl or scripts\n- Generating or validating OpenAPI\u002FSwagger specs\n- Mocking external APIs for development\n- Debugging HTTP request\u002Fresponse issues\n- Load testing endpoints\n\n## Testing APIs with curl\n\n### GET requests\n\n```bash\n# Basic GET\ncurl -s https:\u002F\u002Fapi.example.com\u002Fusers | jq .\n\n# With headers\ncurl -s -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  https:\u002F\u002Fapi.example.com\u002Fusers | jq .\n\n# With query params\ncurl -s \"https:\u002F\u002Fapi.example.com\u002Fusers?page=2&limit=10\" | jq .\n\n# Show response headers too\ncurl -si https:\u002F\u002Fapi.example.com\u002Fusers\n```\n\n### POST\u002FPUT\u002FPATCH\u002FDELETE\n\n```bash\n# POST JSON\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fusers \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d '{\"name\": \"Alice\", \"email\": \"alice@example.com\"}' | jq .\n\n# PUT (full replace)\ncurl -s -X PUT https:\u002F\u002Fapi.example.com\u002Fusers\u002F123 \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"Alice Updated\", \"email\": \"alice@example.com\"}' | jq .\n\n# PATCH (partial update)\ncurl -s -X PATCH https:\u002F\u002Fapi.example.com\u002Fusers\u002F123 \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"Alice V2\"}' | jq .\n\n# DELETE\ncurl -s -X DELETE https:\u002F\u002Fapi.example.com\u002Fusers\u002F123\n\n# POST form data\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fupload \\\n  -F \"file=@document.pdf\" \\\n  -F \"description=My document\"\n```\n\n### Debug requests\n\n```bash\n# Verbose output (see full request\u002Fresponse)\ncurl -v https:\u002F\u002Fapi.example.com\u002Fhealth 2>&1\n\n# Show only response headers\ncurl -sI https:\u002F\u002Fapi.example.com\u002Fhealth\n\n# Show timing breakdown\ncurl -s -o \u002Fdev\u002Fnull -w \"DNS: %{time_namelookup}s\\nConnect: %{time_connect}s\\nTLS: %{time_appconnect}s\\nFirst byte: %{time_starttransfer}s\\nTotal: %{time_total}s\\n\" https:\u002F\u002Fapi.example.com\u002Fhealth\n\n# Follow redirects\ncurl -sL https:\u002F\u002Fapi.example.com\u002Fold-endpoint\n\n# Save response to file\ncurl -s -o response.json https:\u002F\u002Fapi.example.com\u002Fdata\n```\n\n## API Test Scripts\n\n### Bash test runner\n\n```bash\n#!\u002Fbin\u002Fbash\n# api-test.sh - Simple API test runner\nBASE_URL=\"${1:-http:\u002F\u002Flocalhost:3000}\"\nPASS=0\nFAIL=0\n\nassert_status() {\n  local method=\"$1\" url=\"$2\" expected=\"$3\" body=\"$4\"\n  local args=(-s -o \u002Fdev\u002Fnull -w \"%{http_code}\" -X \"$method\")\n  if [ -n \"$body\" ]; then\n    args+=(-H \"Content-Type: application\u002Fjson\" -d \"$body\")\n  fi\n  local status\n  status=$(curl \"${args[@]}\" \"$BASE_URL$url\")\n  if [ \"$status\" = \"$expected\" ]; then\n    echo \"PASS: $method $url -> $status\"\n    ((PASS++))\n  else\n    echo \"FAIL: $method $url -> $status (expected $expected)\"\n    ((FAIL++))\n  fi\n}\n\nassert_json() {\n  local url=\"$1\" jq_expr=\"$2\" expected=\"$3\"\n  local actual\n  actual=$(curl -s \"$BASE_URL$url\" | jq -r \"$jq_expr\")\n  if [ \"$actual\" = \"$expected\" ]; then\n    echo \"PASS: GET $url | jq '$jq_expr' = $expected\"\n    ((PASS++))\n  else\n    echo \"FAIL: GET $url | jq '$jq_expr' = $actual (expected $expected)\"\n    ((FAIL++))\n  fi\n}\n\n# Health check\nassert_status GET \u002Fhealth 200\n\n# CRUD tests\nassert_status POST \u002Fapi\u002Fusers 201 '{\"name\":\"Test\",\"email\":\"test@test.com\"}'\nassert_status GET \u002Fapi\u002Fusers 200\nassert_json \u002Fapi\u002Fusers '.[-1].name' 'Test'\nassert_status DELETE \u002Fapi\u002Fusers\u002F1 204\n\n# Auth tests\nassert_status GET \u002Fapi\u002Fadmin 401\nassert_status GET \u002Fapi\u002Fadmin 403  # with wrong role\n\necho \"\"\necho \"Results: $PASS passed, $FAIL failed\"\n[ \"$FAIL\" -eq 0 ] && exit 0 || exit 1\n```\n\n### Python test runner\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"api_test.py - API integration test suite.\"\"\"\nimport json, sys, urllib.request, urllib.error\n\nBASE = sys.argv[1] if len(sys.argv) > 1 else \"http:\u002F\u002Flocalhost:3000\"\nPASS = FAIL = 0\n\ndef request(method, path, body=None, headers=None):\n    \"\"\"Make an HTTP request, return (status, body_dict, headers).\"\"\"\n    url = f\"{BASE}{path}\"\n    data = json.dumps(body).encode() if body else None\n    hdrs = {\"Content-Type\": \"application\u002Fjson\", \"Accept\": \"application\u002Fjson\"}\n    if headers:\n        hdrs.update(headers)\n    req = urllib.request.Request(url, data=data, headers=hdrs, method=method)\n    try:\n        resp = urllib.request.urlopen(req)\n        body = json.loads(resp.read().decode()) if resp.read() else None\n    except urllib.error.HTTPError as e:\n        return e.code, None, dict(e.headers)\n    return resp.status, body, dict(resp.headers)\n\ndef test(name, fn):\n    \"\"\"Run a test function, track pass\u002Ffail.\"\"\"\n    global PASS, FAIL\n    try:\n        fn()\n        print(f\"  PASS: {name}\")\n        PASS += 1\n    except AssertionError as e:\n        print(f\"  FAIL: {name} - {e}\")\n        FAIL += 1\n\ndef assert_eq(actual, expected, msg=\"\"):\n    assert actual == expected, f\"got {actual}, expected {expected}. {msg}\"\n\n# --- Tests ---\nprint(f\"Testing {BASE}\\n\")\n\ntest(\"GET \u002Fhealth returns 200\", lambda: (\n    assert_eq(request(\"GET\", \"\u002Fhealth\")[0], 200)\n))\n\ntest(\"POST \u002Fapi\u002Fusers creates user\", lambda: (\n    assert_eq(request(\"POST\", \"\u002Fapi\u002Fusers\", {\"name\": \"Test\", \"email\": \"t@t.com\"})[0], 201)\n))\n\ntest(\"GET \u002Fapi\u002Fusers returns array\", lambda: (\n    assert_eq(type(request(\"GET\", \"\u002Fapi\u002Fusers\")[1]), list)\n))\n\ntest(\"GET \u002Fapi\u002Fnotfound returns 404\", lambda: (\n    assert_eq(request(\"GET\", \"\u002Fapi\u002Fnotfound\")[0], 404)\n))\n\nprint(f\"\\nResults: {PASS} passed, {FAIL} failed\")\nsys.exit(0 if FAIL == 0 else 1)\n```\n\n## OpenAPI Spec Generation\n\n### Generate from existing endpoints\n\n```bash\n# Scaffold an OpenAPI 3.0 spec from curl responses\n# Run this, then fill in the details\ncat > openapi.yaml \u003C\u003C 'EOF'\nopenapi: \"3.0.3\"\ninfo:\n  title: My API\n  version: \"1.0.0\"\n  description: API description here\nservers:\n  - url: http:\u002F\u002Flocalhost:3000\n    description: Local development\npaths:\n  \u002Fhealth:\n    get:\n      summary: Health check\n      responses:\n        \"200\":\n          description: Service is healthy\n          content:\n            application\u002Fjson:\n              schema:\n                type: object\n                properties:\n                  status:\n                    type: string\n                    example: ok\n  \u002Fapi\u002Fusers:\n    get:\n      summary: List users\n      parameters:\n        - name: page\n          in: query\n          schema:\n            type: integer\n            default: 1\n        - name: limit\n          in: query\n          schema:\n            type: integer\n            default: 20\n      responses:\n        \"200\":\n          description: List of users\n          content:\n            application\u002Fjson:\n              schema:\n                type: array\n                items:\n                  $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n    post:\n      summary: Create user\n      requestBody:\n        required: true\n        content:\n          application\u002Fjson:\n            schema:\n              $ref: \"#\u002Fcomponents\u002Fschemas\u002FCreateUser\"\n      responses:\n        \"201\":\n          description: User created\n          content:\n            application\u002Fjson:\n              schema:\n                $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n        \"400\":\n          description: Validation error\n  \u002Fapi\u002Fusers\u002F{id}:\n    get:\n      summary: Get user by ID\n      parameters:\n        - name: id\n          in: path\n          required: true\n          schema:\n            type: string\n      responses:\n        \"200\":\n          description: User details\n          content:\n            application\u002Fjson:\n              schema:\n                $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n        \"404\":\n          description: Not found\ncomponents:\n  schemas:\n    User:\n      type: object\n      properties:\n        id:\n          type: string\n        name:\n          type: string\n        email:\n          type: string\n          format: email\n        createdAt:\n          type: string\n          format: date-time\n    CreateUser:\n      type: object\n      required:\n        - name\n        - email\n      properties:\n        name:\n          type: string\n        email:\n          type: string\n          format: email\n  securitySchemes:\n    bearerAuth:\n      type: http\n      scheme: bearer\n      bearerFormat: JWT\nEOF\n```\n\n### Validate OpenAPI spec\n\n```bash\n# Using npx (no install needed)\nnpx @redocly\u002Fcli lint openapi.yaml\n\n# Quick check: is the YAML valid?\npython3 -c \"import yaml; yaml.safe_load(open('openapi.yaml'))\" && echo \"Valid YAML\"\n```\n\n## Mock Server\n\n### Quick mock with Python\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"mock_server.py - Lightweight API mock from OpenAPI-like config.\"\"\"\nimport json, http.server, re, sys\n\nPORT = int(sys.argv[1]) if len(sys.argv) > 1 else 8080\n\n# Define mock routes: (method, path_pattern) -> response\nROUTES = {\n    (\"GET\", \"\u002Fhealth\"): {\"status\": 200, \"body\": {\"status\": \"ok\"}},\n    (\"GET\", \"\u002Fapi\u002Fusers\"): {\"status\": 200, \"body\": [\n        {\"id\": \"1\", \"name\": \"Alice\", \"email\": \"alice@example.com\"},\n        {\"id\": \"2\", \"name\": \"Bob\", \"email\": \"bob@example.com\"},\n    ]},\n    (\"POST\", \"\u002Fapi\u002Fusers\"): {\"status\": 201, \"body\": {\"id\": \"3\", \"name\": \"Created\"}},\n    (\"GET\", r\"\u002Fapi\u002Fusers\u002F\\w+\"): {\"status\": 200, \"body\": {\"id\": \"1\", \"name\": \"Alice\"}},\n    (\"DELETE\", r\"\u002Fapi\u002Fusers\u002F\\w+\"): {\"status\": 204, \"body\": None},\n}\n\nclass MockHandler(http.server.BaseHTTPRequestHandler):\n    def _handle(self):\n        for (method, pattern), response in ROUTES.items():\n            if self.command == method and re.fullmatch(pattern, self.path.split('?')[0]):\n                self.send_response(response[\"status\"])\n                if response[\"body\"] is not None:\n                    self.send_header(\"Content-Type\", \"application\u002Fjson\")\n                    self.end_headers()\n                    self.wfile.write(json.dumps(response[\"body\"]).encode())\n                else:\n                    self.end_headers()\n                return\n        self.send_response(404)\n        self.send_header(\"Content-Type\", \"application\u002Fjson\")\n        self.end_headers()\n        self.wfile.write(json.dumps({\"error\": \"Not found\"}).encode())\n\n    do_GET = do_POST = do_PUT = do_PATCH = do_DELETE = _handle\n\n    def log_message(self, fmt, *args):\n        print(f\"{self.command} {self.path} -> {args[1] if len(args) > 1 else '?'}\")\n\nprint(f\"Mock server on http:\u002F\u002Flocalhost:{PORT}\")\nhttp.server.HTTPServer((\"\", PORT), MockHandler).serve_forever()\n```\n\nRun: `python3 mock_server.py 8080`\n\n## Node.js Express Scaffolding\n\n### Minimal REST API\n\n```javascript\n\u002F\u002F server.js - Minimal Express REST API\nconst express = require('express');\nconst app = express();\napp.use(express.json());\n\n\u002F\u002F In-memory store\nconst items = new Map();\nlet nextId = 1;\n\n\u002F\u002F CRUD endpoints\napp.get('\u002Fapi\u002Fitems', (req, res) => {\n  const { page = 1, limit = 20 } = req.query;\n  const all = [...items.values()];\n  const start = (page - 1) * limit;\n  res.json({ items: all.slice(start, start + +limit), total: all.length });\n});\n\napp.get('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  const item = items.get(req.params.id);\n  if (!item) return res.status(404).json({ error: 'Not found' });\n  res.json(item);\n});\n\napp.post('\u002Fapi\u002Fitems', (req, res) => {\n  const { name, description } = req.body;\n  if (!name) return res.status(400).json({ error: 'name required' });\n  const id = String(nextId++);\n  const item = { id, name, description: description || '', createdAt: new Date().toISOString() };\n  items.set(id, item);\n  res.status(201).json(item);\n});\n\napp.put('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  if (!items.has(req.params.id)) return res.status(404).json({ error: 'Not found' });\n  const item = { ...req.body, id: req.params.id, updatedAt: new Date().toISOString() };\n  items.set(req.params.id, item);\n  res.json(item);\n});\n\napp.delete('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  if (!items.has(req.params.id)) return res.status(404).json({ error: 'Not found' });\n  items.delete(req.params.id);\n  res.status(204).end();\n});\n\n\u002F\u002F Error handler\napp.use((err, req, res, next) => {\n  console.error(err.stack);\n  res.status(500).json({ error: 'Internal server error' });\n});\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () => console.log(`API running on http:\u002F\u002Flocalhost:${PORT}`));\n```\n\n### Setup\n\n```bash\nmkdir my-api && cd my-api\nnpm init -y\nnpm install express\nnode server.js\n```\n\n## Debugging Patterns\n\n### Check if port is in use\n\n```bash\n# Linux\u002FmacOS\nlsof -i :3000\n# or\nss -tlnp | grep 3000\n\n# Kill process on port\nkill $(lsof -t -i :3000)\n```\n\n### Test CORS\n\n```bash\n# Preflight request\ncurl -s -X OPTIONS https:\u002F\u002Fapi.example.com\u002Fusers \\\n  -H \"Origin: http:\u002F\u002Flocalhost:3000\" \\\n  -H \"Access-Control-Request-Method: POST\" \\\n  -H \"Access-Control-Request-Headers: Content-Type\" \\\n  -I\n```\n\n### Watch for response time regressions\n\n```bash\n# Quick benchmark (10 requests)\nfor i in $(seq 1 10); do\n  curl -s -o \u002Fdev\u002Fnull -w \"%{time_total}\\n\" http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers\ndone | awk '{sum+=$1; if($1>max)max=$1} END {printf \"Avg: %.3fs, Max: %.3fs\\n\", sum\u002FNR, max}'\n```\n\n### Inspect JWT tokens\n\n```bash\n# Decode JWT payload (no verification)\necho \"$TOKEN\" | cut -d. -f2 | base64 -d 2>\u002Fdev\u002Fnull | jq .\n```\n\n## Tips\n\n- Use `jq` for JSON response processing: `curl -s url | jq '.items[] | {id, name}'`\n- Set `Content-Type` header on every request with a body - missing it causes silent 400s\n- Use `-w '\\n'` with curl to ensure output ends with a newline\n- For large response bodies, pipe to `jq -C . | less -R` for colored paging\n- Test error paths: invalid JSON, missing fields, wrong types, unauthorized, not found\n- For WebSocket testing: `npx wscat -c ws:\u002F\u002Flocalhost:3000\u002Fws`\n","# API Development\n\nBuild, test, document, and debug HTTP APIs from the command line. Covers the full API lifecycle: scaffolding endpoints, testing with curl, generating OpenAPI docs, mocking services, and debugging.\n\n## When to Use\n\n- Scaffolding new REST or GraphQL endpoints\n- Testing APIs with curl or scripts\n- Generating or validating OpenAPI\u002FSwagger specs\n- Mocking external APIs for development\n- Debugging HTTP request\u002Fresponse issues\n- Load testing endpoints\n\n## Testing APIs with curl\n\n### GET requests\n\n```bash\n# Basic GET\ncurl -s https:\u002F\u002Fapi.example.com\u002Fusers | jq .\n\n# With headers\ncurl -s -H \"Authorization: Bearer $TOKEN\" \\\n  -H \"Accept: application\u002Fjson\" \\\n  https:\u002F\u002Fapi.example.com\u002Fusers | jq .\n\n# With query params\ncurl -s \"https:\u002F\u002Fapi.example.com\u002Fusers?page=2&limit=10\" | jq .\n\n# Show response headers too\ncurl -si https:\u002F\u002Fapi.example.com\u002Fusers\n```\n\n### POST\u002FPUT\u002FPATCH\u002FDELETE\n\n```bash\n# POST JSON\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fusers \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"Authorization: Bearer $TOKEN\" \\\n  -d '{\"name\": \"Alice\", \"email\": \"alice@example.com\"}' | jq .\n\n# PUT (full replace)\ncurl -s -X PUT https:\u002F\u002Fapi.example.com\u002Fusers\u002F123 \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"Alice Updated\", \"email\": \"alice@example.com\"}' | jq .\n\n# PATCH (partial update)\ncurl -s -X PATCH https:\u002F\u002Fapi.example.com\u002Fusers\u002F123 \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"name\": \"Alice V2\"}' | jq .\n\n# DELETE\ncurl -s -X DELETE https:\u002F\u002Fapi.example.com\u002Fusers\u002F123\n\n# POST form data\ncurl -s -X POST https:\u002F\u002Fapi.example.com\u002Fupload \\\n  -F \"file=@document.pdf\" \\\n  -F \"description=My document\"\n```\n\n### Debug requests\n\n```bash\n# Verbose output (see full request\u002Fresponse)\ncurl -v https:\u002F\u002Fapi.example.com\u002Fhealth 2>&1\n\n# Show only response headers\ncurl -sI https:\u002F\u002Fapi.example.com\u002Fhealth\n\n# Show timing breakdown\ncurl -s -o \u002Fdev\u002Fnull -w \"DNS: %{time_namelookup}s\\nConnect: %{time_connect}s\\nTLS: %{time_appconnect}s\\nFirst byte: %{time_starttransfer}s\\nTotal: %{time_total}s\\n\" https:\u002F\u002Fapi.example.com\u002Fhealth\n\n# Follow redirects\ncurl -sL https:\u002F\u002Fapi.example.com\u002Fold-endpoint\n\n# Save response to file\ncurl -s -o response.json https:\u002F\u002Fapi.example.com\u002Fdata\n```\n\n## API Test Scripts\n\n### Bash test runner\n\n```bash\n#!\u002Fbin\u002Fbash\n# api-test.sh - Simple API test runner\nBASE_URL=\"${1:-http:\u002F\u002Flocalhost:3000}\"\nPASS=0\nFAIL=0\n\nassert_status() {\n  local method=\"$1\" url=\"$2\" expected=\"$3\" body=\"$4\"\n  local args=(-s -o \u002Fdev\u002Fnull -w \"%{http_code}\" -X \"$method\")\n  if [ -n \"$body\" ]; then\n    args+=(-H \"Content-Type: application\u002Fjson\" -d \"$body\")\n  fi\n  local status\n  status=$(curl \"${args[@]}\" \"$BASE_URL$url\")\n  if [ \"$status\" = \"$expected\" ]; then\n    echo \"PASS: $method $url -> $status\"\n    ((PASS++))\n  else\n    echo \"FAIL: $method $url -> $status (expected $expected)\"\n    ((FAIL++))\n  fi\n}\n\nassert_json() {\n  local url=\"$1\" jq_expr=\"$2\" expected=\"$3\"\n  local actual\n  actual=$(curl -s \"$BASE_URL$url\" | jq -r \"$jq_expr\")\n  if [ \"$actual\" = \"$expected\" ]; then\n    echo \"PASS: GET $url | jq '$jq_expr' = $expected\"\n    ((PASS++))\n  else\n    echo \"FAIL: GET $url | jq '$jq_expr' = $actual (expected $expected)\"\n    ((FAIL++))\n  fi\n}\n\n# Health check\nassert_status GET \u002Fhealth 200\n\n# CRUD tests\nassert_status POST \u002Fapi\u002Fusers 201 '{\"name\":\"Test\",\"email\":\"test@test.com\"}'\nassert_status GET \u002Fapi\u002Fusers 200\nassert_json \u002Fapi\u002Fusers '.[-1].name' 'Test'\nassert_status DELETE \u002Fapi\u002Fusers\u002F1 204\n\n# Auth tests\nassert_status GET \u002Fapi\u002Fadmin 401\nassert_status GET \u002Fapi\u002Fadmin 403  # with wrong role\n\necho \"\"\necho \"Results: $PASS passed, $FAIL failed\"\n[ \"$FAIL\" -eq 0 ] && exit 0 || exit 1\n```\n\n### Python test runner\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"api_test.py - API integration test suite.\"\"\"\nimport json, sys, urllib.request, urllib.error\n\nBASE = sys.argv[1] if len(sys.argv) > 1 else \"http:\u002F\u002Flocalhost:3000\"\nPASS = FAIL = 0\n\ndef request(method, path, body=None, headers=None):\n    \"\"\"Make an HTTP request, return (status, body_dict, headers).\"\"\"\n    url = f\"{BASE}{path}\"\n    data = json.dumps(body).encode() if body else None\n    hdrs = {\"Content-Type\": \"application\u002Fjson\", \"Accept\": \"application\u002Fjson\"}\n    if headers:\n        hdrs.update(headers)\n    req = urllib.request.Request(url, data=data, headers=hdrs, method=method)\n    try:\n        resp = urllib.request.urlopen(req)\n        body = json.loads(resp.read().decode()) if resp.read() else None\n    except urllib.error.HTTPError as e:\n        return e.code, None, dict(e.headers)\n    return resp.status, body, dict(resp.headers)\n\ndef test(name, fn):\n    \"\"\"Run a test function, track pass\u002Ffail.\"\"\"\n    global PASS, FAIL\n    try:\n        fn()\n        print(f\"  PASS: {name}\")\n        PASS += 1\n    except AssertionError as e:\n        print(f\"  FAIL: {name} - {e}\")\n        FAIL += 1\n\ndef assert_eq(actual, expected, msg=\"\"):\n    assert actual == expected, f\"got {actual}, expected {expected}. {msg}\"\n\n# --- Tests ---\nprint(f\"Testing {BASE}\\n\")\n\ntest(\"GET \u002Fhealth returns 200\", lambda: (\n    assert_eq(request(\"GET\", \"\u002Fhealth\")[0], 200)\n))\n\ntest(\"POST \u002Fapi\u002Fusers creates user\", lambda: (\n    assert_eq(request(\"POST\", \"\u002Fapi\u002Fusers\", {\"name\": \"Test\", \"email\": \"t@t.com\"})[0], 201)\n))\n\ntest(\"GET \u002Fapi\u002Fusers returns array\", lambda: (\n    assert_eq(type(request(\"GET\", \"\u002Fapi\u002Fusers\")[1]), list)\n))\n\ntest(\"GET \u002Fapi\u002Fnotfound returns 404\", lambda: (\n    assert_eq(request(\"GET\", \"\u002Fapi\u002Fnotfound\")[0], 404)\n))\n\nprint(f\"\\nResults: {PASS} passed, {FAIL} failed\")\nsys.exit(0 if FAIL == 0 else 1)\n```\n\n## OpenAPI Spec Generation\n\n### Generate from existing endpoints\n\n```bash\n# Scaffold an OpenAPI 3.0 spec from curl responses\n# Run this, then fill in the details\ncat > openapi.yaml \u003C\u003C 'EOF'\nopenapi: \"3.0.3\"\ninfo:\n  title: My API\n  version: \"1.0.0\"\n  description: API description here\nservers:\n  - url: http:\u002F\u002Flocalhost:3000\n    description: Local development\npaths:\n  \u002Fhealth:\n    get:\n      summary: Health check\n      responses:\n        \"200\":\n          description: Service is healthy\n          content:\n            application\u002Fjson:\n              schema:\n                type: object\n                properties:\n                  status:\n                    type: string\n                    example: ok\n  \u002Fapi\u002Fusers:\n    get:\n      summary: List users\n      parameters:\n        - name: page\n          in: query\n          schema:\n            type: integer\n            default: 1\n        - name: limit\n          in: query\n          schema:\n            type: integer\n            default: 20\n      responses:\n        \"200\":\n          description: List of users\n          content:\n            application\u002Fjson:\n              schema:\n                type: array\n                items:\n                  $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n    post:\n      summary: Create user\n      requestBody:\n        required: true\n        content:\n          application\u002Fjson:\n            schema:\n              $ref: \"#\u002Fcomponents\u002Fschemas\u002FCreateUser\"\n      responses:\n        \"201\":\n          description: User created\n          content:\n            application\u002Fjson:\n              schema:\n                $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n        \"400\":\n          description: Validation error\n  \u002Fapi\u002Fusers\u002F{id}:\n    get:\n      summary: Get user by ID\n      parameters:\n        - name: id\n          in: path\n          required: true\n          schema:\n            type: string\n      responses:\n        \"200\":\n          description: User details\n          content:\n            application\u002Fjson:\n              schema:\n                $ref: \"#\u002Fcomponents\u002Fschemas\u002FUser\"\n        \"404\":\n          description: Not found\ncomponents:\n  schemas:\n    User:\n      type: object\n      properties:\n        id:\n          type: string\n        name:\n          type: string\n        email:\n          type: string\n          format: email\n        createdAt:\n          type: string\n          format: date-time\n    CreateUser:\n      type: object\n      required:\n        - name\n        - email\n      properties:\n        name:\n          type: string\n        email:\n          type: string\n          format: email\n  securitySchemes:\n    bearerAuth:\n      type: http\n      scheme: bearer\n      bearerFormat: JWT\nEOF\n```\n\n### Validate OpenAPI spec\n\n```bash\n# Using npx (no install needed)\nnpx @redocly\u002Fcli lint openapi.yaml\n\n# Quick check: is the YAML valid?\npython3 -c \"import yaml; yaml.safe_load(open('openapi.yaml'))\" && echo \"Valid YAML\"\n```\n\n## Mock Server\n\n### Quick mock with Python\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"mock_server.py - Lightweight API mock from OpenAPI-like config.\"\"\"\nimport json, http.server, re, sys\n\nPORT = int(sys.argv[1]) if len(sys.argv) > 1 else 8080\n\n# Define mock routes: (method, path_pattern) -> response\nROUTES = {\n    (\"GET\", \"\u002Fhealth\"): {\"status\": 200, \"body\": {\"status\": \"ok\"}},\n    (\"GET\", \"\u002Fapi\u002Fusers\"): {\"status\": 200, \"body\": [\n        {\"id\": \"1\", \"name\": \"Alice\", \"email\": \"alice@example.com\"},\n        {\"id\": \"2\", \"name\": \"Bob\", \"email\": \"bob@example.com\"},\n    ]},\n    (\"POST\", \"\u002Fapi\u002Fusers\"): {\"status\": 201, \"body\": {\"id\": \"3\", \"name\": \"Created\"}},\n    (\"GET\", r\"\u002Fapi\u002Fusers\u002F\\w+\"): {\"status\": 200, \"body\": {\"id\": \"1\", \"name\": \"Alice\"}},\n    (\"DELETE\", r\"\u002Fapi\u002Fusers\u002F\\w+\"): {\"status\": 204, \"body\": None},\n}\n\nclass MockHandler(http.server.BaseHTTPRequestHandler):\n    def _handle(self):\n        for (method, pattern), response in ROUTES.items():\n            if self.command == method and re.fullmatch(pattern, self.path.split('?')[0]):\n                self.send_response(response[\"status\"])\n                if response[\"body\"] is not None:\n                    self.send_header(\"Content-Type\", \"application\u002Fjson\")\n                    self.end_headers()\n                    self.wfile.write(json.dumps(response[\"body\"]).encode())\n                else:\n                    self.end_headers()\n                return\n        self.send_response(404)\n        self.send_header(\"Content-Type\", \"application\u002Fjson\")\n        self.end_headers()\n        self.wfile.write(json.dumps({\"error\": \"Not found\"}).encode())\n\n    do_GET = do_POST = do_PUT = do_PATCH = do_DELETE = _handle\n\n    def log_message(self, fmt, *args):\n        print(f\"{self.command} {self.path} -> {args[1] if len(args) > 1 else '?'}\")\n\nprint(f\"Mock server on http:\u002F\u002Flocalhost:{PORT}\")\nhttp.server.HTTPServer((\"\", PORT), MockHandler).serve_forever()\n```\n\nRun: `python3 mock_server.py 8080`\n\n## Node.js Express Scaffolding\n\n### Minimal REST API\n\n```javascript\n\u002F\u002F server.js - Minimal Express REST API\nconst express = require('express');\nconst app = express();\napp.use(express.json());\n\n\u002F\u002F In-memory store\nconst items = new Map();\nlet nextId = 1;\n\n\u002F\u002F CRUD endpoints\napp.get('\u002Fapi\u002Fitems', (req, res) => {\n  const { page = 1, limit = 20 } = req.query;\n  const all = [...items.values()];\n  const start = (page - 1) * limit;\n  res.json({ items: all.slice(start, start + +limit), total: all.length });\n});\n\napp.get('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  const item = items.get(req.params.id);\n  if (!item) return res.status(404).json({ error: 'Not found' });\n  res.json(item);\n});\n\napp.post('\u002Fapi\u002Fitems', (req, res) => {\n  const { name, description } = req.body;\n  if (!name) return res.status(400).json({ error: 'name required' });\n  const id = String(nextId++);\n  const item = { id, name, description: description || '', createdAt: new Date().toISOString() };\n  items.set(id, item);\n  res.status(201).json(item);\n});\n\napp.put('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  if (!items.has(req.params.id)) return res.status(404).json({ error: 'Not found' });\n  const item = { ...req.body, id: req.params.id, updatedAt: new Date().toISOString() };\n  items.set(req.params.id, item);\n  res.json(item);\n});\n\napp.delete('\u002Fapi\u002Fitems\u002F:id', (req, res) => {\n  if (!items.has(req.params.id)) return res.status(404).json({ error: 'Not found' });\n  items.delete(req.params.id);\n  res.status(204).end();\n});\n\n\u002F\u002F Error handler\napp.use((err, req, res, next) => {\n  console.error(err.stack);\n  res.status(500).json({ error: 'Internal server error' });\n});\n\nconst PORT = process.env.PORT || 3000;\napp.listen(PORT, () => console.log(`API running on http:\u002F\u002Flocalhost:${PORT}`));\n```\n\n### Setup\n\n```bash\nmkdir my-api && cd my-api\nnpm init -y\nnpm install express\nnode server.js\n```\n\n## Debugging Patterns\n\n### Check if port is in use\n\n```bash\n# Linux\u002FmacOS\nlsof -i :3000\n# or\nss -tlnp | grep 3000\n\n# Kill process on port\nkill $(lsof -t -i :3000)\n```\n\n### Test CORS\n\n```bash\n# Preflight request\ncurl -s -X OPTIONS https:\u002F\u002Fapi.example.com\u002Fusers \\\n  -H \"Origin: http:\u002F\u002Flocalhost:3000\" \\\n  -H \"Access-Control-Request-Method: POST\" \\\n  -H \"Access-Control-Request-Headers: Content-Type\" \\\n  -I\n```\n\n### Watch for response time regressions\n\n```bash\n# Quick benchmark (10 requests)\nfor i in $(seq 1 10); do\n  curl -s -o \u002Fdev\u002Fnull -w \"%{time_total}\\n\" http:\u002F\u002Flocalhost:3000\u002Fapi\u002Fusers\ndone | awk '{sum+=$1; if($1>max)max=$1} END {printf \"Avg: %.3fs, Max: %.3fs\\n\", sum\u002FNR, max}'\n```\n\n### Inspect JWT tokens\n\n```bash\n# Decode JWT payload (no verification)\necho \"$TOKEN\" | cut -d. -f2 | base64 -d 2>\u002Fdev\u002Fnull | jq .\n```\n\n## Tips\n\n- Use `jq` for JSON response processing: `curl -s url | jq '.items[] | {id, name}'`\n- Set `Content-Type` header on every request with a body - missing it causes silent 400s\n- Use `-w '\\n'` with curl to ensure output ends with a newline\n- For large response bodies, pipe to `jq -C . | less -R` for colored paging\n- Test error paths: invalid JSON, missing fields, wrong types, unauthorized, not found\n- For WebSocket testing: `npx wscat -c ws:\u002F\u002Flocalhost:3000\u002Fws`\n",{"name":5,"metadata":24,"description":7},{"clawdbot":25},{"os":26,"emoji":30,"requires":31},[27,28,29],"linux","darwin","win32","🔌",{"anyBins":32},[33,34,35],"curl","node","python3","main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fgitgoodordietrying\u002Fapi-dev",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill api-dev",{"tool":51,"command":52},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill api-dev",{"tool":54,"command":55},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill api-dev","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fgitgoodordietrying\u002Fapi-dev\u002FSKILL.md",true,[],[60,68,75,82,89,96],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":67},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":67},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":67},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":67},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":67},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":67},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]