v9-component

Scaffold a new v9 component with all required files following Fluent UI patterns (hook, styles, render, types, tests, stories, conformance)

npx skills add https://github.com/microsoft/fluentui --skill v9-component

Scaffold a V9 Component

Create a new v9 component named $ARGUMENTS using the repo's Nx generators.

Steps

Adding a component to an existing package

Use the react-component generator:

yarn nx g @fluentui/workspace-plugin:react-component --name $ARGUMENTS --project <project-name>

Where <project-name> is the Nx project (e.g., react-button). This generates all required files: component, types, hook, styles, render, index barrel, and conformance test.

Creating a new package + component

Use the react-library generator first, then add the component:

# Create the package (will prompt for owner team)
yarn create-package

# Or non-interactively:
yarn nx g @fluentui/workspace-plugin:react-library --name <package-name> --owner "<team>"

# Then add the component inside it:
yarn nx g @fluentui/workspace-plugin:react-component --name $ARGUMENTS --project <package-name>

After scaffolding

  1. Review generated files against docs/architecture/component-patterns.md and fill in component-specific logic.

  2. Add styles in use${ARGUMENTS}Styles.styles.ts using design tokens:

    import { makeStyles } from '@griffel/react';
    import { tokens } from '@fluentui/react-theme';
    
  3. Create a default story at the appropriate stories package location if not generated.

  4. Update API docs after adding exports:

    yarn nx run <project>:generate-api
    

Critical Rules

  • Always use ForwardRefComponent with React.forwardRef — never React.FC
  • Always use design tokens from @fluentui/react-theme — never hardcoded colors/spacing/typography
  • Always preserve user className as the LAST argument in mergeClasses()
  • Use _unstable suffix on exported hooks: use$ARGUMENTS_unstable, use${ARGUMENTS}Styles_unstable, render${ARGUMENTS}_unstable
  • Guard any window/document/navigator access with canUseDOM() from @fluentui/react-utilities
  • Do not add dependencies on other Tier 3 component packages (see docs/architecture/layers.md)

Available Generators Reference

GeneratorCommandPurpose
react-componentyarn nx g @fluentui/workspace-plugin:react-componentAdd component to existing package
react-libraryyarn nx g @fluentui/workspace-plugin:react-libraryCreate new v9 package
recipe-generatoryarn nx g @fluentui/workspace-plugin:recipe-generatorCreate a v9 recipe
prepare-initial-releaseyarn nx g @fluentui/workspace-plugin:prepare-initial-releasePrepare package for release (compat/preview/stable)
bundle-size-configurationyarn nx g @fluentui/workspace-plugin:bundle-size-configurationSetup bundle-size tracking
cypress-component-configurationyarn nx g @fluentui/workspace-plugin:cypress-component-configurationSetup Cypress component tests

More skills from microsoft

oss-growth
microsoft
OSS growth hacker persona
agent-framework-azure-ai-py
microsoft
Build Azure AI Foundry agents using the Microsoft Agent Framework Python SDK (agent-framework-azure-ai). Use when creating persistent agents with AzureAIAgentsProvider, using hosted tools (code interpreter, file search, web search), integrating MCP servers, managing conversation threads, or implementing streaming responses. Covers function tools, structured outputs, and multi-tool agents.
development
airunway-aks-setup
microsoft
Set up AI Runway on AKS — from bare cluster to running model. Covers cluster verification, controller install, GPU assessment, provider setup, and first deployment. WHEN: "setup AI Runway", "onboard AKS cluster", "install AI Runway", "airunway setup", "deploy model to AKS", "GPU inference on AKS", "KAITO setup on AKS", "run LLM on AKS", "vLLM on AKS", "set up model serving on AKS", "AI Runway controller".
devops
appinsights-instrumentation
microsoft
Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.
devops
applicationinsights-web-ts
microsoft
Instrument browser/web apps with the Application Insights JavaScript SDK (@microsoft/applicationinsights-web). Use for Real User Monitoring (RUM) — page views, clicks, AJAX/fetch dependencies, exceptions, custom events, and browser-side GenAI agent traces correlated to backend OpenTelemetry traces. Covers SDK Loader Script and npm setup, framework extensions (React, React Native, Angular), Click Analytics, telemetry initializers, and OTel GenAI semantic conventions for agent/tool/model spans emitted from the browser.
devops
azure-ai-anomalydetector-java
microsoft
Build anomaly detection applications with Azure AI Anomaly Detector SDK for Java. Use when implementing univariate/multivariate anomaly detection, time-series analysis, or AI-powered monitoring.
development
azure-ai-language-conversations-py
microsoft
Implement Conversational Language Understanding (CLU) using the azure-ai-language-conversations Python SDK. Use when working with ConversationAnalysisClient to analyze conversation intent and entities, building NLP features, or integrating language understanding into applications.
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 for Python. Use for ML workspaces, jobs, models, datasets, compute, and pipelines. Triggers: "azure-ai-ml", "MLClient", "workspace", "model registry", "training jobs", "datasets".
development