bitwarden/figma-to-angular
> Converts Figma designs into production Angular components with Storybook stories for the Bitwarden Clients monorepo. Use this skill whenever the user provides a Figma URL and wants to create an Angular component, or mentions "implement this design", "create a component from Figma", "build this from the design spec", or similar. Also trigger when the user pastes a Figma link and asks for a component, even if they don't say "Figma" explicitly.
npx skills add https://github.com/bitwarden/clients --skill figma-to-angular
This skill turns a Figma design spec into a fully implemented Angular component with Storybook
stories in the Bitwarden Clients monorepo. The output should match the design visually while
following all codebase conventions.
Call get_design_context from the Figma MCP server. Extract the fileKey and nodeId from the URL:
figma.com/design/:fileKey/:fileName?node-id=:nodeId → convert - to : in nodeIdclientFrameworks: "angular" and clientLanguages: "typescript,html,css"The response contains reference code (React+Tailwind), a screenshot, and design metadata. Treat the
code as a structural reference only — it must be fully converted to Angular.
Before writing any code, understand the conventions of the target location. Use an Explore agent to
discover:
file naming, module structure, barrel exports, and whether they use standalone components.
buttons, inputs, icons). Reuse them instead of reimplementing.
tailwind.config to understand the prefix(commonly tw-), available design tokens, and color system.
moduleMetadata,I18nMockService usage, argTypes.
I18nPipe import path and the locale messages file to add new keys.This exploration is critical. Skipping it leads to components that don't match the codebase and
require extensive rework.
Create a mapping from Figma's design values to the codebase's Tailwind tokens. The Figma response
includes raw CSS values (hex colors, px sizes). These must be translated to semantic tokens.
Common mappings for Bitwarden:
| Figma concept | Where to look |
| ------------------ | ----------------------------------------------------------- |
| Colors (hex) | tailwind.config → colors, bg, fg, border sections |
| Font sizes | tailwind.config → extend.fontSize |
| Spacing / padding | Standard Tailwind scale with prefix |
| Border radius | Standard Tailwind (rounded-*) |
| Component variants | Existing component source (e.g. base-button.directive.ts) |
Never use raw hex values. Always map to a semantic token. If no exact match exists, use the closest
available token and note the discrepancy.
Before writing code, create a plan covering:
input() and output() functions<ng-content> (labels, hints, actions)Present this plan to the user and get approval before writing files.
Create these files following the patterns discovered in Phase 2:
component-name.component.ts)@Component({
selector: "bit-component-name",
templateUrl: "./component-name.component.html",
changeDetection: ChangeDetectionStrategy.OnPush,
imports: [/* discovered dependencies */],
host: {
class: "tw-block",
},
})
Key conventions:
ChangeDetectionStrategy.OnPush alwaysinput(), input.required<T>(), input(default, { transform: booleanAttribute })output<T>()signal() and viewChild()Object.freeze({ ... } as const) with a same-name type alias (ADR-0025).Even for simple string unions, prefer the const object pattern for consistency.
component-name.component.html)@if, @for, @switchngClass and ngStyle, prefer class and style.tailwind.config){{ "key" | i18n }} or {{ "key" | i18n: param }}bit-label, bitButton, bit-hint, etc.)index.ts)export { ComponentNameComponent } from "./component-name.component";
component-name.stories.ts)Every component gets stories. Follow the exact patterns from sibling components:
import { Meta, moduleMetadata, StoryObj } from "@storybook/angular";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { I18nMockService } from "../utils/i18n-mock.service";
export default {
title: "Component Library/ComponentName",
component: ComponentNameComponent,
decorators: [
moduleMetadata({
imports: [/* component + dependencies */],
providers: [
{
provide: I18nService,
useFactory: () =>
new I18nMockService({
// All i18n keys used by the component
// Use __$1__ for parameter placeholders
}),
},
],
}),
],
parameters: {
design: {
type: "figma",
url: "/* original Figma URL */",
},
},
} as Meta<ComponentNameComponent>;
Include stories for:
component-name.component.spec.ts)Write unit tests when the component has behavior that Storybook stories alone can't verify. Stories
cover visual rendering and variant appearance — don't duplicate that. Tests should focus on:
clamping percentages to 0–100, variant-to-class mappings
dismissed)
role, aria-label, aria-live values change with stateSkip tests for components that are purely presentational with no logic beyond displaying inputs
(e.g. a simple badge or divider). Look at sibling *.spec.ts files to match the test setup
patterns (TestBed configuration, imports, mock providers).
Add export * from "./component-name"; to the parent directory's index.ts, inserted
alphabetically.
Use Playwright MCP tools to verify the component renders correctly:
http://localhost:6006/iframe.html?id=component-library-component-name--default&viewMode=story
If Storybook isn't running or Playwright isn't available, tell the user and suggest they verify
manually.
Present the screenshot to the user alongside the original Figma screenshot. Ask if adjustments are
needed. Common refinements:
I18nPipe. This includesaria-labels and other accessibility text — they need localization too. Add keys to the locale file
and provide mocks in stories.
bitButton. If ithas a label, use bit-label. Don't reimplement what exists.
between apps and libraries — always check the specific target directory.
codebase's design token system. Raw hex values break theming.
<label for>element pointing at a hidden <input type="file"> rather than programmatic .click(). The
codebase has an AriaDisabledClickCaptureService that intercepts programmatic clicks on certain
elements, causing silent failures.
imports: [...] in the @Componentdecorator). Do not create *.module.ts files. The codebase is moving away from NgModules.
plan than to rewrite files.
Take bitwarden/figma-to-angular from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.