My own Next.js + Payload CMS starter with an agentic AI assistant built in: skills, typed tools, working memory and human approval before anything goes live.

Me and other developers spinning up Payload sites — plus the editors who end up living in the admin.
A solo project — and the foundation I start client work from. Each client project feeds fixes and features back into the template.
Stop rebuilding the same CMS setup for every client, and give editors an assistant that can really do the work — without letting it loose on a production site.
An agent inside Payload built on the Vercel AI SDK and Claude. Tools are grouped into skills that switch on by intent, the agent reads the live schema instead of guessing it, keeps working memory across long sessions, and anything destructive waits for an explicit “yes”.
The starting point for my client work — Occollo and Ztracený kód arény build on its AI plugin and editor features.
Editors draft, translate and lay out whole pages by chatting, with a human approving every publish.
Write tools save drafts. Going live is a separate tool whose description explicitly forbids calling it without the user's confirmation — the guardrail lives right where the model reads it.
export function createApprovalTools(payload: Payload): ToolSet {
return {
publishDraftChanges: tool({
description:
'Publish the current draft of a page, making the draft content live. Only call this after the user has explicitly confirmed they want to publish (e.g. "yes, publish it" / "looks good, go live"). Never call this proactively.',
inputSchema: z.object({
pageId: z.string().describe('The page document ID'),
locale: z
.string()
.optional()
.describe('Locale to publish. Omit to publish the default locale.'),
}),
execute: async ({ pageId, locale }) => {
try {
const updated = await payload.update({
collection: 'pages',
id: pageId,
data: { _status: 'published' } as never,
locale: (locale ?? undefined) as never,
draft: false,
})
// …
return { success: true, documentId: updated.id }
} catch (err) {
return {
error: `Failed to publish: ${err instanceof Error ? err.message : String(err)}`,
}
}
},
}),
// discardDraftChanges: …
}
}Each skill bundles tools, trigger keywords and extra instructions. A small always-on core lets the agent discover the schema of whatever project it's dropped into.
export interface SkillDefinition {
/** Unique identifier */
id: string
/** Short description for the AI to understand when to use this skill */
description: string
/** Keywords that trigger this skill from user messages */
triggerKeywords: string[]
/** Tool names from the ToolSet that this skill activates */
toolNames: string[]
/** Supplementary instructions injected when this skill is active */
instructions: string
/** Other skill IDs that must be loaded together with this one */
dependencies?: string[]
}
/** Schema discovery + memory tools — always active, not gated by any skill */
export const ALWAYS_ACTIVE_TOOLS = [
'listCollections',
'getCollectionSchema',
'listAvailableBlocks',
'getBlockSchema',
'getGlobalSchema',
'getLocales',
'updateMemory',
]Long sessions get their context compacted. Skills are re-inferred from working memory — loaded schemas, open tasks, the write log — so the agent doesn't forget what it was doing mid-plan.
/**
* Infer skills that should be active based on working memory state.
* This ensures skills survive context compaction — if the agent loaded
* schemas or has an active plan, the corresponding write tools stay available
* even if the user's latest message doesn't contain trigger keywords.
*/
export function inferSkillsFromMemory(memory: WorkingMemory): string[] {
const skills: string[] = []
// Active plan → keep planning + reading active
if (memory.status !== 'idle') {
skills.push('planning', 'content-reading')
}
// Schemas loaded → content-writing is likely needed
if (memory.entities.schemasLoaded.length > 0) {
skills.push('content-writing', 'rich-text')
}
// …
return skills
}Only tools relevant to the current intent are exposed. Fewer choices, fewer wrong calls, fewer tokens.
Publishing and discarding drafts are separate tools whose descriptions forbid proactive use — the model has to hear “yes” first.
Introspection tools let the agent load any collection or block definition on demand, so the template works unchanged on every client's data model.
Giving a model 40 tools at once makes it worse at all of them. Gating tools behind skills — and remembering which skills were active — made the assistant both cheaper and noticeably more accurate.