Frontend Composition Layer Grill Log
Frontend Composition Layer Grill Log
Context
- Source: user
/brainstormthen/requirements-phasedirection, 2026-10-22. - Brainstorm Brief:
frontend-composition-layer-brainstorm-brief,
sha256
3b6981ffb2bf4745f51c43b9cb039efde3eda1c4bc84800bc1356847843586db, imported R0. - System under change:
wearedevpunks/skills@21a3cacskills/agnostic/frontend/frontend-domain-structure/, plus a frontend Pack lint asset inapps/cli.
Layer Model
Q1
Prerequisites:
- none
Altitude: L2
Source: Brainstorm Brief
Question: What is the frontend layer order, and what is the top layer called?
Accepted answer:
app → composition → features → modules → integrations. Each layer imports only lower layers.
Rejected alternatives:
- Top layer
abstractions/: user chosecomposition/. - Pegasus
root/+templates/: user chose onecomposition/layer. modules/as the deepest layer: user keptintegrations/.
Q2
Prerequisites:
- Q1
Altitude: L2
Source: Brainstorm Brief
Question:
What may routes in app/ import?
Accepted answer:
- Only
composition/.
Rejected alternatives:
- Routes also import module readers directly (pegasus RSC readers).
Q3
Prerequisites:
- Q1
Altitude: L2
Source: Brainstorm Brief
Question:
What does composition/ own?
Accepted answer:
- App-wide providers, surface shells, page templates, and cross-feature registries and aggregators.
Q4
Prerequisites:
- Q3
Altitude: L2
Source: Brainstorm Brief
Question: Where does surface-specific code live?
Accepted answer:
- A surface is a subfolder of
composition/only (composition/site/,composition/admin/). Features stay flat.
Rejected alternatives:
- Features nested by surface (
features/<surface>/<feature>): a feature that two surfaces show would need an owner choice. - Surface mini-apps with their own features and modules.
Q5
Prerequisites:
- Q1
Altitude: L2
Source: Brainstorm Brief
Question: How do two features coordinate?
Accepted answer:
- Features never import peer features. The nearest composition that holds both connects them through props, slots or callbacks.
Rejected alternatives:
- Narrow documented peer-feature exception (current skill).
- "Shared code moves down into modules" as the only rule (pegasus): it turned
modules/into a catch-all.
Q6
Prerequisites:
- Q3, Q5
Altitude: L2
Source: Brainstorm Brief
Question: Where do shell parts that features consume live?
Accepted answer:
- A shell splits: what features consume (navigation registry, header slot, toast or assistant channel) is a module; the shell assembly is composition.
Q7
Prerequisites:
- Q1
Altitude: L2
Source: Brainstorm Brief
Question: Where do mock data, demo data and fake runtimes live?
Accepted answer:
- They are integrations. Only composition or tests select them. No production UI lives in a folder named "prototype".
Q8
Prerequisites:
- Q1
Altitude: L2
Source: Brainstorm Brief
Question: Are layer folder names fixed?
Accepted answer:
- Yes. The skill drops "These labels may differ between projects".
Enforcement
Q9
Prerequisites:
- Q1, Q8
Altitude: L2
Source: Brainstorm Brief
Question: How is the structure enforced?
Accepted answer:
- A custom lint rule is mandatory and ships as a lint asset of the frontend Pack.
Rejected alternatives:
- Recommended, not mandatory, enforcement.
- A lint script shipped inside the skill: copies drift.
Scope
Q10
Prerequisites:
- none
Altitude: L1
Source: Brainstorm Brief
Question: What changes in this delivery?
Accepted answer:
- Only the skill and its enforcement change. Each repository migrates later by running the skill.
Rejected alternatives:
- Migration plans for pegasus, apito, emera and assolombarda in this delivery.
Round R1
Glossary Q15
Altitude: L1
Question: Which terms are canonical?
Accepted answer:
- Canonical term: Composition — the top frontend layer; it combines features and modules into providers, surface shells, page templates and registries.
- Avoid: abstractions, root, templates, shell layer
- Canonical term: Surface — one part of an app that a distinct user group sees through its own shell.
- Avoid: area, portal, section, sub-app
- Canonical term: Feature — a user-facing capability with its own workflow, policy or state.
- Avoid: page, screen, widget
- Canonical term: Module — an app-local capability that several features use; it owns no user workflow.
- Avoid: shared, lib, utils, common
- Canonical term: Integration — an adapter to an outside system, client setup, or a fake or mock runtime.
- Avoid: infra, adapters, mock, prototype
- Relationship: a Surface is a subfolder of Composition; Composition imports Feature and Module.
- Axiom: each layer imports only lower layers; a Feature never imports another Feature.
Rejected alternatives:
- Only Composition and Surface as new terms.
Q16
Prerequisites:
- Q9, Q10
Altitude: L1
Question: What happens when an adopting repository already violates the rule?
Accepted answer:
- Nothing special. The lint rule reports every violation as an error. No baseline, no ratchet. User: "we dont care we just have lint error to flag it".
Rejected alternatives:
- Ratchet with a recorded violation list: no managed baseline mechanism exists, and the user wants plain errors.
Q17
Prerequisites:
- Q10
Altitude: L1
Question: What does running the skill on a non-conforming repository do?
Accepted answer:
- The skill applies the new pattern only to the scope of the implementation that invoked it. User: "it just applies the new pattern to the scope of the impl that called it".
Rejected alternatives:
- One-shot whole-app migration.
- Separate review-mode migration inventory handed to
delivery-phase.
Round R2
Q11
Prerequisites:
- Q9
Altitude: L2
Question: What does the lint rule check?
Accepted answer:
- Six checks, all errors: (1) layer order; (2) routes import only composition; (3) no feature imports another feature; (4) cross-domain imports go only through the domain's public entrypoint; (5) relative imports are resolved and checked like aliased imports; (6) no folder named
*prototype*ormock*outsideintegrations/.
Rejected alternatives:
- Only checks 1–3.
Q12
Prerequisites:
- Q1
Altitude: L2
Question: Where does app-local shared presentation live?
Accepted answer:
- A
ui/layer holds primitives and shadcn components. All other presentation lives with its owner, in a feature or a module. User: "ui/ holds primitives and shadcn. the rest can go in either modules/features whatever".
Rejected alternatives:
- No
ui/at all; every shared presentation is a module.
Q13
Prerequisites:
- Q1
Altitude: L2
Question: Where does server code inside a frontend app live?
Accepted answer:
src/server/sits outside the frontend layers and followseffect-backend-structure.app/apihandlers import onlyserver/. Among the frontend layers, onlyintegrations/imports server code, and only through server public entrypoints.
Rejected alternatives:
- Modules import server readers directly (pegasus today).
Q14
Prerequisites:
- Q2
Altitude: L2
Question:
How do routes get notFound, metadata and data readers?
Accepted answer:
- A composition page template exports its component plus optional
generateMetadataand loader functions; the route file only connects them. Framework packages stay importable everywhere; the rule governssrc/imports only.
Rejected alternatives:
- Routes also import module readers.
Q18
Prerequisites:
- Q1, Q9
Altitude: L2
Question: Which skill surfaces move with the change?
Accepted answer:
- One delivery moves: skills repo
frontend-domain-structure(SKILL.md, both references,agents/openai.yaml) and its contract test;create-planarchitecture-convergence;implement-specarchitecture-conformance;ask-hidiscovery-and-docsandbaseline;hi-climanaged-lint reference;apps/clilint catalog, Pack entry anddata/lint/<asset>; wiki skills, Packs and managed lint pages;BASELINE_CHANGELOG.md.
Rejected alternatives:
- Skill first, lint asset in a later delivery.
Q19
Prerequisites:
- Q9
Altitude: L2
Question: Which applicability does the lint asset use?
Accepted answer:
- The asset attaches to the
reactPack, whose detection uses each package's own manifest (issue-224 Q8). The skill stays in thefrontendPack. This refines Q9: "lint asset of the frontend Pack" becomes "lint asset of thereactPack".
Rejected alternatives:
- Detection data on the
frontendPack: it changes the Pack's reach for everything else it carries.
Q20
Prerequisites:
- Q9, Q16
Altitude: L2
Question:
May a project turn the rule off in oxlint.local.ts?
Accepted answer:
- Yes, through the existing override contract. The rule ships on, as an error.
Rejected alternatives:
- A new managed-lint mechanism that refuses local overrides.
Q21
Prerequisites:
- Q9
Altitude: L2
Question: Which artifact is the authority when the skill text and the lint rule disagree?
Accepted answer:
- The skill reference is the authority; the lint asset implements it and links to it. User: "exaclty. theres not gonna be any disagreemtn" — the two must match exactly.
Rejected alternatives:
- The lint rule as authority.
Q22
Prerequisites:
- Q1, Q16
Altitude: L2
Question:
What does the rule do with src/ top-level folders and files outside the layers?
Accepted answer:
- Any unknown top-level folder is an error. Framework-required root files (
proxy.ts,middleware.ts,instrumentation.ts) count as the route layer. User: "agree hard with this. just error!".
Rejected alternatives:
- Ignore unknown folders.
Q23
Prerequisites:
- Q1, Q8
Altitude: L2
Question: Which folder is the route layer for frameworks other than Next?
Accepted answer:
- A fixed enum:
app/orroutes/. No project option. User: "keep an enum of routes/ and app/".
Rejected alternatives:
- A per-project route folder option.
Round R3
Q24
Prerequisites:
- Q12
Altitude: L2
Question:
Is ui/ an app-local src/ui/ folder, the shared UI package, or both?
Accepted answer:
- In a monorepo (HI repository detector signals), only the shared
packages/uipackage holds primitives and shadcn components; an app-localui/folder is an error. In a single-package repository,src/ui/is the lowest layer. User: "if its a monorepo (we have detector) we only allow packages/ui".
Rejected alternatives:
- Both
packages/uiand app-localsrc/ui/in a monorepo. ui/only as the shared package, with no single-reposrc/ui/.
Q25
Prerequisites:
- Q19, Q22
Altitude: L2
Question: What does the rule do in a React package that is not a layered app?
Accepted answer:
- The rule checks a package only when its layer root contains
app/orroutes/. A package without a route layer is not checked.
Rejected alternatives:
- Per-project exemption lists in
oxlint.local.ts.
Q26
Prerequisites:
- Q22, Q23
Altitude: L2
Question: Which root holds the layers?
Accepted answer:
src/when it exists, else the package root. One layer root per package, no project option.
Rejected alternatives:
- Require
src/.
Round R4
Q27
Prerequisites:
- Q8, Q21
Altitude: L3
Question: Which skill files own the layer model and the rule list?
Accepted answer:
references/structure.mdis rewritten: layer table, import rules, and a Lint Rules table with one row per rule id equal to the plugin rule names; it is the authority.references/react/structure.mdkeeps React-specific placement (providers, shells, page templates, hooks).SKILL.mdkeeps its workflow and adds: run the lint rule; apply the pattern only to the invoking scope (Q17).
Rejected alternatives:
- A new
references/layers.mdbesidestructure.md.
Q28
Prerequisites:
- Q11
Altitude: L3
Question: What is a domain, and what is its public entrypoint file?
Accepted answer:
- A domain is the first folder under a layer (
features/<x>,modules/<x>,integrations/<x>,composition/<x>). Its entrypoint isindex.tsorindex.tsxin that folder. Imports inside a domain are free; from outside only the entrypoint.ui/is exempt (shadcn one file per component).
Rejected alternatives:
- Also accept
public.ts(emera).
Q29
Prerequisites:
- Q3, Q4
Altitude: L3
Question:
Is the inside of composition/ fixed?
Accepted answer:
- Only the first level:
composition/providers/plus one folder per surface. Inside a surface, the skill guidesshell/andpages/<page>/; the lint rule does not check it.
Rejected alternatives:
- Lint enforces
shell/andpages/inside each surface.
Q30
Prerequisites:
- Q11
Altitude: L3
Question: Do test and story files follow the layer rules?
Accepted answer:
- Yes, no exemption.
Rejected alternatives:
- Exempt
*.test.*and*.stories.*(pegasus).
Q31
Prerequisites:
- Q11, Q19, Q22, Q24
Altitude: L3
Question: What are the asset id, plugin name, file paths and rule names?
Accepted answer:
- Asset
react-frontend-layerson thereactPack; JS pluginfrontend-layers, sourceapps/cli/src/data/lint/frontend-layers/index.mjs, installed at<scope>/tools/oxlint/frontend-layers/index.mjs. Rules:layer-order,route-imports,no-peer-feature,public-entrypoint,no-prototype-folder,known-top-level,ui-placement. Relative-import resolution (Q11 check 5) is shared by every rule.
Rejected alternatives:
- One rule
frontend-layers/structurewith message codes: can only be turned off as a whole.
Q32
Prerequisites:
- Q11, Q26
Altitude: L3
Question: Which import specifiers does the rule resolve, and how?
Accepted answer:
- Relative specifiers against the absolute
context.filename;@/against the layer root. Every other specifier is a package and is ignored. Covered nodes:ImportDeclaration,ExportNamedDeclarationandExportAllDeclarationwithsource,ImportExpressionwith a string literal,CallExpressionofrequirewith a string literal.
Rejected alternatives:
- Read
tsconfigpaths.
Q33
Prerequisites:
- Q24
Altitude: L3
Question: How does the rule know it runs in a monorepo?
Accepted answer:
- At lint time the rule walks up from the package root for the HI detector signals
pnpm-workspace.yamlor apackage.jsonwithworkspaces, read once per run.
Rejected alternatives:
- HI writes a per-package setting into the generated config: needs a new builder mechanism.
Q34
Prerequisites:
- Q31
Altitude: L3
Question: How is the rule tested?
Accepted answer:
- Vitest tests in
apps/clirun the real oxlint binary on fixture trees, one passing and one failing tree per rule, beside the existing byte-identical packaging test.
Rejected alternatives:
- Unit tests with a fake rule context: do not prove oxlint wiring.
Q35
Prerequisites:
- Q21, Q27, Q31
Altitude: L3
Question: What proves the skill rule list and the lint rules match exactly?
Accepted answer:
- An HI test parses the Lint Rules table in the synced
.agents/skills/frontend-domain-structure/references/structure.mdand asserts its rule ids equal the plugin rule names.
Rejected alternatives:
- Skills repo contract test pins the ids: cannot see the plugin.
Supersession R5
Q35-R5
Prerequisites:
- Q35
Altitude: L3
Question: Which synced skill copy does the parity test read?
Accepted answer:
- Supersedes Q35 path only: the HI parity test reads
apps/cli/skills/agnostic/frontend/frontend-domain-structure/references/structure.md, the Registry source thatbun run sync:skillswrites and that ships next to the plugin. User, 2026-10-22: "Use apps/cli/skills".
Rejected alternatives:
.agents/skills/frontend-domain-structure/references/structure.md: it changes only after a Baseline release andhi update, so the test would fail between sync and release.
Closure
- Shared-understanding confirmation and closure, user, 2026-10-22: "agree lets go".
- Glossary published at frontend-composition-layer-glossary.
- Handoff:
$create-architecture, then$create-spec,$write-backlog,$create-plan.