Imported from fredeschmidt/tv2reg-designsystem (
.agents/skills/architecture/SKILL.md). Install upstream withnpx skills add fredeschmidt/tv2reg-designsystem --skill architecture. Copyright stays with the author.
Architecture
Use this skill to enforce repository architecture constraints. In component builds, this runs after design extraction and before implementation.
Mandatory Execution Rules
- Read this file before acting.
- Execute all workflow steps in exact order.
- Execute all sub-bullets under each step.
- Do not skip, combine, or reorder steps.
- If blocked or context is missing, resolve before moving on.
- When done, return to the calling skill.
Trigger
Use when implementation needs architectural guardrails for:
- components,
- tokens,
- themes/regions,
- page integration constraints.
In build flows:
build-component-figma->architecture-> implementation.
Do This First (Required)
- Confirm scope type:
- shared core change,
- regional extension,
- experiment.
- Read
references/token-architecture.md. - Read
references/golden-path-workflow.md. - If region-specific work, read
references/regional-extension-guide.md.
Repository Contract (Must Keep)
- One shared implementation for all regions.
- Static pages remain:
index.html,article.html,design-manual.html. - Token source is
assets/tokens.css; token consumer isassets/styles.css. - Runtime theme switching only in
assets/theme.js. - Shared JS entry point is
assets/script.js. - Each new component gets its own folder:
assets/components/<component-name>/<component-name>.css<component-name>.jsonly if behavior requires JS.
- Component CSS/JS must be scoped.
- Component CSS loads via
assets/styles.cssimports only (no page-level component<link>tags). - Component JS loads via
assets/script.jsonly (no page-level component<script>tags). - No per-region HTML forks; region differences come from tokens.
- Preserve accessible semantic structure across pages/components:
- correct landmarks,
- logical heading order,
- meaningful control semantics.
- Component class naming must follow BEM (
block__element--modifier) to keep styles predictable and scoped.
Hard Rules
- Use tokens in component/layout CSS (
var(--...)). - Typography in component CSS must use the new semantic type system first (
--base-type-*,--base-leading-*,--base-weight-*) including family, size, weight, and line-height. - Do not use legacy typography aliases (
--font-*) inside component styles; reserve them for compatibility in shared/global legacy layers only. - For Figma component builds and design-driven updates, reuse existing tokens by default.
- Do not add new tokens unless user explicitly asks for token architecture changes.
- Keep
assets/styles.csslimited to imports + shared/global rules (no component rule blocks there). - Keep
assets/script.jsas shared registry/entry for component scripts. - Keep theme IDs synchronized across:
- selectors in
assets/tokens.css, THEMESinassets/theme.js,- theme picker option values.
- selectors in
- Avoid page-specific inline styles/scripts.
- Keep semantic markup stable across pages.
- Prefer native HTML semantics first (
button,a,label,input,nav, etc.); use ARIA only when native semantics cannot express the behavior. - Ensure interactive UI remains keyboard operable with visible focus states and no keyboard traps.
- Ensure controls expose an accessible name and required state (
aria-expanded,aria-controls,aria-current, etc.) when behavior needs it. - Keep non-text contrast and text contrast at WCAG AA level for default component/theme states.
- In component CSS, prefer BEM class selectors over tag/descendant coupling to page structure.
- Keep one canonical block per component folder and scope element/modifier classes to that block.
Safe Change Workflow (Execute In Order)
- Define semantic need (not raw styling).
- Choose existing token(s) in
assets/tokens.css. - For typography, choose semantic
--base-type-*+--base-leading-*+--base-weight-*tokens before introducing hardcoded font values. - Do not override
font-size,font-weight, orline-heightwith raw values when semantic base typography tokens cover the use case; if unavoidable, document the exception explicitly. - If no exact token for the design task:
- use closest semantic token,
- document visual delta,
- do not create new token by default.
- Only if user explicitly requests, add/adjust tokens in
assets/tokens.css. - If creating component, add
assets/components/<component-name>/and component files. - Import component CSS from
assets/styles.css. - If component JS exists, register/import from
assets/script.js. - If adding theme/region, update both:
- token override block in
assets/tokens.css, - key in
assets/theme.js.
- Validate:
- theme selector works on all pages,
localStoragekeytv2-region-themepersists,- no hardcoded region colors in component rules,
- component/layout CSS uses
--base-*/--core-*as the default token API, - no legacy
--font-*usage inside component CSS, - no direct raw
font-size/font-weight/line-heightoverrides where semantic base typography tokens already define them, - component CSS/JS loading follows contract,
- semantic structure is valid (landmarks, heading order, labels),
- interactive behavior is keyboard accessible with visible focus,
- ARIA usage (if any) matches actual behavior/state and is not redundant with native semantics,
- text and interactive UI contrast satisfy WCAG AA,
- component classes follow BEM consistently (block, element, modifier),
- no cross-component selector coupling that breaks BEM scoping,
- mobile and desktop render correctly.
Output Requirements
When done, report:
- Constraints applied.
- Architecture decisions made.
- Files that must be touched (or avoided).
- Any rule conflicts/blockers and how they were resolved.