- docs/lightbox.md: setup, sizes, styling, overrides, migration from a hand-made modal or glightbox - AGENT.md (§6.9, §7 catalog, §7.1, §12), ipal-reference (option, wiring, api.md section), ipal-site and ipal-block steps, PROGRAMISTA §6 row 48 - ipal-audit warns about lightbox libraries - notifications.md, richtext.md, media.md, frontend.md, README index Co-Authored-By: Claude Opus 5.5 <[email protected]>
87 KiB
AGENT.md — rules for AI (Payload 3 + Next 16 + @intecion/ipal-kit)
Who this is for: an AI agent (Antigravity, Claude Code, Cursor) working in a client project built on ipal-kit. Read all of it before your first change. The rules are hard, with no workarounds. API details for each module:
docs/<module>.md(map in §12). Installation, deployment, migration and Gitea are covered in the document for humans: the developer guide (PROGRAMISTA.md).In the project:
- a short
AGENTS.mdin the root (template in §13) that points to this file innode_modules/@intecion/ipal-kit/docs/agent/AGENT.md— do not copy the rules, a copy goes stale; (pnpm exec ipal-skillsadds/refreshes theipal-kit:start…endblock with this pointer);- skills in
.agents/skills/(§14) — copied from the package with one command, refreshed after every ipal-kit update;- the full plugin map — every option, env variable, route, layout component, import map entry, hook, collection, global and every export: the
ipal-referenceskill (.agents/skills/ipal-reference/SKILL.md+resources/api.md). Before you write anything "from scratch", check there.
Main rule — the plugin helps, never limits
ipal-kit is a plugin: it helps the project and never limits it. Every module can be turned off on its own; every default (access rules, fields, hooks, labels, routes, collections, globals) can be overridden and the project config wins; safe defaults have an option to loosen/extend them; the plugin exports building blocks (helpers, builders, hooks), not just finished features; it does not force dependencies, routes, UI or data shape where an option or an exported building block is enough.
In practice: before you write something from scratch or start fighting the plugin — find
the option or the exported builder (module docs §12, types in dist/**/*.d.ts). It is missing →
plugin gap (report + a marked workaround in the project code), never patching
node_modules or forking the package.
Docs language: all ipal-kit docs, this guide and the skills are written in English. Write new rules, AGENTS.md entries and plugin-gap reports in English.
Seeding on production (details: node_modules/@intecion/ipal-kit/docs/seeding.md). Write seeds with
createSeeder from @intecion/ipal-kit/seed (the templates do) — it enforces every rule below:
- Seeds are create-only and idempotent: match by the default-locale slug / form title / the global, skip what exists.
- Never delete; never seed users, passwords or secrets; globals: fill only empty fields; no media uploads.
- Every locale written separately with
fallbackLocale: false;context: { disableRevalidate: true, ipalSkipIndexNow: true }. - On production: dry run first (
SEED_DRY_RUN=1), back up the database (Coolify Backup now), then the real run. SEED_UPDATE=1on production / a non-local database only withIPAL_SEED_ALLOW_PROD_UPDATE=1, after a backup; records an editor changed are always skipped and reported (skip (edited)) — never useSEED_FORCE=1there.- Schema and one-off data fixes → Payload migrations; field renames with content → ipal-migrate-fields; content → seeds.
0. COMPASS (if you remember only this)
- ipal-kit is mandatory. A feature the plugin has goes through the plugin. Something is missing → report (§1.3, plugin gap) + a marked workaround, not a silent patch.
- Nothing hardcoded. Text, image, link, file, company data → admin panel. Domains,
keys →
.env. Also in an||fallback and incatch. - Next 16 =
proxy.ts. NEVERmiddleware.ts. - No explicit
<head>, with ISR andgenerateStaticParams— otherwise metadata lands in<body>and SEO breaks. - Minimum collections. ipalKit adds Users, company data/navigation are globals, FAQ/hero are blocks.
- A section = a composition of UI primitives.
buildLinksField()+<CMSLink>, upload +<Media>,<Section>+<SectionHeader>. NoctaLabel/pdfUrlfields. A clear panel (§6.5a): repeated items = an "+ Add …" array withrowLabel, nevercta1/cta2; labels in English, short; no empty "just in case" fields. - Renderers from the plugin:
RenderBlocks(not aswitch),RenderRichText(not your own Lexical parser),useForm(not hand-made form plumbing). - No
anyand no@ts-ignore. Types from@/payload-types,unknown+ guard. - One source of truth —
i18n.config.ts,lib/content.ts, never copies. - "Done" only after a local
pnpm build+ the checks from §11. - Every site has the MANDATORY SET from §0b — SEO, GEO (llms.txt, Markdown,
MCP), R2, Turnstile, forms from the builder.
ipal-auditchecks that it is wired,ipal-seo-check— that it works. There is no "I'll do it later".
How to add… (details in the skill from §14)
| What | How |
|---|---|
| a page | in the panel: Pages + blocks, no code (§5.1) |
| a section (block) | src/blocks/<Name>/config.ts + Component.tsx, an entry in blocks/registry.ts, the block in the Pages layout field → pnpm generate:types (+ pnpm payload generate:importmap with rowLabel) — ipal-block |
| a form | the Forms panel (builder) from the seed scripts/seed-form-*.ts, a block with <RenderForm>, sending via sendForm — ipal-form |
| a language | i18n.config.ts (the only place) + a Postgres migration + content in the new language — ipal-locale-add |
| a collection with URLs | content: { collections: [...] } in ipalKit and createContentHelpers (§5.4) — ipal-collection |
0b. MANDATORY SET — every site, no exceptions
These are not options. Every project has all the items below, wired through the
plugin. Data is missing (domain, keys, bucket)? Wire the code anyway — it works once
the values are entered in .env / the panel, and you list what is missing in the report. You skip an item
only on a client decision recorded in AGENTS.md (the ipal-audit-skip: line, below).
The "Check" column: A = ipal-audit (code), S = ipal-seo-check (running
site), P = a test in the panel. Full code: PROGRAMISTA.md §2.
| # | Area | What must exist (file) | Plugin API | Check |
|---|---|---|---|---|
| 1 | i18n + routing | src/proxy.ts, [locale]/[[...slug]]/page.tsx = createPageRoute(content, {…}) + a literal revalidate, not-found.tsx = createNotFoundPage(content, { load }) + notFoundView.ts (renderNotFoundView) |
createProxy, createContentHelpers, createPageRoute, createNotFoundPage (/rsc) |
A, S |
| 2 | SEO — meta | generateMetadata in every page route; favicon and OG from Site Settings; htmlLimitedBots in next.config.ts; SEO tab + buildNoindexField in Pages |
generatePageMetadata, buildIconsMetadata, buildNoindexField |
A, S |
| 3 | SEO — maps | src/app/sitemap.xml/route.ts (export { sitemapRoute as GET } + force-dynamic), src/app/robots.ts (export { getRobots as default } + force-dynamic — AI bots from the panel), src/app/manifest.ts — re-exports from lib/content |
sitemapRoute, getRobots (or robots without the panel), manifest |
A, S |
| 3a | Search Console / Bing | recommended: domain verification via DNS (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in Site Settings → Search & AI (Google, Bing, Yandex), generatePageMetadata adds the <meta> itself; sitemap https://<domain>/sitemap.xml submitted in GSC and Bing |
panel (optional), verificationFrom |
P |
| 4 | SEO — structured data | layout: <SiteProviders shell={…}> gives WebSite + Organization (sameAs) from Site Settings; local business → createContentHelpers({ siteJsonLd }) with buildLocalBusinessJsonLd (type, hours → formatOpeningHours); navigation: <SiteProviders jsonLd={[buildNavigationJsonLd(…)]}>; page: createPageRoute adds getPageJsonLd (WebPage/BlogPosting, breadcrumbs, FAQ — pageJsonLd: { faq }) |
getSiteShell, SiteProviders, build*JsonLd, getPageJsonLd |
A, S |
| 5 | GEO — llms | src/app/llms.txt/route.ts (llmsRoute) and src/app/llms-full.txt/route.ts (llmsFullRoute) from lib/content; the buildSummaryField() field in Pages, summaryField: 'aiSummary' in createContentHelpers |
llmsRoute, llmsFullRoute, buildSummaryField |
A, S |
| 6 | GEO — Markdown | src/app/md/[locale]/[[...slug]]/route.ts (single-language: src/app/md/[[...slug]]/route.ts) = export { markdownRoute as GET } from '@/lib/content'; createContentHelpers({ markdownAlternate: true }) (link in <head>); createProxy(…, { NextResponse, markdown: true }) (without it /md/… gets redirected to a language) |
markdownRoute, markdownAlternate, createProxy({ markdown }) |
A, S |
| 7 | GEO — MCP | src/app/api/mcp/route.ts = export { mcpGET as GET, mcpPOST as POST } from '@/lib/content' (public — AI browses the site: get_site_info, list_pages, search_content, get_page); name: createContentHelpers({ mcp: { serverName } }) |
mcpGET, mcpPOST |
A, S |
| 8 | GEO — AI bots + IndexNow | robots lets in AI bots (default aiBots: 'allow'; block only on a client decision); AI bot policy and per-bot exceptions — Site Settings → Search & AI → AI crawlers (works only with getRobots); ipalKit({ indexNow: true }) + src/app/indexnow-key.txt/route.ts (indexNowKeyRoute; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with IPAL_NOINDEX=1) |
buildRobots, getRobots, indexNowKeyRoute |
A, S |
| 9 | Media / R2 / speed | Media with focalPoint, normalizeFilenameHook, buildOptimizeUploadHook, buildMediaPlaceholderHook + field; always buildR2Storage(['media'], { s3Storage }) + @payloadcms/storage-s3; R2_* in .env.example; <MediaPreconnect/>; images: buildImagesConfig() and buildUploadSecurityHeaders() in next.config.ts; the project's <Media> via mediaImageProps/videoProps (§6.11b) |
buildR2Storage, mediaImageProps, videoProps, buildImagesConfig |
A, S |
| 10 | Forms | every form from a seed (scripts/seed-form-*.ts: fields, confirmation, mail to the company and confirmation to the customer, every language); a block with <RenderForm> + formClasses.ts (look, once); actions.ts = createSubmitAction({ getCachedPayload, headers }); forms: {…} in ipalKit; email: mailAdapter() |
RenderForm (/rsc), createSubmitAction, mailAdapter |
A, P |
| 11 | Turnstile | <SiteProviders> in [locale]/layout.tsx (wires TurnstileProvider with the key from the panel); RenderForm renders the widget; keys in Site Integrations |
SiteProviders, getTurnstileConfig, TurnstileProvider |
A, P |
| 12 | Consent + analytics | Consent Mode: 'advanced' (default — the Google tag loads at once with every signal denied) or 'basic' (<SiteProviders analytics={{ consentMode: 'basic' }}> — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; ipalKit({ consentLog: true }) (without it the /api/ipal/consent endpoint does not exist) + <SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}> (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (settings: inline / modal / detailed) per the design, brief is silent → detailed, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (cookie-scan → import) — feeds <CookieTable> on the policy page and the lists in the detailed window; Cookie Settings → Detail labels in every language |
consent.md, analytics.md | A, ipal-consent-check |
| 13 | Security | buildSecurityHeaders in next.config.ts; twoFactor: { issuer, plugin: payloadTotp }; CSP report-only → enforce; IPAL_IP_HEADER in production |
security.md, forms.md | A |
| 14 | Operations | src/app/api/health/route.ts (healthRoute); src/instrumentation.ts with assertEnv(ipalEnvRules({ storage: true, ipHeader: true })); staging with IPAL_NOINDEX=1; smoke tests (§8a) |
healthRoute, assertEnv, ipalEnvRules |
A |
| 15 | System pages | Site Settings → System Pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (getSystemLinks(locale)) |
getSystemLinks, getSystemPagePath, getNotFoundPage |
P |
| 16 | Nothing hardcoded | every text, link, image, file, company data from the panel; domains and keys from .env (§2) |
— | A, P |
| 17 | Content | one h1, the answer at the start of each section, facts, internal links, FAQ from real questions, aiSummary, sameAs, consistent company data (§0c) |
— | S, P |
| 18 | Scaling | fluid.css / fluid-wide.css, hero on --ipal-hero-min-h, the screen list in §6.11a (including 1366×768) |
— | A, browser |
Turnstile works by itself: both keys in the panel (or env) → the widget shows, and
submitForm requires a token; no keys → no widget, the form works.
Do not make the provider or the widget conditional in code — always wire them.
R2 works by itself: the full R2_* set in env → media in the bucket; missing → local disk
(dev). Always wire the code, so production does not save media to the container disk
(they disappear on redeploy).
Forbidden substitutes (ERROR in ipal-audit)
| Instead of the plugin | Why not | Use |
|---|---|---|
your own form with fields in JSX, react-hook-form, formik, your own form renderer |
the client cannot change the fields; no Turnstile, rate limit, GDPR consent; a copy of the engine passes addresses from the Emails tab into HTML | the builder in the panel + <RenderForm> (look: formClasses, unusual cases: useBuilderForm) |
your own api/contact / api/send / api/form route, nodemailer / resend / @sendgrid in the project |
bypasses the submitForm validation and gates, a second mail transport |
the sendForm server action → submitForm, mails from Forms → Emails via mailAdapter() |
| reCAPTCHA, hCaptcha, your own captcha | a second mechanism, no status in the panel | Turnstile from the plugin |
a hand-written <script type="application/ld+json"> |
no escaping, drifts from the panel | JsonLdGraph |
your own sitemap.ts / a text robots.txt in public/ |
no hreflang, noindex or system pages | sitemapRoute, getRobots from lib/content |
a verification <meta> / google*.html file in code or public/ |
a deploy for every change; the code belongs to the client | DNS verification, or the code in Site Settings → Search & AI |
your own llms.txt in public/ |
static, goes stale | llmsRoute / llmsFullRoute from lib/content |
your own link function (resolveHref, getHref…): the homepage slug in code (=== 'home'), `/${slug}` |
no language prefix, the homepage depends on Site Settings, javascript: from the panel in href, a dead link leads to / |
resolveLink(link, locale) / resolveNav from lib/content (field: buildLinkField) |
page + url + label fields in globals, prefooterButtonUrl, ctaLabel; style based on content (label === 'Tesla'); legal link labels in code |
the editor cannot choose a file / new tab / style; renaming breaks the look; Polish text in the English version | buildLinkField / buildLinksField with appearances, resolveNav, getSystemLinks |
@aws-sdk/client-s3 / your own upload to the bucket |
bypasses the media hooks and the URL from R2_PUBLIC_URL |
buildR2Storage |
Deliberate exception (only on a client decision)
In the project's AGENTS.md, under "Project decisions", one line with the item keys and the reason:
ipal-audit-skip: mcp, llms-full — the client does not want to share content with AI agents (email 2026-03-02)
Keys: llms, llms-full, markdown, mcp, jsonld, r2, turnstile,
analytics, twofactor, aibots, forms-seed (audit.sh understands only these). Without this line a missing item is an error.
0c. CONTENT FOR GOOGLE AND AI (SEO + GEO) — how you write and lay out pages
The technology from §0b makes the site able to be highly visible. Whether Google ranks it and an AI assistant quotes it depends on the content. When you enter content from the brief into the panel (seed, phase 6 in ipal-site), apply the rules below — without inventing facts.
Structure of every page
- One
h1(the hero/page heading), then sectionh2s,h3s inside — no skipped levels.SectionHeadergetsas="h1"only in the first section. - Answer first. The first 1–2 sentences of a section answer its heading directly ("How much does … cost?" → "From 1500 PLN net for…"). AI quotes exactly such sentences.
- Headings = customers' questions and phrases, not slogans ("How does installation work?", not "Process").
- Facts instead of generalities: numbers, scope, service area, lead time, "from" prices —
only from the brief; missing →
[TO FILL]. No "best quality", "professional approach". - Content in HTML, not in images. Key information must not be only in a graphic or in a
video.
altdescribes what is in the image (not "photo1", not keywords). - Every page links onward: service → related services + contact; post → the service it is about. No page without internal links (CMSLink).
- FAQ from real questions from the brief → FAQ block +
getPageJsonLd(…, { faq })(FAQPage). Questions and answers in JSON-LD = visible on the page, word for word. - Length: a service page ≥ ~300 words of meaningful content; shorter = "thin" — merge it with another or ask for material.
Credibility (E-E-A-T) and the company entity
- An About us page with people, experience, certificates (from the brief); posts with an author and a date.
- The same company data everywhere (name, address, phone): footer, contact, JSON-LD
(
LocalBusiness/Organization), Google Business Profile. One Company global as the source. - Site Settings → sameAs: the company's profiles (Google Business Profile, LinkedIn, Facebook…).
- Site Settings → site description (2–3 sentences: who, what, where) — feeds llms.txt, MCP and meta.
aiSummaryof important pages: fix the auto-fill when the summary is weak (1–3 sentences, facts).
Meta in the SEO tab
Title ≤ 60 characters, unique, key phrase first; description ≤ 155 characters, with specifics and a call to action; a share image (1200×630) on pages with an offer — the rest inherit the default from Site Settings. A description unique on every page — an empty one is filled from the content on save, but a hand-written one is better. Google ignores the same description on many pages.
noindex — when YES, when NO
| Page | noindex? |
|---|---|
| "Thank you" after a form, a confirmation page | yes |
| internal search results, filter/parameter pages | yes (+ disallowParams in robots) |
| a test page, a draft page, a landing page only for a paid campaign | yes |
| staging, preview, a test copy of the whole site | IPAL_NOINDEX=1 in that environment's env — not the checkbox |
| homepage, archives (blog, projects) | never — the panel blocks saving |
| services, offer, contact, about us, posts | never |
| privacy policy, cookies, terms | no by default (they are a credibility signal, they do no harm); noindex only at the client's request |
| 404 | not applicable — the plugin excludes it from the sitemap and returns a real 404 |
noindex does not replace a redirect or a deletion: old address → change the slug (308 from
trackSlugHistoryHook), a page to remove → delete it. Keep draft content as a draft
(unpublished content is not publicly available), not as a published page with noindex.
Checks: ipal-seo-check (one h1, heading order, alt, OG image, thin pages,
internal links, noindex in the sitemap).
0a. HOW YOU WORK — on your own, like an experienced employee
You build the site from brief to handover. The human provides business decisions and content, they do not lead you by the hand. You think, anticipate problems, solve them yourself and check your own work yourself. For a full build use the ipal-site skill — it guides you through all the stages.
You decide yourself (and record the decision in AGENTS.md → "Project decisions")
- technical choices within these rules: splitting into blocks, variants, names, subcomponents, order of work, refactoring your own code,
- fixing everything found by the build,
ipal-audit,ipal-seo-check,ipal-consent-check, - plugin defaults (media limits, ISR, robots) — unless the brief says otherwise.
You ask only about this (collect the questions in one list, not one at a time)
- data that is missing from the brief and the panel: languages, market, domain, company data, analytics IDs and integration keys, notification email addresses;
- irreversible decisions: deleting content, migrating a database with content, changing slugs of published pages, publishing to production;
- a conflict between the brief and the rules (e.g. "this text must be hardcoded") — straight away with a proposal for a compliant solution;
- costs and accounts in external services.
Content is missing? Do not wait — build the structure, enter the content from the brief in the panel.
Do not invent company data, prices, reviews or numbers — enter a clear
placeholder [TO FILL: …] in the panel and list it in the final report.
Anticipate — go through this list before every task
| Question | Typical mistake you avoid |
|---|---|
| Does it work in every language? (slug, content, 404, switcher) | /en/... → 404, because the EN slug is empty |
| Does the page stay static? | headers(), searchParams, cookies() in the page tree (§4) |
| Does the schema change lose data? | renaming a field without a migration → ipal-migrate-fields |
| Will the build pass in a container without a database? | a route reading the database without force-dynamic |
| Is a new script / pixel / iframe behind consent? | YouTube, a map, a chat loaded before consent (GDPR) |
| Can the editor change it without code? | text, link or image in JSX (§2) |
| Performance? | an image outside <Media>, a video without preload, queries outside the cached helpers |
| Security? | a secret in the client, missing server-only, Local API without overrideAccess: false |
| Does the plugin already have it? | your own version of an ipal-kit feature (§1.1) |
Check it yourself before you say "done"
A full ipal-audit, ipal-seo-check and ipal-consent-check on the built
app (pnpm build && pnpm start), the editor test (§11). Attach the results
to the report — without them the task is not finished.
When something does not work
Diagnose (ipal-debug: symptom → cause → fix), fix it at the source, check again. Do not report problems you can solve.
Report only when
- ipal-kit has a bug or is missing a feature → plugin gap (report + a minimal, marked workaround — the work goes on, you do not wait),
- you see an ipal-kit improvement useful in many projects → plugin gap (type: improvement),
- the task is finished → the final report (format in ipal-site).
Do not report progress step by step or things you fixed yourself — they go as one list into the final report.
1. ipal-kit IS MANDATORY
1.1 Before you write anything
Check whether the plugin has it: the module docs (§12) and the types
node_modules/@intecion/ipal-kit/dist/**/*.d.ts. Do not guess signatures. If
the plugin has it — use it. Your own version of an existing plugin feature is an error.
1.2 What belongs to the plugin and what to the project
Rule: identical in every project → plugin. Depends on the client → project.
| Plugin (you use) | Project (you write) |
|---|---|
| i18n, routing, slug, SEO meta, sitemap, hreflang | blocks: schema + look |
| forms, GDPR consent, Turnstile, email | Company/Header/Footer globals (the data model depends on the country: NIP/ABN/EIN) |
| consent, analytics/pixels | CSP (the project's domains) |
| security headers, 2FA, white-label | schema.org: mapping YOUR data to @type |
| hooks (revalidate, slugHistory, cross-locale), system pages, R2 storage | look (Tailwind, DESIGN.md) |
1.3 When the plugin is missing something or something does not work
Do not patch silently (a hook with a hardcoded value, your own helper, as any). It
almost always means the plugin already has it (check the docs) or the plugin is missing it.
The ipal-plugin-gap skill: report + a minimal, marked workaround
(// WORKAROUND ipal-kit <version>: …), the work goes on. The report contains:
- a description of the problem / missing feature,
- the proposed API (function / option signature),
- why it is universal (useful in other projects).
Real mistakes: an afterRead hook in Media with https://media.klient.pl (the plugin generates
the URL from R2_PUBLIC_URL), <link rel="preconnect"> with a hardcoded domain (the plugin has
<MediaPreconnect/>), a copied Analytics component in the project with the consent
gating removed (the plugin enforces consent itself — Google via Consent Mode v2, advanced by default or
basic with analytics={{ consentMode: 'basic' }}, other pixels after consent — and late loading is analytics={{ defer: true }}).
2. NO HARDCODING
| What | FORBIDDEN | REQUIRED |
|---|---|---|
| Text | text in JSX, if (locale === 'pl'), arrays of texts in code |
a localized: true field from the panel |
| Image / file | import x from '@/assets/…', src="/images/…", a file URL in a text field |
upload → media + <Media> / a file type link |
| Link | href="/pl/kontakt", a menu as an array, a localizedRoutes map |
buildLinkField() + <CMSLink>, getLocalizedSlugs, getSystemPagePath, navigation as relationship → pages |
| Configuration | locale as 'pl' | 'en', a hardcoded collection slug, a language list ['pl','en'] |
i18n.config.ts, locale as never, the list from the config |
| Company data | NIP, address, phone, name in code | a global (siteSettings / company) |
| Infrastructure | domain, key, bucket in code | .env |
Hidden hardcoding in a fallback (common): siteName || 'Kancelaria X',
catch { return { name: 'Firma…' } }, theme_color: '#0e1e24'. When the panel does not
return data → omit the field (...(name ? { name } : {})), do not insert the
client's values. Another project will copy the code and show someone else's data.
Favicon: buildIconsMetadata(settings.favicon) (PNG, not a hand-made SVG).
CDN preconnect: <MediaPreconnect /> (from env). Media: normalizeFilenameHook.
3. PROJECT STRUCTURE AND NAMING
src/
app/
(frontend)/
styles.css # Tailwind + @source on node_modules/@intecion/ipal-kit/dist
[locale]/ # single-language: no [locale] (see i18n.md)
layout.tsx # no <head>; <SiteProviders shell={await getSiteShell(locale)}> + Header/Footer
actions.ts # sendForm = createSubmitAction(…) (the only way to send forms)
not-found.tsx # createNotFoundPage(content, { load: loadNotFoundView }) — 404 from the panel
notFoundView.ts # 'use server' → renderNotFoundView(content, { blocks }, locale)
[[...slug]]/page.tsx # DOUBLE brackets; createPageRoute(content, { blocks, … }) + revalidate
(payload)/ # admin panel (generated)
manifest.ts # export { manifest as default } from lib/content + force-dynamic
sitemap.xml/route.ts # export { sitemapRoute as GET } + force-dynamic (styling from the plugin)
robots.ts # export { getRobots as default } + force-dynamic (AI bots allowed; policy from the panel)
llms.txt/route.ts # export { llmsRoute as GET } (GEO)
llms-full.txt/route.ts # export { llmsFullRoute as GET } (GEO)
md/[locale]/[[...slug]]/route.ts # export { markdownRoute as GET } — the page as Markdown (GEO)
api/mcp/route.ts # export { mcpGET as GET, mcpPOST as POST } — public MCP (GEO)
api/health/route.ts # export { healthRoute as GET }
indexnow-key.txt/route.ts # export { indexNowKeyRoute as GET }
instrumentation.ts # assertEnv(ipalEnvRules({...})) from '@intecion/ipal-kit/env'
components/
forms/formClasses.ts # the ONLY place for the look of forms (RenderForm classNames)
ui/ # primitives: CMSLink, Button, Media, Section, SectionHeader
layout/ # Header, Footer, MobileNav (§6.8)
icons/ # names.ts + Icon.tsx (§6.10)
blocks/<BlockName>/ # config.ts + Component.tsx (+ XxxCard.tsx, client files next to it)
blocks/registry.ts # blockType → component
collections/ # Pages.ts, Media.ts (+ content only when required)
globals/ # Header.ts, Footer.ts, Company.ts
lib/content.ts # createContentHelpers — the ONLY access to Payload, routes, links, navigation
i18n.config.ts # locales — one source
payload.config.ts
proxy.ts # NOT middleware.ts
Routes in app/ are re-exports from lib/content — the configuration (domain, summaryField,
MCP name) lives once, in createContentHelpers. Section fields (buildSectionHeaderField,
buildSectionSettingsField), links (resolveLink) and menus (resolveNav) are in the plugin —
do not create src/fields/sectionHeader.ts or lib/navigation.ts.
| Element | Convention | Example |
|---|---|---|
| Block folder, collection, global | PascalCase | blocks/FeatureGrid/, collections/Pages.ts |
| Helper, lib file | camelCase | lib/content.ts |
| Collection slug | camelCase, plural | pages, blogPosts |
| Block slug = registry key | camelCase | hero, featureGrid |
| Field name | camelCase, vocabulary from §6.5 | header, links, media |
| Component | a named function, types from @/payload-types |
export function Hero(...) |
No abbreviations (HeroSection, not HeroSec). Do not create lib/pages.ts,
lib/locales.ts, lib/navigation.ts — the plugin has resolveRoute, getConfiguredLocales, resolveNav.
4. NEXT 16 — RENDERING, SEO, BUILD
proxy.ts, nevermiddleware.ts. middleware.ts exists → delete it. Proxy:export const proxy = createProxy(i18nConfig, { NextResponse, markdown: true }), the matcher as an inline literal (['/((?!api|admin|_next|.*\\..*).*)']), not an import.- No explicit
<head>in the layout. It pushes metadata into<body>.<MediaPreconnect/>in<body>(React 19 hoists it). - ISR:
export const revalidate = 3600inpage.tsx. Refresh after save:buildRevalidateHook(hooks.md). generateStaticParamsin[[...slug]]/page.tsx:export const generateStaticParams = route.generateStaticParams(fromcreatePageRoute) orexport { generateStaticParams } from '@/lib/content'. A route without it is dynamic → metadata in the body. It prerenders only the pages collection (up to 1000 per language); entries ofcontentcollections render on the first request (ISR).htmlLimitedBotsinnext.config.ts(seo.md).- Do not read
searchParamsin a page without pagination — it deoptimizes ISR/SSG. Do not readheaders()/cookies()anywhere in the tree of static pages — in blocks, components, the[locale]layout or innot-found.tsx(Next 16:Page changed from static to dynamic at runtime). Locale for blocks →enhanceProps; innot-found.tsx(noparams) →createNotFoundPage(content, { load })— the language from the URL, content from a server action only on a 404 (the{ blocks }variant puts the 404 in every language into the RSC data of EVERY page — pages.md). export const dynamic = 'force-dynamic'on routes that read the database:manifest.ts,sitemap.xml/route.ts,llms.txt,api/health. The plugin's handlers have try/catch, butdynamicmust be in the route file.instrumentation.tswithassertEnv(ipalEnvRules({...}))imported from@intecion/ipal-kit/env(the root pulls in Payload → Edge/Turbopack crash), insideif (process.env.NEXT_RUNTIME === 'nodejs')(env.md).- RSC by default.
'use client'only for state/interaction, in a separate file; the section stays a server component and passes data to it. Secrets:import 'server-only'. - Blocks do not import
lib/*(cycle). Server-side data →enhanceProps.
5. CONTENT MODEL — WHAT IS WHAT
5.1 Main rule
Everything visible on the site, the editor changes in the panel — headings, paragraphs, buttons (text and target), images, files, section order, SEO, form and banner texts, contact data. The developer provides the building blocks (blocks), the editor composes pages from them. A new page = no code.
5.2 Collection, global or block?
- Block — part of a page (hero, FAQ, gallery, CTA, reviews in a section).
- Global — one set per site (navigation, footer, company data, settings).
- Collection — a list of records, each with its own URL (post, product, project).
5.3 MINIMUM collections
By default: pages, media + the plugin's globals (site-settings,
site-integrations, Notifications, Cookie Settings) + the project's globals
(navigation, footer, company). Nothing more until the client explicitly requires it.
users is added by ipalKit (an auth collection with roles and 2FA) — do not create it, unless
you need extra fields (then your own Users.ts with the slug from access.authCollection;
the plugin adds roles and 2FA to it).
NEVER: a second media, daneFirmy/settings/
navigation/footer as collections (they are globals), FAQ/hero/features as collections
(they are blocks), a collection for a single thing (that is a page or a global).
Test before a new collection — all must be YES: a list of many records? does each have its own URL? does the client explicitly require it? does Payload not have it built in?
Typical content collections (when required): posts/blogPosts (+ authors,
categories), products, projects (portfolio). Reviews (testimonials) without
their own URLs → do not add them to content.
5.4 Wiring collections with URLs
// ipalKit({ content: contentConfig }) and createContentHelpers({ content: contentConfig })
export const contentConfig = {
collections: [{ slug: 'posts', perPage: 10 }],
} satisfies ContentOption
The URL prefix is not in the code — the editor assigns the archive page in Site
Settings (postsArchive). Changing its slug moves the whole section, per language.
The plugin does the routing (resolveRoute), sitemap, generateStaticParams, hreflang.
Every content collection: title, buildSlugField, SEO tab, buildNoindexField,
trackSlugHistoryHook, structured data if relevant (seo.md). Details: content.md.
5.5 System pages
Site Settings → System Pages: homepage, notFound (404), privacyPolicy,
cookiePolicy, termsOfService. Link by role (getSystemPagePath),
never by slug. pages.md.
6. BUILDING SECTIONS (.tsx blocks)
Three problems that must never repeat: a zoo of CTA fields (ctaLabel,
cta2Text, buttonUrl…), files as text (pdfUrl: '/files/x.pdf'),
the monolith section (200–400 lines with cards, SVG icons and button styles).
6.0 Ten component rules (summary — details below)
- Small: a section's
Component.tsx≤ ~80 lines of JSX; a list item > 5 lines → its ownXxxCard.tsx. - One thing = one component, styled ONCE. A button is
Button(look) +CMSLink(target from the panel) — never your own button classes in sections. Changing the look of all buttons = one change inButton.tsx. Same for: image →Media, heading →SectionHeader. - Repeated items = an "+ Add …" array, never numbered fields. Buttons:
buildLinksField()→ the editor clicks "Add Button" as many times as needed (maxRows= as many as the design fits).cta1/cta2/cta3,feature1Title…,image2= an audit error. - A panel readable without knowing the code: English labels of 1–3 words, collapsed rows with content
(
rowLabel), ≤ 6 items visible after adding a block, technical settings in the sidebar. - A variant instead of a copy: a different look of the same section =
variant(select), not a second block. - No text, link or image in JSX — everything from the panel, in every language.
- Empty field = the element does not render (no "Lorem", no empty
<div>). - Server by default; interaction in a separate, small
'use client'file with simple props. - Types from
@/payload-types, named export, imports from@/…, no barrels. - Every new block: an empty-block test in the panel (§6.5a) +
ipal-audit --quick.
6.1 Three layers
LAYER 1 — shared fields: from the plugin (buildLinkField, buildLinksField,
buildSectionHeaderField, buildSectionSettingsField)
src/components/ui/ LAYER 2 — UI primitives (CMSLink, Button, Media, Section, SectionHeader)
src/blocks/X/ LAYER 3 — section = a composition of layers 1 and 2
Changing the look of a button across the whole site = one change in Button.tsx. If
you have to change 12 blocks, the architecture is wrong.
6.2 Layer 1 — shared fields
Link / CTA — from the plugin (links.md), never a copy in the project:
import { buildLinkField, buildLinksField } from '@intecion/ipal-kit'
buildLinksField() // `links` field: 0–2 section buttons
buildLinkField() // `link` field: a single link
buildLinkField({ disableLabel: true, appearances: false }) // the whole card clickable
Link type: page / URL (also mailto, tel, #anchor) / file (upload). A downloadable
file = a file type link, never a pdfUrl field. In payload-types.ts: CmsLink.
Image / video: { name: 'media', type: 'upload', relationTo: 'media' }. The media
collection allows PDF, has alt (required, localized), normalizeFilenameHook and a safety net for oversized
files buildOptimizeUploadHook + buildOptimizeUploadField (storage.md). Prepare files
before uploading — the hook only catches mistakes and asks for consent.
Section heading and settings — from the plugin (blocks.md):
buildSectionHeaderField()→ theheadergroup:eyebrow,heading,intro(localized),buildSectionSettingsField()→ thesettingsgroup (sidebar):anchor,background(project backgrounds:buildSectionSettingsField({ backgrounds: [{ label, value }] }), extra fields:fields). Every section hasbuildSectionSettingsField()— nobgColor,sectionIdper block. Field labels in English (the panel is in English).
6.3 Layer 2 — UI primitives
Code 1:1: section-code.md. Each one has one job:
| Primitive | Does | Instead of |
|---|---|---|
CMSLink (async, server) |
every link from the panel: resolveLink(link, locale) from lib/content (href, internal, targetProps, appearance) + classes from Button |
<a href>, <Link href> in sections |
Button.tsx |
Record<LinkAppearance, string> with variant classes |
ternary chains, button styles in sections |
Media |
every image/video from the panel (next/image, alt from the document) |
<img src={x.url}> |
Section |
id from the anchor, background from the map, container |
a hand-written <section className=…> |
SectionHeader |
eyebrow + heading (h1/h2) + intro |
loose headings in every section |
locale for blocks — once, in the page route (never headers() in components):
createPageRoute passes every block locale, isFirst (first section → its
heading is the only h1) + whatever blockProps returns (e.g. { formTexts, sendForm }). Your own page: enhanceProps={() => ({ locale })}.
Turnstile and consent are in <SiteProviders> in the layout, not in props.
6.4 Layer 3 — section = composition
The model shape of a section (the whole component; the config.ts schema and an example with
repeated items — FeatureGrid + FeatureCard — in section-code.md):
// src/blocks/Hero/Component.tsx — the whole component
import type { HeroBlock } from '@/payload-types'
import { Section } from '@/components/ui/Section'
import { SectionHeader } from '@/components/ui/SectionHeader'
import { Media } from '@/components/ui/Media'
import { CMSLink } from '@/components/ui/CMSLink'
export function Hero({ header, media, links, settings, locale }: HeroBlock & { locale: string }) {
return (
<Section settings={settings}>
<div className="grid items-center gap-10 md:grid-cols-2">
<div>
<SectionHeader header={header} as="h1" />
{links?.length ? (
<div className="flex flex-wrap gap-3">
{links.map(({ id, link }) => <CMSLink key={id} link={link} locale={locale} />)}
</div>
) : null}
</div>
<Media resource={media} priority sizes="(min-width: 768px) 50vw, 100vw" />
</div>
</Section>
)
}
Extract a subcomponent when any of these is true: the same JSX 2+ times;
an items[] element has >5 lines of markup (→ <Name>Card.tsx); Component.tsx >80
lines of JSX; there is state/interaction (→ a separate 'use client' file, §6.9).
A subcomponent of one section → in its folder; used in 2+ sections → src/components/ui/.
6.5 Fixed field vocabulary
| Thing | Field name | FORBIDDEN |
|---|---|---|
| Section buttons / CTA | links (buildLinksField()) |
cta, ctaLabel, ctaHref, ctaTarget, cta2…, buttons, buttonText, buttonUrl, primaryCta |
| A single link (card, item) | link (buildLinkField()) |
href, url, target, linkTo, readMoreUrl |
| Image / video | media |
image, img, imageUrl, photo, bgImage, heroImage |
| Downloadable file | a file type link |
separate pdf, pdfUrl, file, download, attachment |
| Section heading | header (buildSectionHeaderField()) |
loose title, headline, sectionTitle, subheading, subtitle |
| Item text | heading + text |
title/desc/description interchangeably |
| Formatted text | content (richText) |
body, html, richText |
| List of items | items |
cards, features, list, boxes |
| Anchor / background | settings (buildSectionSettingsField()) |
sectionId, bgColor, dark, theme per block |
| GDPR consent in a form | consent (checkbox) |
— |
The only exception is two things of the same kind with different roles
(media + backgroundMedia); the core of the name stays.
6.5a Editor panel — clarity (every block, collection, global)
The editor should open a block and know right away what is where — without dozens of empty fields, without guessing, without numbered slots. You design the schema for the editor, not for the component.
- Repeated items = one array with "+ Add …", never numbered fields.
cta1Label/cta2Url,feature1Title…feature6Title,image2,phone2→ an array: buttonsbuildLinksField()(panel: "Add Button"),itemselements withlabels: { singular: 'Feature', plural: 'Features' }(panel: "Add Feature").maxRows= as many as the design fits,minRowsonly when the layout breaks without an item. - A row shows its content:
admin: { initCollapsed: true, components: rowLabel('heading', 'Feature') }→ collapsed rows "Fast delivery", "24/7 support" instead of "Feature 01".buildLinksFieldhas this built in (row = button label). - The panel in English, short.
label1–3 words, Sentence case ("Heading", "Background");admin.descriptiononly when the label is not enough — one sentence ≤ 80 characters: what it does / where it shows, with a format example ('Section id for #links, e.g. "pricing".'), never how the code works. Select options with a readablelabel("Inverted (dark)"), not the raw value. - No "just in case" fields. Every field is displayed by the component; an empty
optional field = the element does not render (the component handles it). Hide
dependent fields:
admin.condition(video fields only withmediaType: 'video', variant fields only with thatvariant). A look variant =variant(select) in one block, not a second block with a copy of the fields. - Order = order on the page:
header→ content →media→items→links. Technical settings (settings: anchor, background, variant) in the sidebar. A block with > ~10 fields →tabs(Content,Media,Settings); short pairs (type+newTab,width+height) in arowwithadmin.width: '50%'. - Links only through link fields. Every button/link is
buildLinkField/buildLinksField(a page from the list, URL, file) — never a text URL field for your own page, never a link typed into JSX. - Names for humans. Block:
labels: { singular: 'Feature grid', plural: 'Feature grids' }— the name of what the editor sees on the page. Collection:admin.useAsTitle,defaultColumns(3–4),admin.group(Content,Settings,Forms). requiredsparingly — only when the section is broken without a value (e.g. theheadingof a list item, thealtof an image). Selects and checkboxes withdefaultValue.
// BAD — 14 fields, half always empty, numbered slots, link as text
{ name: 'title', type: 'text' }, { name: 'subtitle', type: 'text' },
{ name: 'cta1Label', type: 'text' }, { name: 'cta1Url', type: 'text' },
{ name: 'cta2Label', type: 'text' }, { name: 'cta2Url', type: 'text' },
{ name: 'feature1Title', type: 'text' }, { name: 'feature1Text', type: 'text' }, // …feature3
{ name: 'bgColor', type: 'text', admin: { description: 'Section background color in hex, used in the component className' } },
// GOOD — 4 items in the panel, grows with the "+ Add …" button
buildSectionHeaderField(), // Eyebrow / Heading / Intro
{ name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' }, maxRows: 6,
admin: { initCollapsed: true, components: rowLabel('heading', 'Feature') },
fields: [{ name: 'heading', type: 'text', localized: true, required: true }, { name: 'text', type: 'textarea', localized: true }] },
buildLinksField(), // "+ Add Button"
buildSectionSettingsField(), // sidebar: anchor, background
Empty-block test (after every new block, in the panel): add the block to a page →
at the start ≤ 6 items are visible, everything is in English, buttons and items are added
with "+ Add …", collapsed rows have readable names, nothing requires knowledge of the code.
Automatic checks: ipal-audit (the "panel:" section). After adding rowLabel in
the project: pnpm payload generate:importmap.
6.6 Anti-patterns → fix
// BAD
{ name: 'ctaLabel', type: 'text' }, { name: 'ctaHref', type: 'text' },
{ name: 'secondaryCtaTarget', type: 'relationship', relationTo: 'pages' },
{ name: 'pdfUrl', type: 'text' },
// GOOD
buildLinksField({ maxRows: 3 })
// BAD — the section builds the href and styles the button itself
<a href={`/${locale}/${cta.slug}`} className="rounded-full bg-orange-500 px-6 py-3">{ctaLabel}</a>
<a href="/files/katalog.pdf" download>Pobierz katalog</a>
<img src={image.url} alt="" />
// GOOD
{links?.map(({ id, link }) => <CMSLink key={id} link={link} locale={locale} />)}
<Media resource={media} />
// BAD — a ternary chain
className={v === 'a' ? 'x' : v === 'b' ? 'y' : 'z'}
// GOOD — Record<Variant, string> (Button.tsx, Section.tsx)
6.7 Refactoring a monolith section
- List what the section displays (heading, images, buttons, repeated items).
- Schema per §6.5; CTA →
buildLinksField(). - Renaming fields loses content in the database. A project with content → a migration first (old field → new), then remove the old ones. An empty project → just the rename.
- Component:
<Section>,<SectionHeader>,<Media>,<CMSLink>, repeated items →items.map+XxxCard. pnpm generate:types, types from@/payload-types, the checks from §11.
6.8 Header and Footer (navigation globals)
Code (globals, Header, Footer, MobileNav; resolveNav from the plugin): nav-code.md.
Skill: ipal-nav.
- Navigation, footer, company data = project globals (
header,footer,company), built withbuildLinkField— the company data model depends on the country (NIP/ABN/EIN). - Menu: one level of submenu, no deeper. The CTA in the header =
links. - Logo and name from Site Settings — do not duplicate the fields in Header.
- Footer content in
<NoSnippet>(/rsc, inside<footer>) — otherwise Google shows the address from the footer as the description of every subpage. The same for the contact bar and a CTA repeated on every page. Never on<main>. Details: seo.md → "Descriptions in Google". - Legal links in the footer from the System Pages roles:
await getSystemLinks(locale)(href + page title), not by hand and with no labels in code. - Highlighting a menu item / a button variant =
appearancefrom the panel (buildLinkField({ appearances: [...] }), any names), never a condition on content (label === '…'). - Resolve links on the server:
await resolveNav(header.navItems, locale)fromlib/content→{ href, label, internal, newTab, targetProps, children }[](dead links skipped); only this data goes to the client component (MobileNav) —CMSLinkis a server component. - a11y labels (menu button) — fields in the panel.
- A global changed on every page →
afterChange: [buildGlobalRevalidateHook({ revalidatePath })](it callsrevalidatePath('/', 'layout')).buildRevalidateHookis for collections. The plugin's globals (Site Settings, Site Integrations, Cookie Settings, Notifications) refresh ISR themselves once you passipalKit({ revalidatePath })(fromnext/cache); without it the change shows after therevalidatewindow. - The plugin's globals: read public (Site Integrations: admin only), write editor+. Change their access, admin
or hooks with
ipalKit({ globalOverrides: { notifications: { access: { update: authenticated } } } })— an object merges key by key (your keys win), a function(global) => globaltakes over. Never copy a plugin global. - Only
[locale]/layout.tsxfetches globals and passes them as props.
6.9 Client components ('use client')
- Native HTML first. Expandable FAQ →
<details>/<summary>, modal →<dialog>. Zero JS, works without hydration.useStateonly when HTML is not enough. - A separate file, first line
'use client', the name says what it does (MobileNav.tsx,Slider.tsx,Tabs.tsx). The section stays a server component. - Only serializable props — strings, numbers, arrays of simple objects. No functions, no whole Payload documents (trim to the fields you need).
- Render content on the server, pass it as
children— rich text,Media,CMSLinkdo not go into the client component:// server (block) <Tabs labels={items.map((i) => i.heading)}> {items.map((i) => <RenderRichText key={i.id} data={i.content} />)} </Tabs> // client: Tabs shows children[active] - Forbidden in the client: importing
payload,@/lib/content,@/payload.config,server-only, secrets. Types are allowed (import type). - Plugin hooks from
@intecion/ipal-kit/client(useForm,useConsentContext…). - a11y labels (
aria-label, "Close", "Next slide") — from the panel, via props. - An enlarged image is never a hand-made modal (no
useState(index)+div role="dialog",glightbox,photoswipe, a link to the raw file in a new tab) —<LightboxTrigger>around the thumbnail (a client component you render from a server block with plainlightboxImage(…)data), one<SiteProviders lightbox>, labels from Notifications → Lightbox (lightbox.md).ipal-auditwarns about lightbox libraries and hand-made image dialogs.
6.10 Icons
Two sources, nothing in between: graphics from the client (also the logo, brand icons) →
upload + <Media>; a fixed set of UI icons → a select field with names +
a lucide-react map in src/components/icons/ (names in a separate file, so the block
config does not import React). Code: section-code.md. Never SVG pasted into a section's JSX.
6.11 Styles
- Tailwind in components; colors and fonts as tokens in
styles.css(@theme) from theDESIGN.mdsource. In components only tokens (bg-primary), neverbg-[#ff6600]or hex. - Map the plugin's tokens to the project:
--ipal-primary: var(--color-primary). - Fluid typography and spacing:
@import "@intecion/ipal-kit/fluid.css"+ mapping in@theme(text-h1,py-section,px-gutter— PROGRAMISTA §2.5). Do not writeclamp()in components; other values fromDESIGN.md→ override the--ipal-*variables in:root. - JSON-LD only via
<JsonLdGraph>from/rsc— never your own<script dangerouslySetInnerHTML>. - Fonts via
next/font, wired to@themethrough a CSS variable. - No CSS Modules and no
style={{…}}— exception: a dynamic value from data. - Variants →
Record<Variant, string>, not ternary chains. Examplestyles.css: section-code.md.
6.11a Scaling (fluid / responsive) — from 360 px to 1920 px
- Scale from the plugin:
fluid.css(grows up to 1280 px) orfluid-wide.css(grows up to 1920 px — choose it when the site should look different on a 13″ laptop and a 27″ monitor). Noclamp()in components; numbers fromDESIGN.md→ override--ipal-*in:root. - Screen height: instead of
h-screen/100vh→min-h-[var(--ipal-hero-min-h)](svh, with a limit). Hero heading--ipal-fs-display-fit, hero spacing--ipal-space-section-fit— on 1366×768 the hero CTA must be visible without scrolling. - Widths: container
max-w-[var(--ipal-container)]+px-gutter; running textmax-w-[var(--ipal-measure)](~68 characters per line). No fixedw-[640px],h-[500px]in sections —min(),%,aspect-*,max-w-*. - Grids:
grid-cols-[repeat(auto-fit,minmax(min(100%,18rem),1fr))]or breakpoints; a card reacts to its column: container queries (@container+@md:), not only to the screen. - Cropped images (
object-cover) have a focal point from the panel (focalPoint: truein Media →object-positionfrommediaImageProps). - Test screens (every page, browser / Playwright): 360×740, 390×844, 768×1024, 1024×768, 1280×800, 1366×768, 1440×900 (13–15″ laptops), 1536×864, 1920×1080, plus 125 % and 150 % zoom at 1366 (common on Windows). No horizontal scroll, no clipped text, the menu works, the hero CTA is visible.
6.11b Speed (Core Web Vitals)
| What | How | Forbidden |
|---|---|---|
| LCP image (the first visible one, usually the hero) | <Media priority> — exactly one per page |
priority on many images, the hero as a CSS background-image |
| every other image | <Media sizes={MEDIA_SIZES.third}> — sizes = the width on screen |
no sizes (downloads the full width), <img> |
| placeholder | buildMediaPlaceholderHook + a field in Media (blur + color) |
empty boxes that "jump in" while loading |
| background video | videoMode="background", MP4 H.264 ≤ 20 MB, no sound, with a poster |
a video as the hero without a poster, autoplay with sound |
| video with content | videoMode="player" (loads after a click) |
preload="auto" |
| YouTube | <YouTubeEmbed> from /client (the iframe only after a click) |
a bare <iframe src="youtube.com/embed…"> |
| next.config | images: { ...buildImagesConfig() } (AVIF/WebP, R2) |
no remotePatterns → images from R2 without optimization |
| fonts | next/font, max 2 families × 2–3 weights, subsets: ['latin', 'latin-ext'] (PL), display: 'swap' |
a <link> to Google Fonts, 6 weights "just in case" |
| third-party scripts | Analytics (via SiteProviders, analytics={{ defer: true }}) / ConsentScript from the plugin |
chat/map widgets loaded at start |
| client components | small, interaction only (§6.9) | a whole section 'use client' |
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms.
Checks: ipal-audit (img/video outside Media, many priority, h-screen, fixed widths,
YouTube <iframe>) and ipal-seo-check (images without dimensions, LCP image without priority).
6.12 Exports and imports
- Named exports (
export function Hero).export defaultonly where Next/Payload requires it:page,layout,not-found,route,sitemap,robots,manifest,payload.config. - No
index.tsbarrels inblocks/andcomponents/— they mix server modules with'use client'and break tree-shaking. Import the file directly:@/components/ui/CMSLink. - Always the
@/alias, never../../../. Exception: a file next to it in the same folder (./FeatureCard). import typefor types only.- Import order: external →
@intecion/ipal-kit→@/→ relative. payload.configand collections import only the blocks'config.ts, neverComponent.tsx. Onlyblocks/registry.tsties the components together.
7. PLUGIN PATTERNS — USE THEM, DO NOT REWRITE THEM
Catalog: need → import. Before you write a helper, hook, logic component or route —
find it here. Entry points: @intecion/ipal-kit (server/config), /client ('use client'),
/rsc (server components), /server (server actions), /admin (panel), /env
(instrumentation.ts). The plugin gives the logic and the skeleton; the look stays in the project
(classes, classNames, your own markup on top of a hook). Something is missing that will repeat in another
project → plugin gap, not a copy.
Page and data (lib/content.ts = createContentHelpers, PROGRAMISTA §2.7)
| Need | Use | Doc |
|---|---|---|
| Payload, settings, languages (cached per request) | getCachedPayload, getSettings, getConfiguredLocales |
content.md |
| Catch-all page (route, 308, 404, meta, static params, JSON-LD, blocks) | createPageRoute(content, { blocks, notFound, permanentRedirect, redirect, blockProps, render }) (/rsc) → { Page, generateMetadata, generateStaticParams }; redirect turns on under-construction mode for pages; lib/content hides the same pages in Markdown and MCP (isPathVisible), the sitemap and llms.txt (underConstructionSeo); pass isPathVisible to createSearchRoute yourself |
pages.md, construction.md |
| 404 from the panel in every language | createNotFoundPage(content, { load }) + the server action renderNotFoundView(content, { blocks, fallback }, locale) (/rsc) |
pages.md |
| Layout: consent, banner, Turnstile, analytics, site JSON-LD, preconnect | getSiteShell(locale) + <SiteProviders shell> (/rsc) |
consent.md |
| Your own page / archive | resolveRoute, getEntries, resolvePageRedirect, generatePageMetadata, getPageJsonLd, generateStaticParams |
content.md, pages.md |
| Rendering blocks | RenderBlocks + the registry map (never a switch) |
blocks.md |
| Rich text / Lexical → Markdown | RenderRichText (/rsc, styling via converters), lexicalToMarkdown |
richtext.md |
| A localized value | resolveLocalized(value, locale) (not getSafeString) |
i18n.md |
Fields and panel
| Need | Use | Doc |
|---|---|---|
| Link / CTA / downloadable file | buildLinkField, buildLinksField |
links.md |
| Link to a category / product / post | buildLinkField({ relationTo: ['pages', 'categories'] }) — the address from the archive |
links.md |
| Section heading and settings | buildSectionHeaderField, buildSectionSettingsField({ backgrounds }) |
blocks.md |
| Readable array rows | rowLabel(['heading'], 'Feature') (+ generate:importmap) |
links.md |
| Slug / noindex / description for AI | buildSlugField, buildNoindexField, buildSummaryField |
slug.md, seo.md |
| System pages and their protection | getSystemPagePath, buildPreventDeleteSystemPage, buildValidateUniqueRole |
pages.md, hooks.md |
| ISR after save, old slug → 308, images across languages | buildRevalidateHook, trackSlugHistoryHook, buildCrossLocaleFieldSync |
hooks.md |
| ISR after a global is saved | plugin globals: ipalKit({ revalidatePath }); your own globals: buildGlobalRevalidateHook({ revalidatePath }) |
hooks.md |
| Change a plugin global (access, hooks, fields) | ipalKit({ globalOverrides }) |
access.md |
| Roles and access | adminOnly, adminOrEditor, adminOrSelf, authenticated, requireRole, hasMinimumRole (+ …Field); injected users: access.authAccess, first user = admin (access.firstUserAdmin) |
access.md |
| Data from globals | getGlobal, getSiteSettings, getSiteIntegrations |
payload-helpers.md |
Links and navigation
| Need | Use | Doc |
|---|---|---|
| href + new tab + rel + internal for a link from the panel | resolveLink(link, locale) (lib/content) / resolveLink(link, opts) |
links.md |
| Menu from a global (any depth, dead links skipped) | resolveNav(items, locale) |
links.md |
| Legal links in the footer (href + page title) | getSystemLinks(locale) / resolveSystemLinks |
links.md |
| Highlighted item, button variant | buildLinkField({ appearances: [...] }) — the project's names |
links.md |
| Language paths, switcher, hreflang | getLocalizedSlugs, switchLocalePath, LanguageSwitcher, buildLocalizedPath |
i18n.md |
Safe URL (no javascript:) |
safeHref |
links.md |
Forms
| Need | Use | Doc |
|---|---|---|
| A form from the panel in a block (steps, radio, lists, dates) | <RenderForm form action locale texts classNames> (/rsc) |
forms.md |
| Look of the forms | formClasses.ts (BuilderFormClassNames) — once per project |
forms.md |
| Unusual form markup | BuilderForm renderField / useBuilderForm (/client) |
forms.md |
| A field filled in by the page (product variant, category) | RenderForm values / prepareBuilderForm + BuilderForm values |
forms.md |
| Sending | createSubmitAction({ getCachedPayload, headers }) (/server) |
forms.md |
| Message texts and step button texts | Notifications → getFormTexts(locale) |
notifications.md |
| A form in the database | seed ipal-form/resources/seed-form.template.ts |
forms.md, seeding.md |
| Antispam / limit / IP | honeypot in BuilderForm, Turnstile from SiteProviders (createSubmitAction({ turnstileHostnames }) pins the domain), clientIp, setRateLimitStore, setUnknownIpFactor |
forms.md, turnstile.md |
| GTM event after sending | buildFormAnalyticsFields (panel) — RenderForm sends it itself |
forms.md |
| A form outside the builder (e.g. filters) | useForm + buildValidator, required, email… |
forms.md |
SEO and GEO (routes = re-export from lib/content)
| Need | Use | Doc |
|---|---|---|
| Metadata, canonical, hreflang, OG, X | generatePageMetadata (createPageRoute does it itself) |
seo.md |
| sitemap / robots / manifest | sitemapRoute (splits into a sitemap index above 10 000 URLs; sitemapOptions, sitemapEntries), getRobots (panel) / robots (code only), manifest |
seo.md |
| Search Console / Bing verification, AI crawler policy, llms.txt note | Site Settings → Search & AI (searchSettings); building blocks verificationFrom, robotsOptionsFrom |
seo.md |
| JSON-LD | getSiteShell().jsonLd, getPageJsonLd, build*JsonLd, formatOpeningHours, sameAsUrls, <JsonLdGraph> |
seo.md |
| Product / category JSON-LD (an entry that is not an article) | pageJsonLd.entries + buildProductJsonLd |
seo.md |
| llms.txt / llms-full / Markdown / MCP | llmsRoute, llmsFullRoute, markdownRoute, mcpGET/mcpPOST; markdownAlternate: true; createProxy({ markdown: true }) |
seo.md, content.md, mcp.md |
| IndexNow | ipalKit({ indexNow: true }) + indexNowKeyRoute |
seo.md |
| Search | createSearchRoute({ …, isPathVisible }) |
content.md |
Media, look, speed
| Need | Use | Doc |
|---|---|---|
| R2, file names, optimization, preview | buildR2Storage, normalizeFilenameHook, buildOptimizeUploadHook, buildMediaPlaceholderHook |
storage.md |
Image / video in <Media> |
mediaImageProps, videoProps, MEDIA_SIZES |
storage.md |
| Enlarge an image (card, gallery, product, rich text) | <SiteProviders lightbox> + <LightboxTrigger group image={lightboxImage(media, { size })}> (/client), RenderRichText lightbox, useLightbox; labels: ipalKit({ lightbox: true }) → Notifications → Lightbox |
lightbox.md |
| YouTube without cookies before a click | <YouTubeEmbed> (/client) |
storage.md |
next.config |
buildImagesConfig, buildSecurityHeaders, buildCsp, buildUploadSecurityHeaders |
storage.md, security.md |
| Fluid typography and spacing | fluid.css / fluid-wide.css (--ipal-* variables) |
PROGRAMISTA §2.5 |
Consent, analytics, operations
| Need | Use | Doc |
|---|---|---|
| Banner, settings, cookie button | <SiteProviders banner={<CookieBanner …/>}>, CookieButton, useConsent |
consent.md |
| Settings window: in the bar / small / large with cookie details | <CookieBanner settings="inline" | "modal" | "detailed"> — do not build your own window or cookie list |
consent.md → "Large window with details" |
| A consent-dependent script | ConsentScript |
consent.md |
| Cookie table on the policy page | <CookieTable> (/rsc), getCookieTable |
consent.md |
| GA4, GTM, Pixel, Clarity, LinkedIn, TikTok | IDs in the panel — SiteProviders loads Analytics (analytics={{ defer: true }}; consentMode: 'basic' = no Google request before consent) |
analytics.md |
email: mailAdapter(), sendEmail |
email.md | |
| Env validation, health | assertEnv(ipalEnvRules({…})) (/env), healthRoute |
env.md |
| 2FA, white-label, headers | twoFactor: { issuer, plugin: payloadTotp }, whiteLabel, buildSecurityHeaders |
security.md, white-label.md |
| Rate limit (forms, MCP, search) | built in; IP from IPAL_IP_HEADER; several instances → setRateLimitStore |
forms.md |
Compliance (PL/EU) — the mechanism from the plugin, the content from the client: policy pages
as System Pages, CookieBanner + CookieButton, a consent checkbox in
forms (enforced server-side), the controller's data in a global, the cookie
table from the panel (<CookieTable> and the settings="detailed" window, scan: ipal-consent-check). You do not write legal texts. An accessibility widget — only when the client
requires it (accessibility.md).
Security: 2FA enforced (ipalKit({ twoFactor: { issuer, plugin: payloadTotp } }), never twoFactor: false without a client decision). CSP: first
report-only, then enforce; no Trusted Types (they break Turnstile/GA).
7.1 Newer defaults — turn off / override (the plugin helps, never limits)
| Feature (default) | Turn off | Override / building blocks |
|---|---|---|
| Plugin globals: write editor+ (Site Integrations: admin) | — | ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } }); a function (global) => global takes over (applyGlobalOverrides) |
Global saves revalidate the layout (with ipalKit({ revalidatePath })) |
omit revalidatePath; once: context: { disableRevalidate: true } |
buildGlobalRevalidateHook on your own globals |
Staff features without access (no roles field): every logged-in account passes (userMeetsRole) |
add access (roles decide) |
globalOverrides, forms.formSubmissionOverrides, consentLog.collectionOverrides, stats.collectionOverrides |
Consent records / stats visits: read and delete admin (stats view and chart follow stats-visits read access) |
omit consentLog / stats |
consentLog.collectionOverrides, stats.collectionOverrides (object merges access/admin/hooks, function takes over; applyCollectionOverride) |
Injected users: admin manages everyone, others only themselves |
— | access.authAccess (your keys win); your own users collection wins whole |
| First registered account = admin | access.firstUserAdmin: false |
buildRolesField(defaultRole, { firstUserAdmin }) |
| 2FA on the panel's login collection, mismatch = startup error | twoFactor: false (discouraged) |
twoFactor.collectionSlug, allowCollectionMismatch: true |
enabled: false keeps the schema |
— | — (no endpoints, onInit or admin components; no DROP TABLE in migrate:create) |
No client IP = one shared unknown-ip bucket at 20× the limit |
setUnknownIpFactor(0) (only with a limiter in front) |
setUnknownIpFactor(n); UNKNOWN_IP_FACTOR |
| Turnstile token domain not checked | (default) | createSubmitAction({ turnstileHostnames }), verifyTurnstile({ hostnames }) — leave empty in dev |
Consent Mode advanced |
consentMode: 'basic' |
your own <Analytics> props (SiteProviders analytics={false}) |
| Locale cookie: consent read under its own stored version | — | createProxy(config, { policyVersion }) / createLocaleMiddleware({ policyVersion }) |
| Construction mode hides pages in Markdown, MCP | markdown: { isPathVisible: () => true }, mcp: { isPathVisible: () => true } |
isPathVisible, isPathVisibleIn(mode, path), pathOf(url), type PathVisibility |
| Construction mode filters the sitemap and llms.txt | underConstructionSeo: false |
include / getIncludedPaths in the low-level builders |
getSettings at depth: 1 |
— | createContentHelpers({ settingsDepth: 2 }) (every request pays) |
| Image lightbox (off) | — (opt-in: <SiteProviders lightbox>, LightboxTrigger, RenderRichText lightbox, ipalKit({ lightbox: true }) for panel labels) |
texts, classNames, unstyled, --ipal-lightbox-* variables, renderImage, renderDialog, loop, useLightbox, withLightboxUploads, lightboxImage |
RenderRichText renders unsafe link URLs as # |
safeLinks={false} (fully trusted content only) |
your own converters |
| Search & AI tab in Site Settings | searchSettings: false (top level, works without seo; seo.searchSettings still works) |
searchSettings: (fields) => fields; verificationFrom, robotsOptionsFrom |
Verification <meta> from the panel |
empty fields = no tag | const { verification, ...meta } = await generatePageMetadata(…) |
| AI crawler policy from the panel | robots instead of getRobots; policy default |
buildRobots({ ...robotsOptionsFrom(settings), aiBotRules }); AI_ASSISTANT_BOTS, AI_TRAINING_BOTS |
| Sitemap split / CDN cache / memo | sitemapOptions: { maxUrls: Infinity, cacheControl: false, memoSeconds: 0 } |
sitemapEntries, createSitemapRouteHandler, buildSitemapIndexXml, buildSitemapEntries |
Sitemap error = 503 + Retry-After |
— (correct HTTP behaviour) | your own route with buildSitemapXml |
IndexNow silent with IPAL_NOINDEX |
indexNow off by default |
submitToIndexNow by hand |
8a. TESTS — what you check and how
You test the behavior the client and Google see, not the plugin's implementation (it has its own tests). Order from the cheapest:
| Level | What | When |
|---|---|---|
| Types | pnpm generate:types && pnpm tsc --noEmit |
after every schema change |
| Rules | ipal-audit --quick (hardcoding, the §0b set, panel) |
after every block / collection |
| Build | pnpm build — page routes ● (SSG), not ƒ |
before every "done" |
| Smoke (Playwright) | ipal-audit/resources/smoke.spec.template.ts → tests/smoke.spec.ts: all URLs from the sitemap 200 + title + one h1, 404, GEO routes, banner, form end-to-end |
before handover and after every ipal-kit update |
| Site in the browser | ipal-seo-check, ipal-consent-check, cookie-scan |
before handover, after deploy |
| Project logic | vitest for your own functions (mapping company data to JSON-LD, helpers, hooks, migration scripts with --dry-run) |
when you write logic the plugin does not have |
| Panel | the editor test (§11) and the empty-block test (§6.5a) | every new block / global |
Rules:
- A test independent of content — it finds elements by roles and
data-ipal, URLs from the sitemap, not by texts the editor will change tomorrow. - Every fixed bug = a test that would have caught it (smoke or vitest), so it does not come back.
- Test the form for real: sending → a record in Form Submissions → mail to the company and confirmation to the customer (locally: Site Integrations → Send test + adapter logs).
- Do not test the plugin in the project (e.g. whether
submitFormvalidates) — ipal-kit does that. When the plugin's behavior is wrong: plugin gap. - Tests in the project's CI: types + audit
--quick+ build on every push; smoke on staging (IPAL_NOINDEX=1) before a production deployment.
8. CODE STANDARDS
Types
- No
any/@ts-ignore. Unknown shape →unknown+ a type guard. - Types from
@/payload-types(pnpm generate:types), not hand-made copies.interfaceNameon shared fields/blocks gives named types. - A generic at the call site:
getSiteSettings<SiteSetting>(payload), notason the result. - Configuration:
as const satisfies I18nConfig. - An acceptable narrow cast:
doc.slug as unknown as Record<string, unknown>withlocale: 'all'(the generator does not model this mode),locale as never.
Payload
- In hooks pass
reqto subsequent operations (one transaction). - A hook that updates a document → a flag in
context(context.skip) against a loop. - The Local API bypasses access control —
overrideAccess: falsewhen it should respect the user. blocks: []crashes — always ≥1 block.
Errors
- Never
catch {}. Log the specifics (payload.logger.error), return a controlled result. - A user error (400, a readable message) ≠ a system error (log + a generic message).
- Validate input in endpoints and server actions.
- Guard clauses instead of an
ifpyramid.
Readability
- Names say WHAT (
publishedPosts, notarr); functions = verb + noun. - A comment says WHY, not WHAT.
- Magic numbers/strings → named constants.
- The smallest change that solves the problem. Do not rewrite things along the way.
9. ANTI-PATTERNS THAT REALLY HAPPENED
| Anti-pattern | Effect | Rule |
|---|---|---|
middleware.ts in Next 16 |
routing does not work | only proxy.ts |
| the proxy matcher as an import | /admin, /_next → 500 |
inline literal |
[slug] instead of [[...slug]] |
slug.join is not a function, /pl is not matched |
double brackets |
an explicit <head> in the layout |
metadata in the body, crawlers do not see it | no <head> |
no ISR / generateStaticParams |
dynamic route, metadata in the body | both mandatory |
await searchParams without pagination |
loss of SSG/ISR | do not read it |
| a hardcoded slug map | a second source of truth | getLocalizedSlugs |
lib/pages.ts, your own resolvePage |
drifts from the plugin | resolveRoute |
your own switch (blockType) |
grows linearly, no enhanceProps | RenderBlocks |
| your own Lexical parser | formatting bugs, XSS | RenderRichText |
| hand-made form plumbing | duplicated logic, holes | useForm |
| a hardcoded domain in a Media hook | another project = someone else's domain | R2 from env via the plugin |
siteName || 'Firma X' |
someone else's data in another project | omit the field |
| a hand-rendered favicon | Google does not show it | buildIconsMetadata |
a copied Analytics in the project |
pixels without consent (GDPR) | Analytics from the plugin via SiteProviders (options: analytics={{ defer, consentMode }}) |
import('@payload-config') through a variable |
Cannot find module in the build |
injection / props |
ctaLabel, buttonUrl, pdfUrl in blocks |
a zoo of fields, no consistency | buildLinksField() |
no @source for the plugin in CSS |
plugin components without styles | @source |
a users/settings/faq collection |
duplicates Payload / the wrong entity | §5.3 |
a form with fields in JSX + api/contact + nodemailer |
the client cannot change the form, spam without Turnstile and a limit | §0b: builder + submitForm |
| "I'll do GEO later" — no llms/md/MCP | the site is invisible to AI assistants | §0b.5–7 |
| media on the container disk in production | files disappear on redeploy | buildR2Storage always |
TurnstileProvider only "when there is a key" in code |
the widget disappears after a change in the panel, a bot skips verification | the provider always, getTurnstileConfig |
The common denominator: duplication (two sources of truth) or a broken chain (the change did not reach where it had to). One source + verification with grep eliminate most of it.
10. DIVISION OF WORK
- Agent (Antigravity / Claude): architecture, collections, blocks, routing, editability through the panel, integrations, no hardcoding. Functionality first.
- Impeccable: the look (colors, typography, spacing, animations) based on
PRODUCT.md+DESIGN.mdin the project root (/impeccable init,/impeccable document). The agent does not "polish" styles ad hoc. Impeccable does not touch content — design tokens in code are the visual system, not hardcoded content. - Editor: all content in the panel.
Record the key project decisions (stack, decisions, page modes) in the project's AGENTS.md
(§13), do not rely on session memory.
11. BEFORE YOU SAY "DONE"
Run, do not guess — ipal-audit (the §0b set + the rules below) and ipal-seo-check
(GEO and SEO on the built site) instead of manual greps:
bash .agents/skills/ipal-audit/scripts/audit.sh
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
pnpm generate:types && pnpm tsc --noEmit
pnpm build # --webpack in the script; locally, not only dev
# hardcoding and the field zoo in blocks
grep -rnE "name: '[a-zA-Z]*([cC]ta|[bB]utton|Url|Href|[pP]df)[a-zA-Z]*'" src/blocks
grep -rnE 'href=\{?["`]/|<img |/files/|/images/|\.pdf' src/blocks
grep -rnE '<(a|Link) ' src/blocks # only CMSLink in sections
find src/blocks -name 'Component.tsx' -exec wc -l {} + | awk '$1 > 120'
grep -rnE "(bg|text|border)-\[#" src/blocks src/components # hex instead of tokens
grep -rln "^'use client'" src | xargs grep -lnE "@/lib/content|from 'payload'|server-only" # server code in the client
find src/blocks src/components -name 'index.ts' # barrel — delete it (no exceptions)
# architecture
ls src/middleware.ts 2>/dev/null && echo "DELETE middleware.ts"
grep -rn "localizedRoutes\|as any\|@ts-ignore" src
grep -rn "<head" src/app
Every hit is an error or a deliberate, commented exception. After the build, page
routes must be ● (SSG), not ƒ.
Editor test — through the panel alone, without code, in every language:
- changes every heading, text, label
- replaces every image and downloadable file
- changes the text and target of every button
- adds, removes, reorders sections; creates a new page from blocks
- changes the menu, footer, company data
- changes the page SEO, the form texts and the cookie banner texts
- assigns the system pages (including 404)
Anything that needs a developer → move it to the panel.
12. MODULE MAP (API details)
| Module | File |
|---|---|
| Roles and panel access | access.md |
| Accessibility widget (optional) | accessibility.md |
| GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok | analytics.md |
| Blocks, RenderBlocks, enhanceProps | blocks.md |
| Cookie consent, banner | consent.md |
| Routing, archives, redirects, Markdown, search | content.md |
| Email SMTP / Graph | email.md |
| Env validation | env.md |
| Forms, useForm, honeypot | forms.md |
| Hooks | hooks.md |
| i18n, proxy, language switcher | i18n.md |
| Links / CTA (fields + href) | links.md |
| The site's MCP server | mcp.md |
| Form messages | notifications.md |
| System pages, 404, generateStaticParams | pages.md |
| Under-construction mode | construction.md |
| Visit statistics (optional) | stats.md |
| Light / dark theme | theme.md |
| Payload helpers (getSiteSettings…) | payload-helpers.md |
| Rich text | richtext.md |
| Headers, CSP, 2FA, panel path | security.md |
| SEO, metadata, sitemap, JSON-LD, llms.txt | seo.md |
| Auto-slug | slug.md |
| Media: collection, file names, optimization, placeholders | media.md |
| Image lightbox (enlarge, galleries, rich text images) | lightbox.md |
R2, buildImagesConfig, YouTube |
storage.md |
Front end: createContentHelpers (@/lib/content), createPageRoute, SiteProviders |
frontend.md |
Integrations (the site-integrations global, statuses, email test) |
integrations.md |
| Deployment, production env, health check | deployment.md |
| Seeds on production: create-only, dry run, backup, update guard | seeding.md |
| Meta Pixel / GA4 via GTM | gtm-meta-pixel.md |
| Turnstile | turnstile.md |
| Panel white-label | white-label.md |
13. AGENTS.md TEMPLATE FOR A PROJECT
Copy it to the project root as AGENTS.md and fill it in. Do not copy the rules — this
file points to them.
# AGENTS.md
**Project:** <client> · <domain> · market <PL/AU/US> · industry <…>
**Languages:** <pl, en, de> · **Media:** <R2 / local> · **Email:** <SMTP / Graph>
## Rules
Before your first change, read all of:
`node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`
Module details: `node_modules/@intecion/ipal-kit/docs/<module>.md`.
Skills: `.agents/skills/ipal-*` (refresh: `pnpm exec ipal-skills`). Always run `ipal-audit` before "done".
The rules in AGENT.md take precedence over your general knowledge of Next/Payload.
ipal-kit helps, never limits: first the plugin's option / exported builder; missing → plugin gap (ipal-plugin-gap), never a patch in `node_modules`.
Write everything in this file in English.
## Site map
- <pages from the brief, the sections on each — written by ipal-site>
## Project decisions
- <client-specific decisions, e.g. "blog without authors", "404 = homepage">
- <exceptions to the rules — with the reason>
- <only on a client decision> ipal-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
Claude Code reads CLAUDE.md, not AGENTS.md — add a CLAUDE.md in the root with one
line @AGENTS.md (an import), instead of copying the content. pnpm exec ipal-skills does this itself:
it adds the <!-- ipal-kit:start -->…<!-- ipal-kit:end --> block to AGENTS.md (a pointer to
AGENT.md, ipal-reference, ipal-setup), and creates a missing CLAUDE.md with @AGENTS.md.
On every run it replaces only the text between the markers — it does not touch your own content.
14. SKILLS (Antigravity, Claude Code, Cursor)
The skills are in the package: node_modules/@intecion/ipal-kit/docs/agent/skills/.
At the start the agent sees only their names and descriptions, and reads the full instructions when
the task matches — manually: /<name>.
| Skill | When |
|---|---|
ipal-site |
a whole site from brief to report — guides you through the other skills (§0a) |
ipal-reference |
the full plugin map: ipalKit options, env, routes, proxy, layout, import map, hooks, collections, globals + resources/api.md (every export) — before you write something yourself |
ipal-setup |
a new project from scratch (foundation) — complete installation stage by stage |
ipal-block |
a new or revised section (block) — schema, panel (§6.5a), component |
ipal-collection |
"we need a blog / products / …" — before a file appears in src/collections |
ipal-nav |
header, menu, footer, company data |
ipal-form |
a form from the panel: renderer, submitForm action, Turnstile, mails, GTM |
ipal-locale-add |
a new language — configuration, content, the locale-coverage script |
ipal-migrate-fields |
changing fields that already contain content — 3 phases, a script with dry-run |
ipal-upgrade |
updating ipal-kit in an existing project |
ipal-debug |
anything does not work — procedure + a symptom → cause → fix table |
ipal-audit |
before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
ipal-seo-check |
the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
ipal-consent-check |
browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode advanced (all signals denied) — a client who wants zero requests gets consentMode: 'basic' |
ipal-plugin-gap |
ipal-kit has a bug or is missing a feature — report + a marked workaround, the work goes on |
Run the scripts in the skills, do not read them (the output is enough): ipal-audit/scripts/audit.sh,
ipal-seo-check/scripts/seo-check.mjs, ipal-consent-check/scripts/consent-check.mjs,
ipal-locale-add/scripts/locale-coverage.ts; templates to copy are in resources/.
Installation in the project (once and after every ipal-kit update) — ipal-skills is
a command (bin) of the package:
pnpm exec ipal-skills # → .agents/skills/ipal-*
pnpm exec ipal-skills --dry-run # only show what will change
pnpm exec ipal-skills --dest .claude/skills # Claude Code looks for skills in .claude/skills
pnpm exec ipal-skills --no-pointer # skills only, without touching AGENTS.md / CLAUDE.md
Besides the skills, the command maintains the pointer to the guide: the ipal-kit:start…end block in
AGENTS.md (it creates the file when missing) and in CLAUDE.md (when missing — it creates CLAUDE.md
with @AGENTS.md; when CLAUDE.md already imports @AGENTS.md — it does not duplicate it). Run it
right after pnpm add @intecion/ipal-kit — the plugin has no postinstall script.
It copies only the ipal-* folders: adds new ones, replaces existing ones entirely, removes
retired ones. Name the project's own skills without the ipal- prefix — they stay untouched.
--dest must be a subdirectory of the project. Commit the copied ipal-* to the project repo.
tsconfig.json must exclude the skills directory (it contains .ts/.tsx templates that
break tsc and next build): "exclude": ["node_modules", ".agents"] (with --dest .claude/skills — ".claude"). Without it ipal-skills prints a warning and exits with
code 1. The commands in this file and in the skills assume .agents/skills/ — with a different
--dest replace the path.