# PocketBase Gotchas

> A scanner for PocketBase mistakes that fail silently — lost writes, filter injection, removed APIs and guest-writable rules.

PocketBase Gotchas is a paid AI agent skill on Agensi by Michal Burgermeister, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [Michal Burgermeister](https://www.agensi.io/creators/michal-burgermeister)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-10-16
- Security: scan passed (2026-10-16); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/pocketbase-gotchas
- Tags: database, api, security, pocketbase, javascript-sdk

## About this skill

PocketBase often fails silently instead of throwing errors. This skill identifies and fixes critical implementation mistakes in code, migrations, and live database configurations that lead to data loss or security breaches.

### What it does
- **Scans for silent write failures** by detecting concurrent SDK requests in loops or `Promise.all` missing the `requestKey`.
- **Audits API rules** in both migration files and the live `pb_data/data.db` to catch public access gaps.
- **Finds auth legacy errors** such as references to the removed `pb.admins` or superuser credentials leaked in frontend code.
- **Prevents filter injection** by flagging string concatenation in queries and suggesting safe `pb.filter` placeholders.
- **Fixes React Strict Mode bugs** involving shared `useRef` flags that cause discarded fetch data.

### How it works
1. **Run the bundled scanner** using `python3 scripts/pb_scan.py <project-dir>` to generate a report of high-priority violations.
2. **Review the JS SDK implementation** specifically for `autoCancellation` behavior and batch API settings.
3. **Verify collection schemas** against code to ensure fields aren't being silently dropped due to typos.
4. **Audit API rules** using a normal user context to confirm that empty rules aren't exposing private records.

### Frameworks & tools
Works with PocketBase (v0.23+), the PocketBase JavaScript SDK, and React (Strict Mode). The included scanner requires Python 3.9+.

### Why this beats prompting it yourself
Generic LLMs often suggest deprecated v0.22 patterns like `pb.admins` or miss that PocketBase returns a 200 OK even when a write fails due to a field typo. This skill uses a specialized static analysis script to verify the actual state of your `data.db` API rules, which prompts alone cannot see.

### Use cases
- Auditing a project before deployment to ensure no superuser keys are in the browser bundle.
- Debugging why only the last record in a loop is being saved to the database.
- Hardening security rules after changing collections in the Admin UI.
- Migrating older PocketBase implementations to the v0.23+ superuser and autodate patterns.

### Known limitations
Does not support PocketBase versions earlier than v0.23. Cannot verify field names that are generated dynamically at runtime.

## Requires

- Python 3.9+
- PocketBase (v0.23+)

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the PocketBase Gotchas skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific PocketBase issues does this skill detect that a standard linter might miss?

PocketBase-specific silent failures: concurrent writes lost to SDK auto-cancellation, filters built from user input, the removed pb.admins API, superuser logins shipped to the browser, and guest-writable API rules — including rules changed in the dashboard that never reached your migrations.

### What is included?

The scanner scripts/pb_scan.py (Python 3.9+, standard library, read-only) with 26 tests, the review checklist in SKILL.md for what a scanner cannot see (field names, autodate, UTC dates), and README.md.

### Which versions of PocketBase and the JavaScript SDK are supported?

It is fully compatible with PocketBase v0.23 and newer; it is not recommended for projects using legacy v0.22 syntax, as the auth patterns and superuser structures changed significantly.

### Does this skill only analyze code, or does it also check my live database configuration?

The bundled scanner performs a deep audit of both your migration files and the live 'pb_data/data.db' rules, ensuring your actual database configuration matches your intended security posture.

### Is this skill effective for debugging PocketBase issues within React environments?

Yes, it includes specific detection and remediation steps for React Strict Mode bugs, particularly focusing on shared 'useRef' flags that cause fetch data to be discarded.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
