This skill should be used when the user asks to "create a post", "edit a post", "update post content", "list posts", "convert markdown to Lexical", or mentions Payload CMS content management. Handles Payload Local API operations and markdown-to-Lexical conversion.
Manages Payload CMS content using Local API and converts markdown to Lexical JSON. Triggers when creating/editing posts, listing collections, or converting markdown for rich text fields.
/plugin marketplace add b-open-io/prompts/plugin install bopen-tools@b-open-ioThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/lexical-format.mdreferences/rest-api.mdscripts/create-post.tsscripts/list-posts.tsscripts/md-to-lexical.shscripts/md_to_lexical.pyscripts/update-post.tsManage Payload CMS content using the Local API (preferred) or REST API. Includes markdown-to-Lexical JSON conversion for rich text fields.
Payload offers two API approaches:
| Approach | When to Use | Auth Required |
|---|---|---|
| Local API | Running scripts in the project directory | No |
| REST API | External access, remote automation | Yes |
Prefer Local API for CLI workflows. It runs server-side with full database access and no authentication overhead.
Run TypeScript scripts from the Payload project directory. The .env file already contains required credentials:
# From the Payload project directory (e.g., ~/code/bopen-ai)
source .env && bunx tsx scripts/update-post.ts my-post-slug content.json
Or inline for one-off commands:
PAYLOAD_SECRET="$PAYLOAD_SECRET" DATABASE_URI="$DATABASE_URI" bunx tsx scripts/update-post.ts slug content.json
source .env && bunx tsx scripts/list-posts.ts
# Convert markdown
python3 scripts/md_to_lexical.py article.md > /tmp/content.json
# Update the post
source .env && bunx tsx scripts/update-post.ts my-post-slug /tmp/content.json
source .env && bunx tsx scripts/create-post.ts "Post Title" post-slug /tmp/content.json
Payload's Lexical editor stores content as JSON. Convert markdown using the included Python script:
python3 scripts/md_to_lexical.py input.md > output.json
{
"root": {
"type": "root",
"format": "",
"indent": 0,
"version": 1,
"children": [
{ "type": "paragraph", ... },
{ "type": "heading", "tag": "h2", ... }
],
"direction": "ltr"
}
}
| Markdown | Lexical Node Type |
|---|---|
| Paragraphs | paragraph |
# Heading | heading with tag h1-h6 |
**bold** | text with format: 1 |
*italic* | text with format: 2 |
`code` | text with format: 16 |
| Code blocks | block with blockType: "code" |
| Lists | list with listitem children |
> quotes | quote |
--- | horizontalrule |
[links](url) | link with fields.url |
| Value | Format |
|---|---|
| 0 | Normal |
| 1 | Bold |
| 2 | Italic |
| 3 | Bold + Italic |
| 16 | Code |
For simple updates without the helper scripts:
import { getPayload } from "payload";
import configPromise from "@payload-config";
const payload = await getPayload({ config: configPromise });
// Find post by slug
const result = await payload.find({
collection: "posts",
where: { slug: { equals: "my-post" } },
});
// Update content
await payload.update({
collection: "posts",
id: result.docs[0].id,
data: {
content: { root: { ... } },
},
});
| Collection | Slug | Purpose |
|---|---|---|
| Posts | posts | Blog posts |
| Pages | pages | Static pages |
| Media | media | Uploaded files |
| Users | users | User accounts |
| Categories | categories | Post categories |
references/lexical-format.md - Complete Lexical node type reference with all fieldsreferences/rest-api.md - REST API documentation for external accessscripts/md_to_lexical.py - Python markdown-to-Lexical converterscripts/md-to-lexical.sh - Bash wrapper for conversionsscripts/list-posts.ts - List posts using Local APIscripts/update-post.ts - Update post content using Local APIscripts/create-post.ts - Create new post using Local API"Cannot find module '@payload-config'"
Run scripts from the Payload project root directory where tsconfig.json defines this path alias.
"PAYLOAD_SECRET is required"
Set the environment variable. Check the project's .env file for the correct value.
"Database connection failed"
Verify DATABASE_URI is correct and the database is accessible.
Post not updating
Check the post's _status field. Posts must be "published" to appear on the site.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.