/d2c:d2c-guardfrom d2c
Enforces design tokens, component reuse, SOLID/DRY principles, and preferred library conventions when editing frontend code. Activates on component file edits when .claude/d2c/design-tokens.json exists.
Ships in d2c. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Trigger condition: This skill activates when ANY component file inside src/ or app/ is being created or modified, AND .claude/d2c/design-tokens.json exists.
Component file extensions by framework (read framework from design-tokens.json):
.tsx, .jsx.vue.svelte.component.ts.astroframework field is missing, default to .tsx/.jsx (React).These rules hold across every phase of this skill. No exceptions.
.claude/d2c/design-tokens.json. If it is missing, unreadable, or has d2c_schema_version < 1, STOP AND ASK the user to run /d2c-init (or /d2c-init --force if outdated).preferred_libraries.<category>.selected. The user explicitly chose which library to use for each capability. NEVER substitute an installed-but-not-selected library. If the design requires a capability not covered by preferred_libraries, STOP AND ASK.design-tokens.json. No raw hex, no magic numbers, no exceptions.components array in design-tokens.json before creating anything new. If an existing component can do the job, MUST use it.confidence > 0.6 and value ≠ "mixed". Project conventions (declaration style, export style, type definitions, import ordering, file naming, CSS wrapper, barrel exports, props pattern) override framework defaults.decisions.lock.json from the IR run directory at the start of every phase after Phase 2. Only nodes with status: "failed" may have their component choice or token mapping changed. If a locked decision must change, STOP AND ASK.When any rule is ambiguous, STOP AND ASK — do not guess.
When writing or editing frontend code in this project, follow these rules:
.claude/d2c/design-tokens.json exists.components section before creating any new component — reuse what exists.If design-tokens.json contains a conventions section, these conventions override the framework reference file's generic patterns for all stylistic decisions. Only enforce conventions where confidence > 0.6 (or override is true) and value is not "mixed".
conventions.component_declaration): Use arrow functions or function declarations as specified.conventions.export_style): Use default or named exports as specified.conventions.type_definition): Use interface or type as specified.conventions.type_location): Keep types in the component file (colocated) or in a separate types.ts (separate_file).conventions.file_naming): Name new files in PascalCase, kebab-case, or camelCase as specified.conventions.import_ordering): Order import groups per the detected pattern array.conventions.css_utility_pattern): Wrap Tailwind classes with the project's utility function (e.g., cn() from @/lib/utils). Use the wrapper_import path for the import.conventions.barrel_exports): If "yes", update index.ts barrel files when adding new components.conventions.props_pattern): Destructure props in the function signature or use a props object as specified.If the conventions section does not exist, follow framework reference file defaults.
.claude/d2c/design-tokens.json.styling_approach.preferred_libraries exists in design-tokens.json, always use the selected library for each capability category.preferred_libraries.data_fetching.selected. Use the correct import/API pattern for the project's framework. Common patterns: React Query = useQuery/useMutation, SWR = useSWR/useSWRMutation, axios = axios.get()/axios.post(), Nuxt = useFetch/useAsyncData, Solid = createResource, Angular = inject(HttpClient). Never use an alternative library that is installed but not selected.preferred_libraries.dates.selected. Never mix date libraries (e.g., don't use moment if date-fns is selected).selected library for each category. Use the framework-correct variant (e.g., lucide-react for React, lucide-vue-next for Vue, lucide-svelte for Svelte).api section.className for React/Solid (JSX), class for Vue/Svelte/Angular/Astro/Qwik.PageHeader uses Heading + Breadcrumbs + ActionBar.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub d2c-ai/d2c --plugin d2c5 skills in this plugin
/d2c-auditAudit codebase for design token drift, unused tokens, component reuse violations, library pattern violations, and accessibility issues. Use when checking code quality, running design system audits, or finding hardcoded values./d2c-buildBuild production-ready frontend code from a Figma design. Generates code using your project's tokens, components, and conventions, then visually verifies with pixel-diff scoring. Use when implementing designs, generating code from Figma, or building UI components./d2c-build-flowBuild a connected multi-page Figma flow (onboarding, checkout, KYC, etc.) into production-ready frontend code: per-page components, a shared layout, routing, optional shared state, and a navigation smoke test. Takes a natural-language prompt listing ordered steps (each step = one Figma frame URL, optional per-step route). Use when implementing flows that span 2+ screens, when the user mentions 'flow', 'multi-page', 'onboarding', 'checkout', or lists steps./d2c-initScan your codebase to extract design tokens, detect framework, discover components, and configure preferred libraries. Run once per project before /d2c-build. Use when setting up d2c, initializing design system, or scanning codebase.