[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75MMVPQ09DQTCWVKX2S29M9":3,"skill-same:01M75MMVPQ09DQTCWVKX2S29M9":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M75MMVPQ09DQTCWVKX2S29M9","payload",null,"Use when working with Payload projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.","whimzyLive\u002Fnightshift-ai","whimzyLive","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F22066605?v=4","01M75MMH22XX6R3NTAFHD7HEN7","Rushi Patel","01M75MMH32DHVVC61XRSHWVEV2",3,"MIT","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: payload\ndescription: Use when working with Payload projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.\n---\n\n# Payload Application Development\n\nPayload is a Next.js native CMS with TypeScript-first architecture, providing admin panel, database management, REST\u002FGraphQL APIs, authentication, and file storage.\n\n## Quick Reference\n\n| Task                     | Solution                                                                   | Details                                                                                                                          |\n| ------------------------ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| Auto-generate slugs      | `slugField()`                                                              | [FIELDS.md#slug-field-helper](reference\u002FFIELDS.md#slug-field-helper)                                                             |\n| Restrict content by user | Access control with query                                                  | [ACCESS-CONTROL.md#row-level-security-with-complex-queries](reference\u002FACCESS-CONTROL.md#row-level-security-with-complex-queries) |\n| Local API user ops       | `user` + `overrideAccess: false`                                           | [QUERIES.md#access-control-in-local-api](reference\u002FQUERIES.md#access-control-in-local-api)                                       |\n| Draft\u002Fpublish workflow   | `versions: { drafts: true }`                                               | [COLLECTIONS.md#versioning--drafts](reference\u002FCOLLECTIONS.md#versioning--drafts)                                                 |\n| Computed fields          | `virtual: true` with **field-level** `hooks.afterRead` returning the value | [FIELDS.md#virtual-fields](reference\u002FFIELDS.md#virtual-fields)                                                                   |\n| Conditional fields       | `admin.condition`                                                          | [FIELDS.md#conditional-fields](reference\u002FFIELDS.md#conditional-fields)                                                           |\n| Custom field validation  | `validate` function                                                        | [FIELDS.md#validation](reference\u002FFIELDS.md#validation)                                                                           |\n| Filter relationship list | `filterOptions` on field                                                   | [FIELDS.md#relationship](reference\u002FFIELDS.md#relationship)                                                                       |\n| Select specific fields   | `select` parameter                                                         | [QUERIES.md#field-selection](reference\u002FQUERIES.md#field-selection)                                                               |\n| Auto-set author\u002Fdates    | beforeChange hook                                                          | [HOOKS.md#collection-hooks](reference\u002FHOOKS.md#collection-hooks)                                                                 |\n| Prevent hook loops       | `req.context` check                                                        | [HOOKS.md#context](reference\u002FHOOKS.md#context)                                                                                   |\n| Cascading deletes        | beforeDelete hook                                                          | [HOOKS.md#collection-hooks](reference\u002FHOOKS.md#collection-hooks)                                                                 |\n| Geospatial queries       | `point` field with `near`\u002F`within`                                         | [FIELDS.md#point-geolocation](reference\u002FFIELDS.md#point-geolocation)                                                             |\n| Reverse relationships    | `join` field type                                                          | [FIELDS.md#join-fields](reference\u002FFIELDS.md#join-fields)                                                                         |\n| Next.js revalidation     | Context control in afterChange                                             | [HOOKS.md#nextjs-revalidation-with-context-control](reference\u002FHOOKS.md#nextjs-revalidation-with-context-control)                 |\n| Query by relationship    | Nested property syntax                                                     | [QUERIES.md#nested-properties](reference\u002FQUERIES.md#nested-properties)                                                           |\n| Complex queries          | AND\u002FOR logic                                                               | [QUERIES.md#andor-logic](reference\u002FQUERIES.md#andor-logic)                                                                       |\n| Transactions             | Pass `req` to operations                                                   | [ADAPTERS.md#threading-req-through-operations](reference\u002FADAPTERS.md#threading-req-through-operations)                           |\n| Background jobs          | Jobs queue with tasks                                                      | [ADVANCED.md#jobs-queue](reference\u002FADVANCED.md#jobs-queue)                                                                       |\n| Custom API routes        | Collection custom endpoints                                                | [ADVANCED.md#custom-endpoints](reference\u002FADVANCED.md#custom-endpoints)                                                           |\n| Cloud storage            | Storage adapter plugins                                                    | [ADAPTERS.md#storage-adapters](reference\u002FADAPTERS.md#storage-adapters)                                                           |\n| Multi-language           | `localization` config + `localized: true`                                  | [ADVANCED.md#localization](reference\u002FADVANCED.md#localization)                                                                   |\n| Create plugin            | `(options) => (config) => Config`                                          | [PLUGIN-DEVELOPMENT.md#plugin-architecture](reference\u002FPLUGIN-DEVELOPMENT.md#plugin-architecture)                                 |\n| Plugin package setup     | Package structure with SWC                                                 | [PLUGIN-DEVELOPMENT.md#plugin-package-structure](reference\u002FPLUGIN-DEVELOPMENT.md#plugin-package-structure)                       |\n| Add fields to collection | Map collections, spread fields                                             | [PLUGIN-DEVELOPMENT.md#adding-fields-to-collections](reference\u002FPLUGIN-DEVELOPMENT.md#adding-fields-to-collections)               |\n| Plugin hooks             | Preserve existing hooks in array                                           | [PLUGIN-DEVELOPMENT.md#adding-hooks](reference\u002FPLUGIN-DEVELOPMENT.md#adding-hooks)                                               |\n| Check field type         | Type guard functions                                                       | [FIELD-TYPE-GUARDS.md](reference\u002FFIELD-TYPE-GUARDS.md)                                                                           |\n\n## Quick Start\n\n```bash\nnpx create-payload-app@latest my-app\ncd my-app\npnpm dev\n```\n\n### Minimal Config\n\n```ts\nimport { buildConfig } from 'payload';\nimport { mongooseAdapter } from '@payloadcms\u002Fdb-mongodb';\nimport { lexicalEditor } from '@payloadcms\u002Frichtext-lexical';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst filename = fileURLToPath(import.meta.url);\nconst dirname = path.dirname(filename);\n\nexport default buildConfig({\n  admin: {\n    user: 'users',\n    importMap: {\n      baseDir: path.resolve(dirname),\n    },\n  },\n  collections: [Users, Media],\n  editor: lexicalEditor(),\n  secret: process.env.PAYLOAD_SECRET,\n  typescript: {\n    outputFile: path.resolve(dirname, 'payload-types.ts'),\n  },\n  db: mongooseAdapter({\n    url: process.env.DATABASE_URL,\n  }),\n});\n```\n\n## Essential Patterns\n\n### Defaults & Conventions\n\nApply these defaults when modeling content unless there's a clear reason not to:\n\n- **Enable drafts\u002Fversions by default:** `versions: { drafts: true }`. This is the\n  recommended starting point for any content collection. It auto-injects a\n  `_status` field (`draft` \u002F `published` \u002F `changed`) — **don't add your own\n  `status` field**, it's redundant. Only skip versions for collections that have\n  no publish\u002Fdraft lifecycle (e.g. internal join tables, settings).\n- **Use `slugField()` for all slugs** instead of hand-rolling\n  `{ name: 'slug', type: 'text', unique: true }`. It auto-generates the slug from\n  the title, adds a regenerate toggle, and handles uniqueness\u002Findexing for you.\n  It defaults to generating from a `title` field — if the collection has no\n  `title`, pass the source field: `slugField({ useAsSlug: 'name' })`.\n- **`position: 'sidebar'` is for short, at-a-glance fields** — status, category,\n  author, publish date. Avoid it for long fields that need horizontal space to be\n  usable (description, rich text content, long text). Those belong in the main\n  document area.\n\n### Basic Collection\n\n```ts\nimport type { CollectionConfig } from 'payload';\nimport { slugField } from 'payload';\n\nexport const Posts: CollectionConfig = {\n  slug: 'posts',\n  admin: {\n    useAsTitle: 'title',\n    \u002F\u002F _status (from versions.drafts) shows the draft\u002Fpublished state — no custom status field needed\n    defaultColumns: ['title', 'author', '_status', 'createdAt'],\n  },\n  versions: {\n    drafts: true,\n  },\n  fields: [\n    { name: 'title', type: 'text', required: true },\n    slugField(), \u002F\u002F auto-generates from `title`, unique + indexed, sidebar position\n    { name: 'content', type: 'richText' }, \u002F\u002F long field — stays in the main area, not the sidebar\n    \u002F\u002F short, at-a-glance field — good sidebar candidate\n    { name: 'author', type: 'relationship', relationTo: 'users', admin: { position: 'sidebar' } },\n  ],\n  timestamps: true,\n};\n```\n\nFor more collection patterns (auth, upload, drafts, live preview), see [COLLECTIONS.md](reference\u002FCOLLECTIONS.md).\n\n### Common Fields\n\n```ts\n\u002F\u002F Text field\n{ name: 'title', type: 'text', required: true }\n\n\u002F\u002F Relationship\n{ name: 'author', type: 'relationship', relationTo: 'users', required: true }\n\n\u002F\u002F Rich text\n{ name: 'content', type: 'richText', required: true }\n\n\u002F\u002F Slug — use the helper instead of a hand-rolled text field\nslugField()\n\n\u002F\u002F Select (for genuine taxonomy — NOT publish state; use versions.drafts + _status for that)\n{ name: 'category', type: 'select', options: ['news', 'tutorial', 'opinion'] }\n\n\u002F\u002F Upload\n{ name: 'image', type: 'upload', relationTo: 'media' }\n```\n\nFor all field types (array, blocks, point, join, virtual, conditional, etc.), see [FIELDS.md](reference\u002FFIELDS.md).\n\n### Hook Example\n\nHooks live at one of two levels and they are not interchangeable. **Collection hooks** receive `{ doc, data, req, operation, ... }` and act on the whole document. **Field hooks** live inside an individual field's `hooks` object, receive `{ value, siblingData, ... }`, and **return the new value** for that field. Computed\u002Fvirtual fields, per-field formatters, and per-field access masking are field hooks; cross-field business logic is a collection hook.\n\n```ts\n\u002F\u002F Collection-level: business logic across the document\nexport const Posts: CollectionConfig = {\n  slug: 'posts',\n  hooks: {\n    beforeChange: [\n      async ({ data, operation }) => {\n        if (operation === 'create') {\n          data.slug = slugify(data.title);\n        }\n        return data;\n      },\n    ],\n  },\n  fields: [{ name: 'title', type: 'text' }],\n};\n\n\u002F\u002F Field-level: compute \u002F format a single field's value (virtual fields use this)\nexport const Users: CollectionConfig = {\n  slug: 'users',\n  fields: [\n    { name: 'firstName', type: 'text' },\n    { name: 'lastName', type: 'text' },\n    {\n      name: 'fullName',\n      type: 'text',\n      virtual: true,\n      hooks: {\n        afterRead: [({ siblingData }) => `${siblingData.firstName} ${siblingData.lastName}`],\n      },\n    },\n  ],\n};\n```\n\nWhen asked to \"compute a field\" or \"populate a field's value in a hook\", use a **field-level** hook on that field — never a collection-level `afterRead` that mutates `doc`.\n\nFor all hook patterns, see [HOOKS.md](reference\u002FHOOKS.md). For access control, see [ACCESS-CONTROL.md](reference\u002FACCESS-CONTROL.md).\n\n### Access Control with Type Safety\n\n```ts\nimport type { Access } from 'payload';\nimport type { User } from '@\u002Fpayload-types';\n\n\u002F\u002F Type-safe access control\nexport const adminOnly: Access = ({ req }) => {\n  const user = req.user as User;\n  return user?.roles?.includes('admin') || false;\n};\n\n\u002F\u002F Row-level access control\nexport const ownPostsOnly: Access = ({ req }) => {\n  const user = req.user as User;\n  if (!user) return false;\n  if (user.roles?.includes('admin')) return true;\n\n  return {\n    author: { equals: user.id },\n  };\n};\n```\n\n### Query Example\n\n```ts\n\u002F\u002F Local API\nconst posts = await payload.find({\n  collection: 'posts',\n  where: {\n    status: { equals: 'published' },\n    'author.name': { contains: 'john' },\n  },\n  depth: 2,\n  limit: 10,\n  sort: '-createdAt',\n});\n\n\u002F\u002F Query with populated relationships\nconst post = await payload.findByID({\n  collection: 'posts',\n  id: '123',\n  depth: 2, \u002F\u002F Populates relationships (default is 2)\n});\n\u002F\u002F Returns: { author: { id: \"user123\", name: \"John\" } }\n\n\u002F\u002F Without depth, relationships return IDs only\nconst post = await payload.findByID({\n  collection: 'posts',\n  id: '123',\n  depth: 0,\n});\n\u002F\u002F Returns: { author: \"user123\" }\n```\n\nFor all query operators and REST\u002FGraphQL examples, see [QUERIES.md](reference\u002FQUERIES.md).\n\n### Getting Payload Instance\n\n```ts\n\u002F\u002F In API routes (Next.js)\nimport { getPayload } from 'payload'\nimport config from '@payload-config'\n\nexport async function GET() {\n  const payload = await getPayload({ config })\n\n  const posts = await payload.find({\n    collection: 'posts',\n  })\n\n  return Response.json(posts)\n}\n\n\u002F\u002F In Server Components\nimport { getPayload } from 'payload'\nimport config from '@payload-config'\n\nexport default async function Page() {\n  const payload = await getPayload({ config })\n  const { docs } = await payload.find({ collection: 'posts' })\n\n  return \u003Cdiv>{docs.map(post => \u003Ch1 key={post.id}>{post.title}\u003C\u002Fh1>)}\u003C\u002Fdiv>\n}\n```\n\n## Security Pitfalls\n\n### 1. Local API Access Control (CRITICAL)\n\n**By default, Local API operations bypass ALL access control**, even when passing a user.\n\n```ts\n\u002F\u002F ❌ SECURITY BUG: Passes user but ignores their permissions\nawait payload.find({\n  collection: 'posts',\n  user: someUser, \u002F\u002F Access control is BYPASSED!\n});\n\n\u002F\u002F ✅ SECURE: Actually enforces the user's permissions\nawait payload.find({\n  collection: 'posts',\n  user: someUser,\n  overrideAccess: false, \u002F\u002F REQUIRED for access control\n});\n```\n\n**When to use each:**\n\n- `overrideAccess: true` (default) - Server-side operations you trust (cron jobs, system tasks)\n- `overrideAccess: false` - When operating on behalf of a user (API routes, webhooks)\n\nSee [QUERIES.md#access-control-in-local-api](reference\u002FQUERIES.md#access-control-in-local-api).\n\n### 2. Transaction Failures in Hooks\n\n**Nested operations in hooks without `req` break transaction atomicity.**\n\n```ts\n\u002F\u002F ❌ DATA CORRUPTION RISK: Separate transaction\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.create({\n        collection: 'audit-log',\n        data: { docId: doc.id },\n        \u002F\u002F Missing req - runs in separate transaction!\n      });\n    },\n  ];\n}\n\n\u002F\u002F ✅ ATOMIC: Same transaction\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.create({\n        collection: 'audit-log',\n        data: { docId: doc.id },\n        req, \u002F\u002F Maintains atomicity\n      });\n    },\n  ];\n}\n```\n\nSee [ADAPTERS.md#threading-req-through-operations](reference\u002FADAPTERS.md#threading-req-through-operations).\n\n### 3. Infinite Hook Loops\n\n**Hooks triggering operations that trigger the same hooks create infinite loops.**\n\n```ts\n\u002F\u002F ❌ INFINITE LOOP\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.update({\n        collection: 'posts',\n        id: doc.id,\n        data: { views: doc.views + 1 },\n        req,\n      }); \u002F\u002F Triggers afterChange again!\n    },\n  ];\n}\n\n\u002F\u002F ✅ SAFE: Use context flag\nhooks: {\n  afterChange: [\n    async ({ doc, req, context }) => {\n      if (context.skipHooks) return;\n\n      await req.payload.update({\n        collection: 'posts',\n        id: doc.id,\n        data: { views: doc.views + 1 },\n        context: { skipHooks: true },\n        req,\n      });\n    },\n  ];\n}\n```\n\nSee [HOOKS.md#context](reference\u002FHOOKS.md#context).\n\n## Project Structure\n\n```txt\nsrc\u002F\n├── app\u002F\n│   ├── (frontend)\u002F\n│   │   └── page.tsx\n│   └── (payload)\u002F\n│       └── admin\u002F[[...segments]]\u002Fpage.tsx\n├── collections\u002F\n│   ├── Posts.ts\n│   ├── Media.ts\n│   └── Users.ts\n├── globals\u002F\n│   └── Header.ts\n├── components\u002F\n│   └── CustomField.tsx\n├── hooks\u002F\n│   └── slugify.ts\n└── payload.config.ts\n```\n\n## Building & Type Generation\n\nPayload generates `payload-types.ts` for you — you rarely need to run `generate:types` by hand.\n\n- **During development:** `typescript.autoGenerate` defaults to `true`, so the dev\n  server regenerates types automatically whenever your config changes. Don't run\n  `generate:types` manually while the dev server is running — it's redundant.\n- **During builds:** `payload build` generates the import map and types before\n  running `next build`. Prefer it over calling `next build` directly so neither is\n  ever stale. Pass `--no-types` to skip type generation.\n- **Manual generation** (`payload generate:types`) is an escape hatch — only when\n  neither the dev server nor a build is in the loop (e.g. a one-off script, or CI\n  before a step that doesn't run `payload build`).\n\n```ts\n\u002F\u002F payload.config.ts\nexport default buildConfig({\n  typescript: {\n    outputFile: path.resolve(dirname, 'payload-types.ts'),\n    \u002F\u002F autoGenerate defaults to true — types regenerate in dev automatically\n  },\n});\n\n\u002F\u002F Usage\nimport type { Post, User } from '@\u002Fpayload-types';\n```\n\n## Common Gotchas\n\n1. **Local API bypasses access control** unless you pass `overrideAccess: false`\n2. **Missing `req` in nested operations** breaks transaction atomicity\n3. **Hook loops** — operations in hooks can re-trigger the same hooks; use `req.context` flags\n4. **Field-level access** returns boolean only, no query constraints\n5. **Relationship depth** defaults to 2; set `depth: 0` for IDs only\n6. **Draft status** — `_status` field is auto-injected when drafts are enabled\n7. **Types regenerate automatically** in dev (`autoGenerate`) and during `payload build` — avoid running `generate:types` manually\n8. **MongoDB transactions** require replica set configuration\n9. **SQLite transactions** are disabled by default; enable with `transactionOptions: {}`\n10. **Point fields** are not supported in SQLite\n\n## Best Practices\n\n### Content Modeling\n\n- Enable `versions: { drafts: true }` by default on content collections; rely on the\n  auto-injected `_status` field rather than adding a custom `status` field\n- Use `slugField()` for slugs instead of hand-rolling a unique text field\n- Reserve `position: 'sidebar'` for short, at-a-glance fields (status, category,\n  author, date); keep long fields (description, rich text) in the main area\n\n### Security\n\n- Default to restrictive access, gradually add permissions\n- Use `overrideAccess: false` when passing `user` to Local API\n- Field-level access only returns boolean (no query constraints)\n- Never trust client-provided data\n- Use `saveToJWT: true` for roles to avoid database lookups\n\n### Performance\n\n- Index frequently queried fields\n- Use `select` to limit returned fields\n- Set `maxDepth` on relationships to prevent over-fetching\n- Prefer query constraints over async operations in access control\n- Cache expensive operations in `req.context`\n\n### Data Integrity\n\n- Always pass `req` to nested operations in hooks\n- Use context flags to prevent infinite hook loops\n- Enable transactions for MongoDB (requires replica set) and Postgres\n- Use `beforeValidate` for data formatting\n- Use `beforeChange` for business logic\n\n### Type Safety\n\n- Let dev (`autoGenerate`) and `payload build` generate types; run `generate:types` manually only when neither is running\n- Import types from generated `payload-types.ts`\n- Type your user object: `import type { User } from '@\u002Fpayload-types'`\n- Use field type guards for runtime type checking\n- When extracting any Payload value into a named constant — a collection, field, hook, access function, plugin, etc. — annotate it with the matching Payload type (`CollectionConfig`, `Field`, `CollectionBeforeChangeHook`, `Access`, `Plugin`, …) or use `satisfies \u003CType>`. Without an annotation, string properties like `type: 'text'` widen to `string` and discriminated unions (`Field`, `CollectionConfig`) fail to resolve. Inline literals get this for free via contextual typing; extracted constants do not.\n\n### Organization\n\n- Keep collections in separate files\n- Extract access control to `access\u002F` directory\n- Extract hooks to `hooks\u002F` directory\n- Use reusable field factories for common patterns\n- Document complex access control with comments\n\n## Reference Documentation\n\n- **[FIELDS.md](reference\u002FFIELDS.md)** - All field types, validation, admin options\n- **[FIELD-TYPE-GUARDS.md](reference\u002FFIELD-TYPE-GUARDS.md)** - Type guards for runtime field type checking and narrowing\n- **[COLLECTIONS.md](reference\u002FCOLLECTIONS.md)** - Collection configs, auth, upload, drafts, live preview\n- **[HOOKS.md](reference\u002FHOOKS.md)** - Collection hooks, field hooks, context patterns\n- **[ACCESS-CONTROL.md](reference\u002FACCESS-CONTROL.md)** - Collection, field, global access control, RBAC, multi-tenant\n- **[ACCESS-CONTROL-ADVANCED.md](reference\u002FACCESS-CONTROL-ADVANCED.md)** - Context-aware, time-based, subscription-based access, factory functions, templates\n- **[QUERIES.md](reference\u002FQUERIES.md)** - Query operators, Local\u002FREST\u002FGraphQL APIs\n- **[ENDPOINTS.md](reference\u002FENDPOINTS.md)** - Custom API endpoints: authentication, helpers, request\u002Fresponse patterns\n- **[ADAPTERS.md](reference\u002FADAPTERS.md)** - Database, storage, email adapters, transactions\n- **[ADVANCED.md](reference\u002FADVANCED.md)** - Authentication, jobs, endpoints, components, plugins, localization\n- **[PLUGIN-DEVELOPMENT.md](reference\u002FPLUGIN-DEVELOPMENT.md)** - Plugin architecture, monorepo structure, patterns, best practices\n\n## Resources\n\n- llms-full.txt: \u003Chttps:\u002F\u002Fpayloadcms.com\u002Fllms-full.txt>\n- Docs: \u003Chttps:\u002F\u002Fpayloadcms.com\u002Fdocs>\n- GitHub: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload>\n- Examples: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload\u002Ftree\u002Fmain\u002Fexamples>\n- Templates: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload\u002Ftree\u002Fmain\u002Ftemplates>\n","# Payload Application Development\n\nPayload is a Next.js native CMS with TypeScript-first architecture, providing admin panel, database management, REST\u002FGraphQL APIs, authentication, and file storage.\n\n## Quick Reference\n\n| Task                     | Solution                                                                   | Details                                                                                                                          |\n| ------------------------ | -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| Auto-generate slugs      | `slugField()`                                                              | [FIELDS.md#slug-field-helper](reference\u002FFIELDS.md#slug-field-helper)                                                             |\n| Restrict content by user | Access control with query                                                  | [ACCESS-CONTROL.md#row-level-security-with-complex-queries](reference\u002FACCESS-CONTROL.md#row-level-security-with-complex-queries) |\n| Local API user ops       | `user` + `overrideAccess: false`                                           | [QUERIES.md#access-control-in-local-api](reference\u002FQUERIES.md#access-control-in-local-api)                                       |\n| Draft\u002Fpublish workflow   | `versions: { drafts: true }`                                               | [COLLECTIONS.md#versioning--drafts](reference\u002FCOLLECTIONS.md#versioning--drafts)                                                 |\n| Computed fields          | `virtual: true` with **field-level** `hooks.afterRead` returning the value | [FIELDS.md#virtual-fields](reference\u002FFIELDS.md#virtual-fields)                                                                   |\n| Conditional fields       | `admin.condition`                                                          | [FIELDS.md#conditional-fields](reference\u002FFIELDS.md#conditional-fields)                                                           |\n| Custom field validation  | `validate` function                                                        | [FIELDS.md#validation](reference\u002FFIELDS.md#validation)                                                                           |\n| Filter relationship list | `filterOptions` on field                                                   | [FIELDS.md#relationship](reference\u002FFIELDS.md#relationship)                                                                       |\n| Select specific fields   | `select` parameter                                                         | [QUERIES.md#field-selection](reference\u002FQUERIES.md#field-selection)                                                               |\n| Auto-set author\u002Fdates    | beforeChange hook                                                          | [HOOKS.md#collection-hooks](reference\u002FHOOKS.md#collection-hooks)                                                                 |\n| Prevent hook loops       | `req.context` check                                                        | [HOOKS.md#context](reference\u002FHOOKS.md#context)                                                                                   |\n| Cascading deletes        | beforeDelete hook                                                          | [HOOKS.md#collection-hooks](reference\u002FHOOKS.md#collection-hooks)                                                                 |\n| Geospatial queries       | `point` field with `near`\u002F`within`                                         | [FIELDS.md#point-geolocation](reference\u002FFIELDS.md#point-geolocation)                                                             |\n| Reverse relationships    | `join` field type                                                          | [FIELDS.md#join-fields](reference\u002FFIELDS.md#join-fields)                                                                         |\n| Next.js revalidation     | Context control in afterChange                                             | [HOOKS.md#nextjs-revalidation-with-context-control](reference\u002FHOOKS.md#nextjs-revalidation-with-context-control)                 |\n| Query by relationship    | Nested property syntax                                                     | [QUERIES.md#nested-properties](reference\u002FQUERIES.md#nested-properties)                                                           |\n| Complex queries          | AND\u002FOR logic                                                               | [QUERIES.md#andor-logic](reference\u002FQUERIES.md#andor-logic)                                                                       |\n| Transactions             | Pass `req` to operations                                                   | [ADAPTERS.md#threading-req-through-operations](reference\u002FADAPTERS.md#threading-req-through-operations)                           |\n| Background jobs          | Jobs queue with tasks                                                      | [ADVANCED.md#jobs-queue](reference\u002FADVANCED.md#jobs-queue)                                                                       |\n| Custom API routes        | Collection custom endpoints                                                | [ADVANCED.md#custom-endpoints](reference\u002FADVANCED.md#custom-endpoints)                                                           |\n| Cloud storage            | Storage adapter plugins                                                    | [ADAPTERS.md#storage-adapters](reference\u002FADAPTERS.md#storage-adapters)                                                           |\n| Multi-language           | `localization` config + `localized: true`                                  | [ADVANCED.md#localization](reference\u002FADVANCED.md#localization)                                                                   |\n| Create plugin            | `(options) => (config) => Config`                                          | [PLUGIN-DEVELOPMENT.md#plugin-architecture](reference\u002FPLUGIN-DEVELOPMENT.md#plugin-architecture)                                 |\n| Plugin package setup     | Package structure with SWC                                                 | [PLUGIN-DEVELOPMENT.md#plugin-package-structure](reference\u002FPLUGIN-DEVELOPMENT.md#plugin-package-structure)                       |\n| Add fields to collection | Map collections, spread fields                                             | [PLUGIN-DEVELOPMENT.md#adding-fields-to-collections](reference\u002FPLUGIN-DEVELOPMENT.md#adding-fields-to-collections)               |\n| Plugin hooks             | Preserve existing hooks in array                                           | [PLUGIN-DEVELOPMENT.md#adding-hooks](reference\u002FPLUGIN-DEVELOPMENT.md#adding-hooks)                                               |\n| Check field type         | Type guard functions                                                       | [FIELD-TYPE-GUARDS.md](reference\u002FFIELD-TYPE-GUARDS.md)                                                                           |\n\n## Quick Start\n\n```bash\nnpx create-payload-app@latest my-app\ncd my-app\npnpm dev\n```\n\n### Minimal Config\n\n```ts\nimport { buildConfig } from 'payload';\nimport { mongooseAdapter } from '@payloadcms\u002Fdb-mongodb';\nimport { lexicalEditor } from '@payloadcms\u002Frichtext-lexical';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst filename = fileURLToPath(import.meta.url);\nconst dirname = path.dirname(filename);\n\nexport default buildConfig({\n  admin: {\n    user: 'users',\n    importMap: {\n      baseDir: path.resolve(dirname),\n    },\n  },\n  collections: [Users, Media],\n  editor: lexicalEditor(),\n  secret: process.env.PAYLOAD_SECRET,\n  typescript: {\n    outputFile: path.resolve(dirname, 'payload-types.ts'),\n  },\n  db: mongooseAdapter({\n    url: process.env.DATABASE_URL,\n  }),\n});\n```\n\n## Essential Patterns\n\n### Defaults & Conventions\n\nApply these defaults when modeling content unless there's a clear reason not to:\n\n- **Enable drafts\u002Fversions by default:** `versions: { drafts: true }`. This is the\n  recommended starting point for any content collection. It auto-injects a\n  `_status` field (`draft` \u002F `published` \u002F `changed`) — **don't add your own\n  `status` field**, it's redundant. Only skip versions for collections that have\n  no publish\u002Fdraft lifecycle (e.g. internal join tables, settings).\n- **Use `slugField()` for all slugs** instead of hand-rolling\n  `{ name: 'slug', type: 'text', unique: true }`. It auto-generates the slug from\n  the title, adds a regenerate toggle, and handles uniqueness\u002Findexing for you.\n  It defaults to generating from a `title` field — if the collection has no\n  `title`, pass the source field: `slugField({ useAsSlug: 'name' })`.\n- **`position: 'sidebar'` is for short, at-a-glance fields** — status, category,\n  author, publish date. Avoid it for long fields that need horizontal space to be\n  usable (description, rich text content, long text). Those belong in the main\n  document area.\n\n### Basic Collection\n\n```ts\nimport type { CollectionConfig } from 'payload';\nimport { slugField } from 'payload';\n\nexport const Posts: CollectionConfig = {\n  slug: 'posts',\n  admin: {\n    useAsTitle: 'title',\n    \u002F\u002F _status (from versions.drafts) shows the draft\u002Fpublished state — no custom status field needed\n    defaultColumns: ['title', 'author', '_status', 'createdAt'],\n  },\n  versions: {\n    drafts: true,\n  },\n  fields: [\n    { name: 'title', type: 'text', required: true },\n    slugField(), \u002F\u002F auto-generates from `title`, unique + indexed, sidebar position\n    { name: 'content', type: 'richText' }, \u002F\u002F long field — stays in the main area, not the sidebar\n    \u002F\u002F short, at-a-glance field — good sidebar candidate\n    { name: 'author', type: 'relationship', relationTo: 'users', admin: { position: 'sidebar' } },\n  ],\n  timestamps: true,\n};\n```\n\nFor more collection patterns (auth, upload, drafts, live preview), see [COLLECTIONS.md](reference\u002FCOLLECTIONS.md).\n\n### Common Fields\n\n```ts\n\u002F\u002F Text field\n{ name: 'title', type: 'text', required: true }\n\n\u002F\u002F Relationship\n{ name: 'author', type: 'relationship', relationTo: 'users', required: true }\n\n\u002F\u002F Rich text\n{ name: 'content', type: 'richText', required: true }\n\n\u002F\u002F Slug — use the helper instead of a hand-rolled text field\nslugField()\n\n\u002F\u002F Select (for genuine taxonomy — NOT publish state; use versions.drafts + _status for that)\n{ name: 'category', type: 'select', options: ['news', 'tutorial', 'opinion'] }\n\n\u002F\u002F Upload\n{ name: 'image', type: 'upload', relationTo: 'media' }\n```\n\nFor all field types (array, blocks, point, join, virtual, conditional, etc.), see [FIELDS.md](reference\u002FFIELDS.md).\n\n### Hook Example\n\nHooks live at one of two levels and they are not interchangeable. **Collection hooks** receive `{ doc, data, req, operation, ... }` and act on the whole document. **Field hooks** live inside an individual field's `hooks` object, receive `{ value, siblingData, ... }`, and **return the new value** for that field. Computed\u002Fvirtual fields, per-field formatters, and per-field access masking are field hooks; cross-field business logic is a collection hook.\n\n```ts\n\u002F\u002F Collection-level: business logic across the document\nexport const Posts: CollectionConfig = {\n  slug: 'posts',\n  hooks: {\n    beforeChange: [\n      async ({ data, operation }) => {\n        if (operation === 'create') {\n          data.slug = slugify(data.title);\n        }\n        return data;\n      },\n    ],\n  },\n  fields: [{ name: 'title', type: 'text' }],\n};\n\n\u002F\u002F Field-level: compute \u002F format a single field's value (virtual fields use this)\nexport const Users: CollectionConfig = {\n  slug: 'users',\n  fields: [\n    { name: 'firstName', type: 'text' },\n    { name: 'lastName', type: 'text' },\n    {\n      name: 'fullName',\n      type: 'text',\n      virtual: true,\n      hooks: {\n        afterRead: [({ siblingData }) => `${siblingData.firstName} ${siblingData.lastName}`],\n      },\n    },\n  ],\n};\n```\n\nWhen asked to \"compute a field\" or \"populate a field's value in a hook\", use a **field-level** hook on that field — never a collection-level `afterRead` that mutates `doc`.\n\nFor all hook patterns, see [HOOKS.md](reference\u002FHOOKS.md). For access control, see [ACCESS-CONTROL.md](reference\u002FACCESS-CONTROL.md).\n\n### Access Control with Type Safety\n\n```ts\nimport type { Access } from 'payload';\nimport type { User } from '@\u002Fpayload-types';\n\n\u002F\u002F Type-safe access control\nexport const adminOnly: Access = ({ req }) => {\n  const user = req.user as User;\n  return user?.roles?.includes('admin') || false;\n};\n\n\u002F\u002F Row-level access control\nexport const ownPostsOnly: Access = ({ req }) => {\n  const user = req.user as User;\n  if (!user) return false;\n  if (user.roles?.includes('admin')) return true;\n\n  return {\n    author: { equals: user.id },\n  };\n};\n```\n\n### Query Example\n\n```ts\n\u002F\u002F Local API\nconst posts = await payload.find({\n  collection: 'posts',\n  where: {\n    status: { equals: 'published' },\n    'author.name': { contains: 'john' },\n  },\n  depth: 2,\n  limit: 10,\n  sort: '-createdAt',\n});\n\n\u002F\u002F Query with populated relationships\nconst post = await payload.findByID({\n  collection: 'posts',\n  id: '123',\n  depth: 2, \u002F\u002F Populates relationships (default is 2)\n});\n\u002F\u002F Returns: { author: { id: \"user123\", name: \"John\" } }\n\n\u002F\u002F Without depth, relationships return IDs only\nconst post = await payload.findByID({\n  collection: 'posts',\n  id: '123',\n  depth: 0,\n});\n\u002F\u002F Returns: { author: \"user123\" }\n```\n\nFor all query operators and REST\u002FGraphQL examples, see [QUERIES.md](reference\u002FQUERIES.md).\n\n### Getting Payload Instance\n\n```ts\n\u002F\u002F In API routes (Next.js)\nimport { getPayload } from 'payload'\nimport config from '@payload-config'\n\nexport async function GET() {\n  const payload = await getPayload({ config })\n\n  const posts = await payload.find({\n    collection: 'posts',\n  })\n\n  return Response.json(posts)\n}\n\n\u002F\u002F In Server Components\nimport { getPayload } from 'payload'\nimport config from '@payload-config'\n\nexport default async function Page() {\n  const payload = await getPayload({ config })\n  const { docs } = await payload.find({ collection: 'posts' })\n\n  return \u003Cdiv>{docs.map(post => \u003Ch1 key={post.id}>{post.title}\u003C\u002Fh1>)}\u003C\u002Fdiv>\n}\n```\n\n## Security Pitfalls\n\n### 1. Local API Access Control (CRITICAL)\n\n**By default, Local API operations bypass ALL access control**, even when passing a user.\n\n```ts\n\u002F\u002F ❌ SECURITY BUG: Passes user but ignores their permissions\nawait payload.find({\n  collection: 'posts',\n  user: someUser, \u002F\u002F Access control is BYPASSED!\n});\n\n\u002F\u002F ✅ SECURE: Actually enforces the user's permissions\nawait payload.find({\n  collection: 'posts',\n  user: someUser,\n  overrideAccess: false, \u002F\u002F REQUIRED for access control\n});\n```\n\n**When to use each:**\n\n- `overrideAccess: true` (default) - Server-side operations you trust (cron jobs, system tasks)\n- `overrideAccess: false` - When operating on behalf of a user (API routes, webhooks)\n\nSee [QUERIES.md#access-control-in-local-api](reference\u002FQUERIES.md#access-control-in-local-api).\n\n### 2. Transaction Failures in Hooks\n\n**Nested operations in hooks without `req` break transaction atomicity.**\n\n```ts\n\u002F\u002F ❌ DATA CORRUPTION RISK: Separate transaction\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.create({\n        collection: 'audit-log',\n        data: { docId: doc.id },\n        \u002F\u002F Missing req - runs in separate transaction!\n      });\n    },\n  ];\n}\n\n\u002F\u002F ✅ ATOMIC: Same transaction\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.create({\n        collection: 'audit-log',\n        data: { docId: doc.id },\n        req, \u002F\u002F Maintains atomicity\n      });\n    },\n  ];\n}\n```\n\nSee [ADAPTERS.md#threading-req-through-operations](reference\u002FADAPTERS.md#threading-req-through-operations).\n\n### 3. Infinite Hook Loops\n\n**Hooks triggering operations that trigger the same hooks create infinite loops.**\n\n```ts\n\u002F\u002F ❌ INFINITE LOOP\nhooks: {\n  afterChange: [\n    async ({ doc, req }) => {\n      await req.payload.update({\n        collection: 'posts',\n        id: doc.id,\n        data: { views: doc.views + 1 },\n        req,\n      }); \u002F\u002F Triggers afterChange again!\n    },\n  ];\n}\n\n\u002F\u002F ✅ SAFE: Use context flag\nhooks: {\n  afterChange: [\n    async ({ doc, req, context }) => {\n      if (context.skipHooks) return;\n\n      await req.payload.update({\n        collection: 'posts',\n        id: doc.id,\n        data: { views: doc.views + 1 },\n        context: { skipHooks: true },\n        req,\n      });\n    },\n  ];\n}\n```\n\nSee [HOOKS.md#context](reference\u002FHOOKS.md#context).\n\n## Project Structure\n\n```txt\nsrc\u002F\n├── app\u002F\n│   ├── (frontend)\u002F\n│   │   └── page.tsx\n│   └── (payload)\u002F\n│       └── admin\u002F[[...segments]]\u002Fpage.tsx\n├── collections\u002F\n│   ├── Posts.ts\n│   ├── Media.ts\n│   └── Users.ts\n├── globals\u002F\n│   └── Header.ts\n├── components\u002F\n│   └── CustomField.tsx\n├── hooks\u002F\n│   └── slugify.ts\n└── payload.config.ts\n```\n\n## Building & Type Generation\n\nPayload generates `payload-types.ts` for you — you rarely need to run `generate:types` by hand.\n\n- **During development:** `typescript.autoGenerate` defaults to `true`, so the dev\n  server regenerates types automatically whenever your config changes. Don't run\n  `generate:types` manually while the dev server is running — it's redundant.\n- **During builds:** `payload build` generates the import map and types before\n  running `next build`. Prefer it over calling `next build` directly so neither is\n  ever stale. Pass `--no-types` to skip type generation.\n- **Manual generation** (`payload generate:types`) is an escape hatch — only when\n  neither the dev server nor a build is in the loop (e.g. a one-off script, or CI\n  before a step that doesn't run `payload build`).\n\n```ts\n\u002F\u002F payload.config.ts\nexport default buildConfig({\n  typescript: {\n    outputFile: path.resolve(dirname, 'payload-types.ts'),\n    \u002F\u002F autoGenerate defaults to true — types regenerate in dev automatically\n  },\n});\n\n\u002F\u002F Usage\nimport type { Post, User } from '@\u002Fpayload-types';\n```\n\n## Common Gotchas\n\n1. **Local API bypasses access control** unless you pass `overrideAccess: false`\n2. **Missing `req` in nested operations** breaks transaction atomicity\n3. **Hook loops** — operations in hooks can re-trigger the same hooks; use `req.context` flags\n4. **Field-level access** returns boolean only, no query constraints\n5. **Relationship depth** defaults to 2; set `depth: 0` for IDs only\n6. **Draft status** — `_status` field is auto-injected when drafts are enabled\n7. **Types regenerate automatically** in dev (`autoGenerate`) and during `payload build` — avoid running `generate:types` manually\n8. **MongoDB transactions** require replica set configuration\n9. **SQLite transactions** are disabled by default; enable with `transactionOptions: {}`\n10. **Point fields** are not supported in SQLite\n\n## Best Practices\n\n### Content Modeling\n\n- Enable `versions: { drafts: true }` by default on content collections; rely on the\n  auto-injected `_status` field rather than adding a custom `status` field\n- Use `slugField()` for slugs instead of hand-rolling a unique text field\n- Reserve `position: 'sidebar'` for short, at-a-glance fields (status, category,\n  author, date); keep long fields (description, rich text) in the main area\n\n### Security\n\n- Default to restrictive access, gradually add permissions\n- Use `overrideAccess: false` when passing `user` to Local API\n- Field-level access only returns boolean (no query constraints)\n- Never trust client-provided data\n- Use `saveToJWT: true` for roles to avoid database lookups\n\n### Performance\n\n- Index frequently queried fields\n- Use `select` to limit returned fields\n- Set `maxDepth` on relationships to prevent over-fetching\n- Prefer query constraints over async operations in access control\n- Cache expensive operations in `req.context`\n\n### Data Integrity\n\n- Always pass `req` to nested operations in hooks\n- Use context flags to prevent infinite hook loops\n- Enable transactions for MongoDB (requires replica set) and Postgres\n- Use `beforeValidate` for data formatting\n- Use `beforeChange` for business logic\n\n### Type Safety\n\n- Let dev (`autoGenerate`) and `payload build` generate types; run `generate:types` manually only when neither is running\n- Import types from generated `payload-types.ts`\n- Type your user object: `import type { User } from '@\u002Fpayload-types'`\n- Use field type guards for runtime type checking\n- When extracting any Payload value into a named constant — a collection, field, hook, access function, plugin, etc. — annotate it with the matching Payload type (`CollectionConfig`, `Field`, `CollectionBeforeChangeHook`, `Access`, `Plugin`, …) or use `satisfies \u003CType>`. Without an annotation, string properties like `type: 'text'` widen to `string` and discriminated unions (`Field`, `CollectionConfig`) fail to resolve. Inline literals get this for free via contextual typing; extracted constants do not.\n\n### Organization\n\n- Keep collections in separate files\n- Extract access control to `access\u002F` directory\n- Extract hooks to `hooks\u002F` directory\n- Use reusable field factories for common patterns\n- Document complex access control with comments\n\n## Reference Documentation\n\n- **[FIELDS.md](reference\u002FFIELDS.md)** - All field types, validation, admin options\n- **[FIELD-TYPE-GUARDS.md](reference\u002FFIELD-TYPE-GUARDS.md)** - Type guards for runtime field type checking and narrowing\n- **[COLLECTIONS.md](reference\u002FCOLLECTIONS.md)** - Collection configs, auth, upload, drafts, live preview\n- **[HOOKS.md](reference\u002FHOOKS.md)** - Collection hooks, field hooks, context patterns\n- **[ACCESS-CONTROL.md](reference\u002FACCESS-CONTROL.md)** - Collection, field, global access control, RBAC, multi-tenant\n- **[ACCESS-CONTROL-ADVANCED.md](reference\u002FACCESS-CONTROL-ADVANCED.md)** - Context-aware, time-based, subscription-based access, factory functions, templates\n- **[QUERIES.md](reference\u002FQUERIES.md)** - Query operators, Local\u002FREST\u002FGraphQL APIs\n- **[ENDPOINTS.md](reference\u002FENDPOINTS.md)** - Custom API endpoints: authentication, helpers, request\u002Fresponse patterns\n- **[ADAPTERS.md](reference\u002FADAPTERS.md)** - Database, storage, email adapters, transactions\n- **[ADVANCED.md](reference\u002FADVANCED.md)** - Authentication, jobs, endpoints, components, plugins, localization\n- **[PLUGIN-DEVELOPMENT.md](reference\u002FPLUGIN-DEVELOPMENT.md)** - Plugin architecture, monorepo structure, patterns, best practices\n\n## Resources\n\n- llms-full.txt: \u003Chttps:\u002F\u002Fpayloadcms.com\u002Fllms-full.txt>\n- Docs: \u003Chttps:\u002F\u002Fpayloadcms.com\u002Fdocs>\n- GitHub: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload>\n- Examples: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload\u002Ftree\u002Fmain\u002Fexamples>\n- Templates: \u003Chttps:\u002F\u002Fgithub.com\u002Fpayloadcms\u002Fpayload\u002Ftree\u002Fmain\u002Ftemplates>\n",{"name":5,"description":7},"main","7d4ebd573a4218d5e92eced411b259f34e9203fe",".agents\u002Fskills\u002Fpayload",0,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai","https:\u002F\u002Fwithnightshift.com\u002F","https:\u002F\u002Fgithub.com\u002FwhimzyLive","Creator of @typedorm","2026-11-14 22:45:42",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add whimzyLive\u002Fnightshift-ai --skill payload",{"tool":39,"command":40},"bunx","bunx skills add whimzyLive\u002Fnightshift-ai --skill payload",{"tool":42,"command":43},"pnpm","pnpm dlx skills add whimzyLive\u002Fnightshift-ai --skill payload","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002FSKILL.md",true,[47,53,57,61,65,69,73,77,81,85,89,93],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"README.md","REFERENCE","参考文档",2537,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002FREADME.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"reference\u002FACCESS-CONTROL-ADVANCED.md",18130,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FACCESS-CONTROL-ADVANCED.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"reference\u002FACCESS-CONTROL.md",18384,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FACCESS-CONTROL.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"reference\u002FADAPTERS.md",7471,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FADAPTERS.md",{"path":66,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":67,"sourceHtmlUrl":68},"reference\u002FADVANCED.md",9052,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FADVANCED.md",{"path":70,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":71,"sourceHtmlUrl":72},"reference\u002FCOLLECTIONS.md",6383,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FCOLLECTIONS.md",{"path":74,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":75,"sourceHtmlUrl":76},"reference\u002FENDPOINTS.md",15520,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FENDPOINTS.md",{"path":78,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":79,"sourceHtmlUrl":80},"reference\u002FFIELD-TYPE-GUARDS.md",10950,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FFIELD-TYPE-GUARDS.md",{"path":82,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":83,"sourceHtmlUrl":84},"reference\u002FFIELDS.md",19042,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FFIELDS.md",{"path":86,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":87,"sourceHtmlUrl":88},"reference\u002FHOOKS.md",4374,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FHOOKS.md",{"path":90,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":91,"sourceHtmlUrl":92},"reference\u002FPLUGIN-DEVELOPMENT.md",35306,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FPLUGIN-DEVELOPMENT.md",{"path":94,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":95,"sourceHtmlUrl":96},"reference\u002FQUERIES.md",6125,"https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fpayload\u002Freference\u002FQUERIES.md",[98,106,113,120,127,134],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":105},"01M7BCEWYHDS1FWAJ6G4CD9P54","designing-in-patterns","Use when designing, planning or auditing UI against a component library — naming surfaces with the repo's pattern vocabulary, deciding reuse versus extend versus new, exploring compositions, or writing the reuse table (component-plan.md, a spec's `## Reuse`, a UI audit). Carries the design method; the repo's own vocabulary, bundle and board rules come from project-context and the designer override.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fdesigning-in-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":19},"01M75MVN6GACAC87SV9RBPBMKH","typeorm","Use when defining TypeORM entities, writing migrations, or building repository\u002Fquery-builder code in TypeScript. Covers entity and relation decorators, the Data Mapper pattern, migrations, the query builder, transactions, and multi-database configuration.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fskills\u002Ftypeorm\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":19},"01M75MTEZV8SAZNS20YDSB7KG2","hono-api","Use when building or extending REST APIs with Hono + @hono\u002Fzod-openapi. Covers schema-first route declaration with createRoute, feature-grouped composable routers, a class-based service layer behind interfaces, the strategy pattern for multi-event webhooks, typed request validation, and auto-generated OpenAPI docs.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fskills\u002Fhono-api\u002FSKILL.md",[],[],{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":19},"01M75MTB91SB6HPB3ZRT20F950","electrodb","Use when defining DynamoDB entities, modeling indexes, or writing queries\u002Fmutations with the ElectroDB ORM. Covers entity schema, access patterns, CRUD operations, update expressions, and single-table design patterns.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fskills\u002Felectrodb\u002FSKILL.md",[],[],{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":19},"01M75MT7KT9A3XYX38TX5MY6MA","atomic-design","Use when structuring or decomposing any frontend UI into reusable components, regardless of framework. Applies Brad Frost's atomic design methodology — atoms, molecules, organisms, templates, and pages — to guide consistent component hierarchy, naming, and composition decisions.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fskills\u002Fatomic-design\u002FSKILL.md",[],[],{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":138,"categories":139,"keywords":140,"publishedAt":19},"01M75MSTQ54EY0K29PKBF212K1","writing-docs","Use when writing, restructuring, or reviewing any prose documentation — a tutorial, how-to guide, reference page, or explanation\u002Fconceptual doc — for a public docs site (e.g. Mintlify MDX, docs\u002F, README material), a getting-started guide, an API\u002FCLI reference page, or a \"why we built it this way\" conceptual page. Applies the Diátaxis framework (see https:\u002F\u002Fdiataxis.fr\u002F) — every document belongs to exactly one of the four quadrants (tutorial \u002F how-to guide \u002F reference \u002F explanation), and mixing quadrants inside one document is the single most common documentation failure. Covers the four-quadrant compass for picking the right form, per-quadrant structure templates, an anti-pattern list for quadrant drift, and generic voice\u002Fcraft rules — repo-specific voice and target output format (e.g. Mintlify MDX) are resolved from the repo's docs-manifest (falling back to project-context), never hardcoded here.","https:\u002F\u002Fgithub.com\u002FwhimzyLive\u002Fnightshift-ai\u002Fblob\u002Fmain\u002Fplugins\u002Fsdlc\u002Fskills\u002Fwriting-docs\u002FSKILL.md",[],[]]