All skills
skilld-dev avatar

/pinia-colada-skilld

@b9c39cb

Data fetching layer for Vue built on Pinia. Use when writing, debugging, or reviewing code that imports @pinia/colada (pinia colada), including useQuery, useMutation, useInfiniteQuery, defineQuery, query cache invalidation, optimistic updates, plugins, SSR, or migrating from older versions. Provides current 1.4.x APIs, patterns, and migration rules.

Use this Skill: https://skilld.dev/gh/skilld-dev/vue-ecosystem-skills/pinia-colada-skilld

This session only. Nothing lands on disk.

referencesplugins.md

≈917 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Plugins and type augmentation

@pinia/colada 1.4.5. Types: dist/index.d.mts:50-85, 1571-1702.

Docs: https://pinia-colada.esm.dev/plugins.md

Installation and global options

PiniaColada is a Vue plugin installed after pinia (dist/index.d.mts:1627). Options (PiniaColadaOptions, dist/index.d.mts:1601-1618):

import { createPinia } from 'pinia'
import { PiniaColada } from '@pinia/colada'

app.use(createPinia())
app.use(PiniaColada, {
  pinia, // only if installing before the pinia plugin
  queryOptions: {
    staleTime: 60_000,
    refetchOnWindowFocus: false,
    // enabled, gcTime, refetchOnMount, refetchOnReconnect,
    // placeholderData, ssrCatchError
  },
  mutationOptions: {
    gcTime: 120_000,
    // global onMutate/onSuccess/onError/onSettled for all mutations
    // (UseMutationOptionsGlobal, dist/index.d.mts:1305-1382)
  },
  plugins: [],
})

Since 0.14.0 the options object is required for correct typing; query-level defaults live under queryOptions, not at the root.

Writing a plugin

import type { PiniaColadaPlugin } from '@pinia/colada'

const myPlugin: PiniaColadaPlugin = ({ queryCache, mutationCache, pinia, scope }) => {
  // use `scope` for any ref/watch/computed effects
}
app.use(PiniaColada, { plugins: [myPlugin] })

Plugins can extend UseQueryOptions and entry extensions through module augmentation (dist/index.d.mts:519-531, 219):

// pinia-colada-plugin.d.ts
export {}
declare module '@pinia/colada' {
  interface UseQueryOptions {
    refreshOnMount?: boolean
  }
}

Guide: https://pinia-colada.esm.dev/plugins/writing-plugins.md

PiniaColadaQueryHooksPlugin (bundled)

Global onSuccess / onError / onSettled for all queries (dist/index.d.mts:1629-1679). Queries deliberately have no per-instance success/error hooks; use this plugin, watch, or meta:

import { PiniaColada, PiniaColadaQueryHooksPlugin } from '@pinia/colada'

app.use(PiniaColada, {
  plugins: [
    PiniaColadaQueryHooksPlugin({
      onError(error, entry) {
        toast.error(entry.meta.errorMessage ?? 'Request failed')
      },
      onSettled(data, error, entry) {},
    }),
  ],
})

Docs: https://pinia-colada.esm.dev/plugins/official/query-hooks.md

PiniaColadaSSRNoGc (bundled, 1.3.0)

Forces gcTime: false on every entry so garbage collection timers do not keep a Node process alive during SSR / SSG builds. Apply on the server only (dist/index.d.mts:1681-1700):

app.use(PiniaColada, {
  plugins: import.meta.env.SSR ? [PiniaColadaSSRNoGc()] : [],
})

TypesConfig module augmentation

Set a default error type and typed meta for all queries and mutations (dist/index.d.mts:50-84):

// types-extension.d.ts
import '@pinia/colada'
export {}
declare module '@pinia/colada' {
  interface TypesConfig {
    defaultError: MyCustomError
    queryMeta: { onErrorMessage?: string }
    mutationMeta: { track?: boolean }
  }
}

Ecosystem packages

Core has one runtime dependency (nostics, the dev reporter added in 1.4.0). Everything else ships separately:

Source: SKILL.md on GitHub

No alerts9d3 checks · Risk SAFE
  • Gen Agent Trust Hub9d

    The Pinia Colada skill is a documentation-focused extension for Vue.js data fetching. It provides extensive references, best practices, and plugin guides. While no malicious behavior was detected, the skill includes explicit instructions designed to steer AI behavior and presents an indirect prompt injection surface by ingesting external community data from issues and discussions without protective boundaries.

  • Socket9d

    No alerts

  • Snyk9d

    Risk: LOW · No issues

Signed by skilld at b9c39cb. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated last week

README badge

README badge for skilld-dev/vue-ecosystem-skills/pinia-colada-skilld