From 25719ae7ecca9b46878a95c39f655bbdb6ebe491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 29 Oct 2026 11:46:50 +0100 Subject: [PATCH 1/2] Agent guide: ask architecture questions first, ipal-kit first, code rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- bin/ipal-skills.mjs | 5 +- docs/agent/AGENT.md | 81 +++++++++++++++++++--- docs/agent/skills/ipal-block/SKILL.md | 5 ++ docs/agent/skills/ipal-collection/SKILL.md | 5 ++ docs/agent/skills/ipal-debug/SKILL.md | 8 +-- docs/agent/skills/ipal-form/SKILL.md | 5 ++ docs/agent/skills/ipal-plugin-gap/SKILL.md | 30 +++++--- docs/agent/skills/ipal-setup/SKILL.md | 41 +++++++++-- docs/agent/skills/ipal-site/SKILL.md | 51 ++++++++------ docs/dev/vibe.md | 2 +- test/docsConsistency.test.ts | 14 ++++ 11 files changed, 195 insertions(+), 52 deletions(-) diff --git a/bin/ipal-skills.mjs b/bin/ipal-skills.mjs index 4abe5b8..1de4a65 100755 --- a/bin/ipal-skills.mjs +++ b/bin/ipal-skills.mjs @@ -79,8 +79,9 @@ if (pointer) { `2. Everything the plugin provides (options, env vars, routes, layout, hooks, collections, globals, every export): the \`ipal-reference\` skill — \`${skillsDir}/ipal-reference/SKILL.md\`.`, `3. New project or missing foundation: the \`ipal-setup\` skill; a whole site: \`ipal-site\`. All skills: \`${skillsDir}/\`.`, '4. Module details: `node_modules/@intecion/ipal-kit/docs/.md`.', - '5. If the plugin has it, use it. If an option is missing, use the `ipal-plugin-gap` skill — never patch `node_modules`.', - '6. ipal-kit docs, this guide and the skills are in English; write rules, AGENTS.md entries and gap reports in English.', + '5. ipal-kit first: if the plugin has it, use it. Broken or not enough → report it with the `ipal-plugin-gap` skill and wait for the owner — no hand-built replacement, never patch `node_modules`.', + '6. Before you set up a site: ask the owner the architecture questions (AGENT.md "Ask before you build") and wait for the answers; record them under "Project decisions".', + '7. ipal-kit docs, this guide and the skills are in English; write rules, AGENTS.md entries and gap reports in English.', END, ].join('\n') const upsert = (file, { create }) => { diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 4229b98..abe0e9e 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -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 : docs/plugin-requests/` 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

Nasza oferta

} +// GOOD — data comes in typed props (enhanceProps / lib/content), text from the panel, one job +export function Offer({ header, items }: OfferBlockProps) { return
} +``` + --- ## 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 : …`), 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 : …`) 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/.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 - ## 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 - +- - - ipal-audit-skip: — ``` @@ -1258,7 +1321,7 @@ the task matches — manually: `/`. | `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`, diff --git a/docs/agent/skills/ipal-block/SKILL.md b/docs/agent/skills/ipal-block/SKILL.md index f3f9f65..1038e7e 100644 --- a/docs/agent/skills/ipal-block/SKILL.md +++ b/docs/agent/skills/ipal-block/SKILL.md @@ -5,6 +5,11 @@ description: Builds or refactors one page section (Payload block + React compone # ipal-block +**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the +plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's +decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules" +(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour). + One section per use of this skill. Details and ready code: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §6. diff --git a/docs/agent/skills/ipal-collection/SKILL.md b/docs/agent/skills/ipal-collection/SKILL.md index bc633dc..259ce8e 100644 --- a/docs/agent/skills/ipal-collection/SKILL.md +++ b/docs/agent/skills/ipal-collection/SKILL.md @@ -5,6 +5,11 @@ description: Decides whether something should be a Payload collection, a global, # ipal-collection +**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the +plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's +decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules" +(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour). + Sources: `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` §5, `docs/content.md`, `docs/hooks.md`, `docs/seo.md`. diff --git a/docs/agent/skills/ipal-debug/SKILL.md b/docs/agent/skills/ipal-debug/SKILL.md index c88d86a..a5603b6 100644 --- a/docs/agent/skills/ipal-debug/SKILL.md +++ b/docs/agent/skills/ipal-debug/SKILL.md @@ -25,9 +25,9 @@ through this procedure. Ask only when you are missing something you cannot get y `force-dynamic` "to make it work", copying plugin code into the project = **no**). 5. **Prove it**: the same command from step 1 passes + `ipal-audit --quick` + (rendering/SEO) `ipal-seo-check` on the build. -6. Bug on the ipal-kit side → a workaround in the project **only if it is clean and - marked** (`// WORKAROUND ipal-kit : `) + an **ipal-plugin-gap** report. - Record the case in `AGENTS.md` → "Project decisions" if it may come back. +6. Bug on the ipal-kit side → an **ipal-plugin-gap** report to the owner and **wait for the decision** — no + workaround on your own. Only an approved workaround goes in, marked + (`// WORKAROUND ipal-kit : `) and recorded in `AGENTS.md` → "Project decisions". ## Symptom → cause → fix @@ -96,4 +96,4 @@ through this procedure. Ask only when you are missing something you cannot get y - the docs tell you to import something that the entry point does not export; - you are writing the same boilerplate in a second project in a row (a module candidate). Then **ipal-plugin-gap**: symptom, minimal reproduction, version, proposed -change in the plugin, workaround used in the project. **Never** edit `node_modules`. +change in the plugin, the owner's decision (and the approved workaround, if any). **Never** edit `node_modules`. diff --git a/docs/agent/skills/ipal-form/SKILL.md b/docs/agent/skills/ipal-form/SKILL.md index fad658a..4ed447a 100644 --- a/docs/agent/skills/ipal-form/SKILL.md +++ b/docs/agent/skills/ipal-form/SKILL.md @@ -5,6 +5,11 @@ description: Wires forms the ipal-kit way — forms built by the editor in the p # ipal-form +**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the +plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's +decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules" +(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour). + **The editor builds the form in the panel. The project has the action, a block with `` and the classes.** Every further form — including multi-step ones and ones with choice lists — is panel work only. Fields/labels typed by hand in JSX = an error (ipal-audit catches it). API details: `docs/forms.md`, `turnstile.md`, `notifications.md`, `email.md`. diff --git a/docs/agent/skills/ipal-plugin-gap/SKILL.md b/docs/agent/skills/ipal-plugin-gap/SKILL.md index 82e2c37..df7cdf0 100644 --- a/docs/agent/skills/ipal-plugin-gap/SKILL.md +++ b/docs/agent/skills/ipal-plugin-gap/SKILL.md @@ -1,12 +1,13 @@ --- name: ipal-plugin-gap -description: Handles the moment when @intecion/ipal-kit seems to lack a feature or behaves wrongly — verifies against the plugin docs and type definitions first, then writes a structured report for the plugin instead of patching the project with hooks, hardcoded values or copied plugin code. Use when tempted to work around the plugin, when a plugin function errors or is missing, or when the same need appears in several projects. +description: Handles the moment when @intecion/ipal-kit seems to lack a feature or behaves wrongly — verifies against the plugin docs and type definitions first, then reports the gap to the owner with a structured plugin request and waits for their decision instead of patching the project with hooks, hardcoded values, copied plugin code or any self-made workaround. Use when tempted to work around the plugin, when a plugin function errors or is missing, or when the same need appears in several projects. --- # ipal-plugin-gap -Rule: AGENT.md §1.3 — **do not patch silently**. A report + a minimal, marked -workaround (if the work needs it) — and you keep working, you do not wait for a reply. +Rule: AGENT.md "ipal-kit first" and §1.3 — **report first, then wait**. You do nothing on your own for +that part until the owner decides; work on unrelated parts may go on. No hand-built replacement, no silent +workaround. Report type: **bug** (the plugin behaves differently from the docs) or **improvement** (the same code written in yet another project; no option exists that would remove it). @@ -26,10 +27,18 @@ building block is a **plugin gap to report** (type: improvement) — not a reaso The plugin has it → use it and tell the user where it was. -## 2. Report (when it really is missing or broken) -Save it in the project's `docs/plugin-requests/-.md`. Show the user -right away only a **blocking bug** (you cannot go on without a workaround); everything else goes into -the final report (ipal-site, "For ipal-kit" section). +## 2. Report to the owner (when it really is missing or broken) +Save it in the project's `docs/plugin-requests/-.md` and **tell the owner right away**: +the file, a one-paragraph summary and the options below. Then stop work on that part. + +**Options you offer the owner** (they choose — you do not): +1. wait for a plugin fix / new option (the plugin request goes to the ipal-kit team); +2. use an existing plugin option or building block differently (if you found one with a trade-off — say which); +3. an approved, minimal workaround in the project (only if the owner says yes). + +**After the decision:** write it into `AGENTS.md` → "Project decisions" (what, why, the request file, who approved). +A workaround is then minimal, in one file, marked `// WORKAROUND ipal-kit : docs/plugin-requests/`, +and listed in the final report (ipal-site, "For ipal-kit" section) so it can be removed after the plugin fix. ```markdown # @@ -40,11 +49,14 @@ the final report (ipal-site, "For ipal-kit" section). ## Proposed API -## Temporary workaround (if needed) -: docs/plugin-requests/`> +## Options for the owner +1. wait for the plugin · 2. · 3. +## Decision +: docs/plugin-requests/`> ``` ## 3. What not to do +- any workaround before the owner decided — including "temporary" ones, - a hook with the client's domain/name/colour hardcoded, - a copy of a plugin component in the project (e.g. `Analytics`, `CookieBanner`), - edits / `patch-package` in `node_modules/@intecion/ipal-kit`, diff --git a/docs/agent/skills/ipal-setup/SKILL.md b/docs/agent/skills/ipal-setup/SKILL.md index 7a26c1d..f383626 100644 --- a/docs/agent/skills/ipal-setup/SKILL.md +++ b/docs/agent/skills/ipal-setup/SKILL.md @@ -8,12 +8,16 @@ description: Complete start-to-finish install of @intecion/ipal-kit in a Payload **Goal: the MANDATORY SET from AGENT.md §0b (18 items), with nothing left "to discover".** Stage 11 checks everything; you do not finish with gaps (exception: an `ipal-audit-skip:` line from a client decision, AGENT.md §0b). -**One stage = one commit** (`git commit -m "ipal-setup : "`). Do not wait for an OK between -stages (AGENT.md §0a); collect questions in **one list at the start**: client, domain, market, languages, -database (Postgres/Mongo), R2 credentials, Turnstile keys, mail (SMTP or Graph), local business (LocalBusiness?), -cookie dialog mode (`inline`/`modal`/`detailed`; brief says nothing → `detailed`), `DESIGN.md`. Missing data does not -block you: wire the code, the value goes into `.env`/the panel later, anything missing goes into the report. Step-by-step mode -only on request. Full site build: **ipal-site**. +**Stage 0 first: ask the architecture questions and wait for the answers** (below). After that: **one stage = one +commit** (`git commit -m "ipal-setup : "`), no waiting for an OK between stages (AGENT.md §0a). Missing +*content data* (keys, IDs, company data) does not block you: wire the code, the value goes into `.env`/the panel +later, anything missing goes into the report. Step-by-step mode only on request. Full site build: **ipal-site**. + +**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the +plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's +decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules" +(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour). + **ipal-kit helps, never limits:** you can turn off every module separately and override every default — **the project config wins**. Every stage has a **Turn off / override** line; "currently always" = the plugin code @@ -25,6 +29,31 @@ Entry points: `@intecion/ipal-kit` (config, builders, helpers), `/rsc` (server c --- +## 0. Architecture questions — ask, then wait (mandatory) + +**Steps.** Read the brief, `DESIGN.md`/`PRODUCT.md` and any existing code. Send the owner **one list** with every +question the brief does not answer (rule: AGENT.md "Ask before you build"). **Wait for the answers** — do not start +stage 1 on a guess. Ask again about anything still open; a missing architecture answer is never filled with a default. +``` +Before I set up the site I need your decisions on: +1. Languages: which ones, which is the default, URLs — every language with a prefix (/pl/…, /en/…) or the default without one? +2. Styling: a design system / DESIGN.md, or Tailwind tokens from scratch? Brand colours, fonts, light/dark theme? +3. Pages and content: which pages? Lists with their own URLs (blog, case studies, products) and their archive pages? +4. Forms: which forms, who receives the submissions, e-mail via SMTP (panel) or Microsoft Graph? +5. Analytics and consent: GA4 / GTM / Meta / other pixels? Consent Mode basic or advanced? Cookie dialog + inline / modal / detailed? Cookie scan of the finished site? +6. SEO/GEO: market, local business (address, opening hours)? AI access (llms.txt, Markdown, MCP, AI bots) — on? +7. Database: Postgres or MongoDB? Media: Cloudflare R2 or local disk (Coolify volume)? +8. Admin: 2FA (on by default), white-label with the client's logo, agency credit in the panel? +9. Hosting: Coolify — which server/project? Production domain(s), www or apex? Who adds the DNS records? +``` +**Code.** None — write every answer into `AGENTS.md` → "Project decisions" (one line per topic; template: AGENT.md §13). + +**Check.** All nine topics have an answer in "Project decisions"; nothing in it says "assumed" or "default". + +**Turn off / override.** Never skipped. If the owner says "you decide" for a topic, write that down as their answer, +propose a concrete choice and get a yes before you build it. + ## 1. Installation **Steps.** Scaffold: `npx create-payload-app@latest ` (Blank, Postgres/Mongo), delete the starter diff --git a/docs/agent/skills/ipal-site/SKILL.md b/docs/agent/skills/ipal-site/SKILL.md index 29fd716..73b73ad 100644 --- a/docs/agent/skills/ipal-site/SKILL.md +++ b/docs/agent/skills/ipal-site/SKILL.md @@ -10,30 +10,39 @@ decisions yourself, ask once for missing data, anticipate problems, check your own work, and hand over a report at the end. The user should not have to guide or correct you. -**Rhythm:** one phase = one commit (`feat(site): phase N — `). Do not wait for an OK -between phases. Before each phase, go through the "Anticipate" table in AGENT.md §0a. +**Rhythm:** the architecture answers first (phase 0 — you wait for them). Then one phase = one commit +(`feat(site): phase N — `), no waiting for an OK between phases. Before each phase, go through the +"Anticipate" table in AGENT.md §0a. -## Phase 0 — Discovery and one question list +**ipal-kit first (hard rule, AGENT.md "ipal-kit first"):** anything the plugin covers is built with the +plugin's feature. It does not work or is not enough → report it with **ipal-plugin-gap** and wait for the owner's +decision on that part; no hand-built replacement, no silent workaround. **Code rules:** AGENT.md "Code rules" +(one job per file/component/function, no duplicates, typed, texts from the panel, a check for new behaviour). + + +## Phase 0 — Discovery, architecture questions and one question list 1. Read: the brief (all attachments), `AGENTS.md`, `DESIGN.md`/`PRODUCT.md`, `package.json` (ipal-kit version), existing code. New project or finishing one? 2. Write into `AGENTS.md` → "Site map": pages (from the brief), sections on each, forms, languages, collections (only if there are lists with URLs — ipal-collection). -3. **One question list** — only what is not in the brief and cannot be settled - yourself, each with a **default answer** you will use if there is no reply: +3. **Architecture questions — mandatory, you wait for the answers.** Send the list from **ipal-setup** + stage 0 (languages + default locale + URLs, styling, pages/collections, forms + e-mail, analytics/consent/ + cookie scan, SEO/GEO, database + media, 2FA/white-label/credit, hosting + domains + DNS) for every topic + the brief does not answer. Write the answers into `AGENTS.md` → "Project decisions". **Never guess an + architecture answer**, and do not start phase 1 until every topic is answered. +4. **Content questions** — data that is not in the brief (it does not change the architecture), each with a + **default** you use if there is no reply: ``` Before I finish, I need (if you don't answer, I'll use the value in brackets): - 1. Site languages? (pl + en — as in the brief) - 2. Production domain? (placeholder in .env, I'll set canonical after deployment) - 3. Company data: tax ID (NIP), address, phone? ([TO FILL] in the panel) - 4. Which address should form submissions go to? (without it the form seed won't run — the only question without which I can't deliver forms) - 5. Analytics: GA4/GTM/pixel IDs? (off until the IDs are entered in the panel) - 6. R2 details: bucket, endpoint, keys, media domain? (R2 is always wired; until the keys arrive, media stay local in dev) - 7. Turnstile keys? (test keys in dev; you'll enter production keys in Site integrations) - 8. AI access to content (llms.txt, Markdown, MCP, AI bots)? (on — I turn it off only at your explicit request) - 9. Translations: should I make drafts for approval? (yes, marked in the report) + 1. Company data: tax ID (NIP), address, phone? ([TO FILL] in the panel) + 2. Analytics: GA4/GTM/pixel IDs? (off until the IDs are entered in the panel) + 3. R2 keys (bucket, endpoint, access keys)? (until they arrive, media stay local in dev) + 4. Turnstile keys? (test keys in dev; you'll enter production keys in Site integrations) + 5. Translations: should I make drafts for approval? (yes, marked in the report) ``` - Send the list and **keep working** on the default values. Fill in the answers - when they arrive. Stop only before an irreversible decision (AGENT §0a). + Send this list with the architecture questions. After the architecture answers arrive, **keep working** + on the content defaults and fill in the content answers when they arrive. Stop before an irreversible + decision (AGENT §0a) and on a plugin gap (ipal-plugin-gap — report, wait for the owner). ## Phase 1 — Foundation - New project → **ipal-setup** (all of it, with `ipal-skills`, `AGENTS.md`). @@ -111,8 +120,8 @@ JSON-LD, AI bots in robots — every gap is an `[ERROR]` to fix. Plus by hand: the editor test (AGENT §11) in every language, the form (list in ipal-form §6), keyboard (Tab through the menu, banner, form; visible focus), 404 in every language. Fix every `[ERROR]` (**ipal-debug**) and run the -check again. Never hand over with errors — exception: a blocking ipal-kit bug -(plugin gap report, `ipal-plugin-gap`, + workaround). +check again. Never hand over with errors — exception: an ipal-kit bug reported with `ipal-plugin-gap` +and waiting for the owner's decision (or handled by an approved, marked workaround). ## Phase 10 — Final report (the only big message to the user) ```markdown @@ -134,9 +143,9 @@ Turnstile <✓ / waiting for keys> · forms from the panel ✓ · consent ✓ · ## Fixed along the way - (briefly, only what matters) ## For ipal-kit -- [bug|improvement] → docs/plugin-requests/ (workaround: ) +- [bug|improvement] → docs/plugin-requests/ · owner's decision: ## Next step - ``` -Do not report progress along the way. Exceptions: the question list from phase 0, a blocking -ipal-kit bug, an irreversible decision. +Do not report progress along the way. Exceptions: the question lists from phase 0, a plugin gap +(reported at once, ipal-plugin-gap), an irreversible decision. diff --git a/docs/dev/vibe.md b/docs/dev/vibe.md index 771d380..5e201ad 100644 --- a/docs/dev/vibe.md +++ b/docs/dev/vibe.md @@ -392,7 +392,7 @@ already has it (AGENT.md §1.1, §7). If it does — remove your code and use th Short version: `/ipal-plugin-gap `. ``` Do not patch it silently. Write a report according to AGENT.md §1.3 (problem, proposed API, why it is universal) -in docs/plugin-requests/, a minimal workaround marked // WORKAROUND ipal-kit , and keep working. +in docs/plugin-requests/, tell me, and wait for my decision on that part — no workaround on your own. ``` **A new collection you did not ask for:** diff --git a/test/docsConsistency.test.ts b/test/docsConsistency.test.ts index 8d8dbb7..e53e2af 100644 --- a/test/docsConsistency.test.ts +++ b/test/docsConsistency.test.ts @@ -261,6 +261,20 @@ describe('agent guide covers the whole plugin', () => { expect(missingFrom(env)).toEqual([]) }) + test('the working rules reach every skill that builds the site', () => { + const agent = read('docs/agent/AGENT.md') + for (const heading of ['## Ask before you build', '## ipal-kit first', '## Code rules']) {expect(agent).toContain(heading)} + const skills = ['ipal-setup', 'ipal-site', 'ipal-block', 'ipal-collection', 'ipal-form'] + const missing = skills.filter((name) => { + const text = read(`docs/agent/skills/${name}/SKILL.md`) + return !text.includes('ipal-kit first') || !text.includes('Code rules') || !text.includes('ipal-plugin-gap') + }) + expect(missing).toEqual([]) + // Both entry skills start with the architecture questions and wait for the answers. + expect(read('docs/agent/skills/ipal-setup/SKILL.md')).toContain('## 0. Architecture questions') + expect(read('docs/agent/skills/ipal-site/SKILL.md')).toContain('Architecture questions') + }) + test('every @/lib/content helper', () => { expect(missingFrom(contentHelperNames())).toEqual([]) }) From e1f82ce3877a6c3cae43a13121c26b100aa6428f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 29 Oct 2026 11:54:35 +0100 Subject: [PATCH 2/2] ipal-skills --external: vendored third-party agent skills, pinned MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - docs/agent/external: Vercel react-best-practices and composition-patterns (MIT), Addy Osmani accessibility (MIT), Anthropic frontend-design (Apache-2.0), official Payload skill at v3.92.1 (MIT) — text only, each with its licence, SOURCE.md (repo, commit) and an override note in front of the SKILL.md (ipal-kit first, Payload fetching over swr, DESIGN.md tokens, Payload 3 not 4); manifest.json with sha256 per file - scripts/vendor-external-skills.mjs (maintainer, not shipped): fetches by full commit SHA only, rejects non-text or executable files, regenerates the manifest; --check verifies it - ipal-skills --external [names]: copies ext-* after checking every file against the manifest, downloads nothing, never touches ext-* folders without ipal-kit's SOURCE.md, removes only retired ones it installed; an unknown name stops the run before anything is copied - AGENT.md §14, ipal-setup stage 2 (optional step), README: usage, overrides, how to update the pins - test/externalSkills.test.ts: pins are SHAs, no branch fetch, checksums, text only, licences, override note, installer leaves other folders alone Co-Authored-By: Claude Opus 5.5 --- README.md | 10 + bin/ipal-skills.mjs | 55 +- docs/agent/AGENT.md | 21 + docs/agent/external/ext-accessibility/LICENSE | 21 + .../agent/external/ext-accessibility/SKILL.md | 475 ++ .../external/ext-accessibility/SOURCE.md | 14 + .../references/A11Y-PATTERNS.md | 233 + .../ext-accessibility/references/WCAG.md | 191 + .../ext-composition-patterns/AGENTS.md | 946 ++++ .../external/ext-composition-patterns/LICENSE | 17 + .../ext-composition-patterns/README.md | 60 + .../ext-composition-patterns/SKILL.md | 99 + .../ext-composition-patterns/SOURCE.md | 14 + .../ext-composition-patterns/metadata.json | 11 + .../rules/_sections.md | 29 + .../rules/_template.md | 24 + .../rules/architecture-avoid-boolean-props.md | 100 + .../rules/architecture-compound-components.md | 112 + .../patterns-children-over-render-props.md | 87 + .../rules/patterns-explicit-variants.md | 100 + .../rules/react19-no-forwardref.md | 42 + .../rules/state-context-interface.md | 191 + .../rules/state-decouple-implementation.md | 113 + .../rules/state-lift-state.md | 125 + .../external/ext-frontend-design/LICENSE.txt | 177 + .../external/ext-frontend-design/SKILL.md | 81 + .../external/ext-frontend-design/SOURCE.md | 14 + docs/agent/external/ext-payload/LICENSE.md | 22 + docs/agent/external/ext-payload/SKILL.md | 459 ++ docs/agent/external/ext-payload/SOURCE.md | 14 + .../reference/ACCESS-CONTROL-ADVANCED.md | 704 +++ .../ext-payload/reference/ACCESS-CONTROL.md | 697 +++ .../ext-payload/reference/ADAPTERS.md | 326 ++ .../ext-payload/reference/ADVANCED.md | 386 ++ .../ext-payload/reference/COLLECTIONS.md | 303 ++ .../ext-payload/reference/ENDPOINTS.md | 634 +++ .../reference/FIELD-TYPE-GUARDS.md | 553 +++ .../external/ext-payload/reference/FIELDS.md | 744 ++++ .../external/ext-payload/reference/HOOKS.md | 186 + .../reference/PLUGIN-DEVELOPMENT.md | 1436 +++++++ .../external/ext-payload/reference/QUERIES.md | 274 ++ .../ext-react-best-practices/AGENTS.md | 3810 +++++++++++++++++ .../external/ext-react-best-practices/LICENSE | 17 + .../ext-react-best-practices/README.md | 123 + .../ext-react-best-practices/SKILL.md | 159 + .../ext-react-best-practices/SOURCE.md | 14 + .../ext-react-best-practices/metadata.json | 15 + .../rules/_sections.md | 46 + .../rules/_template.md | 28 + .../rules/advanced-effect-event-deps.md | 56 + .../rules/advanced-event-handler-refs.md | 55 + .../rules/advanced-init-once.md | 42 + .../rules/advanced-use-latest.md | 39 + .../rules/async-api-routes.md | 38 + .../async-cheap-condition-before-await.md | 37 + .../rules/async-defer-await.md | 82 + .../rules/async-dependencies.md | 51 + .../rules/async-parallel.md | 28 + .../rules/async-suspense-boundaries.md | 99 + .../rules/bundle-analyzable-paths.md | 63 + .../rules/bundle-barrel-imports.md | 60 + .../rules/bundle-conditional.md | 31 + .../rules/bundle-defer-third-party.md | 49 + .../rules/bundle-dynamic-imports.md | 35 + .../rules/bundle-preload.md | 50 + .../rules/client-event-listeners.md | 74 + .../rules/client-localstorage-schema.md | 71 + .../rules/client-passive-event-listeners.md | 48 + .../rules/client-swr-dedup.md | 56 + .../rules/js-batch-dom-css.md | 107 + .../rules/js-cache-function-results.md | 80 + .../rules/js-cache-property-access.md | 28 + .../rules/js-cache-storage.md | 70 + .../rules/js-combine-iterations.md | 32 + .../rules/js-early-exit.md | 50 + .../rules/js-flatmap-filter.md | 60 + .../rules/js-hoist-regexp.md | 45 + .../rules/js-index-maps.md | 37 + .../rules/js-length-check-first.md | 49 + .../rules/js-min-max-loop.md | 82 + .../rules/js-request-idle-callback.md | 105 + .../rules/js-set-map-lookups.md | 24 + .../rules/js-tosorted-immutable.md | 57 + .../rules/rendering-activity.md | 26 + .../rules/rendering-animate-svg-wrapper.md | 47 + .../rules/rendering-conditional-render.md | 40 + .../rules/rendering-content-visibility.md | 38 + .../rules/rendering-hoist-jsx.md | 46 + .../rules/rendering-hydration-no-flicker.md | 82 + .../rendering-hydration-suppress-warning.md | 30 + .../rules/rendering-resource-hints.md | 85 + .../rules/rendering-script-defer-async.md | 68 + .../rules/rendering-svg-precision.md | 28 + .../rules/rendering-usetransition-loading.md | 75 + .../rules/rerender-defer-reads.md | 39 + .../rules/rerender-dependencies.md | 45 + .../rules/rerender-derived-state-no-effect.md | 40 + .../rules/rerender-derived-state.md | 29 + .../rules/rerender-functional-setstate.md | 74 + .../rules/rerender-lazy-state-init.md | 58 + .../rules/rerender-memo-with-default-value.md | 38 + .../rules/rerender-memo.md | 44 + .../rules/rerender-move-effect-to-event.md | 45 + .../rules/rerender-no-inline-components.md | 82 + .../rerender-simple-expression-in-memo.md | 35 + .../rules/rerender-split-combined-hooks.md | 64 + .../rules/rerender-transitions.md | 40 + .../rules/rerender-use-deferred-value.md | 59 + .../rerender-use-ref-transient-values.md | 73 + .../rules/server-after-nonblocking.md | 73 + .../rules/server-auth-actions.md | 96 + .../rules/server-cache-lru.md | 41 + .../rules/server-cache-react.md | 76 + .../rules/server-dedup-props.md | 65 + .../rules/server-hoist-static-io.md | 149 + .../rules/server-no-shared-module-state.md | 50 + .../rules/server-parallel-fetching.md | 83 + .../rules/server-parallel-nested-fetching.md | 34 + .../rules/server-serialization.md | 38 + docs/agent/external/manifest.json | 171 + docs/agent/skills/ipal-setup/SKILL.md | 6 + scripts/vendor-external-skills.mjs | 193 + test/docsConsistency.test.ts | 4 + test/externalSkills.test.ts | 122 + 124 files changed, 18732 insertions(+), 1 deletion(-) create mode 100644 docs/agent/external/ext-accessibility/LICENSE create mode 100644 docs/agent/external/ext-accessibility/SKILL.md create mode 100644 docs/agent/external/ext-accessibility/SOURCE.md create mode 100644 docs/agent/external/ext-accessibility/references/A11Y-PATTERNS.md create mode 100644 docs/agent/external/ext-accessibility/references/WCAG.md create mode 100644 docs/agent/external/ext-composition-patterns/AGENTS.md create mode 100644 docs/agent/external/ext-composition-patterns/LICENSE create mode 100644 docs/agent/external/ext-composition-patterns/README.md create mode 100644 docs/agent/external/ext-composition-patterns/SKILL.md create mode 100644 docs/agent/external/ext-composition-patterns/SOURCE.md create mode 100644 docs/agent/external/ext-composition-patterns/metadata.json create mode 100644 docs/agent/external/ext-composition-patterns/rules/_sections.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/_template.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/architecture-avoid-boolean-props.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/architecture-compound-components.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/patterns-children-over-render-props.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/patterns-explicit-variants.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/react19-no-forwardref.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/state-context-interface.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/state-decouple-implementation.md create mode 100644 docs/agent/external/ext-composition-patterns/rules/state-lift-state.md create mode 100644 docs/agent/external/ext-frontend-design/LICENSE.txt create mode 100644 docs/agent/external/ext-frontend-design/SKILL.md create mode 100644 docs/agent/external/ext-frontend-design/SOURCE.md create mode 100644 docs/agent/external/ext-payload/LICENSE.md create mode 100644 docs/agent/external/ext-payload/SKILL.md create mode 100644 docs/agent/external/ext-payload/SOURCE.md create mode 100644 docs/agent/external/ext-payload/reference/ACCESS-CONTROL-ADVANCED.md create mode 100644 docs/agent/external/ext-payload/reference/ACCESS-CONTROL.md create mode 100644 docs/agent/external/ext-payload/reference/ADAPTERS.md create mode 100644 docs/agent/external/ext-payload/reference/ADVANCED.md create mode 100644 docs/agent/external/ext-payload/reference/COLLECTIONS.md create mode 100644 docs/agent/external/ext-payload/reference/ENDPOINTS.md create mode 100644 docs/agent/external/ext-payload/reference/FIELD-TYPE-GUARDS.md create mode 100644 docs/agent/external/ext-payload/reference/FIELDS.md create mode 100644 docs/agent/external/ext-payload/reference/HOOKS.md create mode 100644 docs/agent/external/ext-payload/reference/PLUGIN-DEVELOPMENT.md create mode 100644 docs/agent/external/ext-payload/reference/QUERIES.md create mode 100644 docs/agent/external/ext-react-best-practices/AGENTS.md create mode 100644 docs/agent/external/ext-react-best-practices/LICENSE create mode 100644 docs/agent/external/ext-react-best-practices/README.md create mode 100644 docs/agent/external/ext-react-best-practices/SKILL.md create mode 100644 docs/agent/external/ext-react-best-practices/SOURCE.md create mode 100644 docs/agent/external/ext-react-best-practices/metadata.json create mode 100644 docs/agent/external/ext-react-best-practices/rules/_sections.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/_template.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/advanced-effect-event-deps.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/advanced-event-handler-refs.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/advanced-init-once.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/advanced-use-latest.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-api-routes.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-cheap-condition-before-await.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-defer-await.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-dependencies.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-parallel.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/async-suspense-boundaries.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-analyzable-paths.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-barrel-imports.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-conditional.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-defer-third-party.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-dynamic-imports.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/bundle-preload.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/client-event-listeners.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/client-localstorage-schema.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/client-passive-event-listeners.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/client-swr-dedup.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-batch-dom-css.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-cache-function-results.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-cache-property-access.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-cache-storage.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-combine-iterations.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-early-exit.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-flatmap-filter.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-hoist-regexp.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-index-maps.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-length-check-first.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-min-max-loop.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-request-idle-callback.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-set-map-lookups.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/js-tosorted-immutable.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-activity.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-animate-svg-wrapper.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-conditional-render.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-content-visibility.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-hoist-jsx.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-hydration-no-flicker.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-hydration-suppress-warning.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-resource-hints.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-script-defer-async.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-svg-precision.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rendering-usetransition-loading.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-defer-reads.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-dependencies.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-derived-state-no-effect.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-derived-state.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-functional-setstate.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-lazy-state-init.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-memo-with-default-value.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-memo.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-move-effect-to-event.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-no-inline-components.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-simple-expression-in-memo.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-split-combined-hooks.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-transitions.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-use-deferred-value.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/rerender-use-ref-transient-values.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-after-nonblocking.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-auth-actions.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-cache-lru.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-cache-react.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-dedup-props.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-hoist-static-io.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-no-shared-module-state.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-parallel-fetching.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-parallel-nested-fetching.md create mode 100644 docs/agent/external/ext-react-best-practices/rules/server-serialization.md create mode 100644 docs/agent/external/manifest.json create mode 100644 scripts/vendor-external-skills.mjs create mode 100644 test/externalSkills.test.ts diff --git a/README.md b/README.md index 9898915..48edbc8 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,16 @@ have none) pointing the agent at the full guide: `AGENT.md`, the `ipal-reference (every option, env var, route and export) and the `ipal-setup` skill. Only the text between the markers is ever rewritten. `--no-pointer` skips that step. There is no `postinstall` script. +`pnpm exec ipal-skills --external` also adds a few well-known third-party skills as `ext-*` folders — Vercel's +React best practices and composition patterns, Addy Osmani's accessibility skill, Anthropic's frontend-design +skill and the official Payload 3 skill. They are vendored into the package at pinned commits (text only, each +with its licence and source), so nothing is downloaded, and each starts with a note that ipal-kit's rules win. +Pick some with `--external ext-accessibility,ext-payload`. + +*Updating the pins (plugin maintainers):* change the commit in `scripts/vendor-external-skills.mjs`, run +`node scripts/vendor-external-skills.mjs`, review `git diff docs/agent/external`, and run +`pnpm vitest run test/externalSkills.test.ts`. + From here, the guide takes over: **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** — from an empty project to a working site. diff --git a/bin/ipal-skills.mjs b/bin/ipal-skills.mjs index 1de4a65..8815b6a 100755 --- a/bin/ipal-skills.mjs +++ b/bin/ipal-skills.mjs @@ -4,22 +4,30 @@ // pnpm ipal-skills --dry-run → show what would change // pnpm ipal-skills --dest .claude/skills // pnpm ipal-skills --no-pointer → skills only, leave AGENTS.md / CLAUDE.md alone +// pnpm ipal-skills --external → also the vendored third-party skills (ext-*, pinned, text only) +// pnpm ipal-skills --external ext-accessibility,ext-payload → only those // Only folders named ipal-* are touched; the project's own skills stay as they are. // ipal-* folders that no longer exist in the package are removed (renamed/retired skills). +// ext-* folders are touched only with --external, and only those carrying ipal-kit's SOURCE.md. // AGENTS.md (and CLAUDE.md) get a marked ipal-kit block pointing at the guide — only the // text between the markers is ever rewritten; the project's own content stays as it is. +import { createHash } from 'node:crypto' import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs' import { dirname, join, relative, resolve } from 'node:path' import { fileURLToPath } from 'node:url' const args = process.argv.slice(2) if (args.includes('--help') || args.includes('-h')) { - console.log('Usage: ipal-skills [--dest ] [--dry-run] [--no-pointer]\nDefault dest: .agents/skills') + console.log('Usage: ipal-skills [--dest ] [--dry-run] [--no-pointer] [--external [ext-a,ext-b]]\nDefault dest: .agents/skills') process.exit(0) } const dryRun = args.includes('--dry-run') const pointer = !args.includes('--no-pointer') +const externalArg = args.indexOf('--external') +const externalPick = externalArg >= 0 && args[externalArg + 1] && !args[externalArg + 1].startsWith('-') + ? args[externalArg + 1].split(',').map((n) => n.trim()).filter(Boolean) + : null const destArg = args.indexOf('--dest') const destValue = destArg >= 0 ? args[destArg + 1] : '.agents/skills' // A missing value would resolve to cwd and remove every ipal-* folder there. @@ -40,6 +48,16 @@ if (!existsSync(src)) { process.exit(1) } +// Validate --external before anything is copied. +const extSrc = join(pkgRoot, 'docs', 'agent', 'external') +const manifest = externalArg >= 0 ? JSON.parse(readFileSync(join(extSrc, 'manifest.json'), 'utf8')) : { skills: [] } +const known = manifest.skills.map((skill) => skill.name) +const unknown = (externalPick ?? []).filter((name) => !known.includes(name)) +if (unknown.length) { + console.error(`ipal-skills: unknown external skill(s): ${unknown.join(', ')} — available: ${known.join(', ')}`) + process.exit(1) +} + const isSkillDir = (base, name) => name.startsWith('ipal-') && statSync(join(base, name)).isDirectory() const shipped = readdirSync(src).filter((n) => isSkillDir(src, n)) const existing = existsSync(dest) ? readdirSync(dest).filter((n) => isSkillDir(dest, n)) : [] @@ -60,6 +78,41 @@ for (const name of retired) { } console.log(`${dryRun ? '[dry-run] ' : ''}${shipped.length} skill(s) → ${dest}`) +// Third-party skills, vendored into the package at pinned commits (docs/agent/external, +// scripts/vendor-external-skills.mjs). Nothing is downloaded here: every file is checked +// against manifest.json before it is copied. +if (externalArg >= 0) { + const MARK = 'Vendored by @intecion/ipal-kit' + const ours = (name) => existsSync(join(dest, name, 'SOURCE.md')) && readFileSync(join(dest, name, 'SOURCE.md'), 'utf8').includes(MARK) + const filesOf = (dir) => readdirSync(dir).flatMap((n) => (statSync(join(dir, n)).isDirectory() ? filesOf(join(dir, n)).map((f) => `${n}/${f}`) : [n])) + for (const skill of manifest.skills.filter((s) => !externalPick || externalPick.includes(s.name))) { + const from = join(extSrc, skill.name) + const files = filesOf(from).sort() + const tampered = files.filter((f) => skill.files[f] !== createHash('sha256').update(readFileSync(join(from, f))).digest('hex')) + if (tampered.length || files.length !== Object.keys(skill.files).length) { + console.error(`ipal-skills: ${skill.name} does not match manifest.json (${tampered.join(', ') || 'file list'}) — skipped`) + process.exitCode = 1 + continue + } + if (existsSync(join(dest, skill.name)) && !ours(skill.name)) { + console.warn(`skip ${skill.name} (a folder of that name exists and is not from ipal-kit)`) + continue + } + console.log(`${existsSync(join(dest, skill.name)) ? 'update' : 'add '} ${skill.name} (${skill.publisher}, ${skill.license}, ${skill.commit.slice(0, 12)})`) + if (!dryRun) { + rmSync(join(dest, skill.name), { recursive: true, force: true }) + cpSync(from, join(dest, skill.name), { recursive: true }) + } + } + const retiredExt = existsSync(dest) + ? readdirSync(dest).filter((n) => n.startsWith('ext-') && !known.includes(n) && ours(n)) + : [] + for (const name of retiredExt) { + console.log(`remove ${name} (no longer in ipal-kit)`) + if (!dryRun) rmSync(join(dest, name), { recursive: true, force: true }) + } +} + // Pointer block: an agent opening the project must find the guide without being told. // AGENTS.md is read by Codex/Cursor/Antigravity, CLAUDE.md by Claude Code (which also // follows `@AGENTS.md` imports, so a CLAUDE.md that imports AGENTS.md needs no copy). diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index abe0e9e..fa1f1bc 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -1343,6 +1343,27 @@ It copies only the `ipal-*` folders: adds new ones, replaces existing ones entir 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`, 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 diff --git a/docs/agent/external/ext-accessibility/LICENSE b/docs/agent/external/ext-accessibility/LICENSE new file mode 100644 index 0000000..90715bb --- /dev/null +++ b/docs/agent/external/ext-accessibility/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Addy Osmani + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docs/agent/external/ext-accessibility/SKILL.md b/docs/agent/external/ext-accessibility/SKILL.md new file mode 100644 index 0000000..46e6f83 --- /dev/null +++ b/docs/agent/external/ext-accessibility/SKILL.md @@ -0,0 +1,475 @@ +--- +name: ext-accessibility +description: Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible". +license: MIT +metadata: + author: web-quality-skills + version: "2.0" +--- + +> **Project rules win.** Vendored by @intecion/ipal-kit as guidance. When this skill conflicts with +> `node_modules/@intecion/ipal-kit/docs/agent/AGENT.md`, the project's `AGENTS.md` or `DESIGN.md`, those win: +> ipal-kit features first (the `ipal-reference` skill), Payload 3 + Next 16 App Router, data from Server Components +> through Payload / `@/lib/content`, every visible text from the CMS, design values from `DESIGN.md` tokens. +> Never add a dependency this skill suggests without the owner's decision. +> +> **Tools:** never run `npx lighthouse` / `npx @axe-core/cli` unpinned — add them as devDependencies at fixed versions +> first. Use the ipal-kit components (CookieBanner, AccessibilityWidget, RenderForm…) and fix their markup through +> their props or a plugin gap report, not by copying them. + + +# Accessibility (a11y) + +Comprehensive accessibility guidelines based on WCAG 2.2 and Lighthouse accessibility audits. Goal: make content usable by everyone, including people with disabilities. + +## Evidence-led audit workflow + +When a rendered page is available: + +1. Run a live Lighthouse Accessibility audit when that capability is available; with Chrome DevTools MCP, use `lighthouse_audit`. Use mobile navigation mode for a general public page or snapshot mode when reloading would lose authenticated or user-created state. +2. Use failed audit nodes to localize the relevant component or template instead of searching the whole repository for generic patterns. +3. Inspect a rendered accessibility-tree snapshot for names, roles, states, landmarks, and heading structure; with Chrome DevTools MCP, use `take_snapshot`. Exercise the affected flow with the keyboard. +4. Fix the source, then re-run the same audit and manual interaction. + +If the live tools are unavailable, use Lighthouse CLI or axe for automated coverage and complete the same manual checks. Automated tools detect only a subset of accessibility barriers: a score of 100 is not WCAG conformance, and a low score does not replace issue-level evidence. + +## WCAG Principles: POUR + +| Principle | Description | +|-----------|-------------| +| **P**erceivable | Content can be perceived through different senses | +| **O**perable | Interface can be operated by all users | +| **U**nderstandable | Content and interface are understandable | +| **R**obust | Content works with assistive technologies | + +## Conformance levels + +| Level | Requirement | Target | +|-------|-------------|--------| +| **A** | Minimum accessibility | Must pass | +| **AA** | Standard compliance | Should pass (legal requirement in many jurisdictions) | +| **AAA** | Enhanced accessibility | Nice to have | + +--- + +## Perceivable + +### Text alternatives (1.1) + +**Images require alt text:** +```html + + + + +Bar chart showing 40% increase in Q3 sales + + + + + +
+ 2024 market trends infographic +
+ +
+
+``` + +**Icon buttons need accessible names:** +```html + + + + + + + + +``` + +**Visually hidden class:** +```css +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} +``` + +### Color contrast (1.4.3, 1.4.6) + +| Text Size | AA minimum | AAA enhanced | +|-----------|------------|--------------| +| Normal text (< 18px / < 14px bold) | 4.5:1 | 7:1 | +| Large text (≥ 18px / ≥ 14px bold) | 3:1 | 4.5:1 | +| UI components & graphics | 3:1 | 3:1 | + +```css +/* ❌ Low contrast (2.5:1) */ +.low-contrast { + color: #999; + background: #fff; +} + +/* ✅ Sufficient contrast (7:1) */ +.high-contrast { + color: #333; + background: #fff; +} + +/* ✅ Focus states need contrast too (3:1 against background, WCAG 1.4.11) */ +:focus-visible { + outline: 2px solid currentColor; + outline-offset: 2px; +} +``` + +**Don't rely on color alone:** +```html + + + + + +
+ + + + Please enter a valid email address + +
+``` + +### Media alternatives (1.2) + +```html + + + + + +
+ Transcript +

Full transcript text...

+
+``` + +--- + +## Operable + +### Keyboard accessible (2.1) + +**All functionality must be keyboard accessible.** Prefer native interactive elements — ` +``` + +```javascript +// ✅ When you MUST use a non-interactive element (e.g. div with role="button"), +// make it focusable AND handle keyboard activation. Do NOT add this to a native +// + +``` + +--- + +## Robust + +### ARIA usage (4.1.2) + +**Prefer native elements:** +```html + +
Click me
+ + + + + +
Option
+ + + +``` + +**When ARIA is needed,** use the correct roles and states. See the [ARIA tabs pattern](references/A11Y-PATTERNS.md#aria-tabs) for a complete tablist example. + +### Live regions (4.1.3) + +Use `aria-live` regions to announce dynamic content changes without moving focus. See the [live regions pattern](references/A11Y-PATTERNS.md#live-regions-and-notifications) for markup and a `showNotification()` helper. + +--- + +## Testing checklist + +### Automated testing + +Prefer a live Lighthouse audit that returns failing rendered nodes directly to the agent. With Chrome DevTools MCP, this is `lighthouse_audit`. Otherwise: + +```bash +# Lighthouse accessibility audit +npx lighthouse https://example.com --only-categories=accessibility + +# axe-core +npm install @axe-core/cli -g +axe https://example.com +``` + +### Manual testing + +- [ ] **Keyboard navigation:** Tab through entire page, use Enter/Space to activate +- [ ] **Screen reader:** Test with VoiceOver (Mac), NVDA (Windows), or TalkBack (Android) +- [ ] **Zoom:** Content usable at 200% zoom +- [ ] **High contrast:** Test with Windows High Contrast Mode +- [ ] **Reduced motion:** Test with `prefers-reduced-motion: reduce` +- [ ] **Focus order:** Logical and follows visual order +- [ ] **Target size:** Interactive elements meet 24×24px minimum + +See the [screen reader commands reference](references/A11Y-PATTERNS.md#screen-reader-commands) for VoiceOver and NVDA shortcuts. + +--- + +## Common issues by impact + +### Critical (fix immediately) +1. Missing form labels +2. Missing image alt text +3. Insufficient color contrast +4. Keyboard traps +5. No focus indicators + +### Serious (fix before launch) +1. Missing page language +2. Missing heading structure +3. Non-descriptive link text +4. Auto-playing media +5. Missing skip links + +### Moderate (fix soon) +1. Missing ARIA labels on icons +2. Inconsistent navigation +3. Missing error identification +4. Timing without controls +5. Missing landmark regions + +## References + +- [WCAG 2.2 Quick Reference](https://www.w3.org/WAI/WCAG22/quickref/) +- [WAI-ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/) +- [Deque axe Rules](https://dequeuniversity.com/rules/axe/) +- [Web Quality Audit](../web-quality-audit/SKILL.md) +- [WCAG criteria reference](references/WCAG.md) +- [Accessibility code patterns](references/A11Y-PATTERNS.md) diff --git a/docs/agent/external/ext-accessibility/SOURCE.md b/docs/agent/external/ext-accessibility/SOURCE.md new file mode 100644 index 0000000..e752d96 --- /dev/null +++ b/docs/agent/external/ext-accessibility/SOURCE.md @@ -0,0 +1,14 @@ +# ext-accessibility + +Vendored by @intecion/ipal-kit (`ipal-skills --external`). Do not edit — regenerate with +`scripts/vendor-external-skills.mjs` in the ipal-kit repository. + +| | | +|---|---| +| Publisher | Addy Osmani | +| Source | https://github.com/addyosmani/web-quality-skills/tree/afa8da942115f2961fdbfa80807ea0b232ff6c00/skills/accessibility | +| Commit | `afa8da942115f2961fdbfa80807ea0b232ff6c00` | +| Licence | MIT (see the LICENSE file in this folder) | + +Changes from the upstream text: the `name` in the SKILL.md frontmatter is `ext-accessibility`, and an +override note (project rules win) is inserted after the frontmatter. Nothing else is changed. diff --git a/docs/agent/external/ext-accessibility/references/A11Y-PATTERNS.md b/docs/agent/external/ext-accessibility/references/A11Y-PATTERNS.md new file mode 100644 index 0000000..6d500ef --- /dev/null +++ b/docs/agent/external/ext-accessibility/references/A11Y-PATTERNS.md @@ -0,0 +1,233 @@ +# Accessibility Code Patterns + +Practical, copy-paste-ready patterns for common accessibility requirements. Each pattern is self-contained and linked from the main [SKILL.md](../SKILL.md). + +--- + +## Modal focus trap + +Trap keyboard focus inside a modal dialog so Tab/Shift+Tab cycle through its focusable elements and Escape closes it. + +```javascript +function openModal(modal) { + const focusableElements = modal.querySelectorAll( + 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])' + ); + const firstElement = focusableElements[0]; + const lastElement = focusableElements[focusableElements.length - 1]; + + modal.addEventListener('keydown', (e) => { + if (e.key === 'Tab') { + if (e.shiftKey && document.activeElement === firstElement) { + e.preventDefault(); + lastElement.focus(); + } else if (!e.shiftKey && document.activeElement === lastElement) { + e.preventDefault(); + firstElement.focus(); + } + } + if (e.key === 'Escape') { + closeModal(); + } + }); + + firstElement.focus(); +} +``` + +The native `` element handles focus trapping automatically—prefer it when browser support allows. + +--- + +## Skip link + +Allows keyboard users to bypass repetitive navigation and jump straight to main content. + +```html + + +
+
+ +
+ +``` + +```css +.skip-link { + position: absolute; + top: -40px; + left: 0; + background: #000; + color: #fff; + padding: 8px 16px; + z-index: 100; +} + +.skip-link:focus { + top: 0; +} +``` + +--- + +## Error handling + +Announce errors to screen readers and focus the first invalid field on submit. + +```html +
+
+ + + +
+
+``` + +```javascript +form.addEventListener('submit', (e) => { + const firstError = form.querySelector('[aria-invalid="true"]'); + if (firstError) { + e.preventDefault(); + firstError.focus(); + + const errorSummary = document.getElementById('error-summary'); + errorSummary.textContent = + `${errors.length} errors found. Please fix them and try again.`; + errorSummary.focus(); + } +}); +``` + +--- + +## Form labels + +Every input needs an associated label—either explicit (`for`/`id`) or implicit (wrapping `