Setup instructions for agents
Instructions for a coding agent to set contentbit up in a project, check the built pages, fix what is safe, and report the rest.
contentbit checks the pages a site's build writes for SEO and link problems, and points each one at its source: a Markdown line, a shared template element, or a page. Follow these steps in order, without asking the person anything until the report at the end.
1. Read the project
Change nothing yet. Find:
- The site's folder. The folder with the site's
package.jsonand build script. In a monorepo it is a subfolder, such asapps/web/. Run every command below from it. - GitHub, whether
git remote -vlists a github.com remote.
2. Run init
npx contentbit@latest init -y --ci githubpnpm dlx, yarn dlx and bunx work too: init installs with the package
manager of the project's lockfile either way. Leave out --ci github when the
repository is not on GitHub. If you are Claude Code, add --claude to install
the contentbit-author and contentbit-audit skills, and a CLAUDE.md that
imports AGENTS.md.
init installs contentbit as a dev dependency. It finds the site's Markdown
and its build folder, and writes contentbit.config.ts with them, the
content:check and content:context scripts, the AGENTS.md block, and the
workflow. In a monorepo it writes the workflow at the repository root, set to
run in the site's folder. When it finds a build, it also writes the page routes
that attach each Markdown file to its built page. It never overwrites a file.
Keep what it writes.
Then act on its output:
found Markdown:names the globs it wrote tocontent. If one holds files that are not pages of the site, such as a folder of developer notes, remove it fromcontentincontentbit.config.ts.renders this site on a server. The build writes no static HTML, socheckfails until the line's fix is made. Don't change how the site builds. Say so in the report, and skip to step 7.kept: contentbit.config.ts. Add what check needs to it. Add the fields it prints to the config, merged with the ones it has.kept script: content:check. Change the script tocontentbit check.skipped: .github/workflows/contentbit.yml already exists. Add the steps it prints to that workflow's job.
3. Build the site
Run the site's build script, such as pnpm run build. check reads the HTML
it writes. If check later says the build folder does not exist, set
site.build in contentbit.config.ts to the folder the build wrote.
4. Attach every Markdown file to its page
npx contentbit contextRead the Markdown: line near the top, such as - Markdown: 3 files, 0 with a built page. When fewer files have a built page than there are files, run:
npx contentbit adoptCopy the links section of its suggested contentbit.config.ts into yours.
Leave its suggested frontmatter alone. Run context again. A file that still
has no built page is a draft or a page the site does not publish: list it in
the report.
5. Check, and fix only what is safe
npx contentbit checkIf it prints Origin unknown, set site.origin in contentbit.config.ts to
the site's public URL, from its framework config.
Fix these findings without asking. Each fix keeps what the page says and what it ranks for:
| Finding | Fix | Why it is safe |
|---|---|---|
CB_LINK_ANCHOR_MISSING | When the target page has one id for the same section, such as #preshape for #pre-shape, point the link at it. The outline in npx contentbit context <page> gives each heading's id, as in h2 Preshape #preshape. | The link still reaches the section the author meant. |
CB_PAGE_STRUCTURED_DATA_INVALID | Fix the JSON syntax of the JSON-LD block, such as a trailing comma, without changing a value. | Search engines skip a block that does not parse. The fix lets them read what the author wrote. |
CB_SKILL_DRIFT | Run npx contentbit agents. | It refreshes contentbit's own skill files. |
| Markdown changed after the build | Rebuild the site and check again. | No source file changes. |
Leave every other finding to the person, including any anchor with no clear
match. A missing page, a title, a description, a canonical URL, a heading, alt
text, the sitemap and hreflang all change what a page says or how it ranks.
CB_UNKNOWN_BLOCK on the ::: containers of another tool, such as VitePress
or Docusaurus, is not a mistake in the page. Don't touch info findings:
count them in the report.
After your fixes, build and check again.
6. Leave the agent guidance in place
Make sure AGENTS.md holds the block between <!-- contentbit:start --> and
<!-- contentbit:end -->. If it doesn't, run npx contentbit agents. It tells
the next agent to read a page's context before it edits the page, and to check
the site after it builds it.
7. Report
End with this report, and nothing after it. Give every path from the repository root, and write none on a line with nothing to report:
## contentbit setup
- Files changed: every file you created, edited or deleted.
- Scripts added: the package.json scripts init added.
- CI: the workflow file and what it runs, or why there is none.
- Fixed: each fix, with its code and file:line.
- Still open: the errors and warnings check reports, grouped by code, each
with its file and line, or its page when no Markdown file causes it.
- Suggestions: how many info findings, by code.
- Next: what the person needs to decide.