pb-sdk
यह क्या करती है
यह स्किल आपके एजेंट को दिखाती है कि front-end या Node प्रोजेक्ट में PocketBase JavaScript client कैसे इस्तेमाल करें। यह उन डेवलपर्स के लिए है जो वेबसाइट या ऐप को PocketBase डेटा से जोड़ते हैं।
कब इस्तेमाल करें
- ✓जब आप चाहते हैं कि आपका वेब या Node ऐप PocketBase रिकॉर्ड पढ़े या लिखे।
- ✓जब आपको यूज़र्स का साइन-अप, लॉगिन या लॉगिन बनाए रखना हो।
- ✓जब आप चाहते हैं कि रिकॉर्ड बदलने पर लाइव अपडेट मिलें।
Skill का लिंक
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/pocketbase/pb-sdk/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे React ऐप को PocketBase से जोड़िए, ताकि यूज़र लॉगिन करें और अपने रिकॉर्ड लाइव देखें।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट client सेट करता है, फिर queries, बनाने और बदलने, auth store के साथ प्रमाणीकरण, फ़ाइल संभालने, बैच ऑपरेशन और realtime subscriptions के लिए कॉल इस्तेमाल करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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
अक्सर पूछे जाने वाले सवाल
इसे कैसे इंस्टॉल करूँ?
npm या yarn से pocketbase पैकेज इंस्टॉल करें, या CDN script tag से लोड करें।
क्या यह realtime सपोर्ट करता है?
हाँ। यह server-sent events का इस्तेमाल करके realtime subscriptions कवर करता है।
क्या यह फ़ाइलें अपलोड कर सकता है?
हाँ। स्किल में अपलोड के लिए फ़ाइल संभालना शामिल है।
जानकारी
लेखक का मूल विवरण
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.
लोकप्रियता
- GitHub स्टार
- 33k
- रैंकिंग में स्थान
- #8875
- लाइसेंस
- MIT
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
owasp-security
33kआपके एजेंट को वेब ऐप, API, मोबाइल, कंटेनर और AI एजेंट्स के लिए OWASP सुरक्षा मार्गदर्शन सिखाती है, ताकि वह आम कमज़ोरियाँ पहचान सके और सुधार सुझा सके।
agent-management
33kआपके एजेंट को AI Maestro कमांड-लाइन से AI एजेंट बनाने, सूची देखने, hibernate और wake करने, नाम बदलने और हटाने देती है, हर एजेंट के जीवन-चक्र को संभालते हुए।
agent-messaging
33kAgent Messaging Protocol का उपयोग करके AI एजेंट्स के बीच हस्ताक्षरित संदेश भेजने, प्राप्त करने और उनका जवाब देने देती है, ज़्यादातर आपकी अपनी मशीन पर।
docs-search
33kआपके एजेंट को फ़ंक्शन सिग्नेचर, क्लास परिभाषा और कमेंट के लिए ऑटो-जनरेटेड कोड डॉक्यूमेंटेशन खोजने देती है, ताकि कोड बदलने से पहले वह असली API जाँच सके।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।