anvil-stack-payload

Guides Payload CMS development with TypeScript patterns for collections, fields, hooks, and access control.

1|Updated Aug 27, 2026
One-click install
npx skills add https://github.com/rogerznts/anvil --skill anvil-stack-payload-rogerznts
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: anvil-stack-payload
Source: https://github.com/rogerznts/anvil/tree/main/anvil/.claude/skills/anvil-stack-payload
Command: npx skills add https://github.com/rogerznts/anvil --skill anvil-stack-payload-rogerznts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Payload CMS development involves subtle pitfalls that cause security holes and data corruption: Local API operations bypass access control by default, nested hook operations without req break transaction atomicity, and hooks can trigger infinite loops. This Skill provides expert guidance and reference documentation to avoid these traps and implement Payload correctly. ## Core Features & Use Cases - Quick Reference Table: Maps 27 common tasks (slugs, drafts, row-level security, transactions, jobs, plugins) directly to solutions and detailed reference docs. - Security Pitfall Coverage: Documents the three critical traps — overrideAccess: false for Local API, threading req through nested operations, and context flags to prevent hook loops — with correct/incorrect code examples. - Eleven Reference Documents: Deep coverage of fields, collections, hooks, access control (basic and advanced), queries, endpoints, database/storage/email adapters, type guards, and plugin development. - Use Case: When building a multi-tenant Payload app, use this Skill to implement tenant-scoped access control with query constraints, auto-set tenant fields in beforeChange hooks, and keep all nested operations in the same transaction. ## Quick Start Ask the agent how to implement row-level access control or any Payload pattern, and it will apply the correct collection, hook, and query configuration.

Frequently Asked Questions about anvil-stack-payload

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

FAQPage Schema
How do I implement row-level access control in Payload CMS?▼

Return a Where query constraint from a collection access function instead of a boolean, such as { author: { equals: user.id } }. Query constraints work only on collection-level read access; field-level access supports boolean returns only.

Why does Payload Local API ignore my user's permissions?▼

Local API operations bypass access control by default, even when you pass a user. Set overrideAccess: false alongside the user parameter to enforce that user's permissions; otherwise the operation runs with full privileges.

How do I prevent infinite loops in Payload hooks?▼

Pass a flag through the context object, such as context: { skipHooks: true }, on the nested operation and check it at the start of the hook to return early. Without this guard, an afterChange hook that updates the same collection re-triggers itself indefinitely.

Does Payload support transactions in MongoDB and SQLite?▼

MongoDB transactions require a replica set configuration, and SQLite transactions are disabled by default but can be enabled with transactionOptions: {}. Always pass req to nested operations in hooks so they join the same transaction.

How do I auto-generate slugs in Payload collections?▼

Use the slugField() helper instead of hand-rolling a unique text field. It generates the slug from the title by default, adds a regenerate toggle, and handles uniqueness and indexing; pass useAsSlug to source from a different field.

When should I use field-level hooks versus collection hooks in Payload?▼

Use field-level hooks inside a field's hooks object when computing or formatting a single field's value, such as virtual fields with afterRead. Use collection hooks for cross-field business logic that acts on the whole document.