pb-api-rules
Skill by davila7
Explains PocketBase API rules and filter expressions for access control. Useful for setting permissions, writing filters, and debugging 403 or 404 responses.
Install pb-api-rules
Built from the published package, never by AI.
git clone --depth 1 https://github.com/davila7/claude-code-templates /tmp/claude-code-templates && mkdir -p ~/.claude/skills && cp -r /tmp/claude-code-templates/cli-tool/components/skills/pocketbase/pb-api-rules ~/.claude/skills/pb-api-rulesRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/davila7/claude-code-templates /tmp/claude-code-templates && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/claude-code-templates/cli-tool/components/skills/pocketbase/pb-api-rules ~/.gemini/antigravity-cli/skills/pb-api-rulesAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The pb-api-rules skill is a reference for access control in PocketBase. It covers the five rule types for each collection (list, view, create, update, delete), where a locked rule means only superusers can act and an empty string means everyone can. It also covers the filter syntax, operators, request and collection macros, field modifiers, datetime macros and geoDistance().
Rules are filter expressions that must evaluate to true for a request to proceed. Superusers bypass API rules, which apply only to regular auth records and guests. The skill includes common patterns such as owner-only access, verified users only, team membership, and time-limited access. It is for anyone setting or debugging PocketBase permissions.
Written from the project's SKILL.md and checked against it.
What it can do
- Rule typesExplains the list, view, create, update and delete rules set on each collection.
- Filter operatorsCovers comparison, LIKE and array operators such as ?= for multi-valued fields.
- Request macrosDescribes @request.auth, @request.body, @request.query, @request.headers and @request.method.
- Collection macrosShows cross-collection lookups with @collection.* without explicit joins.
- Field modifiersCovers :isset, :changed, :length, :each and :lower for create and update rules.
- Datetime macrosLists macros such as @now, @todayStart and @monthEnd, with arithmetic examples.
- geoDistance()Shows location-based filtering that returns distance in meters.
- Common patternsProvides rule examples for owner-only, verified-only, role-based and team access.
Try asking
- Write a PocketBase list rule so only the record author can view posts
- Why does my PocketBase API return 403 when updating a record?
- Write a filter that matches records where any tag equals a given ID
Good to know
- Superusers always bypass API rules.
- Rules apply only to regular auth records and guests.
- @collection.* performs an implicit EXISTS subquery and can be slow on large datasets.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: cli-tool/components/skills/pocketbase/pb-api-rules/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md7 KB
Alternatives to pb-api-rules
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
pb-api-rules: common questions
What does a locked rule mean in PocketBase?
A locked or null rule means only superusers can perform that action. Regular users and guests are denied.
When should I use ?= instead of = in a PocketBase filter?
Use ?= for multi-valued fields such as multi-select, multi-relation and multi-file fields. The source says = checks the raw JSON string, while ?= checks individual values.
What does an empty string rule allow?
An empty string means everyone, including guests, can perform that action.
How do I install pb-api-rules?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is pb-api-rules free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is pb-api-rules safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to pb-api-rules?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
