- bin `ipal-kit` (subcommand `create`): the architecture questions (or --answers JSON), rendering from reference/ through starter.manifest.json (placeholders, @starter:if variants, //: alternatives, demo dropped), answers into AGENTS.md "Project decisions" and ipal-doctor.json, local .env with a fresh PAYLOAD_SECRET, install from the shipped lockfile, ipal-skills, ipal-tokens, generate:types/importmap, typecheck, ipal-doctor when shipped, secret check, first commit - @intecion/ipal-kit/starter: the building blocks (renderSite, validateAnswers, applyVariants, collectBundle, lockfileWithoutPlugin, secretFindings …) - build:starter packs reference/ into dist/starter/template.json.gz (90 KB); starter:gate in prepublishOnly: site from the packed tarball, frozen install, seed, build, targeted SEED_ONLY seed in production mode, full seed refused, pnpm start checks - D15: plugin dependencies pinned exactly (nodemailer 10.3.1) - reference/: @starter:if markers (runs as before), manifest generate/variants/rewrite - docs: project-starter.md, AGENT.md, ipal-setup, ipal-site, ipal-reference (+ api.md), README, PROGRAMISTA §2, CHANGELOG, docs/README, reference index Co-Authored-By: Claude Opus 5.5 <[email protected]>
1445 lines
112 KiB
Markdown
1445 lines
112 KiB
Markdown
# AGENT.md — rules for AI (Payload 3 + Next 16 + @intecion/ipal-kit)
|
||
|
||
> **Who this is for:** an AI agent (Antigravity, Claude Code, Cursor) working in a client
|
||
> project built on ipal-kit. **Read all of it before your first change.** The rules are
|
||
> hard, with no workarounds. API details for each module: `docs/<module>.md` (map in
|
||
> §12). Installation, deployment, migration and Gitea are covered in the document for humans:
|
||
> [the developer guide (PROGRAMISTA.md)](../dev/PROGRAMISTA.md).
|
||
>
|
||
> **In the project:**
|
||
> - a short `AGENTS.md` in the root (template in §13) that points to this file in
|
||
> `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` — do not copy the rules, a copy goes stale;
|
||
> (`pnpm exec ipal-skills` adds/refreshes the `ipal-kit:start…end` block with this pointer);
|
||
> - skills in `.agents/skills/` (§14) — copied from the package with one command, refreshed
|
||
> after every ipal-kit update;
|
||
> - **the full plugin map** — every option, env variable, route, layout component, import
|
||
> map entry, hook, collection, global and every export: the **`ipal-reference`** skill
|
||
> (`.agents/skills/ipal-reference/SKILL.md` + `resources/api.md`). Before you write
|
||
> anything "from scratch", check there.
|
||
|
||
---
|
||
|
||
## Main rule — the plugin helps, never limits
|
||
|
||
ipal-kit is a plugin: it helps the project and never limits it. Every module can be
|
||
turned off on its own; every default (access rules, fields, hooks, labels, routes,
|
||
collections, globals) can be overridden and **the project config wins**; safe
|
||
defaults have an option to loosen/extend them; the plugin exports building blocks
|
||
(helpers, builders, hooks), not just finished features; it does not force dependencies, routes, UI
|
||
or data shape where an option or an exported building block is enough.
|
||
|
||
**In practice:** before you write something from scratch or start fighting the plugin — find
|
||
the option or the exported builder (module docs §12, types in `dist/**/*.d.ts`). It is missing →
|
||
**plugin gap**: report it to the owner and wait for their decision (see "ipal-kit first" below), never
|
||
patch `node_modules` or fork the package.
|
||
|
||
**Docs language:** all ipal-kit docs, this guide and the skills are written in English.
|
||
Write new rules, AGENTS.md entries and plugin-gap reports in English.
|
||
|
||
> **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. `createSeeder`
|
||
> refuses a run with no record list against a production or non-local database unless `IPAL_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 (ipal-setup
|
||
stage 0). `ipalEnvRules({ databaseName: true })` warns when they do not match (deployment.md §4.2a).
|
||
|
||
**Seeding on production** (details: `node_modules/@intecion/ipal-kit/docs/seeding.md`). Write seeds with
|
||
`createSeeder` from `@intecion/ipal-kit/seed` (the templates do) — it enforces every rule below:
|
||
- Seeds are create-only and idempotent: match by the default-locale slug / form title / the global, skip what exists.
|
||
- Never delete; never seed users, passwords or secrets; globals: fill only empty fields; no media uploads.
|
||
- Every locale written separately with `fallbackLocale: false`; `context: { disableRevalidate: true, ipalSkipIndexNow: true }`.
|
||
- On production: dry run first (`SEED_DRY_RUN=1`), back up the database (Coolify **Backup now**), then the real run.
|
||
- `SEED_UPDATE=1` on production / a non-local database only with `IPAL_SEED_ALLOW_PROD_UPDATE=1`, after a backup;
|
||
records an editor changed are always skipped and reported (`skip (edited)`) — never use `SEED_FORCE=1` there.
|
||
- After launch: named records only (`only` / `SEED_ONLY`); a full run of a live database is refused without `IPAL_SEED_ALLOW_FULL=1`.
|
||
- Schema and one-off data fixes → Payload migrations; field renames with content → **ipal-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 **ipal-setup** stage 0 (ipal-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 provider (SMTP from the panel or Microsoft Graph) |
|
||
| 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 `ipal-kit 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 into `AGENTS.md` and makes the first commit. Ask the owner
|
||
first, then pass the answers — the command never fills a gap. The manual path (`ipal-setup` stages 1–11) is for an
|
||
existing project or what the command does not cover yet (another default language, no URL prefix, Postgres).
|
||
- 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.
|
||
|
||
## ipal-kit first — hard rule
|
||
|
||
- **Anything the plugin covers, you build with the plugin's feature.** Always. Look it up first: the
|
||
**ipal-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 **ipal-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 ipal-kit <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 ipal-kit
|
||
("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 **ipal-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 `ipal-audit` / `ipal-seo-check` result, or a
|
||
documented manual check (§8a).
|
||
|
||
```tsx
|
||
// 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)
|
||
|
||
0. **Ask first.** Architecture questions before you build ("Ask before you build" above) — never guess.
|
||
1. **ipal-kit 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.
|
||
2. **Nothing hardcoded.** Text, image, link, file, company data → admin panel. Domains,
|
||
keys → `.env`. Also in an `||` fallback and in `catch`.
|
||
3. **Next 16 = `proxy.ts`.** NEVER `middleware.ts`.
|
||
4. **No explicit `<head>`, with ISR and `generateStaticParams`** — otherwise metadata
|
||
lands in `<body>` and SEO breaks.
|
||
5. **Minimum collections.** ipalKit adds Users, company data/navigation are globals,
|
||
FAQ/hero are blocks.
|
||
6. **A section = a composition of UI primitives.** `buildLinksField()` + `<CMSLink>`, upload +
|
||
`<Media>`, `<Section>` + `<SectionHeader>`. No `ctaLabel`/`pdfUrl` fields.
|
||
**A clear panel** (§6.5a): repeated items = an "+ Add …" array with `rowLabel`, never
|
||
`cta1`/`cta2`; labels short and in the panel's languages (`{ en, pl }`, guide
|
||
`docs/dev/admin-ux.md`); no empty "just in case" fields.
|
||
7. **Renderers from the plugin:** `RenderBlocks` (not a `switch`), `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.
|
||
8. **No `any` and no `@ts-ignore`.** Types from `@/payload-types`, `unknown` + guard.
|
||
9. **One source of truth** — `i18n.config.ts`, `lib/content.ts`, never copies.
|
||
10. **"Done" only after** a local `pnpm build` + the checks from §11.
|
||
11. **Every site has the MANDATORY SET from §0b** — SEO, GEO (llms.txt, Markdown,
|
||
MCP), R2, Turnstile, forms from the builder. `ipal-audit` checks that it is
|
||
wired, `ipal-seo-check` — that it works. There is no "I'll do it later".
|
||
|
||
**How to add…** (details in the skill from §14)
|
||
| What | How |
|
||
|---|---|
|
||
| a page | in the panel: Pages + blocks, no code (§5.1) |
|
||
| a section (block) | 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`) — **ipal-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`) — **ipal-site** phase 6 |
|
||
| a form | the Forms panel (builder) from the seed `scripts/seed-form-*.ts`, a block with `<RenderForm>`, sending via `sendForm` — **ipal-form** |
|
||
| a language | `i18n.config.ts` (the only place) + a Postgres migration + content in the new language — **ipal-locale-add** |
|
||
| a collection with URLs | `content: { collections: [...] }` in `ipalKit` and `createContentHelpers` (§5.4) — **ipal-collection** |
|
||
|
||
---
|
||
|
||
## 0b. MANDATORY SET — every site, no exceptions
|
||
|
||
These are not options. Every project has **all** the items below, wired through the
|
||
plugin. Data is missing (domain, keys, bucket)? Wire the code anyway — it works once
|
||
the values are entered in `.env` / the panel, and you list what is missing in the report. You skip an item
|
||
**only** on a client decision recorded in `AGENTS.md` (the `ipal-audit-skip:` line, below).
|
||
|
||
The "Check" column: **A** = `ipal-audit` (code), **S** = `ipal-seo-check` (running
|
||
site), **P** = a test in the panel. Full code: PROGRAMISTA.md §2.
|
||
|
||
| # | Area | What must exist (file) | Plugin API | Check |
|
||
|---|---|---|---|---|
|
||
| 1 | i18n + routing | `src/proxy.ts`, `[locale]/[[...slug]]/page.tsx` = `createPageRoute(content, {…})` + a literal `revalidate`, `not-found.tsx` = `createNotFoundPage(content, { load })` + `notFoundView.ts` (`renderNotFoundView`) | `createProxy`, `createContentHelpers`, `createPageRoute`, `createNotFoundPage` (`/rsc`) | A, S |
|
||
| 2 | **SEO** — meta | `generateMetadata` in every page route; favicon and OG from Site settings; `htmlLimitedBots` in `next.config.ts`; SEO tab + `buildNoindexField` in Pages | `generatePageMetadata`, `buildIconsMetadata`, `buildNoindexField` | A, S |
|
||
| 3 | **SEO** — maps | `src/app/sitemap.xml/route.ts` (`export { sitemapRoute as GET }` + `force-dynamic`), `src/app/robots.ts` (`export { getRobots as default }` + `force-dynamic` — AI bots from the panel), `src/app/manifest.ts` — re-exports from `lib/content` | `sitemapRoute`, `getRobots` (or `robots` without the panel), `manifest` | A, S |
|
||
| 3a | **Search Console / Bing** | recommended: **domain verification via DNS** (TXT record, deployment.md §6) — the plugin does nothing, the verification fields stay empty; only for URL-prefix verification: code in **Site settings → Search 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`); `ipalKit({ indexNow: true })` + `src/app/indexnow-key.txt/route.ts` (`indexNowKeyRoute`; publishing → Bing/ChatGPT Search within minutes; IndexNow sends nothing with `IPAL_NOINDEX=1`) | `buildRobots`, `getRobots`, `indexNowKeyRoute` | A, S |
|
||
| 9 | **Media / R2 / speed** | `Media` with `focalPoint`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` + field; **always** `buildR2Storage(['media'], { s3Storage })` + `@payloadcms/storage-s3`; `R2_*` in `.env.example`; `<MediaPreconnect/>`; `images: buildImagesConfig()` and `buildUploadSecurityHeaders()` in `next.config.ts`; the project's `<Media>` via `mediaImageProps`/`videoProps` (§6.11b) | `buildR2Storage`, `mediaImageProps`, `videoProps`, `buildImagesConfig` | A, S |
|
||
| 10 | **Forms** | every form from a **seed** (`scripts/seed-form-*.ts`: fields, confirmation, mail to the company **and** confirmation to the customer, every language); a block with `<RenderForm>` + `formClasses.ts` (look, once); `actions.ts` = `createSubmitAction({ getCachedPayload, headers })`; `forms: {…}` in `ipalKit`; `email: mailAdapter()` | `RenderForm` (`/rsc`), `createSubmitAction`, `mailAdapter` | A, P |
|
||
| 11 | **Turnstile** | `<SiteProviders>` in `[locale]/layout.tsx` (wires `TurnstileProvider` with the key from the panel); `RenderForm` renders the widget; keys in Site integrations | `SiteProviders`, `getTurnstileConfig`, `TurnstileProvider` | A, P |
|
||
| 12 | Consent + analytics | Consent Mode: `'advanced'` (default — the Google tag loads at once with every signal `denied`) or `'basic'` (`<SiteProviders analytics={{ consentMode: 'basic' }}>` — no request to Google before consent; a client who wants zero requests), the choice goes to "Project decisions"; `ipalKit({ consentLog: true })` (without it the `/api/ipal/consent` endpoint does not exist) + `<SiteProviders logEndpoint="/api/ipal/consent" banner={<CookieBanner equalChoice settings="detailed" />}>` (ConsentProvider, banner, CookieButton, Analytics in the right order); settings window mode (`settings`: `inline` / `modal` / `detailed`) per the design, brief is silent → `detailed`, the decision goes to "Project decisions"; tool IDs in the panel; the cookie list from a scan (`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, `ipal-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`; check: a new admin lands on `/admin/setup-totp?back=%2Fadmin` with the QR, no reloading); `IPAL_IP_HEADER` in production | security.md, forms.md | A |
|
||
| 14 | Operations | `src/app/api/health/route.ts` (`healthRoute`); `src/instrumentation.ts` with `assertEnv(ipalEnvRules({ storage: true, ipHeader: true }))`; staging with `IPAL_NOINDEX=1`; smoke tests (§8a) | `healthRoute`, `assertEnv`, `ipalEnvRules` | A |
|
||
| 15 | System pages | Site settings → System pages: homepage, 404, privacy policy, cookies; legal links in the footer by role (`getSystemLinks(locale)`) | `getSystemLinks`, `getSystemPagePath`, `getNotFoundPage` | P |
|
||
| 16 | **Nothing hardcoded** | every text, link, image, file, company data from the panel; domains and keys from `.env` (§2) | — | A, P |
|
||
| 17 | **Content** | one h1, the answer at the start of each section, facts, internal links, FAQ from real questions, `aiSummary`, sameAs, consistent company data (§0c) | — | S, P |
|
||
| 18 | **Scaling** | `fluid.css` / `fluid-wide.css`, hero on `--ipal-hero-min-h`, the screen list in §6.11a (including 1366×768) | — | A, browser |
|
||
| 19 | **Design tokens** | `DESIGN.md` + `src/design/tokens.ts` → `pnpm exec ipal-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`, `ipal-tokens` | A (`ipal-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 `ipal-audit`)
|
||
|
||
| Instead of the plugin | Why not | Use |
|
||
|---|---|---|
|
||
| your own form with fields in JSX, `react-hook-form`, `formik`, your own form renderer | the client cannot change the fields; no Turnstile, rate limit, GDPR consent; a copy of the engine passes addresses from the Emails tab into HTML | the builder in the panel + `<RenderForm>` (look: `formClasses`, unusual cases: `useBuilderForm`) |
|
||
| your own `api/contact` / `api/send` / `api/form` route, `nodemailer` / `resend` / `@sendgrid` in the project | bypasses the `submitForm` validation and gates, a second mail transport | the `sendForm` server action → `submitForm`, mails from Forms → Emails via `mailAdapter()` |
|
||
| reCAPTCHA, hCaptcha, your own captcha | a second mechanism, no status in the panel | Turnstile from the plugin |
|
||
| a hand-written `<script type="application/ld+json">` | no escaping, drifts from the panel | `JsonLdGraph` |
|
||
| your own `sitemap.ts` / a text `robots.txt` in `public/` | no hreflang, noindex or system pages | `sitemapRoute`, `getRobots` from `lib/content` |
|
||
| a verification `<meta>` / `google*.html` file in code or `public/` | a deploy for every change; the code belongs to the client | DNS verification, or the code in Site settings → Search 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:
|
||
```markdown
|
||
ipal-audit-skip: mcp, llms-full — the client does not want to share content with AI agents (email 2026-03-02)
|
||
```
|
||
Keys: `llms`, `llms-full`, `markdown`, `mcp`, `jsonld`, `r2`, `turnstile`,
|
||
`analytics`, `twofactor`, `aibots`, `forms-seed`, `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 ipal-site), apply the rules below — without inventing facts.
|
||
|
||
### Structure of every page
|
||
- **One `h1`** (the hero/page heading), then section `h2`s, `h3`s inside — no skipped
|
||
levels. `SectionHeader` gets `as="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. `alt` describes 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.
|
||
- **`aiSummary`** of important pages: fix the auto-fill when the summary is weak (1–3 sentences, facts).
|
||
|
||
### Meta in the SEO tab
|
||
Title ≤ 60 characters, unique, key phrase first; description ≤ 155 characters, with specifics and a call to action;
|
||
a share image (1200×630) on pages with an offer — the rest inherit the default from Site settings.
|
||
A description **unique on every page** — an empty one is filled from the content on save, but a hand-written
|
||
one is better. Google ignores the same description on many pages.
|
||
|
||
### noindex — when YES, when NO
|
||
| Page | noindex? |
|
||
|---|---|
|
||
| "Thank you" after a form, a confirmation page | **yes** |
|
||
| internal search results, filter/parameter pages | **yes** (+ `disallowParams` in robots) |
|
||
| a test page, a draft page, a landing page only for a paid campaign | **yes** |
|
||
| staging, preview, a test copy of the whole site | **`IPAL_NOINDEX=1` in that environment's env** — not the checkbox |
|
||
| homepage, archives (blog, projects) | **never** — the panel blocks saving |
|
||
| services, offer, contact, about us, posts | **never** |
|
||
| privacy policy, cookies, terms | **no** by default (they are a credibility signal, they do no harm); `noindex` only at the client's request |
|
||
| 404 | not applicable — the plugin excludes it from the sitemap and returns a real 404 |
|
||
|
||
noindex does **not** replace a redirect or a deletion: old address → change the slug (308 from
|
||
`trackSlugHistoryHook`), a page to remove → delete it. Keep draft content as a **draft**
|
||
(unpublished content is not publicly available), not as a published page with noindex.
|
||
|
||
Checks: `ipal-seo-check` (one h1, heading order, alt, OG image, thin pages,
|
||
internal links, noindex in the sitemap).
|
||
|
||
---
|
||
|
||
## 0a. HOW YOU WORK — on your own, like an experienced employee
|
||
|
||
You build the site from brief to handover. The human provides **business decisions and
|
||
content**, they do not lead you by the hand. You think, anticipate problems, solve them
|
||
yourself and check your own work yourself. For a full build use the
|
||
**ipal-site** skill — it guides you through all the stages.
|
||
|
||
### You decide yourself (and record the decision in `AGENTS.md` → "Project decisions")
|
||
- technical choices within these rules: splitting into blocks, variants, names,
|
||
subcomponents, order of work, refactoring your own code,
|
||
- fixing everything found by the build, `ipal-audit`, `ipal-seo-check`, `ipal-consent-check`,
|
||
- plugin defaults (media limits, ISR, robots) — unless the brief says otherwise.
|
||
|
||
### You ask only about this (collect the questions in **one list**, not one at a time)
|
||
- **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 → **ipal-migrate-fields** |
|
||
| Will the build pass in a container **without a database**? | a route reading the database without `force-dynamic` |
|
||
| Is a new script / pixel / iframe **behind consent**? | YouTube, a map, a chat loaded before consent (GDPR) |
|
||
| Can the editor change it **without code**? | text, link or image in JSX (§2) |
|
||
| **Performance**? | an image outside `<Media>`, a video without `preload`, queries outside the cached helpers |
|
||
| **Security**? | a secret in the client, missing `server-only`, Local API without `overrideAccess: false` |
|
||
| Does the plugin **already have it**? | your own version of an ipal-kit feature (§1.1) |
|
||
|
||
### Check it yourself before you say "done"
|
||
A full `ipal-audit`, `ipal-seo-check` and `ipal-consent-check` on the built
|
||
app (`pnpm build && pnpm start`), the editor test (§11). Attach the results
|
||
to the report — without them the task is not finished.
|
||
|
||
### When something does not work
|
||
Diagnose (**ipal-debug**: symptom → cause → fix), fix it at the source,
|
||
check again. Do not report problems you can solve.
|
||
|
||
### Report only when
|
||
- **ipal-kit has a bug or is missing a feature** → **plugin gap** (report to the owner and
|
||
wait for their decision on that part — no workaround on your own; unrelated work goes on),
|
||
- you see an **ipal-kit improvement** useful in many projects → **plugin gap**
|
||
(type: improvement),
|
||
- **the task is finished** → the final report (format in **ipal-site**).
|
||
|
||
Do not report progress step by step or things you fixed yourself — they
|
||
go as one list into the final report.
|
||
|
||
---
|
||
|
||
## 1. ipal-kit IS MANDATORY
|
||
|
||
### 1.1 Before you write anything
|
||
Check whether the plugin has it: the module docs (§12) and the types
|
||
`node_modules/@intecion/ipal-kit/dist/**/*.d.ts`. Do not guess signatures. If
|
||
the plugin has it — use it. Your own version of an existing plugin feature is an error.
|
||
|
||
### 1.2 What belongs to the plugin and what to the project
|
||
Rule: **identical in every project → plugin. Depends on the client → project.**
|
||
|
||
| Plugin (you use) | Project (you write) |
|
||
|---|---|
|
||
| i18n, routing, slug, SEO meta, sitemap, hreflang | blocks: schema + look |
|
||
| forms, GDPR consent, Turnstile, email | Company/Header/Footer globals (the data model depends on the country: NIP/ABN/EIN) |
|
||
| consent, analytics/pixels | CSP (the project's domains) |
|
||
| security headers, 2FA, white-label | schema.org: mapping YOUR data to `@type` |
|
||
| hooks (revalidate, slugHistory, cross-locale), system pages, R2 storage | look (Tailwind, DESIGN.md) |
|
||
|
||
### 1.3 When the plugin is missing something or something does not work
|
||
**Do not patch silently** (a hook with a hardcoded value, your own helper, `as any`). It
|
||
almost always means the plugin already has it (check the docs) or the plugin is missing it.
|
||
The **ipal-plugin-gap** skill: report to the owner and **wait for their decision** on that part
|
||
("ipal-kit first" at the top). A workaround only after approval, marked
|
||
(`// WORKAROUND ipal-kit <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)/
|
||
styles.css # Tailwind + @source on node_modules/@intecion/ipal-kit/dist
|
||
[locale]/ # single-language: no [locale] (see i18n.md)
|
||
layout.tsx # no <head>; <SiteProviders shell={await getSiteShell(locale)}> + Header/Footer
|
||
actions.ts # sendForm = createSubmitAction(…) (the only way to send forms)
|
||
not-found.tsx # createNotFoundPage(content, { load: loadNotFoundView }) — 404 from the panel
|
||
notFoundView.ts # 'use server' → renderNotFoundView(content, { blocks }, locale)
|
||
[[...slug]]/page.tsx # DOUBLE brackets; createPageRoute(content, { blocks, … }) + revalidate
|
||
(payload)/ # admin panel (generated)
|
||
manifest.ts # export { manifest as default } from lib/content + force-dynamic
|
||
sitemap.xml/route.ts # export { sitemapRoute as GET } + force-dynamic (styling from the plugin)
|
||
robots.ts # export { getRobots as default } + force-dynamic (AI bots allowed; policy from the panel)
|
||
llms.txt/route.ts # export { llmsRoute as GET } (GEO)
|
||
llms-full.txt/route.ts # export { llmsFullRoute as GET } (GEO)
|
||
md/[locale]/[[...slug]]/route.ts # export { markdownRoute as GET } — the page as Markdown (GEO)
|
||
api/mcp/route.ts # export { mcpGET as GET, mcpPOST as POST } — public MCP (GEO)
|
||
api/health/route.ts # export { healthRoute as GET }
|
||
indexnow-key.txt/route.ts # export { indexNowKeyRoute as GET }
|
||
instrumentation.ts # assertEnv(ipalEnvRules({...})) from '@intecion/ipal-kit/env'
|
||
components/
|
||
forms/formClasses.ts # the ONLY place for the look of forms (RenderForm classNames)
|
||
ui/ # primitives: CMSLink, Button, Media, Section, SectionHeader
|
||
layout/ # Header, Footer, MobileNav (§6.8)
|
||
icons/ # names.ts + Icon.tsx (§6.10)
|
||
blocks/<BlockName>/ # config.ts + Component.tsx (+ XxxCard.tsx, client files next to it)
|
||
blocks/registry.ts # blockType → component
|
||
collections/ # Pages.ts, Media.ts (+ content only when required)
|
||
globals/ # Header.ts, Footer.ts, Company.ts
|
||
lib/content.ts # createContentHelpers — the ONLY access to Payload, routes, links, navigation
|
||
i18n.config.ts # locales — one source
|
||
payload.config.ts
|
||
proxy.ts # NOT middleware.ts
|
||
```
|
||
|
||
Routes in `app/` are **re-exports** from `lib/content` — the configuration (domain, `summaryField`,
|
||
MCP name) lives once, in `createContentHelpers`. Section fields (`buildSectionHeaderField`,
|
||
`buildSectionSettingsField`), links (`resolveLink`) and menus (`resolveNav`) are in the plugin —
|
||
do not create `src/fields/sectionHeader.ts` or `lib/navigation.ts`.
|
||
|
||
| Element | Convention | Example |
|
||
|---|---|---|
|
||
| Block folder, collection, global | PascalCase | `blocks/FeatureGrid/`, `collections/Pages.ts` |
|
||
| Helper, lib file | camelCase | `lib/content.ts` |
|
||
| Collection slug | camelCase, plural | `pages`, `blogPosts` |
|
||
| Block slug = registry key | camelCase | `hero`, `featureGrid` |
|
||
| Field name | camelCase, vocabulary from §6.5 | `header`, `links`, `media` |
|
||
| Component | a named function, types from `@/payload-types` | `export function Hero(...)` |
|
||
|
||
No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
|
||
`lib/locales.ts`, `lib/navigation.ts` — the plugin has `resolveRoute`, `getConfiguredLocales`, `resolveNav`.
|
||
|
||
---
|
||
|
||
## 4. NEXT 16 — RENDERING, SEO, BUILD
|
||
|
||
1. **`proxy.ts`, never `middleware.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.
|
||
2. **No explicit `<head>` in the layout.** It pushes metadata into `<body>`.
|
||
`<MediaPreconnect/>` in `<body>` (React 19 hoists it).
|
||
3. **ISR:** `export const revalidate = 3600` in `page.tsx`. Refresh after save:
|
||
`buildRevalidateHook` (hooks.md).
|
||
4. **`generateStaticParams`** in `[[...slug]]/page.tsx`:
|
||
`export const generateStaticParams = route.generateStaticParams` (from `createPageRoute`)
|
||
or `export { 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 of `content` collections render on the first request (ISR).
|
||
5. **`htmlLimitedBots`** in `next.config.ts` (seo.md).
|
||
6. **Do not read `searchParams`** in a page without pagination — it deoptimizes
|
||
ISR/SSG. **Do not read `headers()` / `cookies()`** anywhere in the tree of static
|
||
pages — in blocks, components, the `[locale]` layout or in
|
||
`not-found.tsx` (Next 16: `Page changed from static to dynamic at runtime`).
|
||
Locale for blocks → `enhanceProps`; in `not-found.tsx` (no `params`) →
|
||
`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).
|
||
7. **`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, but `dynamic` must be in the route file.
|
||
8. **`instrumentation.ts`** with `assertEnv(ipalEnvRules({...}))` imported from **`@intecion/ipal-kit/env`** (the root pulls in Payload → Edge/Turbopack crash), inside `if (process.env.NEXT_RUNTIME === 'nodejs')` (env.md).
|
||
9. **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'`.
|
||
10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`.
|
||
11. **Next.js 16.4.1 or later** (minimum safe version). 16.0.0–16.4.0 have unauthenticated RCE and DoS
|
||
advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr, GHSA-p3m5-59mp-jv5r); Payload supports no patched
|
||
15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.1) and make sure `sharp` resolves 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.1, sharp ≥ 0.35.5; `pnpm dev` prints no security-upgrade warning.
|
||
12. **No open production advisories.** Node.js 20 or later (the plugin's `nodemailer` 10 requires it). Run
|
||
`pnpm audit --prod`. The plugin's own dependencies are clean; what remains comes from Payload's tree, which only
|
||
the project's lockfile can fix. With `payload` 3.90.x three packages are pinned exactly and need `pnpm.overrides`
|
||
next to the `@payloadcms/*` ones:
|
||
```json
|
||
"dompurify@<3.4.17": "^3.4.17",
|
||
"graphql-scalars@<2.0.1": "^2.0.1",
|
||
"undici@>=7 <7.30.1": "^7.30.1"
|
||
```
|
||
`undici` comes from `payload` (3.92.1 and later already ship 7.30.1), `dompurify` from the admin code editor
|
||
(`@payloadcms/ui` → `monaco-editor`, which pins 3.2.7). `graphql-scalars` comes from `@payloadcms/graphql`, which
|
||
pins 1.22.2 up to the latest Payload (3.92.1); every version up to 2.0.0 has a high ReDoS advisory in the
|
||
`PhoneNumber` scalar (GHSA-x8rm-f576-gq67). 2.x is a major (graphql-js 16+, Node.js 22 recommended), but Payload
|
||
only uses `DateTimeResolver` and `EmailAddressResolver`, which work unchanged — keep the override until Payload
|
||
ships 2.0.1 or later. `deepmerge` (low, from `payload`) has no fixed version yet; it stays in the report. Everything else in the report (`fast-uri`, `js-yaml`,
|
||
`browserslist`, `source-map-js`, `fast-copy`, `baseline-browser-mapping`) is a range: `pnpm update` or 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 on `nodemailer` or `@types/nodemailer`.
|
||
**Check:** `pnpm audit --prod` → no high or critical (only the `deepmerge` low may remain);
|
||
`pnpm why undici dompurify graphql-scalars` → only the fixed versions; with GraphQL in use, a query that reads a
|
||
`createdAt` (DateTime) and filters on `email` (EmailAddress) returns data.
|
||
|
||
---
|
||
|
||
## 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 `ipalKit` (an auth collection with `roles` and 2FA) — do not create it, unless
|
||
you need extra fields (then your own `Users.ts` with the slug from `access.authCollection`;
|
||
the plugin adds roles and 2FA to it).
|
||
|
||
**NEVER:** a second `media`, `daneFirmy`/`settings`/
|
||
`navigation`/`footer` as collections (they are globals), FAQ/hero/features as collections
|
||
(they are blocks), a collection for a single thing (that is a page or a global).
|
||
|
||
**Test before a new collection — all must be YES:** a list of many records?
|
||
does each have its own URL? does the client explicitly require it? does Payload not have it built in?
|
||
|
||
Typical content collections (when required): `posts`/`blogPosts` (+ `authors`,
|
||
`categories`), `products`, `projects` (portfolio). Reviews (`testimonials`) without
|
||
their own URLs → do not add them to `content`.
|
||
|
||
### 5.4 Wiring collections with URLs
|
||
```ts
|
||
// ipalKit({ content: contentConfig }) and createContentHelpers({ content: contentConfig })
|
||
export const contentConfig = {
|
||
collections: [{ slug: 'posts', perPage: 10 }],
|
||
} satisfies ContentOption
|
||
```
|
||
The URL prefix **is not in the code** — the editor assigns the archive page in Site
|
||
Settings (`postsArchive`). Changing its slug moves the whole section, per language.
|
||
The plugin does the routing (`resolveRoute`), sitemap, `generateStaticParams`, hreflang.
|
||
Every content collection: `title`, `buildSlugField`, SEO tab, `buildNoindexField`,
|
||
`trackSlugHistoryHook`, structured data if relevant (seo.md). Details: content.md.
|
||
|
||
### 5.5 System pages
|
||
Site settings → System pages: `homepage`, `notFound` (404), `privacyPolicy`,
|
||
`cookiePolicy`, `termsOfService`. Link by role (`getSystemPagePath`),
|
||
never by slug. pages.md.
|
||
|
||
---
|
||
|
||
## 6. BUILDING SECTIONS (`.tsx` blocks)
|
||
|
||
**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](../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 `ipal-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)
|
||
1. **Small:** a section's `Component.tsx` ≤ ~80 lines of JSX; a list item > 5 lines → its own `XxxCard.tsx`.
|
||
2. **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 in `Button.tsx`. Same for: image → `Media`, heading → `SectionHeader`.
|
||
3. **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.
|
||
4. **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.
|
||
5. **A variant instead of a copy:** a different look of the same section = `variant` (select), not a second block.
|
||
6. **No text, link or image in JSX** — everything from the panel, in every language.
|
||
7. **Empty field = the element does not render** (no "Lorem", no empty `<div>`).
|
||
8. **Server by default;** interaction in a separate, small `'use client'` file with simple props.
|
||
9. **Types from `@/payload-types`**, named export, imports from `@/…`, no barrels.
|
||
10. **Every new block:** an empty-block test in the panel (§6.5a) + `ipal-audit --quick`.
|
||
|
||
### 6.1 Three layers
|
||
```
|
||
LAYER 1 — shared fields: from the plugin (buildLinkField, buildLinksField,
|
||
buildSectionHeaderField, buildSectionSettingsField)
|
||
src/components/ui/ LAYER 2 — UI primitives (CMSLink, Button, Media, Section, SectionHeader)
|
||
src/blocks/X/ LAYER 3 — section = a composition of layers 1 and 2
|
||
```
|
||
Changing the look of a button across the whole site = one change in `Button.tsx`. If
|
||
you have to change 12 blocks, the architecture is wrong.
|
||
|
||
### 6.2 Layer 1 — shared fields
|
||
|
||
**Link / CTA — from the plugin** ([links.md](../links.md)), never a copy in the project:
|
||
|
||
```ts
|
||
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](../blocks.md)):
|
||
- `buildSectionHeaderField()` → the `header` group: `eyebrow`, `heading`, `intro` (localized),
|
||
- `buildSectionSettingsField()` → the `settings` group (sidebar): `anchor`, `background`
|
||
(project backgrounds: `buildSectionSettingsField({ backgrounds: [{ label, value }] })`, extra fields: `fields`).
|
||
Every section has `buildSectionSettingsField()` — no `bgColor`, `sectionId` per 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](./skills/ipal-block/resources/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](./skills/ipal-block/resources/section-code.md)):
|
||
|
||
```tsx
|
||
// 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.
|
||
|
||
1. **Repeated items = one array with "+ Add …"**, never numbered fields.
|
||
`cta1Label`/`cta2Url`, `feature1Title`…`feature6Title`, `image2`, `phone2` → an array:
|
||
buttons `buildLinksField()` (panel: **"Add Button"**), `items` elements with
|
||
`labels: { singular: 'Feature', plural: 'Features' }` (panel: **"Add Feature"**).
|
||
`maxRows` = as many as the design fits, `minRows` only when the layout breaks without an item.
|
||
2. **A row shows its content**: `admin: { initCollapsed: true, components: rowLabel('heading', 'Feature') }`
|
||
→ collapsed rows "Fast delivery", "24/7 support" instead of "Feature 01".
|
||
`buildLinksField` has this built in (row = button label).
|
||
3. **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`, option `label`, tab `label`, `labels.singular/plural`,
|
||
`admin.group`. Type: `AdminText` from `@intecion/ipal-kit`.
|
||
- `admin.description` only 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 (ipal-kit sets
|
||
`i18n.supportedLanguages` when the project has not); set your own list to change it.
|
||
The plugin's own texts are overridable: field/global labels via `globalOverrides` /
|
||
`collectionOverrides`, component texts via `i18n.translations.<lang>.ipal.<key>`
|
||
(keys: `adminTexts` from `@intecion/ipal-kit`). Building blocks for your own admin
|
||
components: `ipalT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`,
|
||
`applyAdminI18n` (already applied by `ipalKit`), `adminDocumentTitle` + `<DocumentTitle>` (`/admin`;
|
||
a custom view's tab title in the admin language — Payload's `meta.title` is one fixed string),
|
||
types `AdminText`, `AdminLanguage`, `AdminTextKey` — details in i18n.md "Admin panel languages and texts".
|
||
**Check:** Polish panel → the view's browser tab reads in Polish.
|
||
4. **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 with `mediaType: 'video'`,
|
||
variant fields only with that `variant`). A look variant = `variant` (select) in
|
||
one block, not a second block with a copy of the fields.
|
||
5. **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 a `row` with `admin.width: '50%'`.
|
||
6. **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.
|
||
7. **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`).
|
||
8. **`required` sparingly** — only when the section is broken without a value (e.g.
|
||
the `heading` of a list item, the `alt` of an image). Selects and checkboxes with `defaultValue`.
|
||
|
||
```ts
|
||
// BAD — 14 fields, half always empty, numbered slots, link as text
|
||
{ name: 'title', type: 'text' }, { name: 'subtitle', type: 'text' },
|
||
{ name: 'cta1Label', type: 'text' }, { name: 'cta1Url', type: 'text' },
|
||
{ name: 'cta2Label', type: 'text' }, { name: 'cta2Url', type: 'text' },
|
||
{ name: 'feature1Title', type: 'text' }, { name: 'feature1Text', type: 'text' }, // …feature3
|
||
{ name: 'bgColor', type: 'text', admin: { description: 'Section background color in hex, used in the component className' } },
|
||
|
||
// GOOD — 4 items in the panel, grows with the "+ Add …" button
|
||
buildSectionHeaderField(), // Eyebrow / Heading / Intro
|
||
{ name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' }, maxRows: 6,
|
||
admin: { initCollapsed: true, components: rowLabel('heading', 'Feature') },
|
||
fields: [{ name: 'heading', type: 'text', localized: true, required: true }, { name: 'text', type: 'textarea', localized: true }] },
|
||
buildLinksField(), // "+ Add Button"
|
||
buildSectionSettingsField(), // sidebar: anchor, background
|
||
```
|
||
|
||
**Empty-block test** (after every new block, in the panel): add the block to a page →
|
||
at the start ≤ 6 items are visible, everything is in English, buttons and items are added
|
||
with "+ Add …", collapsed rows have readable names, nothing requires knowledge of the code.
|
||
Automatic checks: `ipal-audit` (the "panel:" section). After adding `rowLabel` in
|
||
the project: `pnpm payload generate:importmap`.
|
||
|
||
### 6.6 Anti-patterns → fix
|
||
|
||
```ts
|
||
// BAD
|
||
{ name: 'ctaLabel', type: 'text' }, { name: 'ctaHref', type: 'text' },
|
||
{ name: 'secondaryCtaTarget', type: 'relationship', relationTo: 'pages' },
|
||
{ name: 'pdfUrl', type: 'text' },
|
||
// GOOD
|
||
buildLinksField({ maxRows: 3 })
|
||
```
|
||
```tsx
|
||
// 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} />
|
||
```
|
||
```tsx
|
||
// 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
|
||
1. List what the section displays (heading, images, buttons, repeated items).
|
||
2. Schema per §6.5; CTA → `buildLinksField()`.
|
||
3. **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.
|
||
4. Component: `<Section>`, `<SectionHeader>`, `<Media>`, `<CMSLink>`,
|
||
repeated items → `items.map` + `XxxCard`.
|
||
5. `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](./skills/ipal-nav/resources/nav-code.md).
|
||
Skill: **ipal-nav**.
|
||
|
||
- Navigation, footer, company data = **project globals** (`header`, `footer`, `company`),
|
||
built with `buildLinkField` — 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 = `appearance` from the panel (`buildLinkField({ appearances: [...] })`, any names), never a condition on content (`label === '…'`).
|
||
- Resolve links **on the server**: `await resolveNav(header.navItems, locale)` from `lib/content`
|
||
→ `{ href, label, internal, newTab, targetProps, children }[]` (dead links skipped); only this data
|
||
goes to the client component (MobileNav) — `CMSLink` is a server component.
|
||
- a11y labels (menu button) — fields in the panel.
|
||
- A global changed on every page → `afterChange: [buildGlobalRevalidateHook({ revalidatePath })]`
|
||
(it calls `revalidatePath('/', 'layout')`). `buildRevalidateHook` is for collections. The plugin's globals
|
||
(Site settings, Site integrations, Cookie banner, Notifications) refresh ISR themselves once you pass
|
||
`ipalKit({ revalidatePath })` (from `next/cache`); without it the change shows after the `revalidate` window.
|
||
- The plugin's globals: read public (Site integrations: admin only), write editor+. Change their access, admin
|
||
or hooks with `ipalKit({ globalOverrides: { notifications: { access: { update: authenticated } } } })` —
|
||
an object merges key by key (your keys win), a function `(global) => global` takes over. Never copy a plugin global.
|
||
- Only `[locale]/layout.tsx` fetches globals and passes them as props.
|
||
|
||
### 6.9 Client components (`'use client'`)
|
||
|
||
1. **Native HTML first.** Expandable FAQ → `<details>`/`<summary>`, modal →
|
||
`<dialog>`. Zero JS, works without hydration. `useState` only when HTML is not enough.
|
||
2. **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.
|
||
3. **Only serializable props** — strings, numbers, arrays of simple objects.
|
||
No functions, no whole Payload documents (trim to the fields you need).
|
||
4. **Render content on the server, pass it as `children`** — rich text, `Media`,
|
||
`CMSLink` do not go into the client component:
|
||
```tsx
|
||
// 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]
|
||
```
|
||
5. **Forbidden in the client:** importing `payload`, `@/lib/content`, `@/payload.config`,
|
||
`server-only`, secrets. Types are allowed (`import type`).
|
||
6. Plugin hooks from `@intecion/ipal-kit/client` (`useForm`, `useConsentContext`…).
|
||
7. a11y labels (`aria-label`, "Close", "Next slide") — from the panel, via props.
|
||
8. **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 plain `lightboxImage(…)` data),
|
||
one `<SiteProviders lightbox>`, labels from Form messages → Image viewer (lightbox.md). `ipal-audit`
|
||
warns 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](./skills/ipal-block/resources/section-code.md). **Never** SVG pasted into a section's JSX.
|
||
|
||
### 6.11 Styles — the design-token standard ([design-tokens.md](../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, template `ipal-setup/resources/DESIGN.md`) and
|
||
`src/design/tokens.ts` (`defineTokens` from `@intecion/ipal-kit/tokens`, template `ipal-setup/resources/tokens.ts`).
|
||
`pnpm exec ipal-tokens` writes `src/design/tokens.css` (commit it) and fails on a WCAG AA contrast error.
|
||
Never edit the generated file; never put brand values in `styles.css` or in a component.
|
||
- **`styles.css` is the same on every site:** `@import "tailwindcss"`, `@intecion/ipal-kit/fluid-wide.css` (or
|
||
`fluid.css`), `@intecion/ipal-kit/tokens.css`, `@intecion/ipal-kit/tailwind.css`, `../../design/tokens.css` (last), `@source` of 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-…)`,
|
||
or `dark:` for colours (the roles switch with `data-theme` themselves). `dark:` only for non-colour differences.
|
||
- **Inverted section:** `<Section>` with `settings.background = inverted` → `bg-inverse` + `data-surface="inverse"`;
|
||
content inside keeps `text-fg` / `text-link` / `bg-primary` (the scope re-maps them; a dark brand primary needs
|
||
`primary-inverse` / `primary-inverse-text` in `tokens.ts` — the contrast report says when; default: the brand primary). `data-theme="dark"` on any element = a dark panel.
|
||
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>` (not
|
||
`--font-body`: a `var()` cycle with the `font-body` utility). 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: `IPAL_TOKENS.primary` or `ipalVar('primary')`; breakpoints in JS: `IPAL_BREAKPOINTS`.
|
||
- A missing role every site would need → **ipal-plugin-gap**; a project-only decorative colour → `styles.css` below 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.
|
||
Example `styles.css`: [section-code.md](./skills/ipal-block/resources/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) or `fluid.css`
|
||
(stops at 1280 px). No `clamp()` in components or `styles.css`; different numbers from `DESIGN.md` → min/max
|
||
pairs in `src/design/tokens.ts` (`fs: { h1: ['2.25rem', '4rem'] }`, `space: { section: [3, 8] }`) → `ipal-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 text
|
||
`max-w-[var(--ipal-measure)]` (~68 characters per line). No fixed `w-[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: true` in
|
||
Media → `object-position` from `mediaImageProps`).
|
||
- **Test screens** (every page, browser / Playwright): 360×740, 390×844, 768×1024,
|
||
1024×768, **1280×800, 1366×768, 1440×900** (13–15″ laptops), 1536×864, 1920×1080, plus
|
||
125 % and 150 % zoom at 1366 (common on Windows). No horizontal scroll, no clipped text,
|
||
the menu works, the hero CTA is visible.
|
||
|
||
### 6.11b Speed (Core Web Vitals)
|
||
| What | How | Forbidden |
|
||
|---|---|---|
|
||
| LCP image (the first visible one, usually the hero) | `<Media priority>` — exactly one per page | `priority` on many images, the hero as a CSS `background-image` |
|
||
| every other image | `<Media sizes={MEDIA_SIZES.third}>` — `sizes` = the width on screen | no `sizes` (downloads the full width), `<img>` |
|
||
| placeholder | `buildMediaPlaceholderHook` + a field in Media (blur + color) | empty boxes that "jump in" while loading |
|
||
| background video | `videoMode="background"`, MP4 H.264 ≤ 20 MB, no sound, with a poster | a video as the hero without a poster, `autoplay` with sound |
|
||
| video with content | `videoMode="player"` (loads after a click) | `preload="auto"` |
|
||
| YouTube | `<YouTubeEmbed>` from `/client` (the iframe only after a click) | a bare `<iframe src="youtube.com/embed…">` |
|
||
| next.config | `images: { ...buildImagesConfig() }` (AVIF/WebP, R2) | no `remotePatterns` → images from R2 without optimization |
|
||
| fonts | `next/font`, max 2 families × 2–3 weights, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'` | a `<link>` to Google Fonts, 6 weights "just in case" |
|
||
| third-party scripts | `Analytics` (via `SiteProviders`, `analytics={{ defer: true }}`) / `ConsentScript` from the plugin | chat/map widgets loaded at start |
|
||
| client components | small, interaction only (§6.9) | a whole section `'use client'` |
|
||
|
||
Target on the built site (mobile, Lighthouse/PageSpeed): LCP < 2.5 s, CLS < 0.1, INP < 200 ms.
|
||
Checks: `ipal-audit` (img/video outside Media, many `priority`, `h-screen`, fixed widths,
|
||
YouTube `<iframe>`) and `ipal-seo-check` (images without dimensions, LCP image without priority).
|
||
|
||
### 6.12 Exports and imports
|
||
|
||
- **Named exports** (`export function Hero`). `export default` only where
|
||
Next/Payload requires it: `page`, `layout`, `not-found`, `route`,
|
||
`sitemap`, `robots`, `manifest`, `payload.config`.
|
||
- **No `index.ts` barrels** in `blocks/` and `components/` — 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 type`** for types only.
|
||
- **Import order:** external → `@intecion/ipal-kit` → `@/` → relative.
|
||
- `payload.config` and collections import only the blocks' `config.ts`, never
|
||
`Component.tsx`. Only `blocks/registry.ts` ties the components together.
|
||
|
||
---
|
||
|
||
## 7. PLUGIN PATTERNS — USE THEM, DO NOT REWRITE THEM
|
||
|
||
Catalog: **need → import**. Before you write a helper, hook, logic component or route —
|
||
find it here. Entry points: `@intecion/ipal-kit` (server/config), `/client` (`'use client'`),
|
||
`/rsc` (server components), `/server` (server actions), `/admin` (panel), `/env`
|
||
(`instrumentation.ts`). The plugin gives **the logic and the skeleton**; the look stays in the project
|
||
(classes, `classNames`, your own markup on top of a hook). Something is missing that will repeat in another
|
||
project → **plugin gap**, not a copy.
|
||
|
||
**Page and data** (`lib/content.ts` = `createContentHelpers`, PROGRAMISTA §2.7)
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| Payload, settings, languages (cached per request) | `getCachedPayload`, `getSettings`, `getConfiguredLocales` | content.md |
|
||
| Catch-all page (route, 308, 404, meta, static params, JSON-LD, blocks) | `createPageRoute(content, { blocks, notFound, permanentRedirect, redirect, blockProps, render })` (`/rsc`) → `{ Page, generateMetadata, generateStaticParams }`; `redirect` turns on under-construction mode for pages; `lib/content` hides the same pages in Markdown and MCP (`isPathVisible`), the sitemap and llms.txt (`underConstructionSeo`); pass `isPathVisible` to `createSearchRoute` yourself | pages.md, construction.md |
|
||
| 404 from the panel in every language | `createNotFoundPage(content, { load })` + the server action `renderNotFoundView(content, { blocks, fallback }, locale)` (`/rsc`) | pages.md |
|
||
| Layout: consent, banner, Turnstile, analytics, site JSON-LD, preconnect | `getSiteShell(locale)` + `<SiteProviders shell>` (`/rsc`) | consent.md |
|
||
| Your own page / archive | `resolveRoute`, `getEntries`, `resolvePageRedirect`, `generatePageMetadata`, `getPageJsonLd`, `generateStaticParams` | content.md, pages.md |
|
||
| Rendering blocks | `RenderBlocks` + the `registry` map (never a `switch`) | blocks.md |
|
||
| Rich text / Lexical → Markdown | `RenderRichText` (`/rsc`, styling via `converters`), `lexicalToMarkdown` | richtext.md |
|
||
| A localized value | `resolveLocalized(value, locale)` (not `getSafeString`) | i18n.md |
|
||
|
||
**Fields and panel**
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| Link / CTA / downloadable file | `buildLinkField`, `buildLinksField` | links.md |
|
||
| Link to a category / product / post | `buildLinkField({ relationTo: ['pages', 'categories'] })` — the address from the archive | links.md |
|
||
| Section heading and settings | `buildSectionHeaderField`, `buildSectionSettingsField({ backgrounds })` | blocks.md |
|
||
| Readable array rows | `rowLabel(['heading'], 'Feature')` (+ `generate:importmap`) | links.md |
|
||
| Slug / noindex / description for AI | `buildSlugField`, `buildNoindexField`, `buildSummaryField` | slug.md, seo.md |
|
||
| System pages and their protection | `getSystemPagePath`, `buildPreventDeleteSystemPage`, `buildValidateUniqueRole` | pages.md, hooks.md |
|
||
| ISR after save, old slug → 308, images across languages | `buildRevalidateHook`, `trackSlugHistoryHook`, `buildCrossLocaleFieldSync` | hooks.md |
|
||
| ISR after a global is saved | plugin globals: `ipalKit({ revalidatePath })`; your own globals: `buildGlobalRevalidateHook({ revalidatePath })` | hooks.md |
|
||
| Change a plugin global (access, hooks, fields) | `ipalKit({ globalOverrides })` | access.md |
|
||
| Roles and access | `adminOnly`, `adminOrEditor`, `adminOrSelf`, `authenticated`, `requireRole`, `hasMinimumRole` (+ `…Field`); injected `users`: `access.authAccess`, first user = admin (`access.firstUserAdmin`) | access.md |
|
||
| Data from globals | `getGlobal`, `getSiteSettings`, `getSiteIntegrations` | payload-helpers.md |
|
||
|
||
**Links and navigation**
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| href + new tab + rel + internal for a link from the panel | `resolveLink(link, locale)` (`lib/content`) / `resolveLink(link, opts)` | links.md |
|
||
| Menu from a global (any depth, dead links skipped) | `resolveNav(items, locale)` | links.md |
|
||
| Legal links in the footer (href + page title) | `getSystemLinks(locale)` / `resolveSystemLinks` | links.md |
|
||
| Highlighted item, button variant | `buildLinkField({ appearances: [...] })` — the project's names | links.md |
|
||
| Language paths, switcher, hreflang | `getLocalizedSlugs`, `switchLocalePath`, `LanguageSwitcher`, `buildLocalizedPath` | i18n.md |
|
||
| Safe URL (no `javascript:`) | `safeHref` | links.md |
|
||
|
||
**Forms**
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| A form from the panel in a block (steps, radio, lists, dates) | `<RenderForm form action locale texts classNames>` (`/rsc`) | forms.md |
|
||
| Look of the forms | `formClasses.ts` (`BuilderFormClassNames`) — once per project | forms.md |
|
||
| Unusual form markup | `BuilderForm renderField` / `useBuilderForm` (`/client`) | forms.md |
|
||
| A field filled in by the page (product variant, category) | `RenderForm values` / `prepareBuilderForm` + `BuilderForm values` | forms.md |
|
||
| Sending | `createSubmitAction({ getCachedPayload, headers })` (`/server`) | forms.md |
|
||
| Message texts and step button texts | Form messages → `getFormTexts(locale)` | notifications.md |
|
||
| A form in the database | seed `ipal-form/resources/seed-form.template.ts` | forms.md, seeding.md |
|
||
| Antispam / limit / IP | honeypot in `BuilderForm`, Turnstile from `SiteProviders` (`createSubmitAction({ turnstileHostnames })` pins the domain), `clientIp`, `setRateLimitStore`, `setUnknownIpFactor` | forms.md, turnstile.md |
|
||
| GTM event after sending | `buildFormAnalyticsFields` (panel) — `RenderForm` sends it itself | forms.md |
|
||
| A form outside the builder (e.g. filters) | `useForm` + `buildValidator`, `required`, `email`… | forms.md |
|
||
|
||
**SEO and GEO** (routes = re-export from `lib/content`)
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| Metadata, canonical, hreflang, OG, X | `generatePageMetadata` (`createPageRoute` does it itself) | seo.md |
|
||
| sitemap / robots / manifest | `sitemapRoute` (splits into a sitemap index above 10 000 URLs; `sitemapOptions`, `sitemapEntries`), `getRobots` (panel) / `robots` (code only), `manifest` | seo.md |
|
||
| Search Console / Bing verification, AI crawler policy, llms.txt note | Site settings → Search 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 | `ipalKit({ indexNow: true })` + `indexNowKeyRoute` | seo.md |
|
||
| Search | `createSearchRoute({ …, isPathVisible })` | content.md |
|
||
|
||
**Media, look, speed**
|
||
| Need | Use | Doc |
|
||
|---|---|---|
|
||
| R2, file names, optimization, preview | `buildR2Storage`, `normalizeFilenameHook`, `buildOptimizeUploadHook`, `buildMediaPlaceholderHook` | storage.md |
|
||
| Image / video in `<Media>` | `mediaImageProps`, `videoProps`, `MEDIA_SIZES` | storage.md |
|
||
| Enlarge an image (card, gallery, product, rich text) | `<SiteProviders lightbox>` + `<LightboxTrigger group image={lightboxImage(media, { size })}>` (`/client`), `RenderRichText lightbox`, `useLightbox`; labels: `ipalKit({ lightbox: true })` → 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 ipal-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IPAL_TOKENS`, `ipalVar`, `IpalTokenName`, `IPAL_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) | `ipalKit({ 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 `IPAL_COOKIE_SCAN_URL` / `IPAL_COOKIE_SCAN_TOKEN` (`ipalEnvRules({ cookieCrawl: true })`) + the site's `host=token` in the shared service's `IPAL_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 |
|
||
| Mail | `email: mailAdapter()`, `sendEmail` | email.md |
|
||
| Env validation, health | `assertEnv(ipalEnvRules({…}))` (`/env`), `healthRoute` | env.md |
|
||
| 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md |
|
||
| 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 `IPAL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md |
|
||
|
||
**Compliance (PL/EU) — the mechanism from the plugin, the content from the client:** policy pages
|
||
as System pages, `CookieBanner` + `CookieButton`, a `consent` checkbox in
|
||
forms (enforced server-side), the controller's data in a global, the cookie
|
||
table from the panel (`<CookieTable>` and the `settings="detailed"` window, scan: ipal-consent-check). You do not write legal texts. An accessibility widget — only when the client
|
||
requires it (accessibility.md).
|
||
|
||
**Security:** 2FA enforced (`ipalKit({ twoFactor: { issuer, plugin:
|
||
payloadTotp } })`, never `twoFactor: false` without a client decision). 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) | — | `ipalKit({ globalOverrides: { <slug>: { access, admin, hooks } } })`; a function `(global) => global` takes over (`applyGlobalOverrides`) |
|
||
| Global saves revalidate the layout (with `ipalKit({ revalidatePath })`) | omit `revalidatePath`; once: `context: { disableRevalidate: true }` | `buildGlobalRevalidateHook` on your own globals |
|
||
| Staff features without `access` (no roles field): every logged-in account passes (`userMeetsRole`) | add `access` (roles decide) | `globalOverrides`, `forms.formSubmissionOverrides`, `consentLog.collectionOverrides`, `stats.collectionOverrides` |
|
||
| 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 | — | `ipalKit({ 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) |
|
||
| `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`, `ipalKit({ lightbox: true })` for panel labels) | `texts`, `classNames`, `unstyled`, `--ipal-lightbox-*` variables, `renderImage`, `renderDialog`, `loop`, `useLightbox`, `withLightboxUploads`, `lightboxImage` |
|
||
| `RenderRichText` renders unsafe link URLs as `#` | `safeLinks={false}` (fully trusted content only) | your own `converters` |
|
||
| Search 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 `IPAL_NOINDEX` | `indexNow` off by default | `submitToIndexNow` by hand |
|
||
|
||
---
|
||
|
||
## 8a. TESTS — what you check and how
|
||
|
||
You test **the behavior the client and Google see**, not the plugin's implementation (it has
|
||
its own tests). Order from the cheapest:
|
||
|
||
| Level | What | When |
|
||
|---|---|---|
|
||
| Types | `pnpm generate:types && pnpm tsc --noEmit` | after every schema change |
|
||
| Rules | `ipal-audit --quick` (hardcoding, the §0b set, panel) | after every block / collection |
|
||
| Build | `pnpm build` — page routes `●` (SSG), not `ƒ` | before every "done" |
|
||
| Smoke (Playwright) | `ipal-audit/resources/smoke.spec.template.ts` → `tests/smoke.spec.ts`: all URLs from the sitemap 200 + title + one h1, 404, GEO routes, banner, form end-to-end | before handover and after every ipal-kit update |
|
||
| Site in the browser | `ipal-seo-check`, `ipal-consent-check`, `cookie-scan` | before handover, after deploy |
|
||
| Project logic | vitest for your own functions (mapping company data to JSON-LD, helpers, hooks, migration scripts with `--dry-run`) | when you write logic the plugin does not have |
|
||
| Panel | the editor test (§11) and the empty-block test (§6.5a) | every new block / global |
|
||
|
||
Rules:
|
||
- **A test independent of content** — it finds elements by roles and `data-ipal`, URLs from the sitemap, not by
|
||
texts the editor will change tomorrow.
|
||
- **Every fixed bug = a test** that would have caught it (smoke or vitest), so it does not come back.
|
||
- **Test the form for real**: sending → a record in Form Submissions → mail to the company **and**
|
||
confirmation to the customer (locally: Site integrations → Send test + adapter logs).
|
||
- **Do not test the plugin in the project** (e.g. whether `submitForm` validates) — ipal-kit does that. When
|
||
the plugin's behavior is wrong: plugin gap.
|
||
- Tests in the project's CI: types + audit `--quick` + build on every push; smoke on staging
|
||
(`IPAL_NOINDEX=1`) before a production deployment.
|
||
|
||
## 8. CODE STANDARDS
|
||
|
||
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.
|
||
`interfaceName` on shared fields/blocks gives named types.
|
||
- A generic at the call site: `getSiteSettings<SiteSetting>(payload)`, not `as` on the result.
|
||
- Configuration: `as const satisfies I18nConfig`.
|
||
- An acceptable narrow cast: `doc.slug as unknown as Record<string, unknown>`
|
||
with `locale: 'all'` (the generator does not model this mode), `locale as never`.
|
||
|
||
**Payload**
|
||
- In hooks pass `req` to 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: false` when 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 `if` pyramid.
|
||
|
||
**Readability**
|
||
- Names say WHAT (`publishedPosts`, not `arr`); 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.md` in 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 in `DESIGN.md` (template sections) and `src/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** — `ipal-audit` (the §0b set + the rules below) and `ipal-seo-check`
|
||
(GEO and SEO on the built site) instead of manual greps:
|
||
```bash
|
||
bash .agents/skills/ipal-audit/scripts/audit.sh
|
||
node .agents/skills/ipal-seo-check/scripts/seo-check.mjs http://localhost:3000
|
||
pnpm generate:types && pnpm tsc --noEmit
|
||
pnpm build # --webpack in the script; locally, not only dev
|
||
# hardcoding and the field zoo in blocks
|
||
grep -rnE "name: '[a-zA-Z]*([cC]ta|[bB]utton|Url|Href|[pP]df)[a-zA-Z]*'" src/blocks
|
||
grep -rnE 'href=\{?["`]/|<img |/files/|/images/|\.pdf' src/blocks
|
||
grep -rnE '<(a|Link) ' src/blocks # only CMSLink in sections
|
||
find src/blocks -name 'Component.tsx' -exec wc -l {} + | awk '$1 > 120'
|
||
grep -rnE "(bg|text|border)-\[#" src/blocks src/components # hex instead of tokens
|
||
grep -rln "^'use client'" src | xargs grep -lnE "@/lib/content|from 'payload'|server-only" # server code in the client
|
||
find src/blocks src/components -name 'index.ts' # barrel — delete it (no exceptions)
|
||
# architecture
|
||
ls src/middleware.ts 2>/dev/null && echo "DELETE middleware.ts"
|
||
grep -rn "localizedRoutes\|as any\|@ts-ignore" src
|
||
grep -rn "<head" src/app
|
||
```
|
||
Every hit is an error or a deliberate, commented exception. After the build, page
|
||
routes must be `●` (SSG), not `ƒ`.
|
||
|
||
**Editor test — through the panel alone, without code, in every language:**
|
||
- [ ] changes every heading, text, label
|
||
- [ ] replaces every image and downloadable file
|
||
- [ ] changes the text and target of every button
|
||
- [ ] adds, removes, reorders sections; creates a new page from blocks
|
||
- [ ] changes the menu, footer, company data
|
||
- [ ] changes the page SEO, the form texts and the cookie banner texts
|
||
- [ ] assigns the system pages (including 404)
|
||
|
||
Anything that needs a developer → move it to the panel.
|
||
|
||
---
|
||
|
||
## 12. MODULE MAP (API details)
|
||
|
||
| Module | File |
|
||
|---|---|
|
||
| Roles and panel access | [access.md](../access.md) |
|
||
| Accessibility widget (optional) | [accessibility.md](../accessibility.md) |
|
||
| GA4, GTM, Meta Pixel, Clarity, LinkedIn, TikTok | [analytics.md](../analytics.md) |
|
||
| Blocks, RenderBlocks, enhanceProps | [blocks.md](../blocks.md) |
|
||
| Block library: 15 ready sections, page templates, eject | [block-library.md](../block-library.md) |
|
||
| Cookie consent, banner | [consent.md](../consent.md) |
|
||
| Cookie scanner (review list, Open Cookie Database) | [cookie-scanner.md](../cookie-scanner.md) |
|
||
| Routing, archives, redirects, Markdown, search | [content.md](../content.md) |
|
||
| Email SMTP / Graph | [email.md](../email.md) |
|
||
| Env validation | [env.md](../env.md) |
|
||
| Forms, useForm, honeypot | [forms.md](../forms.md) |
|
||
| Hooks | [hooks.md](../hooks.md) |
|
||
| i18n, proxy, language switcher | [i18n.md](../i18n.md) |
|
||
| Links / CTA (fields + href) | [links.md](../links.md) |
|
||
| The site's MCP server | [mcp.md](../mcp.md) |
|
||
| Form messages | [notifications.md](../notifications.md) |
|
||
| System pages, 404, generateStaticParams | [pages.md](../pages.md) |
|
||
| Under-construction mode | [construction.md](../construction.md) |
|
||
| Visit statistics (optional) | [stats.md](../stats.md) |
|
||
| Light / dark theme | [theme.md](../theme.md) |
|
||
| Design tokens, `ipal-tokens`, DESIGN.md | [design-tokens.md](../design-tokens.md) |
|
||
| Payload helpers (getSiteSettings…) | [payload-helpers.md](../payload-helpers.md) |
|
||
| Rich text | [richtext.md](../richtext.md) |
|
||
| Headers, CSP, 2FA, panel path | [security.md](../security.md) |
|
||
| SEO, metadata, sitemap, JSON-LD, llms.txt | [seo.md](../seo.md) |
|
||
| Auto-slug | [slug.md](../slug.md) |
|
||
| Media: collection, file names, optimization, placeholders | [media.md](../media.md) |
|
||
| Image lightbox (enlarge, galleries, rich text images) | [lightbox.md](../lightbox.md) |
|
||
| R2, `buildImagesConfig`, YouTube | [storage.md](../storage.md) |
|
||
| Front end: `createContentHelpers` (`@/lib/content`), `createPageRoute`, `SiteProviders` | [frontend.md](../frontend.md) |
|
||
| Integrations (the `site-integrations` global, statuses, email test) | [integrations.md](../integrations.md) |
|
||
| New site from the reference site: `ipal-kit create`, `@intecion/ipal-kit/starter` | [project-starter.md](../project-starter.md) |
|
||
| Deployment, production env, health check | [deployment.md](../deployment.md) |
|
||
| Seeds on production: create-only, dry run, backup, update guard | [seeding.md](../seeding.md) |
|
||
| Meta Pixel / GA4 via GTM | [gtm-meta-pixel.md](../gtm-meta-pixel.md) |
|
||
| Turnstile | [turnstile.md](../turnstile.md) |
|
||
| Panel white-label | [white-label.md](../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.
|
||
|
||
```markdown
|
||
# AGENTS.md
|
||
|
||
**Project:** <client> · <domain> · market <PL/AU/US> · industry <…>
|
||
**Languages:** <pl, en, de> · **Media:** <R2 / local> · **Email:** <SMTP / Graph>
|
||
|
||
## Rules
|
||
Before your first change, read all of:
|
||
`node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`
|
||
Module details: `node_modules/@intecion/ipal-kit/docs/<module>.md`.
|
||
Skills: `.agents/skills/ipal-*` (refresh: `pnpm exec ipal-skills`). Always run `ipal-audit` before "done".
|
||
The rules in AGENT.md take precedence over your general knowledge of Next/Payload.
|
||
ipal-kit first: anything the plugin covers is built with the plugin. Missing or broken → plugin gap (ipal-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 ipal-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> ipal-audit-skip: <keys from AGENT.md §0b> — <reason, source of the decision>
|
||
```
|
||
|
||
**Claude Code** reads `CLAUDE.md`, not `AGENTS.md` — add a `CLAUDE.md` in the root with one
|
||
line `@AGENTS.md` (an import), instead of copying the content. `pnpm exec ipal-skills` does this itself:
|
||
it adds the `<!-- ipal-kit:start -->…<!-- ipal-kit:end -->` block to `AGENTS.md` (a pointer to
|
||
AGENT.md, `ipal-reference`, `ipal-setup`), and creates a missing `CLAUDE.md` with `@AGENTS.md`.
|
||
On every run it replaces only the text between the markers — it does not touch your own content.
|
||
|
||
---
|
||
|
||
## 14. SKILLS (Antigravity, Claude Code, Cursor)
|
||
|
||
The skills are in the package: `node_modules/@intecion/ipal-kit/docs/agent/skills/`.
|
||
At the start the agent sees only their names and descriptions, and reads the full instructions when
|
||
the task matches — manually: `/<name>`.
|
||
|
||
| Skill | When |
|
||
|---|---|
|
||
| `ipal-site` | **a whole site from brief to report** — guides you through the other skills (§0a) |
|
||
| `ipal-reference` | **the full plugin map**: `ipalKit` options, env, routes, proxy, layout, import map, hooks, collections, globals + `resources/api.md` (every export) — before you write something yourself |
|
||
| `ipal-setup` | a new project from scratch (foundation) — complete installation stage by stage |
|
||
| `ipal-block` | a new or revised section (block) — schema, panel (§6.5a), component |
|
||
| `ipal-collection` | "we need a blog / products / …" — before a file appears in `src/collections` |
|
||
| `ipal-nav` | header, menu, footer, company data |
|
||
| `ipal-form` | a form from the panel: renderer, `submitForm` action, Turnstile, mails, GTM |
|
||
| `ipal-locale-add` | a new language — configuration, content, the `locale-coverage` script |
|
||
| `ipal-migrate-fields` | changing fields that already contain content — 3 phases, a script with dry-run |
|
||
| `ipal-upgrade` | updating ipal-kit in an existing project |
|
||
| `ipal-debug` | anything does not work — procedure + a symptom → cause → fix table |
|
||
| `ipal-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
|
||
| `ipal-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
|
||
| `ipal-consent-check` | browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode `advanced` (all signals `denied`) — a client who wants zero requests gets `consentMode: 'basic'` |
|
||
| `ipal-plugin-gap` | ipal-kit has a bug or is missing a feature — report 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): `ipal-audit/scripts/audit.sh`,
|
||
`ipal-seo-check/scripts/seo-check.mjs`, `ipal-consent-check/scripts/consent-check.mjs`,
|
||
`ipal-locale-add/scripts/locale-coverage.ts`; templates to copy are in `resources/`.
|
||
|
||
**Installation in the project** (once and after every ipal-kit update) — `ipal-skills` is
|
||
a command (`bin`) of the package:
|
||
```bash
|
||
pnpm exec ipal-skills # → .agents/skills/ipal-*
|
||
pnpm exec ipal-skills --dry-run # only show what will change
|
||
pnpm exec ipal-skills --dest .claude/skills # Claude Code looks for skills in .claude/skills
|
||
pnpm exec ipal-skills --no-pointer # skills only, without touching AGENTS.md / CLAUDE.md
|
||
```
|
||
Besides the skills, the command maintains the pointer to the guide: the `ipal-kit:start…end` block in
|
||
`AGENTS.md` (it creates the file when missing) and in `CLAUDE.md` (when missing — it creates `CLAUDE.md`
|
||
with `@AGENTS.md`; when `CLAUDE.md` already imports `@AGENTS.md` — it does not duplicate it). Run it
|
||
**right after `pnpm add @intecion/ipal-kit`** — the plugin has no `postinstall` script.
|
||
It copies only the `ipal-*` folders: adds new ones, replaces existing ones entirely, removes
|
||
retired ones. Name the project's own skills **without** the `ipal-` prefix — they stay untouched.
|
||
`--dest` must be a subdirectory of the project. Commit the copied `ipal-*` to the project repo.
|
||
|
||
**External skills (opt-in)** — well-known third-party skills, vendored into the package at pinned commits
|
||
(text only, licence + `SOURCE.md` in each folder). `ipal-skills` downloads nothing; it checks every file
|
||
against `docs/agent/external/manifest.json` before copying:
|
||
```bash
|
||
pnpm exec ipal-skills --external # all ext-* next to the ipal-* skills
|
||
pnpm exec ipal-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; ipal-kit 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; ipal-kit 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 — ipal-kit first, Payload data fetching over `swr`,
|
||
`DESIGN.md` tokens, Payload 3 not 4. `ext-*` folders are touched only with `--external`, and only those with
|
||
ipal-kit'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 `ipal-skills` prints a warning and exits with
|
||
code 1. The commands in this file and in the skills assume `.agents/skills/` — with a different
|
||
`--dest` replace the path.
|