payload-cms

payload-cms is a cursor rule for Cursor from nedcodes-ok/cursorrules-collection. It costs 734 tokens per session, scanned A, original, MIT.

A set of guidelines for configuring Payload CMS, a content management system for defining editable collections, fields, admin screens, and permissions in code.

In plain words
What is it for?
Use it to define collections and fields, generate TypeScript types, customize the admin interface, add data hooks, and control access.
Why use it?
It helps keep content structures, validation, access rules, and administrative views explicit and maintainable.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nedcodes-ok/cursorrules-collection/payload-cms
Clone the repo
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collection

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for payload-cms

README.md
[![agentmods](https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/payload-cms.svg)](https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/payload-cms)
Your own site
<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/payload-cms"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/payload-cms.svg" alt="Measured on agentmods" height="20"></a>
Per session 734 This file is loaded in full into every session.
When invoked 734 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00734 $0.00734
Opus 5 $0.00367 $0.00367
Sonnet 5 $0.00147 $0.00147
Haiku 4.5 $0.00073 $0.00073

Measured 2d ago against content hash cb15c35990e7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

payload-cms scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules-mdc/tools/payload-cms.mdc · 63 lines

How it starts

The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Payload CMS Cursor Rules

You are an expert in Payload CMS (v3+). Follow these rules:

Collections

  • Define collections in separate files, export from payload.config.ts
  • Use TypeScript-first config, every collection gets generated types via payload generate:types
  • Set slug to lowercase kebab-case matching the filename
  • Always define access control on every collection, never leave defaults in production
  • Use admin.useAsTitle to set which field displays in the admin list view
  • Group related collections with admin.group

Fields

  • Use the most specific field type: email not text for emails, number not text for counts
  • Set required: true explicitly on mandatory fields
  • Use validate functions for custom validation, return a string on error
  • Relationship fields: set hasMany explicitly, use relationTo with collection slugs
  • Rich text: use Lexical editor (default in v3), configure toolbar features explicitly
  • Use tabs and collapsible for organizing complex field schemas
  • Define reusable field groups as shared configs, not copy-paste

Hooks

  • Use beforeChange for data transformation, validation, and slug generation
  • Use afterChange for side effects (emails, webhooks, cache invalidation)
  • Use beforeRead / afterRead for computed fields or data enrichment
  • Keep hooks focused on one concern, chain multiple hooks for complex logic
  • Always type hook arguments: CollectionBeforeChangeHook<YourType>
  • Access req.user in hooks for auth context, req.payload for API calls

Access Control

  • Define access.create, access.read, access.update, access.delete on every collection
  • Return true/false for simple rules, return a Where query for field-level filtering
  • Use req.user to check roles/permissions, never trust client-side data
  • Create a reusable isAdmin access function, don't repeat role checks
  • Field-level access via access.read and access.update on individual fields

API Usage

  • Use the Local API (payload.find, payload.create) in server-side code, not REST
  • Always pass depth to control relationship population, default can be expensive
  • Use where queries with proper operators (equals, contains, in)
  • Paginate with limit and page, never fetch all documents without limits
  • Use select to fetch only needed fields when performance matters

Read the full file on GitHub · 63 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 63 lines · 734 tokens per session scan A cb15c35990e7

Subscribe to this mod's changes

payload-cms is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (37 stars, last pushed 6mo ago), licensed MIT. It adds 734 tokens to every session, about $0.0037 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.