Agents & OrchestrationSûr100100/100
Solid DB (TanStack)
SolidJS bindings for TanStack DB. useLiveQuery returns an Accessor that doubles as data access (call as function) with state/status properties. Fine-grained reactivity: signal reads MUST happen inside the query function for tracking. Config passed as Accessor (() => config). Built-in Suspense support via createResource and errors through Solid ErrorBoundary. ReactiveMap for state. Import from @tanstack/solid-db (re-exports all of @tanstack/db).
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs solid-db__tanstack-db__packages-solid-db-skills-3f7699a301acTanStack
TanStack/db
Contenu à copier
---
name: solid-db
description: >
SolidJS bindings for TanStack DB. useLiveQuery returns an Accessor that
doubles as data access (call as function) with state/status properties.
Fine-grained reactivity: signal reads MUST happen inside the query function
for tracking. Config passed as Accessor (() => config). Built-in Suspense
support via createResource and errors through Solid ErrorBoundary.
ReactiveMap for state. Import from
@tanstack/solid-db (re-exports all of @tanstack/db).
type: framework
library: db
framework: solid
library_version: '0.6.17'
requires:
- db-core
sources:
- 'TanStack/db:docs/framework/solid/overview.md'
- 'TanStack/db:packages/solid-db/src/useLiveQuery.ts'
metadata:
origin: TanStack
---
This skill builds on db-core. Read it first for collection setup, query builder, and mutation patterns.
# TanStack DB — SolidJS
## Setup
```tsx
import { useLiveQuery, eq, not } from '@tanstack/solid-db'
import { ErrorBoundary, For, Show, Suspense } from 'solid-js'
function TodoList() {
const todosQuery = useLiveQuery((q) =>
q
.from({ todo: todoCollection })
.where(({ todo }) => not(todo.completed))
.orderBy(({ todo }) => todo.created_at, 'asc'),
)
return (
<Suspense fallback={<div>Loading...</div>}>
<ul>
<For each={todosQuery()}>{(todo) => <li>{todo.text}</li>}</For>
</ul>
</Suspense>
)
}
```
`@tanstack/solid-db` re-exports everything from `@tanstack/db`.
## Hook
### useLiveQuery
Returns an `Accessor<Array<T>>` (or `Accessor<T | undefined>` with `findOne`) with additional properties. Call it as a function to get data:
```tsx
// Query function — call result as function for data
const query = useLiveQuery((q) => q.from({ todo: todoCollection }))
// query() → Array<T> (data) — or T | undefined when using findOne()
// query.data → DEPRECATED — use query() instead. Migrate any existing code.
// query.status → CollectionStatus
// query.isLoading, query.isReady, query.isError
// query.state → ReactiveMap<TKey, T>
// query.collection → Collection
// With reactive signals — signals MUST be read INSIDE the query function
const [minPriority, setMinPriority] = createSignal(5)
const query = useLiveQuery((q) =>
q
.from({ todo: todoCollection })
.where(({ todo }) => gt(todo.priority, minPriority())),
)
// Config object — pass as Accessor
const query = useLiveQuery(() => ({
query: (q) => q.from({ todo: todoCollection }),
gcTime: 60000,
}))
// Pre-created collection — pass as Accessor
const query = useLiveQuery(() => preloadedCollection)
// Conditional query
const query = useLiveQuery((q) => {
const id = userId()
if (!id) return undefined
return q
.from({ todo: todoCollection })
.where(({ todo }) => eq(todo.userId, id))
})
```
## Solid-Specific Patterns
### Signal reads inside query function
```tsx
// CORRECT — signal read tracked inside query function
const [category, setCategory] = createSignal('work')
const query = useLiveQuery((q) =>
q
.from({ todo: todoCollection })
.where(({ todo }) => eq(todo.category, category())),
)
// Query re-runs when category() changes
// WRONG — signal read outside, not tracked
const cat = category() // read here loses tracking
const query = useLiveQuery((q) =>
q.from({ todo: todoCollection }).where(({ todo }) => eq(todo.category, cat)),
)
```
### findOne (single result)
When the query uses `.findOne()`, `useLiveQuery` returns a single object (or `undefined`) instead of an array:
```tsx
const userQuery = useLiveQuery((q) =>
q
.from({ user: usersCollection })
.where(({ user }) => eq(user.id, userId()))
.findOne(),
)
// userQuery() → T | undefined (not Array<T>)
return <Show when={userQuery()}>{(user) => <div>{user().name}</div>}</Show>
```
### Suspense integration
```tsx
<ErrorBoundary fallback={(error) => <div>{error.message}</div>}>
<Suspense fallback={<div>Loading...</div>}>
<For each={todosQuery()}>{(todo) => <li>{todo.text}</li>}</For>
</Suspense>
</ErrorBoundary>
```
`useLiveQuery` integrates with Solid's `createResource`. Use `<Suspense>` for
loading and `<ErrorBoundary>` for errors. Reading an errored query throws
through the resource, so do not rely on reading `isError` after failure.
## Includes (Hierarchical Data)
When a query uses includes (subqueries in `select`), each child field is a live `Collection` by default. Subscribe to it with `useLiveQuery` in a subcomponent:
```tsx
function ProjectList() {
const projectsQuery = useLiveQuery((q) =>
q.from({ p: projectsCollection }).select(({ p }) => ({
id: p.id,
name: p.name,
issues: q
.from({ i: issuesCollection })
.where(({ i }) => eq(i.projectId, p.id))
.select(({ i }) => ({ id: i.id, title: i.title })),
})),
)
return (
<For each={projectsQuery()}>
{(project) => (
<div>
{project.name}
<IssueList issuesCollection={project.issues} />
</div>
)}
</For>
)
}
// Child component subscribes to the child Collection
function IssueList(props: { issuesCollection: Collection }) {
const issuesQuery = useLiveQuery(() => props.issuesCollection)
return <For each={issuesQuery()}>{(issue) => <div>{issue.title}</div>}</For>
}
```
Note: wrap the child Collection in an Accessor (`() => props.issuesCollection`) to match the overload signature.
With `toArray()`, child results are plain arrays and the parent re-emits on child changes:
```tsx
import { toArray, eq } from '@tanstack/solid-db'
const projectsQuery = useLiveQuery((q) =>
q.from({ p: projectsCollection }).select(({ p }) => ({
id: p.id,
name: p.name,
issues: toArray(
q
.from({ i: issuesCollection })
.where(({ i }) => eq(i.projectId, p.id))
.select(({ i }) => ({ id: i.id, title: i.title })),
),
})),
)
// project.issues is a plain array — no subcomponent needed
```
See db-core/live-queries/SKILL.md for full includes rules (correlation conditions, nested includes, aggregates).
## Common Mistakes
### HIGH Reading signals outside the query function
Wrong:
```tsx
const [userId] = createSignal(1)
const id = userId()
const query = useLiveQuery((q) =>
q.from({ todo: todoCollection }).where(({ todo }) => eq(todo.userId, id)),
)
```
Correct:
```tsx
const [userId] = createSignal(1)
const query = useLiveQuery((q) =>
q
.from({ todo: todoCollection })
.where(({ todo }) => eq(todo.userId, userId())),
)
```
Solid's reactivity tracks signal reads inside reactive contexts. Reading outside the query function captures the value at creation time — changes won't trigger re-execution.
Source: docs/framework/solid/overview.md
### MEDIUM Using deprecated query.data instead of query()
Wrong:
```tsx
<For each={todosQuery.data}>{(todo) => <li>{todo.text}</li>}</For>
```
Correct:
```tsx
<For each={todosQuery()}>{(todo) => <li>{todo.text}</li>}</For>
```
`query.data` is deprecated. Always use `query()` to access data. If you encounter existing code using `.data`, migrate it to the function call form.
See also: db-core/live-queries/SKILL.md — for query builder API.
See also: db-core/mutations-optimistic/SKILL.md — for mutation patterns.Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait Solid DB (TanStack)
Applique les pratiques du skill solid-db__tanstack-db__packages-solid-db-skills-3f7699a301ac.
Comment utiliser Solid DB (TanStack)
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour Solid DB (TanStack)
Dis simplement à ton agent quelque chose comme :
Applique le skill solid-db__tanstack-db__packages-solid-db-skills-3f7699a301ac à cette tâche
Utilise solid-db__tanstack-db__packages-solid-db-skills-3f7699a301ac pour améliorer cette implémentation
Passe en revue ce sujet avec solid-db__tanstack-db__packages-solid-db-skills-3f7699a301ac
Skills liés à Solid DB (TanStack)
Acceleration (Microsoft)
Compare synthetic acceleration options and clearly separate scenario value from forecast commitments.Account Overview (Microsoft)
Create a synthetic Acme account overview and identify evidence that merits seller attention.Acroform Writer (Microsoft)
Use this skill whenever the user wants values written INTO an existing PDF form that lives in the connected SharePoint knowledge source — filling out, completing, populating, or submitting a fillable PDF (application, intake sheet, contract, government form) from data they supply, a spreadsheet row, or the conversation. Triggers include "fill out the job application form", "complete the intake form for [person]", "populate our standard NDA template", and "make this ready to send / non-editable" (flatten). The source form should be found via knowledge search; only ask the user to upload it if knowledge search turns up nothing plausible. different task), and do NOT use it on scanned/image-only PDFs that have no real fillable fields — those need OCR or manual overlay instead, which this skill explicitly detects and reports rather than silently failing.