pb-sdk
What it does
This skill shows your agent how to use the PocketBase JavaScript client in front-end or Node projects. It is for developers connecting a website or app to PocketBase data.
When to use it
- ✓When you want your web or Node app to read or write PocketBase records.
- ✓When you need users to sign up, log in or stay logged in.
- ✓When you want live updates when records change.
Skill link
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/pocketbase/pb-sdk/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Connect my React app to PocketBase so users can log in and see their own records live.”
5 new skills a week. 1 minute to read.
How it works
The agent sets up the client, then uses calls for queries, creates and updates, authentication with the auth store, file handling, batch operations and realtime subscriptions.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
PocketBase JavaScript SDK
Installation & Setup
npm install pocketbase
# or
yarn add pocketbase
# or
<script src="https://cdn.jsdelivr.net/npm/pocketbase@0.36.6/dist/pocketbase.umd.js"></script>
import PocketBase from 'pocketbase'
const pb = new PocketBase('http://127.0.0.1:8090')
CRUD Operations
List records
const records = await pb.collection('posts').getList(1, 20, {
filter: 'status = "active" && created > "2024-01-01"',
sort: '-created,title',
expand: 'author,tags',
fields: 'id,title,author,created', // partial response
skipTotal: true, // skip COUNT query for better performance
})
// records.page, records.perPage, records.totalItems, records.totalPages, records.items
Get full list (auto-paginate)
const allRecords = await pb.collection('posts').getFullList({
filter: 'status = "active"',
sort: '-created',
batch: 200, // records per request (default: 200)
})
View single record
const record = await pb.collection('posts').getOne('RECORD_ID', {
expand: 'author',
})
Get first matching record
const record = await pb.collection('posts').getFirstListItem('slug = "my-post"', {
expand: 'author',
})
Create record
const record = await pb.collection('posts').create({
title: 'My Post',
body: 'Content here',
author: 'USER_ID',
status: 'draft',
})
Update record
const record = await pb.collection('posts').update('RECORD_ID', {
title: 'Updated Title',
status: 'published',
})
Delete record
await pb.collection('posts').delete('RECORD_ID')
Query Parameters
Filter syntax
Same as API rules filter syntax. Common patterns:
// Equality
filter: 'status = "active"'
// Contains (LIKE)
filter: 'title ~ "hello"'
// Multi-relation contains
filter: 'tags ?= "TAG_ID"'
// Date comparison
filter: 'created > "2024-01-01 00:00:00"'
// Relative dates
filter: 'created > @now - 7d'
// Logical operators
filter: 'status = "active" && author = "USER_ID"'
filter: '(type = "a" || type = "b") && active = true'
// Null check
filter: 'parent = null'
filter: 'parent != null'
Sort syntax
sort: '-created' // descending by created
sort: 'title' // ascending by title
sort: '-created,title' // multi-field sort
sort: '@random' // random order
Expand relations
expand: 'author' // single relation
expand: 'author,tags' // multiple relations
expand: 'author.team' // nested expand (author's team)
expand: 'comments_via_post' // back-relation (comments that reference this post)
expand: 'comments_via_post.author' // nested back-relation expand
Fields (partial response)
fields: 'id,title,created'
fields: 'id,expand.author.name' // include expanded field
fields: '*,expand.author.name' // all fields + specific expand
Authentication
Email/password
const authData = await pb.collection('users').authWithPassword('user@example.com', 'password123')
// authData.token, authData.record
OAuth2 (all-in-one)
// Opens popup/redirect for OAuth2 provider
const authData = await pb.collection('users').authWithOAuth2({ provider: 'google' })
// or with redirect
const authData = await pb.collection('users').authWithOAuth2({
provider: 'google',
urlCallback: (url) => { window.location.href = url }
})
OTP (one-time password)
// Step 1: Request OTP
const result = await pb.collection('users').requestOTP('user@example.com')
// result.otpId
// Step 2: Verify OTP
const authData = await pb.collection('users').authWithOTP(result.otpId, '123456')
MFA (multi-factor authentication)
MFA is triggered automatically when enabled. After primary auth returns a mfaId:
try {
await pb.collection('users').authWithPassword('user@example.com', 'password')
} catch (err) {
if (err.response?.mfaId) {
// Need second factor — e.g., OTP
const otpResult = await pb.collection('users').requestOTP('user@example.com')
await pb.collection('users').authWithOTP(otpResult.otpId, '123456', {
mfaId: err.response.mfaId
})
}
}
Auth store
pb.authStore.token // current JWT token
pb.authStore.record // current auth record
pb.authStore.isValid // token not expired
pb.authStore.isAdmin // deprecated — c
FAQ
How do I install it?
Install the pocketbase package with npm or yarn, or load it from a CDN script tag.
Does it support realtime?
Yes. It covers realtime subscriptions using server-sent events.
Can it upload files?
Yes. The skill includes file handling for uploads.
Details
Original description by the author
JavaScript SDK usage for PocketBase client applications. Use when calling PocketBase from frontend or Node.js, authenticating users, subscribing to realtime events, uploading files, or working with the PocketBase JS/TS SDK. Covers CRUD, auth flows, authStore, realtime SSE, file handling, batch operations, and query syntax.
Popularity
- GitHub stars
- 33k
- Ranking position
- #8875
- License
- MIT
- Updated
- 11/2/2026
Comments
- …
More skills from this repository
owasp-security
33kTeaches your agent OWASP security guidance for web apps, APIs, mobile, containers and AI agents, so it can spot common weaknesses and suggest fixes.
agent-management
33kLets your agent create, list, hibernate, wake, rename and delete AI agents using the AI Maestro command line, managing each agent's lifecycle.
agent-messaging
33kLets your agent send, receive and reply to signed messages between AI agents, using the Agent Messaging Protocol, mostly on your own machine.
docs-search
33kLets your agent search auto-generated code documentation for function signatures, class definitions and comments, so it checks the real API before changing code.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.