agentleFS
aiFabricoComaiFabricoCom/fabrico-collections/.claude/skills/fabrico-implementing-frontend/SKILL.md

fabrico-implementing-frontend

Skill2 starsChanged 4 months agoMITView on GitHub

Frontend component patterns, composition, design token integration, barrel file organization, error handling, and Figma-to-code workflow. Use when implementing UI components, translating Figma designs into code, managing component state, or integrating with a design system.

The file

Show its rules and text

We split this skill into the rules it gives an agent

18 rules. About 0 are common, 13 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use design tokens (colors, spacing, typography) from the project's design system.

    line 21
  2. Distinctive:

    If design context, tokens, or specifications are missing or unclear, stop and ask the user.

    line 25
  3. Distinctive:

    Use the checklist below and track progress:

    line 32
  4. Distinctive:

    Search the codebase for a matching token.

    line 48
  5. Distinctive:

    If a token exists — use it.

    line 49
  6. Distinctive:

    If no exact match — find the closest existing token and document the deviation.

    line 50
  7. Distinctive:

    If truly new — flag it and ask the user before creating.

    line 51
  8. Distinctive:

    Search the codebase for existing similar components.

    line 60
  9. Distinctive:

    Follow these patterns for every component:

    line 65
  10. Distinctive:

    Composition: Use composition patterns — content projection (children/slots), render delegation, compound components — to keep components …

    line 67
  11. Very specific:

    Named exports only: Use export { ComponentName } — no default exports.

    line 69
  12. Distinctive:

    Three UI states: Every data-dependent component must handle loading (progress indicator), error (meaningful message + recovery action), and …

    line 71
  13. Distinctive:

    Design tokens: All visual values (colors, spacing, typography, shadows, radii) must come from the design system.

    line 72
  14. Very specific:

    Create index.ts barrel files at public API boundaries — folders whose exports are consumed by other modules.

    line 78
  15. Very specific:

    Use named re-exports only: export { Button } from './Button'.

    line 79
  16. Distinctive:

    Verify the barrel doesn't re-export unused internals that bloat the bundle.

    line 81
  17. Very specific:

    If a calling workflow provides a verification loop (e.g., the Engineering Manager runs the fabrico-ui-reviewer subagent — via the Task …

    line 85
  18. Very specific:

    If no verification workflow is active, use the fabrico-ui-verifying skill directly to compare the implementation against the Figma design.

    line 86

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Implementing Frontend

Provides patterns for building reusable, composable frontend components with design system integration and a structured Figma-to-code workflow.

<principles><declarative-over-imperative> Define what the UI should look like based on state, not how to manipulate the DOM. Describe the desired outcome through components and state declarations. Let the framework handle reconciliation and updates. Compose complex UIs from simple, predictable building blocks rather than writing step-by-step mutation sequences. </declarative-over-imperative><composition-over-complexity> Build complex UIs by composing small, focused components rather than creating monolithic ones. Each component should have a single clear responsibility. Prefer children, slots, and compound component patterns over deep prop trees. </composition-over-complexity><design-system-first> Always use design tokens (colors, spacing, typography) from the project's design system. Never hardcode visual values. Map Figma specs to existing tokens. If no exact token match exists, find the closest and document the deviation — do not invent tokens without approval. </design-system-first><never-guess> If design context, tokens, or specifications are missing or unclear, stop and ask the user. Do not proceed with assumptions about visual implementation. Missing information produces wrong UI — asking produces correct UI. </never-guess></principles>

Implementation Process

Use the checklist below and track progress:

Progress:
- [ ] Step 1: Gather design context
- [ ] Step 2: Plan component structure
- [ ] Step 3: Implement components
- [ ] Step 4: Organize modules
- [ ] Step 5: Verify implementation

Step 1: Gather design context

  • Extract specs from Figma (via the figma MCP server, tools mcp__figma__*, if available). Identify components, spacing, typography, colors, and interaction states.
  • Map every Figma value to an existing design token in the codebase:
    1. Extract the raw value from Figma (e.g., #3B82F6, 16px).
    2. Search the codebase for a matching token.
    3. If a token exists — use it.
    4. If no exact match — find the closest existing token and document the deviation.
    5. If truly new — flag it and ask the user before creating.
  • Identify all states the design implies: default, hover, focus, active, disabled, loading, error, empty.
  • Identify responsive breakpoints from the design. Check how the component should adapt across screen sizes — layout shifts, hidden/shown elements, typography scaling. Map breakpoints to the project's existing responsive tokens or media queries.

Step 2: Plan component structure

  • Decide component boundaries: what is a reusable component vs. page-specific layout.
  • Identify the props interface for each component — typed, with sensible defaults.
  • Determine state needs using the State Decision Framework table below.
  • Search the codebase for existing similar components. Extend or compose existing components rather than duplicating.
  • Sketch the component tree: parent → children relationships, data flow direction, and where state lives.

Step 3: Implement components

Follow these patterns for every component:

  • Composition: Use composition patterns — content projection (children/slots), render delegation, compound components — to keep components flexible. Avoid prop sprawl — if a component accepts more than ~7 props, it likely needs decomposition.
  • Typed props: Define explicit TypeScript types for all props. Never use any. Co-locate types in ComponentName.types.ts.
  • Named exports only: Use export { ComponentName } — no default exports. This ensures consistent imports and simplifies refactoring.
  • Error handling wrappers: Wrap data-dependent sections with the framework's error boundary mechanism for graceful failure. See the framework reference for the specific API.
  • Three UI states: Every data-dependent component must handle loading (progress indicator), error (meaningful message + recovery action), and empty (helpful message when no data).
  • Design tokens: All visual values (colors, spacing, typography, shadows, radii) must come from the design system. Zero hardcoded values.

Step 4: Organize modules

Apply barrel file rules from the Barrel File Guidelines table below:

  • Create index.ts barrel files at public API boundaries — folders whose exports are consumed by other modules.
  • Use named re-exports only: export { Button } from './Button'.
  • Skip barrels for internal utility folders that serve a single parent component.
  • Verify the barrel doesn't re-export unused internals that bloat the bundle.

Step 5: Verify implementation

  • If a calling workflow provides a verification loop (e.g., the Engineering Manager runs the fabrico-ui-reviewer subagent — via the Task tool, subagent_type: fabrico-ui-reviewer — automatically during /fabrico-implement), defer to that workflow — do not duplicate verification here.
  • If no verification workflow is active, use the fabrico-ui-verifying skill directly to compare the implementation against the Figma design.
  • Walk through each interaction state (hover, focus, disabled, error, loading, empty) and verify correctness.
  • Iterate on differences until the implementation matches the design within acceptable tolerances.

State Decision Framework

State typeWhen to useExample
Local stateUI-only, single componentModal open/close, input value
Lifted stateShared between 2-3 siblingsFilter applied to a sibling list
Context / DIDeeply nested consumptionTheme, locale, auth status
Global storeComplex cross-cutting stateMulti-step form wizard, shopping cart
Server cacheRemote data with cachingAPI responses, paginated lists

Barrel File Guidelines

RuleDescription
Create barrel whenFolder exports are consumed by OTHER modules (public API boundary)
Avoid barrel whenInternal utils serving a single parent component — import directly
Re-export styleNamed re-exports only: export { Button } from './Button'
Never wildcardAvoid export * from — breaks tree shaking, hides API surface
Keep flatOne level deep — no barrel importing another barrel
Test with buildVerify barrel doesn't pull unused code into bundle

Component Checklist

Component:
- [ ] Single responsibility — one clear purpose
- [ ] Typed props — explicit types, sensible defaults
- [ ] Named export — no default exports
- [ ] Design tokens — no hardcoded visual values
- [ ] Error state — handles failure gracefully
- [ ] Loading state — shows progress indicator
- [ ] Empty state — meaningful message when no data
- [ ] Composition — uses children/slots, not prop sprawl

Anti-Patterns

Anti-PatternInstead Do
Hardcoded colors/spacing (#3B82F6, 16px)Use design tokens (var(--color-primary-500), theme.spacing(2))
Monolithic component (300+ lines)Split into composed sub-components
Props drilling through 4+ levelsUse context or composition pattern
Duplicating existing componentExtend existing with variants
Inline styles for themingUse design system's styling approach
export defaultNamed exports for consistency and refactoring
any type for propsExplicit type definitions
Barrel file for internal utilsDirect imports for single-consumer folders

Framework-Specific Patterns

The patterns above are framework-agnostic. For framework-specific implementation guidance, load the appropriate reference:

  • React: See ./references/react-patterns.md — hooks, JSX composition, error boundaries, memoization patterns.

Connected Skills

  • fabrico-ui-verifying - for verifying implementation against Figma designs
  • fabrico-technical-context-discovering - for understanding project conventions before implementing
  • fabrico-ensuring-accessibility — to ensure components meet WCAG 2.1 AA standards
  • fabrico-optimizing-frontend — for performance considerations during component implementation
  • fabrico-implementing-forms — for form-specific component patterns and validation
  • fabrico-writing-hooks — for custom hook patterns used within components
  • fabrico-reviewing-frontend — for frontend-specific code review of implemented components</content>

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.