frontend-system-discipline
Frontend System Discipline
Use this skill when frontend code risks drifting away from the design system or when a change tempts the agent to invent local tokens, helper layers, or style buckets that do not carry real ownership.
This is a reuse and structure skill. It keeps UI work tied to the system that already exists instead of creating page-local versions of the same idea.
When to use
Invoke this skill for:
- component or page implementation that touches styling, tokens, layout, or composition
- theme updates, design-token updates, or semantic styling changes
- refactors that introduce local helpers, constants, or wrapper components
- styled-component, CSS module, or style-file organization work
- code review focused on frontend reuse, token discipline, or component structure
Non-negotiable rules
- Do not invent new visual tokens when the existing design system already expresses the need.
- Do not create page-local duplicates of theme values, palette values, spacing scales, typography values, or motion values.
- Do not extract trivial helpers, constants, or style fragments when the inline version is clearer.
- Do not create
helpers.ts,constants.ts, orstyles.tsbuckets for a single use. - Do not wrap a primitive component just to rename it or forward props unchanged.
- Do not split styles into another file unless the split creates a real ownership or reuse boundary.
- Do not duplicate composition patterns across sibling components when a shared primitive already exists.
Required order of thought
Before adding frontend structure, evaluate in this order:
- existing design-system component or primitive
- existing semantic theme token
- existing shared composition pattern
- local inline implementation
- new shared primitive only with explicit reuse or policy value
Skipping this order is non-compliant.
Design-system and theme rules
- Reuse semantic tokens first.
- Keep tokens semantic, not page-specific.
- Promote a value into the theme only when it is stable, meaningful, and reused or expected to be reused.
- Keep product-specific or screen-specific values local until reuse proves otherwise.
- Do not create a token just because a literal appears twice in one file.
- Do not map a token to a one-off visual tweak when the inline literal is clearer.
- Prefer theme ownership for palette, typography, spacing, border radius, elevation, and motion primitives that need to stay consistent.
Composition and helper placement
- Keep one-off transformations inline.
- Extract a helper only when it is reused, domain-bearing, or materially clarifies a complex render path.
- Prefer prop-driven composition before introducing wrappers or adapters.
- Move shared UI behavior into the appropriate shared primitive, not into a page-local convenience layer.
- Avoid helper names that only restate implementation details.
- Keep constant names meaningful only when the name adds more value than the literal itself.
Styled file organization
- Keep local styled declarations beside the component when the style is truly local.
- Name style files after the owning component or shared primitive.
- Use shared style files only when multiple consumers actually benefit from them.
- Avoid generic style buckets that exist only to flatten the tree.
- Keep overrides close to the component unless they have become a real design-system concern.
- Split style files only when the split makes ownership, reuse, or maintenance clearer.
Definition of done
- No trivial helper or wrapper layers were introduced.
- No one-off constant was extracted without shared meaning.
- No local token duplication remains where a theme token already exists.
- Styled files reflect ownership and reuse instead of convenience.
- The final structure is simpler or equally simple than the starting point.
Final output contract
When this skill is used, report:
- which existing design-system or theme primitive was reused
- which tokens or constants were kept local and why
- which helpers or wrappers were rejected
- how styled files were organized and why that ownership is correct
- any new shared primitive added and the reuse or policy reason for it
References
references/design-system-theme.mdreferences/composition-and-styles.mdevals/evals.json
More from mwillbanks/agent-skills
code-discipline
Prevent trivial helpers, wrapper layers, rename-only utilities, duplicate constants, and local reinvention. Enforce reuse of platform primitives, framework capabilities, shared utilities, and proven libraries. Use when adding or reviewing logic, constants, composition, or UI structure so the agent keeps code disciplined and avoids technical debt.
32agent-execution-mode
Enforces complete execution, repository-aware spec-driven delivery, mode-aware delivery, compact sub-agent communication, independent agent-review gating, validation, and reporting for implementation, bugfix, hardening, documentation, specification, architecture, design, review, and post-mortem tasks. Use whenever work must be completed, reviewed, validated, or documented through an explicit execution mode instead of handled ad hoc.
28repo-standards-enforcement
Use this skill to enforce repository-wide standards for toolchain compliance, package-manager purity, type safety, testing, maintainability, and architecture. When a more specific skill exists for a concern such as final linting or formatting remediation, that more specific skill takes precedence over this skill's generalized guidance.
26biome-enforcement
Use this skill when a task touches code, tests, Biome config, or generated artifacts and Biome must remain the final remediation and enforcement pass using the required JSON changed-files command.
24execution-alignment-gate
Detects materially ambiguous or under-specified requests, selects the right clarification target, and enforces bounded alignment before execution, including spec-governed continuations and approval-gated manager handoffs. Use when ambiguity could cause wrong deliverables, wrong scope, wrong implementation path, avoidable rework, or token waste from repeated follow-up.
19speckit-feature-orchestrator
Orchestrates a full Speckit feature workflow from constitution amendment through specification, clarification, plan, tasks, and analysis as a chief-architect governor using subagents. Use when the repository already uses Speckit or the user explicitly asks for Speckit and wants to discuss, refine, or directly drive a new feature into implementation-ready Speckit artifacts in one controlled pass.
12