Co-Authored-By: Claude Fable 5.2 <[email protected]>
141 KiB
AGENT.md — rules for AI (Payload 3 + Next 16 + IAPL, package @intecion/ipal-kit)
Who this is for: an AI agent (Antigravity, Claude Code, Cursor) working in a client project built on IAPL (called ipal-kit before 1.17.0; names: "Names: IAPL and ipal-kit" below). 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 iapl-skillsadds/refreshes theiapl:start…endblock with this pointer);- skills in
.agents/skills/(§14) — copied from the package with one command, refreshed after every IAPL update;- the full plugin map — every option, env variable, route, layout component, import map entry, hook, collection, global and every export: the
iapl-referenceskill (.agents/skills/iapl-reference/SKILL.md+resources/api.md). Before you write anything "from scratch", check there.
Names: IAPL and ipal-kit
The plugin is called IAPL (Intecion Advanced Payload Library) since 1.17.0. Before that it was called
ipal-kit. The package is still @intecion/ipal-kit: install lines and import paths did not change.
Rule for an existing project: do not rename anything on your own. Every old name works through 1.x. A
project moves to the new names only when its owner asks: the iapl-upgrade skill, "→ 1.17.0". In new code
use the name in the middle column. pnpm exec iapl-doctor lists what is still old (legacy-names, info).
| Before 1.17.0 | Now | In 1.x |
|---|---|---|
ipalKit(), IpalOptions |
iapl(), IaplOptions |
both work, same function and type |
ipalEnvRules, IpalEnvFeatures |
iaplEnvRules, IaplEnvFeatures |
both work. Not the same list: ipalEnvRules() names the plugin's variables IPAL_… (alias IAPL_…), iaplEnvRules() names them IAPL_… (alias IPAL_…) — code that filters or maps the rules by rule.name keeps working. Constants COOKIE_SCAN_URL_ENV / COOKIE_SCAN_TOKEN_ENV keep the IPAL_ values; the new ones are IAPL_COOKIE_SCAN_URL_ENV / IAPL_COOKIE_SCAN_TOKEN_ENV |
ipalT, ipalVar, IPAL_TOKENS, IPAL_BREAKPOINTS, IpalTokenName, IpalGlobalSlug |
iaplT, iaplVar, IAPL_TOKENS, IAPL_BREAKPOINTS, IaplTokenName, IaplGlobalSlug |
both work |
commands ipal-kit, ipal-doctor, ipal-skills, ipal-tokens, ipal-blocks |
iapl, iapl-doctor, iapl-skills, iapl-tokens, iapl-blocks |
both installed, same programs |
env IPAL_IP_HEADER, IPAL_NOINDEX, IPAL_COOKIE_SCAN_URL, IPAL_COOKIE_SCAN_TOKEN, IPAL_SEED_ALLOW_FULL, IPAL_SEED_ALLOW_PROD_UPDATE, IPAL_DOCTOR_TOKEN, IPAL_DOCTOR_IMPORT_MAP (crawler service: IPAL_CRAWLER_SITES) |
the same with IAPL_ |
IAPL_… is read first, IPAL_… when it is missing or empty; set one, not both |
ipal-doctor.json |
iapl-doctor.json |
whichever exists is read and written; never keep both |
ipal-audit-skip: lines in AGENTS.md |
iapl-audit-skip: |
both read |
pointer block <!-- ipal-kit:start --> … <!-- ipal-kit:end --> |
<!-- iapl:start --> … <!-- iapl:end --> |
both recognised; iapl-skills rewrites the old one in place |
skills ipal-<name> (16) |
iapl-<name> |
iapl-skills installs the new folders and removes the 16 old ones by name; a project's own ipal-… skill is left alone. A text that still names an ipal-<name> skill — the vendored ext-* skills say "the ipal-reference skill" — means iapl-<name> (iapl-reference) |
files node_modules/@intecion/ipal-kit/bin/ipal-*.mjs |
bin/iapl*.mjs |
the old files are still there and run the new ones (older skills and CI call them by path) |
log prefix [ipal] |
[iapl] |
changed (a log filter on [ipal] needs the new prefix) |
Not renamed — write them exactly like this, in every project:
| Name | Why |
|---|---|
package @intecion/ipal-kit and every import path (@intecion/ipal-kit/client, …/tokens.css), import-map paths @intecion/ipal-kit/admin#…, node_modules/@intecion/ipal-kit/docs/… |
the package name changes in 2.0 |
routes /api/ipal/… |
proxies, cached pages and the crawler call them (the mail service's four routes, new in 1.17.0, are /api/iapl/mail-relay/…) |
CSS tokens --ipal-*, hooks data-ipal="…" |
projects' own CSS uses them |
config.custom.ipal, custom.ipalAccounts, req.context flags (ipalSeed, ipalSkipIndexNow, ipalSkipAutoFill, …), ipalTotpView server props, translation namespace ipal |
projects' hooks and overrides read them |
header X-Ipal-Cookie-Crawler |
WAF rules |
Two stored names have a second spelling, chosen once per site (iapl({ storageNames }), docs/stats.md,
docs/security.md):
Site made before 1.17.0 (default, storageNames: 'ipal') |
Site made since (storageNames: 'iapl', set by iapl create) |
|
|---|---|---|
| visitor cookie of the built-in statistics | ipal_vid |
iapl_vid — and the layout passes visitorCookie={IAPL_VISITOR_COOKIE} to <PageStats> / <SiteProviders stats={{ … }}> |
2FA attempt counter in payload-kv |
ipal:2fa-verify:<collection>:<id> |
iapl:2fa-verify:<collection>:<id> |
Never switch storageNames on a live site: visitors' histories and running 2FA counts start again, and the
cookie list must be approved again. iapl-doctor (storage-names) reports a layout and a config that disagree.
Main rule — the plugin helps, never limits
IAPL 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 it to the owner and wait for their decision (see "IAPL first" below), never
patch node_modules or fork the package.
Docs language: all IAPL docs, this guide and the skills are written in English. Write new rules, AGENTS.md entries and plugin-gap reports in English.
VERY IMPORTANT — seeding after launch. Once a site is live, never run a full seed again: the owner's edits on the live site must survive. Every later change targets named records only — specific pages, globals, forms or fields — listed in the seed (
only: [...]/SEED_ONLY="pages:kontakt,global:header"). Never re-seed everything, not even in create-only mode, without the owner's explicit OK.createSeederrefuses a run with no record list against a production or non-local database unlessIAPL_SEED_ALLOW_FULL=1(set it only after that OK).
Database names (MongoDB and Postgres): the site's domain with the dots removed, plus _prod or _dev —
intecion.com → intecioncom_prod / intecioncom_dev, architektimprez.pl → architektimprezpl_prod /
architektimprezpl_dev. The name is the path of DATABASE_URI: mongodb://…@mongo:27017/intecioncom_prod?authSource=admin,
postgres://…@db:5432/intecioncom_prod. You derive the names from the domain and confirm them with the owner (iapl-setup
stage 0). iaplEnvRules({ databaseName: true }) warns when they do not match (deployment.md §4.2a).
PAYLOAD_SECRET: at least 32 random characters, different per environment (iapl create writes 64). In
production iaplEnvRules refuses a shorter one (secretMinLength, default 32, 0 = off). Never change it on a live
site without the owner's OK: every login session and every stored API key depends on it (deployment.md §1).
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:
- Call
guardSeedExit()first in every seed script (beforegetPayload): a run that ends early exits 1 with the reason instead of a silent 0 that looks like success in Coolify's Terminal. - 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 withIAPL_SEED_ALLOW_PROD_UPDATE=1, after a backup; records an editor changed are always skipped and reported (skip (edited)) — never useSEED_FORCE=1there.- After launch: named records only (
only/SEED_ONLY); a full run of a live database is refused withoutIAPL_SEED_ALLOW_FULL=1. - Schema and one-off data fixes → Payload migrations; field renames with content → iapl-migrate-fields; content → seeds.
Ask before you build — architecture questions
Before you set up a site (or a new part of one), ask the owner these questions and wait for the answers. They decide the architecture; a wrong guess means rework. Ask them as one list, once, at the start — the ready-to-send list is in iapl-setup stage 0 (iapl-site phase 0 uses the same list).
| Topic | What you need to know |
|---|---|
| Languages | which locales, the default locale, URL structure (/pl/… for every language, or the default without a prefix) |
| Styling | a design system / DESIGN.md or plain Tailwind tokens, brand colours, fonts, light/dark theme |
| Content | the pages, the collections (blog, case studies, products…), archive pages |
| Forms | which forms, who receives them; e-mail: the built-in mail service by default — ask only whether the client wants its own SMTP server and sender address (never offer Microsoft Graph: deprecated) |
| Analytics and consent | GA4 / GTM / pixels, Consent Mode basic or advanced, cookie banner mode, cookie scan |
| SEO / GEO | market and local business data, AI crawler policy (llms.txt, Markdown, MCP, AI bots) |
| Data and media | database (Postgres or MongoDB) and its names (<domain without dots>_prod / _dev — derive, then confirm), media storage (R2 or local disk) |
| Admin | 2FA, white-label (client brand in the panel), agency credit |
| Hosting | Coolify, the production domain(s), who adds the DNS records (deployment.md §6) |
- A new site starts with
iapl create(docs/project-starter.md):pnpm --config.auto-install-peers=false dlx @intecion/ipal-kit@<version> create <domain>asks exactly these questions (or reads them from--answers file.json), generates the site from the reference site, writes the answers intoAGENTS.mdand makes the first commit. Ask the owner first, then pass the answers — the command never fills a gap. The manual path (iapl-setupstages 1–11) is for an existing project or what the command does not cover yet: single-language sites, a default language other thanpl, sites withouten, URLs without a prefix, Postgres — the command stops with a message pointing here. - Write every answer into the project's
AGENTS.md→ "Project decisions" (one line per topic). - Do not guess a missing answer. No answer to an architecture question → do not build that part; ask again.
(Only content gaps — company data, texts, IDs — may wait: use
[TO FILL: …]in the panel, §0a.) - An answer that conflicts with these rules → say so straight away and propose a compliant option.
IAPL first — hard rule
- Anything the plugin covers, you build with the plugin's feature. Always. Look it up first: the
iapl-reference skill, the module docs (§12), the types in
dist/**/*.d.ts. - The only exceptions: the plugin's feature does not work, or it is not enough for this project.
- Even then: report the gap to the owner first with the iapl-plugin-gap skill and do nothing on your own for that part until the owner decides (wait for a plugin fix / an approved option / an approved, marked workaround). Work on unrelated parts may go on.
- No hand-built replacements and no silent workarounds. A workaround exists only after the owner approved
it, is marked
// WORKAROUND IAPL <version>: docs/plugin-requests/<file>and is recorded in "Project decisions".
Reference site — copy the pattern, not from memory
Every convention in this file is implemented in the reference site: one complete client site on IAPL
("Example Studio", made up), kept current with each release and built, seeded and smoke-tested in the plugin's CI.
Before you write a file the plugin expects you to wire (payload.config, layout, catch-all page, lib/content.ts,
proxy, SEO/GEO routes, forms, seeds, AGENTS.md, DESIGN.md, deploy notes), open
node_modules/@intecion/ipal-kit/docs/agent/reference-site/INDEX.md, find the matching file and copy its pattern —
short wiring files are in the index in full, longer ones are linked at the tag of your plugin version. Change only the
project's content (names, texts, blocks the site map needs), never the pattern. The index and this file disagree →
report it with iapl-plugin-gap: it is a plugin bug.
Code rules
Short version of §8 — every skill follows it.
- Single responsibility: one job per file, per component, per function.
- Small files, clear names, no dead code (no commented-out code, unused exports or props).
- No duplicated logic — extract it once; reuse the plugin's exports instead of rewriting them.
- Typed, no
any(no@ts-ignore; unknown shape →unknown+ a type guard). - Texts in i18n, never literals — every visible text comes from the panel / localized fields (§2).
- Tests or checks for new behaviour — a unit test, an
iapl-audit/iapl-seo-checkresult, or a documented manual check (§8a).
// BAD — one component fetches, formats and renders; hardcoded text; any
export function Offer({ data }: { data: any }) { const p = fetch(…); return <h2>Nasza oferta</h2> }
// GOOD — data comes in typed props (enhanceProps / lib/content), text from the panel, one job
export function Offer({ header, items }: OfferBlockProps) { return <Section header={header}><OfferList items={items} /></Section> }
0. COMPASS (if you remember only this)
- Ask first. Architecture questions before you build ("Ask before you build" above) — never guess.
- IAPL is mandatory. A feature the plugin has goes through the plugin. Missing or broken → report it (plugin gap, §1.3) and wait for the owner's decision — no 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. iapl 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 short and in the panel's languages ({ en, pl }, guidedocs/dev/admin-ux.md); 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). Sections from the block library first:libraryBlocks+createBlockRegistry(15 ready blocks, docs/block-library.md); an own block only when no library block, variant or option fits. - 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.
iapl-auditchecks that it is wired,iapl-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) | a library block first: blockOptions → libraryBlocks in src/blocks/configs.ts, createBlockRegistry(content, { Image, Link, sendForm }) in blocks/registry.ts (docs/block-library.md). None fits → src/blocks/<Name>/config.ts + Component.tsx, extra in the registry, pageBlocks → pnpm generate:types (+ pnpm payload generate:importmap with rowLabel) — iapl-block |
| a standard page (home, about, services, contact, legal, 404…) | pageTemplates from @intecion/ipal-kit/templates in the content seed (after launch only with SEED_ONLY) — iapl-site phase 6 |
| a form | the Forms panel (builder) from the seed scripts/seed-form-*.ts, a block with <RenderForm>, sending via sendForm — iapl-form |
| a language | i18n.config.ts (the only place) + a Postgres migration + content in the new language — iapl-locale-add |
| a collection with URLs | content: { collections: [...] } in iapl and createContentHelpers (§5.4) — iapl-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 iapl-audit-skip: line, below).
The "Check" column: A = iapl-audit (code), S = iapl-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 engines (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 engines → AI assistants (works only with getRobots); iapl({ indexNow: true }) + src/app/indexnow-key.txt/route.ts (indexNowKeyRoute; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with IAPL_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 iapl; 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"; iapl({ 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 (cookieScanner: true → Cookie review → Scan cookies → Approve cookies → Approve and add; or cookie-scan → import) — feeds <CookieTable> on the policy page and the lists in the detailed window; Cookies → Settings window → Cookie list headings in every language |
consent.md, analytics.md | A, iapl-consent-check |
| 13 | Security | buildSecurityHeaders in next.config.ts; withPayload(withSecurityConfig(nextConfig)) (no X-Powered-By); CSP: buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', … } }) + buildAdminCspHeaders on /admin/:path* + src/app/api/csp-report/route.ts (createCspReportRoute) → read the reports → mode: 'enforce'; twoFactor: { issuer, plugin: payloadTotp } + generate:importmap (TotpRedirectProvider, SafeTotpView; check: a new admin lands on /admin/setup-totp?back=%2Fadmin with the QR, no reloading; a login with the password only gets 403 from /api/globals/site-integrations and /api/form-submissions — security.md "What the second factor covers"); own endpoints: secondFactorPassed(req) / userMeetsRole(req, role); an account without 2FA can only set it up (twoFactor.requireSetup, default: nothing else answers, 72 h from creation or an admin's reset, then blocked until an admin chooses "Reopen setup" on the account) — so set 2FA up right after creating an account; iapl-doctor --url must report 0 accounts without 2FA; Postgres/SQLite: migration for totpSetupFrom; IAPL_IP_HEADER in production |
security.md, forms.md | A |
| 14 | Operations | src/app/api/health/route.ts (healthRoute); src/instrumentation.ts with assertEnv(iaplEnvRules({ storage: true, ipHeader: true })); staging with IAPL_NOINDEX=1; smoke tests (§8a) |
healthRoute, assertEnv, iaplEnvRules |
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 |
| 19 | Design tokens | DESIGN.md + src/design/tokens.ts → pnpm exec iapl-tokens → src/design/tokens.css; styles.css imports fluid-wide.css, tokens.css, tailwind.css, the brand file (§6.11); fonts in --font-family-body / --font-family-heading |
defineTokens, iapl-tokens |
A (iapl-tokens --check), browser (both themes) |
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 iapl-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) |
| a file input wired by hand, your own upload route, form files saved to Media / R2 / disk | candidate and customer documents end up public or kept forever; no type, size or macro checks; the gates are skipped | forms: { attachments: true } + the File field — the file is e-mailed to the company and never stored (forms.md "Files") |
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 engines |
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:
iapl-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, csp (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 iapl-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 | IAPL_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: iapl-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 iapl-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,
iapl-audit,iapl-seo-check,iapl-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)
- the architecture questions ("Ask before you build" at the top) — before you build; you wait for these answers;
- 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 → iapl-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 IAPL feature (§1.1) |
Check it yourself before you say "done"
A full iapl-audit, iapl-seo-check and iapl-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 (iapl-debug: symptom → cause → fix), fix it at the source, check again. Do not report problems you can solve.
Report only when
- IAPL has a bug or is missing a feature → plugin gap (report to the owner and wait for their decision on that part — no workaround on your own; unrelated work goes on),
- you see an IAPL improvement useful in many projects → plugin gap (type: improvement),
- the task is finished → the final report (format in iapl-site).
Do not report progress step by step or things you fixed yourself — they go as one list into the final report.
1. IAPL 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 iapl-plugin-gap skill: report to the owner and wait for their decision on that part
("IAPL first" at the top). A workaround only after approval, marked
(// WORKAROUND IAPL <version>: …) and recorded in "Project decisions". 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)/ # any route group name works ((site) …); iapl-doctor finds it by structure
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(iaplEnvRules({...})) 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(iaplEnvRules({...}))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. - Next.js 16.4.5 or later (minimum safe version; the plugin, the reference site and the starter use 16.4.6).
16.0.0–16.4.0 have unauthenticated RCE and DoS advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr,
GHSA-p3m5-59mp-jv5r); 16.3.0–16.4.4 have GHSA-mfr8-8qww-v76h (information disclosure across root params when a
'use cache'function is called throughunstable_cache(), moderate; fixed in 16.4.5). Payload supports no patched 15.x line. Pinnextandeslint-config-nextto the same 16.4.x (≥ 16.4.5):pnpm add [email protected] [email protected], and make suresharpresolves to 0.35.5 or later (pnpm why sharp). The plugin's peer range stays open (next >=15) — the minimum is yours to keep. Check:pnpm ls next sharp→ next ≥ 16.4.5, sharp ≥ 0.35.5;pnpm exec iapl-doctor→ nonext-minfinding;pnpm devprints no security-upgrade warning. - No open production advisories. Node.js 20 or later for the plugin itself (its
nodemailer10 requires it); Payload 3.94 needs Node.js 22.23.5 or later on the 22 line (engines:">=22.23.5 <23",.nvmrc22), locally, in CI and in Coolify (Nixpacks takes the major fromengines/.nvmrcand the patch from its own release: checknode -vin the app's Terminal; below 22.23.5, update Coolify before moving to Payload 3.94). Runpnpm audit --prod. The plugin's own dependencies are clean; what remains comes from Payload's tree, which only the project's lockfile can fix. Withpayload3.94.x two packages are still pinned below a fix and needpnpm.overridesnext to the@payloadcms/*ones:"dompurify@<3.4.17": "^3.4.17", "happy-dom@<21.0.4": "^21.0.4"happy-domcomes from@payloadcms/richtext-lexical→@lexical/headless0.50 (^20.9.0, still so in 3.94.1); every 20.x has GHSA-c8p4-j97h-3vg8 (high, SSRF when parsing untrusted HTML, fixed in 21.0.0) and GHSA-834v-8h66-3h79 (high, host code execution, fixed in 21.0.4). 21 is a major, but only@lexical/headless/dom(withDOM) loads it — Payload never imports that entry, and Lexical 0.53 itself moved to^21.0.4.dompurifycomes from the admin code editor (@payloadcms/ui→monaco-editor; low advisories). On an older Payload add these too, until you upgrade (upgrading to 3.94.1 is the better fix):"mongoose@>=8 <8.24.7": "~8.24.10", "undici@>=7 <7.30.1": "^7.30.1"mongoose(MongoDB sites on Payload 3.90–3.93):@payloadcms/db-mongodbpins 8.24.1, which has five advisories — GHSA-pcrw-h46h-c93h (critical,sanitizeFilternot applied oncountDocuments, fixed in 8.24.3), GHSA-gg4r-jv3p-qx3c and GHSA-8332-j7wj-wjw4 (high), GHSA-wr5m-5jph-8m96 and GHSA-6972-9mcm-vhwj (moderate), all fixed in 8.24.7; Payload 3.94.0 and later ship 8.24.7.undici(Payload 3.90–3.91): 3.92.0 and later ship 7.30.1. Both selectors match only the vulnerable versions, so they do nothing once Payload ships the fix — remove them then.graphql-scalarsneeds no override any more: GHSA-x8rm-f576-gq67 now covers 1.24.1–2.0.0 only, and@payloadcms/graphqlpins 1.22.2. A"graphql-scalars@<2.0.1": "^2.0.1"line added earlier may be removed (it also works if kept: Payload's GraphQL runs unchanged on 2.x). Thedeepmergelow is gone from Payload 3.94.1. Everything else in the report (fast-uri,js-yaml,browserslist,source-map-js,fast-copy,baseline-browser-mapping) is a range:pnpm updateor a fresh lockfile picks up the fix; add an override like the ones above only if it does not. These are recommendations — the plugin forces none of them. Never add a project dependency onnodemaileror@types/nodemailer. Check:pnpm audit --prod→ no high or critical;pnpm why dompurify happy-dom mongoose undici→ only the fixed versions (dompurify 3.4.17 or later, happy-dom 21.0.4 or later, mongoose 8.24.7 or later, undici 7.30.1 or later);pnpm exec iapl-doctor→ notransitive-minfinding; after a Payload or mongoose change runpnpm build, open the panel and save a document.
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 banner) + the project's globals
(navigation, footer, company). Nothing more until the client explicitly requires it.
users is added by iapl (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).
A second auth collection (customers, members, a client zone) — only when the client requires accounts
for visitors. Then, all four:
admin: { user: 'users' }inbuildConfig— Payload otherwise logs the panel in with the FIRST auth collection in the list, and 2FA and the staff checks follow the panel collection.- Its accounts are visitors to the plugin: no role counts for them (also a
rolesfield of their own with the valueadmin) and they pass none of its checks —userMeetsRole,isAdmin,adminOnly,adminOrEditor,requireRole, the settings globals, Site integrations, form submissions, consent records, stats, cookie scanner. Give them exactly what they need with your ownaccessrules that checkreq.user.collection; never add the collection toaccess.staffCollectionsto "make something work".access.staffCollectionsis for a second collection of STAFF (access.md → "Who is staff"). - In every auth collection use
adminOrSelfIn('<its slug>'), notadminOrSelf, for "only my own record". - Payload's default for a collection or global without
accessis "any logged-in account" — a customer too. Give every collection and global explicitaccess. 2FA covers the panel's collection only. - Never let a sign-up write a field that grants rights (
roles,isAdmin, …): give such a fieldaccess: { create: adminOnlyField, update: adminOnlyField }. - Check: log in as such an account (
POST /api/customers/login), thenGET /api/globals/site-integrations,GET /api/form-submissionsandGET /api/userswith its token must answer403, and so mustPOST /api/setup-totp.
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
// iapl({ 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)
Block library first. The plugin ships 15 sections built to every rule below — hero, textMedia,
featureGrid, cta, richText, faq, contact, gallery, testimonials, stats, steps, logos, team,
pricing, entryList — with variants, { en, pl } panels, accessibility and token-only styling, plus ten page
templates (block-library.md). Turn them on with libraryBlocks(blockOptions), render them with
createBlockRegistry, change them with their options (fields, variants, classNames, ui, components), own one
with iapl-blocks eject. The rules below are how those blocks are built and how you build your own when none fits.
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:
{ en, pl }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) +
iapl-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 as{ en, pl }objects (the panel runs in English and Polish; §6.5a).
6.3 Layer 2 — UI primitives
With the block library they come from the plugin: Section, SectionHeader, Media, CMSLink, buttonClass,
Container, Card from @intecion/ipal-kit/blocks/rsc (no project copies; src/components/ui/ holds only a
project version you pass in with createBlockRegistry(content, { ui: { Media } })). A project without the library:
code 1:1 from 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 the editors' languages, short — follow
docs/dev/admin-ux.md(node_modules/@intecion/ipal-kit/docs/dev/admin-ux.md): its glossary, sentence case, field order and tab / sidebar / collapsible rules.- Every visible field has an explicit
label— never Payload's auto-label from the name (ctaUrl→ "Cta Url"). Label 1–3 words, ≤ 30 characters. - Texts are
{ en: '…', pl: '…' }(one key per admin language of the project):label,admin.description, optionlabel, tablabel,labels.singular/plural,admin.group. Type:AdminTextfrom@intecion/ipal-kit; shorthandadminText('Title', 'Tytuł')from@intecion/ipal-kit/blocks. In a schema fileiapl-auditaccepts both; the same words in a component are an error. admin.descriptiononly when the label is not enough — one sentence ≤ 120 characters: what it does / where it shows, with a format example ('Section id for #links, e.g. "pricing".'), never how the code works (no component, function, env-var or package names).- Select options with a readable
label("Inverted (dark)"), not the raw value. - The admin panel runs in English and Polish by default (IAPL sets
i18n.supportedLanguageswhen the project has not); set your own list to change it. The plugin's own texts are overridable: field/global labels viaglobalOverrides/collectionOverrides, component texts viai18n.translations.<lang>.ipal.<key>(keys:adminTextsfrom@intecion/ipal-kit). Building blocks for your own admin components:iaplT,formatNumber,formatDateTime,defineTexts,ADMIN_LANGUAGES,applyAdminI18n(already applied byiapl),adminDocumentTitle+<DocumentTitle>(/admin; a custom view's tab title in the admin language — Payload'smeta.titleis one fixed string), typesAdminText,AdminLanguage,AdminTextKey— details in i18n.md "Admin panel languages and texts". Check: Polish panel → the view's browser tab reads in Polish.
- Every visible field has an explicit
- 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: iapl-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: iapl-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 banner, Notifications) refresh ISR themselves once you passiapl({ 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
iapl({ 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 Form messages → Image viewer (lightbox.md).iapl-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 — the design-token standard (design-tokens.md)
Every site uses the same --ipal-* token names and Tailwind utilities; only the values differ per brand.
- The brand lives in two files:
DESIGN.md(human, templateiapl-setup/resources/DESIGN.md) andsrc/design/tokens.ts(defineTokensfrom@intecion/ipal-kit/tokens, templateiapl-setup/resources/tokens.ts).pnpm exec iapl-tokenswritessrc/design/tokens.css(commit it) and fails on a WCAG AA contrast error. Never edit the generated file; never put brand values instyles.cssor in a component. styles.cssis the same on every site:@import "tailwindcss",@intecion/ipal-kit/fluid-wide.css(orfluid.css),@intecion/ipal-kit/tokens.css,@intecion/ipal-kit/tailwind.css,../../design/tokens.css(last),@sourceof the plugin's dist.- Components use only the utilities from the preset:
bg-bg,bg-surface,bg-surface-muted,bg-inverse,text-fg,text-fg-strong,text-fg-muted,text-on-primary,border-border,bg-primary hover:bg-primary-hover,text-link,outline-focus,text-h1…text-display,py-section,px-gutter,gap-gap,rounded-control,rounded-card,shadow-sm,max-w-container,duration-fast ease-out. Never hex,bg-[#…],var(--color-…), ordark:for colours (the roles switch withdata-themethemselves).dark:only for non-colour differences. - Inverted section:
<Section>withsettings.background = inverted→bg-inverse+data-surface="inverse"; content inside keepstext-fg/text-link/bg-primary(the scope re-maps them; a dark brand primary needsprimary-inverse/primary-inverse-textintokens.ts— the contrast report says when; default: the brand primary).data-theme="dark"on any element = a dark panel. - Fonts via
next/fontwithvariable: '--font-family-body'/'--font-family-heading'on<html>(not--font-body: avar()cycle with thefont-bodyutility). Max 2 families. - Values a CSS variable can't reach (
next/og, e-mail,theme-color):resolveColors(tokens)from@/design/tokens. In inline styles / charts:IAPL_TOKENS.primaryoriaplVar('primary'); breakpoints in JS:IAPL_BREAKPOINTS. - A missing role every site would need → iapl-plugin-gap; a project-only decorative colour →
styles.cssbelow the imports +DESIGN.md→ Deviations. - JSON-LD only via
<JsonLdGraph>from/rsc— never your own<script dangerouslySetInnerHTML>. - 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-wide.css(grows up to 1920 px — the default for new sites) orfluid.css(stops at 1280 px). Noclamp()in components orstyles.css; different numbers fromDESIGN.md→ min/max pairs insrc/design/tokens.ts(fs: { h1: ['2.25rem', '4rem'] },space: { section: [3, 8] }) →iapl-tokens. - 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: iapl-audit (img/video outside Media, many priority, h-screen, fixed widths,
YouTube <iframe>) and iapl-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: iapl({ revalidatePath }); your own globals: buildGlobalRevalidateHook({ revalidatePath }) |
hooks.md |
| Change a plugin global (access, hooks, fields) | iapl({ globalOverrides }) |
access.md |
| Roles and access | adminOnly, adminOrEditor, adminOrSelf, adminOrSelfIn(slug) (several auth collections), authenticated, requireRole, hasMinimumRole (+ …Field); staff checks: userMeetsRole(req, role), isAdmin(req.user, req.payload) (roles count only for accounts of a staff collection; in a client component isAdmin(user, config) with useConfig(), imported from @intecion/ipal-kit/client (the main entry does not build there with webpack), in middleware isAdmin(user, { staffCollections: ['users'] }) — without the last argument there it is always false), staffCollectionSlugs(payload), access.staffCollections; second factor in your own code: secondFactorPassed(req), requireSecondFactor(access); injected users: access.authAccess, first user = admin (access.firstUserAdmin) |
access.md, security.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 |
| A file on a form (CV, specification) | forms: { attachments: true } + a File field in the panel; the file is e-mailed to the company and never stored (no Media, no bucket, no download). Options FormAttachmentsOption (maxSizeMB, maxTotalMB, maxFiles, fileTypes: FormFileType / FormFileDetect, allowRisky, scan: FormFileScanInput → FormFileScanResult, strictPdf, notice, maxConcurrent, path, submit: FormSubmitEndpointOptions); block buildFileBlock / fileBlock; types FORM_FILE_TYPES, refused RISKY_FILE_EXTENSIONS; own markup getFileProps / getFiles / removeFile, fileFieldRules, fileFieldError, formatFileSize, BuilderFileLimits, BuilderFile; own transfer submitForm({ files }) + splitFormFiles; transport ceiling mailAttachmentLimit |
forms.md "Files", email.md "Attachments" |
| Message texts and step button texts | Form messages → getFormTexts(locale) |
notifications.md |
| A form in the database | seed iapl-form/resources/seed-form.template.ts |
forms.md, seeding.md |
| Antispam / limit / IP | honeypot in BuilderForm (getHoneypotProps on useBuilderForm), 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 engines (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 | iapl({ 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: iapl({ lightbox: true }) → Form messages → Image viewer |
lightbox.md |
| YouTube without cookies before a click | <YouTubeEmbed> (/client) |
storage.md |
next.config |
buildImagesConfig, buildSecurityHeaders (csp), buildCsp, buildCspHeaders, buildAdminCsp / buildAdminCspHeaders, buildUploadSecurityHeaders, withSecurityConfig (hides X-Powered-By) |
storage.md, security.md |
| CSP reports, nonces | createCspReportRoute (parseCspReports, type CspViolation), createProxy({ csp }) + <SiteProviders nonce> (dynamic pages only), createCspNonce, CSP_NONCE_HEADER, buildReportingEndpoints, cspHeaderKey, DEFAULT_CSP_REPORT_GROUP; types BuildAdminCspArgs, CspDirective, CspSources, CreateCspReportRouteArgs, WithSecurityConfigOptions |
security.md |
| Fluid typography and spacing | fluid.css / fluid-wide.css (--ipal-* variables); your own sizes: fluidClamp, FLUID_SCALE, FLUID_RANGES |
design-tokens.md |
| Brand colours, fonts, radii, motion, dark mode | tokens.css + tailwind.css, src/design/tokens.ts (defineTokens, types TokensInput, ColorInput, ColorRole), pnpm exec iapl-tokens (--check, --report, --warn-only); building blocks tokensToCss, defaultTokensCss, contrastReport (ContrastRow), contrastRatio, parseColor, resolveColors, IAPL_TOKENS, iaplVar, IaplTokenName, IAPL_BREAKPOINTS, COLOR_DEFAULTS, STATIC_DEFAULTS, FLUID_TOKENS, INVERSE_SCOPE, LEGACY_DARK_ROLES, LIGHT_SELECTOR, DARK_SELECTOR, INVERSE_SELECTOR, RemValue, FluidRange |
design-tokens.md |
| Accessibility widget CSS | @intecion/ipal-kit/a11y.css (works through the tokens) |
accessibility.md |
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 |
| Cookie list filled from the panel (scan, then one approval adds every cookie to the list, the policy table and the detailed window) | iapl({ cookieScanner: true }) + pnpm generate:importmap + migration; the editor approves on /admin/cookie-approval; project cookies: cookieScanner.declarations / integrations; per-entry review: approval: false — do not type the list by hand or build your own scanner or approval page |
cookie-scanner.md |
| Pre-consent check in a browser (button in the panel, violations, dashboard + e-mail warning) | cookieScanner: { crawl: true } + env IAPL_COOKIE_SCAN_URL / IAPL_COOKIE_SCAN_TOKEN (iaplEnvRules({ cookieCrawl: true })) + the site's host=token in the shared service's IAPL_CRAWLER_SITES; never Playwright/Chromium in the site |
cookie-scanner.md → Browser crawl |
| 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() + serverURL — mail works with no other setup, through the Intecion mail service; SMTP in the panel only when the client asks; your own mail: payload.sendEmail (withMailKind when it is account mail); never a second transport in the project. §7.2 |
email.md | |
| Env validation, health | assertEnv(iaplEnvRules({…})) (/env), healthRoute |
env.md |
| 2FA, white-label, headers | twoFactor: { issuer, plugin: payloadTotp }, whiteLabel, buildSecurityHeaders |
security.md, white-label.md |
| Panel link preview + noindex (site name, description, preview image, technology support credit) | on by default (adminMeta, agency) — do not hand-write admin.meta for it; override single keys in admin.meta or adminMeta: { … } |
white-label.md |
| Rate limit (forms, MCP, search) | built in; IP from IAPL_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: iapl-consent-check). You do not write legal texts. An accessibility widget — only when the client
requires it (accessibility.md).
Security: 2FA enforced (iapl({ twoFactor: { issuer, plugin: payloadTotp } }), never twoFactor: false without a client decision). No X-Powered-By:
withPayload(withSecurityConfig(nextConfig)). CSP in three steps (security.md → "ROLL OUT CSP"):
(1) buildSecurityHeaders({ csp: { mode: 'report-only', reportUri: '/api/csp-report', <flags for what the site loads> } }), the admin rule { source: '/admin/:path*', headers: buildAdminCspHeaders({ mode: 'report-only', reportUri }) } AFTER the site-wide one, and export const POST = createCspReportRoute() in
src/app/api/csp-report/route.ts; (2) deploy, read the console and the [csp] lines in the Coolify logs,
add missing hosts with flags / extra; (3) change mode to 'enforce' in both places. Check:
curl -sI $U/pl | grep -iE 'content-security|x-powered-by'. ISR/SSG sites keep the header policy (with
'unsafe-inline' — Next's inline RSC scripts cannot be hashed); nonces (createProxy({ csp }) +
<SiteProviders nonce>) only on sites whose pages already render per request. 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) | — | iapl({ globalOverrides: { <slug>: { access, admin, hooks } } }); a function (global) => global takes over (applyGlobalOverrides) |
Global saves revalidate the layout (with iapl({ revalidatePath })) |
omit revalidatePath; once: context: { disableRevalidate: true } |
buildGlobalRevalidateHook on your own globals |
Form files (forms.attachments): off; when on — 10 MB, PDF/DOC/DOCX ticked, programs/macros/archives refused, no antivirus, Graph sends files of 3 MB and more through a draft it deletes |
omit attachments; forms.fields.file: false; mailAdapter({ graph: { largeAttachments: false } }) |
maxSizeMB / maxTotalMB / maxFiles / fileTypes / allowRisky / scan / strictPdf / notice / submit; buildFileBlock; formSubmissionOverrides.fields for the file fields of a submission |
Staff features without access (no roles field): every account of the panel's login collection passes (userMeetsRole); accounts of other auth collections never do |
add access (roles decide) |
access.staffCollections (more staff collections), globalOverrides, forms.formSubmissionOverrides, consentLog.collectionOverrides, stats.collectionOverrides |
Cookie check (crawl): start editor+ or the token, results token-only for the running job, latest result only, dashboard warning on, e-mail off until recipients are set |
omit crawl; crawl.dashboard: false |
crawl.serviceUrl / token / siteUrl / maxPages / acceptSelector / consentMode / trackerHosts / globalOverride; Cookie check → Warning e-mails to; building blocks ingestCrawlResult, findCrawlViolations, parseCrawlResult |
| Cookie admin: one Cookies entry — review list and site check as tabs, their own entries out of the navigation (pages and API kept) | cookieScanner.adminLayout: 'separate' |
addCookieScannerTabs, CookieReviewTab, CookieSiteCheckTab; collectionOverrides / crawl.globalOverride win |
Theme choice in localStorage under theme (next-themes' key); old ipal-theme moved before paint; declared to the cookie scanner as necessary local storage |
— | iapl({ theme: { storageKey } }); <ThemeSwitcher storageKey> / useTheme({ storageKey }) |
Cookie list entries have a Type (cookie / local / session storage), filled by the scanner; <CookieTable> shows it when needed |
<CookieTable storageColumn={false}> |
storageColumn, storageTypes, Cookies → Settings window → Cookie list headings → Type |
| Text written in one language fills the empty languages (cookie list, cookie review), never over a language's own text | fillEmptyLocales: false |
fillEmptyLocales: { 'cookie-settings': [...], 'cookie-review': [...] }; buildFillEmptyLocalesGlobalHook / …CollectionHook for your own globals and collections |
Cookie approval: one summary + Approve and add (editor+), unknown cookies approved as marketing + "Needs description", dashboard reminder while cookies wait; nothing reaches the cookie banner before approval |
cookieScanner.approval: false (per-entry review) |
approval.unknownCategory, approval.dashboard: false; building blocks approveCookies, loadCookieApproval, countPendingCookies, flagGoneEntries, sameCookie |
Cookie review: scan + review editor+, delete admin; Open Cookie Database "Functional" → functional |
omit cookieScanner |
cookieScanner.access, collectionOverrides, databaseCategories, integrations, declarations, labels, syncAccepted: false; building blocks runCookieScan, collectCookieFindings, applyCookieFindings |
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; redirect to the 2FA screens by TotpRedirectProvider |
twoFactor: false (discouraged) |
twoFactor.collectionSlug, allowCollectionMismatch: true, twoFactor.provider (own component, or false for the package's) |
2FA setup required: an account without TOTP reaches only the setup screen; 72 h window from creation / admin reset, then blocked; status and "Reopen setup" on the account page, notice on the dashboard, POST /api/ipal/two-factor/reset |
twoFactor.requireSetup: false; parts: requireSetup: { dashboardNotice: false, statusField: false, setupNotice: false } |
requireSetup: { windowHours, exempt } (exempt returns exactly true, never async), twoFactor.resetAccess (default: an admin who entered its own code; the reset ends the account's sessions), texts twoFactor*; twoFactorSetupState(req), buildSetupFields, backfillSetupFrom, buildTwoFactorResetEndpoint. Postgres/SQLite: migration for totp_setup_from applied when the new container starts (prodMigrations or pnpm payload migrate && pnpm start; never a pre-deployment command — deployment.md §4.3), or every login answers 500 |
| The second factor on every collection and global, whichever plugin added it, and on the plugin's endpoints; an unrecognised 2FA package = startup error | per entity: custom.ipal.secondFactor: false or { read: false } (or the package's custom.totp.disableAccessWrapper); everywhere: twoFactor.guard: false (not recommended) |
requireSecondFactor / secondFactorPassed in your own access functions and endpoints |
At most 5 verify attempts per account in 10 minutes (POST /api/verify-totp → 429); the count is kept in memory and in the database (payload.kv), so a restart or a second instance does not reset it |
twoFactor.verifyLimit: false |
verifyLimit: { max, windowMinutes, store: 'memory' } |
2FA verify and setup attempts only from the site's own origin: a request a browser marks as coming from elsewhere (Origin, Sec-Fetch-Site) gets 403 and is not counted. Set serverURL: behind a proxy that rewrites Host and sends no X-Forwarded-Host the site's own page is refused without it (logged once per origin: [iapl] 2FA: a code from origin … was refused) |
twoFactor.sameOrigin: false |
sameOrigin: { origins: ['https://app.example.com'] }; requestFromOwnOrigin, reportRefusedOrigin |
Stored secrets are write-only: smtpPassword and turnstileSecretKey come back as '********' over REST, GraphQL and in the panel; an empty save keeps the value, '[[clear]]' removes it; server code reads the real value with the Local API. The panel is the source — never add an env variable for them (TURNSTILE_SECRET_KEY is deprecated) |
secrets: { writeOnly: false } |
writeOnlySecret(field) / writeOnlySecrets(fields, names) for your own secret fields; with versions on the entity add hooks.afterRead: [maskSecretsOnRestore] |
The SMTP password stays with its server: a save in the panel or over the API that changes the server, port or user name without the password is refused (400 "Enter the password again…"), whatever the transport says — otherwise an admin session points the server at its own machine and a test e-mail hands the password over. A change of the transport alone asks for nothing. Seeds and scripts (Local API, access control off) are not asked |
secrets: { reenterOnChange: false } |
writeOnlySecret(field, { boundTo: [...] }), buildKeepSecret, SMTP_PASSWORD_BOUND_TO |
The admin panel opens for editor and above; an account with only user sees "Unauthorized" (the API is not touched). First start logs how many accounts are below the role |
accounts: { panelRole: 'user' } (or false) |
panelRole: 'admin'; your own access.admin; panelAccess(role) |
Nobody creates an account for themselves, or takes one over. A staff collection (also the project's own, also one a later plugin adds) without a create / update / delete / unlock / read / readVersions rule gets one (on a collection a later plugin adds the plugin's rule is put in front of its own and both must allow; custom: { ipal: { accountRules: false } } on it keeps its own): with the plugin's roles, or wherever an account of it can hold editor or admin (user, editor, admin, boss; viewer, editor; a roles field that is text, json or a relationship holding a list — the value in the account's roles array makes a plugin admin or editor; a single-valued roles field is not affected: its value never counts) — create, delete, unlock: an admin; update: an admin or the account itself; the roles field: only an admin. With roles of its own that hold neither editor nor admin, or none: an account of that same collection, or a plugin admin, and an account never changes its own roles — the plugin cannot rank a project's own roles: write that collection's rules (iapl-doctor → staff-own-roles). read: a staff account. Payload's first-user route answers only for the panel's login collection (the first account, which becomes admin), in any spelling of the URL. access.firstUserAdmin: false with a default role below the panel role: the default panel role is not applied (logged), an explicit one is refused at start. With a slug in access.staffCollections that is not an auth collection Payload does not start (/api/health 503) |
accounts: { adminOnlyCreate: false, adminOnlyWrite: false, staffOnlyRead: false, firstUserRoute: 'all' } |
your own rule wins; firstUserRoute: ['users', 'partners']; a collection with open sign-up keeps its routes; staffCreateAccess, staffUpdateAccess(slug), staffReadAccess, sameStaffCollectionAccess(slug), rolesByAdminOnly, rolesNotOwn(slug), hasPluginRoles, applyStaffAccountAccess, adoptLateAuthCollections, buildFirstUserEndpoint |
| A password set on a staff account has at least 12 characters and is not the e-mail address; existing passwords are not checked | accounts: { password: false } |
password: { minLength }; checkPassword, buildPasswordRuleHook |
| While Turnstile cannot check (wrong secret, Cloudflare down): a text form is accepted, a form with files is refused | forms: { turnstileOnConfigError: 'allow' } |
'reject', { text, files }; turnstileOnConfigError at a call site wins |
Dashboard alerts by role: integration details for admins, a neutral line for editors, nothing for others; cookie alerts for editors and above. 'all' checks nothing — no role, no second factor |
dashboardAlerts: { integrations: 'all', cookies: 'all' } |
integrations: 'editor'; the components' details / audience props |
The back link of the 2FA setup and verify screens is checked on the server (SafeTotpView in front of the package's views): only a path on the site's origin inside the admin route is kept, anything else (javascript:, another host) becomes the admin root. Needs generate:importmap in the same deploy — with a stale map the 2FA screens have no code form and nobody can sign in (iapl-doctor, the start log and a notice above the screen report it; the notice is a hint from the file on disk and never replaces the screen; twoFactor.importMapCheck: false turns it off); check: password only → /admin/verify-totp?back=https%3A%2F%2Fexample.com%2F → code → lands on /admin |
twoFactor.safeBack: false |
safeBack: (back, { adminRoute, origin }) => string; safeAdminBack, wrapTotpViews (@intecion/ipal-kit), SafeTotpView (@intecion/ipal-kit/admin) for own views |
The 2FA package's endpoints (/api/setup-totp, verify-totp, remove-totp, admin/*) answer accounts of the 2FA collection only; reset and remove need the second factor |
— (always on with 2FA) | adminManageAccess through the wrapped factory (security.md "Resetting 2FA") |
| Roles count only for accounts of a staff collection, in every predicate and access function | — | access.staffCollections |
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 }) |
No X-Powered-By (with withSecurityConfig) |
withSecurityConfig(config, { hidePoweredBy: false }) |
— |
CSP off until buildSecurityHeaders({ csp }); then hard rules, 'unsafe-eval' only in dev |
leave out csp |
buildCsp({ extra, override, strictDynamic, dev }), buildAdminCsp({ extra, override }), createCspReportRoute({ onReport, maxBytes }), your own string via additional |
| 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, iapl({ 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 engines 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 IAPL_NOINDEX |
indexNow off by default |
submitToIndexNow by hand |
A site with no SMTP server in the panel sends through the Intecion mail service: it enrols by itself on its first send (an outbound call with its host and the plugin version) and gets its own token through the public route POST /api/iapl/mail-relay/confirm |
mail: { relay: false } (no call, no routes, no state block) |
mail.relay: { url, host, enrol, token, senderName, kind, accountMail, confirmRateLimit, timeoutMs, retryBackoffMs, fetchImpl }; mailAdapter({ relay }); §7.2 |
The mail service's token is kept in payload.kv (never in a field, never readable over REST or GraphQL), bound to the site's server addresses, rotated every 90 days |
"Disconnect" in the panel; disconnectRelay |
enrolRelay, rotateRelayToken, setRelayToken, getRelayStatus |
| Account e-mails through the mail service: at most 5 to one address and 10 asked for by one visitor an hour | mail: { relay: { accountMail: false } } |
accountMail: { perAddress, perVisitor, windowMinutes } |
| Every message says what it is (form notification, form confirmation, account, test, system) | — (other transports ignore the mark) | withMailKind, runWithMailKind, expectMailTo, mail.relay.kind, buildFormMailKindHook |
| Microsoft Graph as transport: deprecated, one warning per start, removed in 2.0 | mail: { graphDeprecationWarning: false } (the warning only) |
move off it: email.md "Moving off Microsoft Graph" |
7.2 E-mail — the mail service (default), SMTP (on request), Graph (deprecated)
What you wire — three lines, every site:
// src/payload.config.ts
import { iapl, mailAdapter } from '@intecion/ipal-kit'
export default buildConfig({
serverURL: process.env.NEXT_PUBLIC_SERVER_URL, // the public https address the site answers on, without a redirect
email: mailAdapter(),
plugins: [iapl({ /* … */ })],
})
Then pnpm generate:importmap (the e-mail tab has a new component, @intecion/ipal-kit/admin#MailRelayStatus).
No env variable, no key, no field to fill in. Do not add nodemailer, resend, an api/send route or a
GRAPH_* variable to a project.
How a send is routed (resolveMailTransport, type MailTransport): Microsoft Graph when the panel says so and
GRAPH_* is set (deprecated) → SMTP when server, user name and password are filled in → Graph when GRAPH_* is set →
the mail service → nothing (mail: { relay: false } and no SMTP). A site with SMTP filled in never contacts the service.
What the site needs for the mail service — check each one:
serverURLis the production host itself (https://example.com, not a host that redirects towww).POST https://<host>/api/iapl/mail-relay/confirmis reachable from the internet with no redirect, no basic auth, no firewall rule.trailingSlash: trueinnext.configor anotherroutes.apibreak it — the fix is Intecion setting the site's confirm address, not moving the route (email.md "When the site cannot be confirmed").- The server may call
https://webservices.intecion.net. - Site integrations → E-mail sending: "Sender name" (else the site name is used) and "Sender address" — with the mail service that is where replies go; the service's own address has no mailbox.
- Intecion has listed the host; otherwise the site enrols and waits for approval (
relay-pending).
Verify: Site integrations → E-mail sending → the block "How e-mails are sent" says "Connected to the built-in
mail service"; Send test e-mail answers "through the built-in mail service, as "; the mail arrives from
[email protected] with the client's name and Reply-To the client's address; iapl-doctor --url reports no mail-* finding. On localhost the plugin refuses to enrol (nothing leaves the machine): test
mail locally with SMTP (Mailpit) or createFakeRelay().
The client wants its own mail server: fill in "Own SMTP server", user name, password and "Sender address" in the
panel, send a test. Nothing in code. A site on GRAPH_*: keeps working, warns once per start; move it when the
owner says so (email.md "Moving off Microsoft Graph").
Your own mail goes through payload.sendEmail. Say what it is when it is not a generic system message:
import { runWithMailKind, withMailKind } from '@intecion/ipal-kit'
await payload.sendEmail(withMailKind({ to: user.email, subject, html }, 'account')) // to an account holder only
await runWithMailKind('account', () => inviteUsers(payload, list))
Kinds (MailKind, MAIL_KINDS, key MAIL_KIND, reader mailKindOf): form-notification, form-confirmation
(both set by the plugin on every form e-mail — buildFormMailKindHook), account (Payload's "forgot password" and
"verify your e-mail": set by the plugin through expectMailTo), test, security-alert, system (the default).
A wrong kind gives a visitor more room than the service means to give: account only for mail to an account
holder, form-confirmation for an address a visitor typed.
Options — iapl({ mail: { relay, graphDeprecationWarning } }) (MailOptions, RelayOptions; mailAdapter({ relay })
overrides per adapter; resolveRelayOptions reads what is in effect):
| Key | Default | Meaning |
|---|---|---|
relay: false |
on | no mail service: no outbound call, no routes, no state block |
url |
RELAY_BASE_URL |
a relay of your own (same contract) |
host |
host of serverURL (relayHost, isPublicHost) |
the public host the service calls back |
enrol |
'auto' |
'manual' (only "Connect again" / enrolRelay), false (token from token / setRelayToken) |
token |
— | a token from elsewhere; nothing is stored, the site does not enrol |
senderName |
panel → site name (relaySenderName) |
fixed name or function |
kind |
— | kind of a message nobody marked |
accountMail |
{ perAddress: 5, perVisitor: 10, windowMinutes: 60 } |
the site's own limit on account mail; false = none |
confirmRateLimit |
{ max: 10, windowMs: 60000 } |
the public confirm route, per address |
timeoutMs, retryBackoffMs, fetchImpl |
30 s, 1 s, fetch |
one attempt; wait between attempts; tests |
graphDeprecationWarning |
true |
false = no start warning on a Graph site (GRAPH_DEPRECATION_NOTICE) |
Routes the plugin adds (gone with relay: false): POST /api/iapl/mail-relay/confirm — public, 404 unless
the site itself just started an enrolment, rate-limited; allow it in any WAF or proxy rule. Admin only:
GET /api/iapl/mail-relay/status (?refresh=1), POST …/connect (optionally { token }), POST …/disconnect.
Failures are recorded in emailStatus with a code (RELAY_STATUS_CODES, RelayStatusCode, relayStatusFor):
relay-pending, relay-suspended, relay-refused, relay-disconnected, relay-quota, relay-too-large,
relay-attachment-refused, relay-recipient-suppressed, relay-unreachable, relay-not-confirmed, relay-error
(and the warning relay-name-replaced) — what each means and what to do: iapl-debug, "E-mail". A send returns
RelaySendResult; confirmed: false means the message may have been sent — do not send it again under
another content; the same message sent again reuses its key and cannot double.
Limits (the service's; per site): 30 messages an hour, 200 a day, 10 recipients a message, 10 MB of files —
read from the service (mailAttachmentLimit, relayAttachmentLimit), never typed into a project. A site that
needs more: Intecion raises the limits, or SMTP.
Building blocks (root entry; all optional — the three lines above are enough):
| Need | Use |
|---|---|
| The transport alone, no SMTP / Graph | email: relayAdapter() (RelayAdapterArgs) |
| Enrol from a deploy script; state; rotate; disconnect; a token issued by hand | enrolRelay (EnrolResult), getRelayStatus (RelayStatus), rotateRelayToken, disconnectRelay, setRelayToken |
| Your own state block or panel route | mailPanelState (MailPanelState), relayPanelEndpoints, relayConfirmEndpoint; the plugin's component is MailRelayStatus (/admin) |
| One message with the retry rule; one HTTP call | sendThroughRelay (RelaySendContext, RelaySendResult), relayRequest (RelayCall, RelayAnswer, RelayRefusal) |
| The request the service takes | buildRelayMessage (BuildRelayMessageArgs, BuiltRelayMessage, RelaySendRequest), bareAddress, bareAddresses, cleanSubject |
| Constants | RELAY_BASE_URL, RELAY_CONFIRM_PATH, RELAY_CONTRACT_VERSION, RELAY_DEFAULTS, RELAY_KV_KEY, RELAY_PRODUCT, RELAY_SENDER_ADDRESS, RELAY_SERVICE_NAME |
| Tests without the service | createFakeRelay (FakeRelay, FakeRelayOptions, FakeRelayMail, FakeRelayLimits): mailAdapter({ relay: { url: fake.url, fetchImpl: fake.fetch } }), then assert on fake.outbox |
Never: read or print the token (payload.kv, key iapl:mail-relay); add a field or env variable for it; call
the service from a client component; retry a failed send in a loop of your own; mark form mail as account.
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 | iapl-audit --quick (hardcoding, the §0b set, panel) |
after every block / collection |
| Build | pnpm build — page routes ● (SSG), not ƒ |
before every "done" |
| Smoke (Playwright) | iapl-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 IAPL update |
| Site in the browser | iapl-seo-check, iapl-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) — IAPL 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 (IAPL_NOINDEX=1) before a production deployment.
8. CODE STANDARDS
The short version is "Code rules" at the top; the details:
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. Whatever writes the look, it lands inDESIGN.md(template sections) andsrc/design/tokens.ts, on the fixed--ipal-*roles (§6.11) — never as new token names or values in components. - 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 — iapl-audit (the §0b set + the rules below) and iapl-seo-check
(GEO and SEO on the built site) instead of manual greps; then iapl-doctor for the whole site against the team
standard (versions, Node 22, layout, database names, env, headers, 2FA, cookie scanner, AGENTS.md, skills, seeds,
block library — doctor.md):
bash .agents/skills/iapl-audit/scripts/audit.sh
pnpm exec iapl-doctor # + --deep --url http://localhost:3000 on the built site
node .agents/skills/iapl-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 |
| Block library: 15 ready sections, page templates, eject | block-library.md |
| Cookie consent, banner | consent.md |
| Cookie scanner (review list, Open Cookie Database) | cookie-scanner.md |
| Routing, archives, redirects, Markdown, search | content.md |
| E-mail: the mail service (default), SMTP, Graph (deprecated) | 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 |
Design tokens, iapl-tokens, DESIGN.md |
design-tokens.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 |
New site from the reference site: iapl create, @intecion/ipal-kit/starter |
project-starter.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 |
iapl-doctor: the site against the team standard, iapl-doctor.json, /api/ipal/doctor |
doctor.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:** <mail service / own SMTP>
## 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/iapl-*` (refresh: `pnpm exec iapl-skills`). Always run `iapl-audit` before "done".
The rules in AGENT.md take precedence over your general knowledge of Next/Payload.
IAPL first: anything the plugin covers is built with the plugin. Missing or broken → plugin gap (iapl-plugin-gap): report to the owner and wait; never a hand-built replacement or a patch in `node_modules`.
Code rules: AGENT.md "Code rules" (single responsibility, no duplicates, typed, texts from the panel, checks).
Write everything in this file in English.
## Site map
- <pages from the brief, the sections on each — written by iapl-site>
## Project decisions
- Architecture answers (AGENT.md "Ask before you build"), one line each: languages + default + URLs ·
styling · pages/collections · forms + e-mail · analytics/consent/cookie scan · SEO/GEO · database (+ names
`<domain>_prod` / `<domain>_dev`, e.g. `intecioncom_prod`) + media ·
2FA/white-label/credit · hosting + domains + DNS
- <client-specific decisions, e.g. "blog without authors", "404 = homepage">
- <approved workarounds: what, why, plugin-request file, owner's approval>
- Launch date: <date> — from then on seeds touch named records only (AGENT.md "seeding after launch")
- <exceptions to the rules — with the reason>
- <only on a client decision> iapl-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 iapl-skills does this itself:
it adds the <!-- iapl:start -->…<!-- iapl:end --> block to AGENTS.md (a pointer to
AGENT.md, iapl-reference, iapl-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 |
|---|---|
iapl-site |
a whole site from brief to report — guides you through the other skills (§0a) |
iapl-reference |
the full plugin map: iapl options, env, routes, proxy, layout, import map, hooks, collections, globals + resources/api.md (every export) — before you write something yourself |
iapl-setup |
a new project from scratch (foundation) — complete installation stage by stage |
iapl-block |
a new or revised section (block) — schema, panel (§6.5a), component |
iapl-collection |
"we need a blog / products / …" — before a file appears in src/collections |
iapl-nav |
header, menu, footer, company data |
iapl-form |
a form from the panel: renderer, submitForm action, Turnstile, mails, GTM |
iapl-locale-add |
a new language — configuration, content, the locale-coverage script |
iapl-migrate-fields |
changing fields that already contain content — 3 phases, a script with dry-run |
iapl-upgrade |
updating IAPL in an existing project |
iapl-debug |
anything does not work — procedure + a symptom → cause → fix table |
iapl-audit |
before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
iapl-seo-check |
the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
iapl-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' |
iapl-doctor |
the whole site against the team standard in one command (pnpm exec iapl-doctor): versions, Node 22, layout, database names, env, headers, CSP, 2FA, cookie scanner, adminMeta, AGENTS.md, skills, seeds, block library, pnpm audit; --url / --deep for the running site and the database; --strict in the CI of a new site |
iapl-plugin-gap |
IAPL has a bug or is missing a feature — report to the owner, wait for the decision; a marked workaround only after approval |
Run the scripts in the skills, do not read them (the output is enough): iapl-audit/scripts/audit.sh, pnpm exec iapl-doctor,
iapl-seo-check/scripts/seo-check.mjs, iapl-consent-check/scripts/consent-check.mjs,
iapl-locale-add/scripts/locale-coverage.ts; templates to copy are in resources/.
Installation in the project (once and after every IAPL update) — iapl-skills is
a command (bin) of the package:
pnpm exec iapl-skills # → .agents/skills/iapl-*
pnpm exec iapl-skills --dry-run # only show what will change
pnpm exec iapl-skills --dest .claude/skills # Claude Code looks for skills in .claude/skills
pnpm exec iapl-skills --no-pointer # skills only, without touching AGENTS.md / CLAUDE.md
Besides the skills, the command maintains the pointer to the guide: the iapl: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 iapl-* 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 iapl-* to the project repo.
External skills (opt-in) — well-known third-party skills, vendored into the package at pinned commits
(text only, licence + SOURCE.md in each folder). iapl-skills downloads nothing; it checks every file
against docs/agent/external/manifest.json before copying:
pnpm exec iapl-skills --external # all ext-* next to the iapl-* skills
pnpm exec iapl-skills --external ext-accessibility,ext-payload # only these
| Skill | Publisher · licence | What it is for | Our override |
|---|---|---|---|
ext-react-best-practices |
Vercel · MIT | React/Next performance rules (waterfalls, bundles, RSC, re-renders) | no swr / client-fetch libraries — Server Components + Payload / @/lib/content |
ext-composition-patterns |
Vercel · MIT | compound components instead of boolean props, React 19 APIs | block schema and RenderBlocks follow §6 |
ext-accessibility |
Addy Osmani · MIT | WCAG 2.2 audit and fixes | Lighthouse / axe only as pinned devDependencies; IAPL components fixed via props or a plugin gap |
ext-frontend-design |
Anthropic · Apache-2.0 | distinctive visual direction, design quality floor | DESIGN.md tokens win; use it to write/extend DESIGN.md + src/design/tokens.ts, mapping its palette onto the --ipal-* roles (design-tokens.md) — never new token names, never hex/fonts/text in components |
ext-payload |
Payload CMS · MIT | Payload 3 reference (v3.92.1) | reference only, never Payload 4 guidance; IAPL features first |
Our rules win. Every ext-* SKILL.md starts with an override note; when an external skill conflicts with
this file, the project's AGENTS.md or DESIGN.md, those win — IAPL first, Payload data fetching over swr,
DESIGN.md tokens, Payload 3 not 4. ext-* folders are touched only with --external, and only those with
IAPL's SOURCE.md; do not name the project's own skills ext-…. Use them only after the owner chose them
("Project decisions").
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 iapl-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.