मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)33k · #8870

pb-api-rules

यह क्या करती है

यह स्किल बताती है कि PocketBase डेटाबेस में कौन डेटा पढ़ और बदल सकता है, इसे कैसे नियंत्रित करें। यह उन डेवलपर्स के लिए है जो PocketBase पर ऐप बना रहे हैं और अनुमतियाँ सही सेट करनी हैं।

कब इस्तेमाल करें

  • ✓जब आपको तय करना हो कि कौन रिकॉर्ड की सूची देख सकता है, देख सकता है, बना सकता है, बदल सकता है या हटा सकता है।
  • ✓जब आपका ऐप 403 या 404 जवाब देता है और आपको वह नियम ढूँढना है जो इसका कारण है।
  • ✓जब आपको ऐसा फ़िल्टर लिखना हो जो कुछ शर्तों से मेल खाने वाले रिकॉर्ड ढूँढे।

Skill का लिंक

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/pocketbase/pb-api-rules/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/pocketbase/pb-api-rules/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मुझे PocketBase नियम सेट करने में मदद कीजिए, ताकि यूज़र सिर्फ़ अपनी पोस्ट देख और बदल सकें।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट पाँच नियम प्रकारों में से हर एक के लिए फ़िल्टर अभिव्यक्तियाँ लिखता है, PocketBase के ऑपरेटर और macros इस्तेमाल करते हुए, और बताता है कि हर नियम किन अनुरोधों को नियंत्रित करता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

PocketBase API Rules & Filter Expressions

Rule Types

Each collection has 5 rule types. Each rule is a filter expression that must evaluate to true for the request to proceed.

Rule Controls Locked = Empty string =
List GET /api/collections/{name}/records superusers only everyone can list
View GET /api/collections/{name}/records/{id} superusers only everyone can view
Create POST /api/collections/{name}/records superusers only everyone can create
Update PATCH /api/collections/{name}/records/{id} superusers only everyone can update
Delete DELETE /api/collections/{name}/records/{id} superusers only everyone can delete

Critical: null/locked means only superusers can perform the action (regular users and guests are denied). Empty string "" means EVERYONE including guests. Superusers always bypass API rules entirely — see below.

Superuser Bypass

Superusers (formerly admins) always bypass API rules. Rules only apply to regular auth records and guests.

Filter Syntax

Operators

Operator Meaning Example
= Equal status = "active"
!= Not equal status != "draft"
> Greater than count > 5
>= Greater or equal count >= 5
< Less than count < 10
<= Less or equal count <= 10
~ LIKE (contains) title ~ "hello"
!~ NOT LIKE title !~ "spam"
?= Any/has (array contains) tags ?= "TAG_ID"
?!= None (array not contains) tags ?!= "TAG_ID"
?> Any greater than scores ?> 90
?>= Any greater or equal scores ?>= 90
?< Any less than scores ?< 10
?<= Any less or equal scores ?<= 10
?~ Any LIKE emails ?~ "@gmail.com"
?!~ Any NOT LIKE emails ?!~ "@test.com"

Critical: use ?= (not =) for multi-valued fields (multi-select, multi-relation, multi-file). = checks the raw JSON string, ?= checks individual values.

Logical Operators

status = "active" && author = @request.auth.id
status = "active" || status = "featured"

Parentheses for grouping: (a = 1 || b = 2) && c = 3

Values

  • Strings: "value" or 'value'
  • Numbers: 123, 45.67
  • Booleans: true, false
  • null — empty/missing value
  • Identifiers: field names, macros

Request Macros (@request.*)

Access the current request context in rules:

Macro Type Description
@request.auth.id string Current auth record ID (empty if guest)
@request.auth.email string Current auth record email
@request.auth.verified bool Whether email is verified
@request.auth.collectionId string Auth collection ID
@request.auth.collectionName string Auth collection name
@request.auth.* any Any field from the auth record
@request.body.fieldName any Field value from request body
@request.query.paramName string URL query parameter
@request.headers.name string Request header (lowercase key)
@request.method string HTTP method (GET/POST/PATCH/DELETE)

Auth record relations

You can traverse relations on the auth record:

@request.auth.team.owner = @request.auth.id

Collection Macros (@collection.*)

Cross-collection lookups without explicit joins:

@collection.memberships.user ?= @request.auth.id &&
@collection.memberships.team ?= team

This checks if a record exists in the memberships collection where the user matches the current auth user and the team matches the current record's team field.

Note: @collection.* performs an implicit EXISTS subquery. It's powerful but can be slow on large datasets — add indexes.

Field Modifiers

Use in create/update rules to validate specific field behaviors:

Modifier Works on Description
:isset @request.body.* True if the field was sent in the request (even if empty)
:changed record field True if the field value differs from current stored value (update only)
:length string/array Returns the length
:each array Applies the condition to each element
:lower string Lowercased value

Examples

// Only allow changing status if user is owner
status:changed = false || 
अक्सर पूछे जाने वाले सवाल

locked नियम का क्या मतलब है?

locked नियम का मतलब है कि वह कार्रवाई सिर्फ़ superusers कर सकते हैं। खाली नियम का मतलब है कि सभी, guests सहित, कर सकते हैं।

क्या superusers नियम मानते हैं?

नहीं। superusers हमेशा API नियमों को बायपास करते हैं।

फ़िल्टर के बारे में स्किल क्या कवर करती है?

यह फ़िल्टर सिंटैक्स, ऑपरेटर, macros और फ़ील्ड modifiers कवर करती है।

जानकारी

लेखक का मूल विवरण

API rules and filter expressions for PocketBase access control. Use when setting permissions, writing filter expressions, configuring who can access what, or debugging 403/404 responses. Covers all 5 rule types, filter syntax, operators, request/collection macros, and field modifiers.

repo: davila7/claude-code-templates

लोकप्रियता

GitHub स्टार
33k
रैंकिंग में स्थान
#8870
लाइसेंस
MIT
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

owasp-security

33k

आपके एजेंट को वेब ऐप, API, मोबाइल, कंटेनर और AI एजेंट्स के लिए OWASP सुरक्षा मार्गदर्शन सिखाती है, ताकि वह आम कमज़ोरियाँ पहचान सके और सुधार सुझा सके।

कोडिंगसिक्योरिटी

agent-management

33k

आपके एजेंट को AI Maestro कमांड-लाइन से AI एजेंट बनाने, सूची देखने, hibernate और wake करने, नाम बदलने और हटाने देती है, हर एजेंट के जीवन-चक्र को संभालते हुए।

AI और एजेंटएजेंट

agent-messaging

33k

Agent Messaging Protocol का उपयोग करके AI एजेंट्स के बीच हस्ताक्षरित संदेश भेजने, प्राप्त करने और उनका जवाब देने देती है, ज़्यादातर आपकी अपनी मशीन पर।

AI और एजेंटएजेंट

docs-search

33k

आपके एजेंट को फ़ंक्शन सिग्नेचर, क्लास परिभाषा और कमेंट के लिए ऑटो-जनरेटेड कोड डॉक्यूमेंटेशन खोजने देती है, ताकि कोड बदलने से पहले वह असली API जाँच सके।

कोडिंगसामान्य कोडिंग

मिलती-जुलती skills