Agent guide: ask architecture questions first, ipal-kit first, code rules

- AGENT.md: "Ask before you build" (languages, styling, content, forms,
  analytics/consent, SEO/GEO, database + media, admin, hosting/DNS) —
  answers go to AGENTS.md "Project decisions", never guessed; "ipal-kit
  first" hard rule — a gap is reported to the owner and the agent waits
  for the decision, no hand-built replacements or silent workarounds;
  short "Code rules" (SRP, small files, no duplicates, typed, i18n texts,
  checks) pointing to §8
- ipal-setup stage 0 and ipal-site phase 0: the architecture question
  list, answered before building; content questions keep defaults
- ipal-plugin-gap: report, offer options, wait, record the decision;
  ipal-block/collection/form/debug and vibe aligned; AGENTS.md template
  and the ipal-skills pointer block carry the rules
- docsConsistency: the rules reach every site-building skill

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 11:46:50 +01:00
co-authored by Claude Opus 5.5
parent f57d089f55
commit 25719ae7ec
11 changed files with 195 additions and 52 deletions
+72 -9
View File
@@ -30,8 +30,8 @@ or data shape where an option or an exported building block is enough.
**In practice:** before you write something from scratch or start fighting the plugin — find
the option or the exported builder (module docs §12, types in `dist/**/*.d.ts`). It is missing →
**plugin gap** (report + a marked workaround in the project code), never patching
`node_modules` or forking the package.
**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.
@@ -46,12 +46,66 @@ Write new rules, AGENTS.md entries and plugin-gap reports in English.
records an editor changed are always skipped and reported (`skip (edited)`) — never use `SEED_FORCE=1` there.
- 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), 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) |
- 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".
## 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.
Something is missing → report (§1.3, plugin gap) + a marked workaround, not a silent patch.
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`.
@@ -222,6 +276,7 @@ yourself and check your own work yourself. For a full build use the
- 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
@@ -257,8 +312,8 @@ Diagnose (**ipal-debug**: symptom → cause → fix), fix it at the source,
check again. Do not report problems you can solve.
### Report only when
- **ipal-kit has a bug or is missing a feature** → **plugin gap** (report +
a minimal, marked workaround — the work goes on, you do not wait),
- **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**).
@@ -289,8 +344,9 @@ Rule: **identical in every project → plugin. Depends on the client → project
### 1.3 When the plugin is missing something or something does not work
**Do not patch silently** (a hook with a hardcoded value, your own helper, `as any`). It
almost always means the plugin already has it (check the docs) or the plugin is missing it.
The **ipal-plugin-gap** skill: report + a minimal, marked workaround
(`// WORKAROUND ipal-kit <version>: …`), the work goes on. The report contains:
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).
@@ -1042,6 +1098,8 @@ Rules:
## 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.
@@ -1216,14 +1274,19 @@ Before your first change, read all of:
Module details: `node_modules/@intecion/ipal-kit/docs/<module>.md`.
Skills: `.agents/skills/ipal-*` (refresh: `pnpm exec ipal-skills`). Always run `ipal-audit` before "done".
The rules in AGENT.md take precedence over your general knowledge of Next/Payload.
ipal-kit helps, never limits: first the plugin's option / exported builder; missing → plugin gap (ipal-plugin-gap), never a patch in `node_modules`.
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 + 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>
- <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>
```
@@ -1258,7 +1321,7 @@ the task matches — manually: `/<name>`.
| `ipal-audit` | before every "done" — the §0b set + the §11 checks + panel (§6.5a) + hardcoding in JSX + tsc + build |
| `ipal-seo-check` | the running site through the eyes of Googlebot and AI agents (head, canonical, hreflang, sitemap, 404, JSON-LD, llms, Markdown, MCP) |
| `ipal-consent-check` | browser: no tracking pixels or cookies before consent; the Google tag may load before consent only in Consent Mode `advanced` (all signals `denied`) — a client who wants zero requests gets `consentMode: 'basic'` |
| `ipal-plugin-gap` | ipal-kit has a bug or is missing a feature — report + a marked workaround, the work goes on |
| `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`,