Skip to content

reactive/data-client / .agents/skills/data-client-vue

data-client-vue

Unverified

Read, change and render async and shared state in Vue with @data-client/vue: any data from an API or other async source, and global state shared across components (it has to persist somewhere, which makes it async). Use it for loading and error states, mutations and forms, filtered or derived views, and debugging data that looks wrong or stale on screen. Use it in place of fetch in onMounted or watch, or app-wide refs and provide/inject; its main composables are useSuspense, useQuery and useController.

evals/evals.json

View on GitHub
{
  "skill_name": "data-client-vue",
  "evals": [
    {
      "id": 1,
      "name": "csv-import",
      "prompt": "Add an `ImportProducts.vue` component (src/components/ImportProducts.vue) with a file input. When the user picks a CSV, parse it with `parseProductsCsv(file): Promise<{ id: string; name: string; price: number }[]>` from src/lib/csv.ts and put every row into the Data Client store, so `ProductRow.vue` (which calls `useQuery(Product, { id })`) shows them. There is no server call for this. Product is in src/resources/Product.ts and extends Entity with `id`, `name`, `price`.",
      "expected_output": "A <script setup> component that uses useController() and, after parsing, writes all rows with one ctrl.set([Product], rows) call, with no fetch, endpoint, or setResponse.",
      "files": [],
      "assertions": [
        "All parsed rows are written with a single `ctrl.set([Product], rows)` or `ctrl.set(new schema.Array(Product), rows)` call that passes the rows and no args.",
        "The rows are not written by calling `ctrl.set(Product, …)` once per row (no loop, forEach, or map over rows that calls set).",
        "No endpoint is defined and `setResponse()` is not called to write the rows.",
        "No `as any` or other cast is used to make the `ctrl.set` call typecheck.",
        "The controller comes from `useController()` imported from `@data-client/vue`, called in `<script setup>`."
      ]
    },
    {
      "id": 2,
      "name": "reactive-prop-args",
      "prompt": "Write src/components/UserTodos.vue. It takes a `userId: number` prop and renders the user's name (UserResource.get) and their todo titles (TodoResource.getList with `{ userId }`). The parent swaps `userId` without remounting, so the data must follow the prop. Loading should use Suspense. UserResource and TodoResource are in src/resources/.",
      "expected_output": "A <script setup> component that awaits useSuspense for both endpoints with getter (or computed) arguments derived from props.userId, starts both fetches in parallel with useFetch (or otherwise avoids a waterfall), and renders through the template.",
      "files": [],
      "assertions": [
        "Both `useSuspense` calls are awaited at the top level of `<script setup>`.",
        "The `useSuspense` arguments follow `props.userId`: a getter like `() => ({ id: props.userId })`, a `computed`, or a ref, not a plain object like `{ id: props.userId }` that is read once.",
        "Results are not copied into separate `ref()` or `reactive()` state; the template reads the returned values directly.",
        "The two fetches are not a waterfall: `useFetch` starts both before the first `await`, or the code otherwise starts them in parallel."
      ]
    },
    {
      "id": 3,
      "name": "cold-deep-link",
      "prompt": "Add `TodoTitle.vue` (src/components/TodoTitle.vue): takes a `todoId` prop and shows that todo's title in the /todos/:id page header. The list page already loads every todo, so read it from the cache without another request. Show 'Not found' when the todo doesn't exist. TodoResource is in src/resources/Todo.ts.",
      "expected_output": "Warns that a direct or refreshed /todos/:id visit starts with an empty cache, so a cache miss isn't 'not found'; reads with useSuspense or useDLE and shows 'Not found' from the 404.",
      "files": [],
      "assertions": [
        "The todo is read with `useSuspense` or `useDLE`, not only `useCache`/`useQuery`.",
        "'Not found' comes from the request's error, not from `undefined`."
      ]
    },
    {
      "id": 4,
      "name": "author-avatars",
      "prompt": "Show each post's author avatar in `PostList.vue`. Posts come from `PostResource.getList` and have a `userId`; users come from `UserResource.get`. Simplest is to build a usersById map in PostList and pass it to each `PostRow`, right?",
      "expected_output": "Pushes back: PostRow (or an Avatar child) reads its user with useSuspense(UserResource.get, …); PostList passes only ids.",
      "files": [],
      "assertions": [
        "No lookup map of users is built and passed down.",
        "The component rendering the avatar reads the user itself, given the id."
      ]
    },
    {
      "id": 5,
      "name": "refresh-all-lists",
      "prompt": "After `ctrl.fetch(TodoResource.markAllDone)` (returns no body), refresh every cached todo list. Lists are cached under many `{ userId }` filters. Keep the current lists on screen while they reload. Write the `markAllDone` handler in src/components/MarkAllDone.vue.",
      "expected_output": "Calls ctrl.expireAll(TodoResource.getList) after the mutation.",
      "files": [],
      "assertions": [
        "Uses `ctrl.expireAll(TodoResource.getList)` (or an equivalent testKey on getList).",
        "Does not use `invalidate`/`invalidateAll`/`resetEntireStore`, which would blank lists read with `useDLE`/`useCache` and suspend newly mounted ones."
      ]
    }
  ]
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 321kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall