Agent skill · software engineering · davila7
PocketBase Hooks
Server-side JavaScript hooks for PocketBase (pb_hooks). Use when writing custom routes, event hooks, cron jobs, sending emails, making HTTP requests, querying the database, or extending PocketBase with server-side logic. Covers the goja ES5 runtime, routing, middleware, all event hooks, DB queries, record operations, and global APIs.
Why this skill is useful
Provides specific server-side JavaScript patterns and commands for PocketBase that the AI wouldn't reliably generate on its own.
What it needs
About 8k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.
What this skill does
PocketBase Server-Side JavaScript (pbhooks) Runtime Basics Files go in pbhooks/.pb.js (must end with .pb.js) Engine: goja — ES5.1 + some ES6. No ES6 modules (import/export), no async/await, no arrow functions in older versions. Use function(){} and CommonJS require(). Each file is loaded on app start and on hot-reload hooks — absolute path to the pbhooks directory TypeScript declarations: pbdata/types.d.ts (auto-generated, useful for IDE support) --hooksPool=25 flag controls concurrent JS goroutines (default: 25) Each handler runs in an isolated context — no shared mutable state between requests Routing Adding routes Path patterns {name} — named path parameter {path...} — wildcard (matches rest of path) {$} — exact match (no trailing slash) Response methods Method Usage -------- ------- e.json(status, data) JSON response e.string(status, text) Plain text e.html(status, html) HTML response e.redirect(status, url) Redirect (301/302) e.blob(status, contentType, bytes) Binary data e.stream(status, contentType, reader) Streaming response e.noContent(status) No body (204) Reading request data Middleware Built-in middleware Global middleware Custom route middleware Priority: middleware runs in order — first registered, first executed. Event Hooks Record lifecycle Each record event has 3 variants: onRecordExecute — wraps the default action. Call e.next() to proceed. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills davila7/pb-hooks