PocketBase Collections

Designs PocketBase collection schemas, field types, relations, and indexes.

30.5k|3.5k|Updated Jul 4, 2025
One-click install
npx skills add https://github.com/davila7/claude-code-templates --skill pocketbase-collections
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: PocketBase Collections
Source: https://github.com/davila7/claude-code-templates/tree/main/cli-tool/components/skills/pocketbase/pb-collections
Command: npx skills add https://github.com/davila7/claude-code-templates --skill pocketbase-collections

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Designing PocketBase collections involves subtle pitfalls like wrong field types, unexpected zero-value defaults, and misconfigured relation cascading. This Skill provides the reference knowledge needed to create collections, choose field types, and set up relations correctly the first time.

Core Features & Use Cases

  • Collection Type Guidance: Explains base, auth, and view collections, including SQL-backed view collections for aggregations and joins.
  • Field Type Reference: Documents all field types with their Go types, zero-value defaults, and modifiers like required, unique, hidden, and presentable.
  • Relation Patterns: Covers one-to-many, many-to-many, self-referencing relations, back-relations, and cascade delete behavior.
  • Use Case: When building a blog backend, use this Skill to design a posts collection with an author relation to users, a tags many-to-many relation, proper indexes on filtered fields, and cascade delete rules.

Quick Start

Ask the AI to design a PocketBase posts collection with an author relation, tags, and appropriate indexes using this skill.

Frequently Asked Questions about PocketBase Collections

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a many-to-many relation in PocketBase?

Create a relation field with maxSelect set to 0 for unlimited selections, such as posts.tags pointing to a tags collection. Filter records using the contains operator, for example tags ?= "TAG_ID".

What field types does PocketBase support for collections?

PocketBase supports text, editor, number, bool, email, url, date, select, file, relation, json, autodate, and password field types. All types default to their zero value rather than null, except json which is the only nullable type.

Does PocketBase cascade delete related records?

Yes, set cascadeDelete to true on a relation field so that deleting the referenced record also deletes all records pointing to it. The default is false, which sets the relation field to an empty string instead.

When should I use a view collection in PocketBase?

Use a view collection for read-only aggregations, joins, or computed data backed by a SQL SELECT query. View collections support list and view API rules and can be used in relations, but do not allow create, update, or delete operations.

Why is my PocketBase field empty instead of null?

PocketBase fields default to their zero value, such as an empty string for text or 0 for numbers, not null. Only json fields can hold an actual null value, so use json if nullability is required.