reactive/data-client / .agents/skills/data-client-rest-setup
data-client-rest-setup
VerifiedSet 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.5 KB |
| evals/evals.json | config | 2.8 KB |
| references.json | config | 386 B |
| references/RestEndpoint.md | markdown | 45.2 KB |
| references/RestEndpoint.vue.md | markdown | 46.1 KB |
| references/auth.md | markdown | 9.4 KB |
| references/auth.vue.md | markdown | 9.7 KB |
| references/axios-migration.md | markdown | 25.4 KB |
| references/axios-migration.vue.md | markdown | 25.5 KB |
| references/django.md | markdown | 2.3 KB |
| references/fetch-migration.md | markdown | 3.8 KB |
| references/got-migration.md | markdown | 4.3 KB |
| references/hookifyResource.md | markdown | 6.0 KB |
| references/hookifyResource.vue.md | markdown | 6.3 KB |
| references/ky-migration.md | markdown | 3.8 KB |
| references/resource.md | markdown | 27.0 KB |
| references/resource.vue.md | markdown | 27.1 KB |
| references/superagent-migration.md | markdown | 4.0 KB |
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."
]
}
]
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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 implementation | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| 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 fallback | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| 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 always | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |