:::contentbit
How-to guides

LLM-agent integration

Give Codex, Claude Code, Cursor, Copilot, and other LLM agents a fast validated writing loop.

Use this guide to install or refresh the agent files that make contentbit part of your normal LLM writing loop. After setup, the agent reads live block instructions from the CLI, writes Markdown, validates the result, and fixes diagnostics until the document is clean.

If you already ran contentbit init, try this now:

write a blog post about our new dark mode

audit my content

For an existing project, install or refresh the integration first:

contentbit agents

The failed validation in the middle of this session is expected. It is the feedback loop doing its job.

claude
>write a blog post about our new dark mode
Skill: contentbit-author
$ contentbit instructions --audience llmexit 0
The guide lists 9 blocks, including the custom quote block. Drafting content/dark-mode.md with a callout, a comparison, and a closing quote.
$ contentbit validate content/dark-mode.mdexit 1
content/dark-mode.md:18:1 error CB_ROW_COLUMNS:::comparison rows require 3 columns (label | left | right). Found 2.hint: Format: - label | left | right
Line 18 is missing the second column value. Fixing the row and revalidating.
$ contentbit validate content/dark-mode.mdexit 0
1 file(s): 0 errors, 0 warnings
Done. content/dark-mode.md validates clean.

What gets installed

contentbit init installs the integration automatically (skip with --no-agents). In an existing project, or after upgrading the CLI:

contentbit agents

This manages:

  • AGENTS.md: a fenced block between <!-- contentbit:start --> and <!-- contentbit:end --> markers with compact instructions any LLM agent reads (Cursor, Codex, Copilot, ...). Your content outside the markers is never touched; re-running refreshes only the block.
  • Claude Code skills: when a .claude/ directory exists (or forced with --claude when it doesn't), two skills land in .claude/skills/:
    • contentbit-author: the writing loop: fetch the authoring guide, write, validate, fix diagnostics until exit 0.
    • contentbit-audit: the health check: run doctor across content, flag validation issues, internal-link problems, thin sections, block-less long documents, and missing image alt text, in that order.

Pass --no-agents-md to manage only the skills. Run contentbit agents --check to see what would be created, refreshed, or skipped before writing files.

Project configuration matters too. Generated instructions tell the LLM agent to use the nearest contentbit.config.ts, which holds the canonical content glob, registry, link fields, and SEO config.

Use the writing loop

The author skill follows the same loop you would run by hand:

# 1. the live guide, including your custom blocks
contentbit instructions --audience llm

# 2. if the project uses link frontmatter, load the current graph
contentbit links

# 3. write the document, then validate until clean
contentbit validate content/new-post.md

Both skills use contentbit.config.ts, so they adapt to your layout without copying project arguments into every command.

If the project has contentbit.seo.config.ts and the task is a search-targeted page, give the agent the page brief before it writes:

contentbit brief <key-or-slug> --json

The brief is the structure contract: target facts, intent, keywords, required sections, required blocks, required links, related pages, and acceptance checks. After the edit, run doctor --strict-seo over the same glob.

Generated instructions document every block prop, enum value, default, and description. That is why the agent can follow a "never guess props" rule. For the model behind this, see LLM authoring.

Use the audit loop

The audit skill starts with doctor, which prints a ranked repair plan and can also emit JSON:

contentbit doctor
contentbit doctor --json

Use stats when you need raw per-document metrics:

contentbit stats

Each stats entry carries a heading outline with per-section word counts, block usage by name, link domains, and a validation summary. Full field reference and recipes: Document stats & auditing. Doctor behavior: Content doctor.

For a human review pass over the same content set, open the read-only Studio:

pnpm studio

Studio is for browsing previews, links, backlinks, keywords, and findings. Agents should keep using doctor --json and stats when they need stable data.

For internal-link health, use the graph command next to stats:

contentbit links
contentbit links --fix

The first command writes .contentbit/link-index.json with resolved linksTo and derived linkedFrom. The second safely rewrites linksTo values that still point at known aliases after a slug rename. The author skill uses that index as context when sibling documents declare slug, linksTo, aliases, or keywords, and asks new linked pages to include keywords.primary and keywords.secondary search-intent phrases for future link selection. Full workflow: Internal linking.

Add contentbit to your own skills

You may already have skills for your content workflows, such as a blog-post or changelog skill. Add contentbit as a context source and a quality gate with this instruction:

Before writing, run `contentbit instructions --audience llm`
and follow it exactly. Never guess block syntax. If sibling documents use
internal-link frontmatter, run `contentbit links` and choose
`linksTo` values from the generated index. After writing, run
`contentbit validate` and fix every diagnostic
(`file:line:col severity CODE message`, with `hint:` lines) until it exits 0.

For data-informed writing, feed contentbit doctor --json or contentbit stats output in as well — for example, have the skill check sibling documents' outlines and block usage so new content matches the structure of what already works.

For the full SEO agent loop, see Programmatic SEO workflows.

This works in any LLM agent that can run shell commands. The CLI is the interface; skills, rules files, and prompts are thin adapters over it.

For flags and command syntax, see the CLI reference.

On this page