Skip to content

reactive/data-client / .agents/skills/data-client-rest-setup

data-client-rest-setup

Verified

Set up and migrate to @data-client/rest for REST APIs. Detects existing HTTP patterns (axios, fetch, ky, superagent, got) and migrates them. Creates custom RestEndpoint base class with common behaviors. Use when adopting @data-client/rest in a new or existing project.

evals/evals.json

View on GitHub
{
  "skill_name": "data-client-rest-setup",
  "evals": [
    {
      "id": 1,
      "name": "axios-codemod-without-website",
      "source": "Migration of alan2207/bulletproof-react@9506629 (apps/react-vite), problem record in https://github.com/reactive/data-client/pull/4607 (.agents/projects/migrations/bulletproof-react/problems.md) P2",
      "prompt": "Migrate this app's axios calls in src/ to @data-client/rest. Note: this machine reaches the npm registry and GitHub, but dataclient.io is unreachable.",
      "expected_output": "Runs the axios codemod from npm (`npx @data-client/codemods axios-to-rest src/`), or `npx jscodeshift -t` on a local copy of `axios-to-rest.js` (e.g. `node_modules/@data-client/codemods/src/transforms/`), with no request to dataclient.io.",
      "files": [],
      "assertions": [
        "The codemod command is `npx @data-client/codemods axios-to-rest <src folder>` or `npx jscodeshift -t <local path to axios-to-rest.js>`.",
        "Never runs a command that fetches from dataclient.io.",
        "Runs it on the source folder, not the repo root."
      ]
    },
    {
      "id": 2,
      "name": "axios-withcredentials-request-init",
      "source": "N1 in the 0.19 beta re-run of alan2207/bulletproof-react@9506629 (apps/react-vite): following the table's `getRequestInit` row literally spread the un-awaited Promise, so every mutation was sent as a GET.",
      "prompt": "Replace this axios instance with a data-client base endpoint class in src/lib/api-client.ts, keeping its behavior. Other files will import it as `ApiEndpoint`; leave the endpoint definitions for later.\n\n```ts\nimport Axios, { InternalAxiosRequestConfig } from 'axios';\nimport { env } from '@/config/env';\n\nfunction authRequestInterceptor(config: InternalAxiosRequestConfig) {\n  if (config.headers) {\n    config.headers.Accept = 'application/json';\n  }\n  config.withCredentials = true;\n  return config;\n}\n\nexport const api = Axios.create({ baseURL: env.API_URL });\napi.interceptors.request.use(authRequestInterceptor);\n```\n\nThe app later calls `api.patch('/users/profile', data)` and `api.post('/discussions', data)` through it.",
      "expected_output": "A `RestEndpoint` subclass with `urlPrefix = env.API_URL`, the Accept header from `getHeaders()`, and cookies sent with `credentials: 'include'` without losing the method, body or headers of each request.",
      "files": [],
      "assertions": [
        "Requests are sent with `credentials: 'include'` (axios `withCredentials`), from `getRequestInit()` or the `requestInit` member.",
        "Any `getRequestInit()` override awaits `super.getRequestInit(body)` before spreading or reading it; the code never spreads the un-awaited call.",
        "`urlPrefix` is `env.API_URL` and the `Accept` header comes from `getHeaders()` (or `requestInit.headers`) without dropping the headers passed in."
      ]
    }
  ]
}
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 319kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 319kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 319kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 319kUpdated Claude CodeCodexVerifiedInstall