.github/skills/tsh-implementing-frontend/SKILL.md
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.
npx skillsauth add thesoftwarehouse/copilot-collections tsh-implementing-frontendInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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>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
#3B82F6, 16px).Step 2: Plan component structure
Step 3: Implement components
Follow these patterns for every component:
any. Co-locate types in ComponentName.types.ts.export { ComponentName } — no default exports. This ensures consistent imports and simplifies refactoring.Step 4: Organize modules
Apply barrel file rules from the Barrel File Guidelines table below:
index.ts barrel files at public API boundaries — folders whose exports are consumed by other modules.export { Button } from './Button'.Step 5: Verify implementation
tsh-ui-reviewer automatically during /tsh-implement), defer to that workflow — do not duplicate verification here.ui-verifying skill directly to compare the implementation against the Figma design.| State type | When to use | Example | | ------------ | --------------------------- | ------------------------------------- | | Local state | UI-only, single component | Modal open/close, input value | | Lifted state | Shared between 2-3 siblings | Filter applied to a sibling list | | Context / DI | Deeply nested consumption | Theme, locale, auth status | | Global store | Complex cross-cutting state | Multi-step form wizard, shopping cart | | Server cache | Remote data with caching | API responses, paginated lists |
| Rule | Description |
| ------------------ | ------------------------------------------------------------------ |
| Create barrel when | Folder exports are consumed by OTHER modules (public API boundary) |
| Avoid barrel when | Internal utils serving a single parent component — import directly |
| Re-export style | Named re-exports only: export { Button } from './Button' |
| Never wildcard | Avoid export * from — breaks tree shaking, hides API surface |
| Keep flat | One level deep — no barrel importing another barrel |
| Test with build | Verify barrel doesn't pull unused code into bundle |
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-Pattern | Instead 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+ levels | Use context or composition pattern |
| Duplicating existing component | Extend existing with variants |
| Inline styles for theming | Use design system's styling approach |
| export default | Named exports for consistency and refactoring |
| any type for props | Explicit type definitions |
| Barrel file for internal utils | Direct imports for single-consumer folders |
The patterns above are framework-agnostic. For framework-specific implementation guidance, load the appropriate reference:
./references/react-patterns.md — hooks, JSX composition, error boundaries, memoization patterns.tsh-ui-verifying - for verifying implementation against Figma designstsh-technical-context-discovering - for understanding project conventions before implementingtsh-ensuring-accessibility — to ensure components meet WCAG 2.1 AA standardstsh-optimizing-frontend — for performance considerations during component implementationtsh-implementing-forms — for form-specific component patterns and validationtsh-writing-hooks — for custom hook patterns used within componentstsh-reviewing-frontend — for frontend-specific code review of implemented componentsdevelopment
Custom hook and composable patterns — naming, composition, stable return shapes, lifecycle cleanup, and testing strategies. Use when writing reusable logic units (React hooks, Vue composables), refactoring logic into hooks, debugging hook behavior, or reviewing hook implementations.
testing
UI verification criteria, structure checklists, severity definitions, and tolerance rules for comparing implementations against Figma designs. Use for verifying UI matches design, understanding what to check, and determining acceptable differences.
development
Clean raw workshop or meeting transcripts from small talk, filler words, and off-topic tangents. Extract and structure business-relevant content into a standardized format with discussion topics, key decisions, action items, and open questions.
development
Discover and establish technical context before implementing any feature. Prioritize project instructions, existing codebase patterns, and external documentation in that order. Use for any task requiring understanding of project conventions, coding standards, architecture patterns, and established practices before writing code.