Skip to content

Commit 3354ce6

Browse files
tudorpopamsclaude
andcommitted
feat: update skills to use existing Nx generators and yarn scripts
- v9-component: use react-component and react-library generators instead of manually creating files, add generators reference table - change: use `yarn change` (repo's beachball script) and `yarn check:change` for verification - package-info: add useful commands section with Nx executors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e12a170 commit 3354ce6

3 files changed

Lines changed: 82 additions & 27 deletions

File tree

.agents/skills/change/SKILL.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,46 @@ allowed-tools: Bash Read Grep Glob
77

88
# Create a Beachball Change File
99

10-
Generate a change file for the current branch's modifications.
10+
Generate a change file for the current branch's modifications using the repo's beachball setup.
1111

1212
## Steps
1313

1414
1. **Identify changed packages** by running:
15-
```!
15+
16+
```bash
1617
git diff --name-only HEAD~1
1718
```
1819

1920
2. **Determine the change type:**
21+
2022
- `patch` — bug fixes, internal refactors, test-only changes
2123
- `minor` — new features, new exports, new component variants
2224
- `none` — changes that don't affect the published package (stories, docs, tests only)
2325
- Never use `major` without explicit user approval
2426

2527
3. **Generate a descriptive message** following the format: `fix(package-name): description` or `feat(package-name): description`
2628

27-
4. **Run beachball** to create the change file:
29+
4. **Run the repo's change script** to create the change file:
30+
31+
```bash
32+
yarn change
33+
```
34+
35+
This runs `beachball change --no-commit` (configured in root `package.json`).
36+
37+
For non-interactive usage with a specific type and message:
38+
39+
```bash
40+
yarn beachball change --no-commit --type <type> --message "<message>"
41+
```
42+
43+
5. **Verify** the change file was created:
44+
2845
```bash
29-
yarn beachball change --type <type> --message "<message>"
46+
yarn check:change
3047
```
3148

32-
5. If multiple packages are affected, create separate change files for each.
49+
6. If multiple packages are affected, create separate change files for each.
3350

3451
## Rules
3552

.agents/skills/package-info/SKILL.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,17 @@ Get a comprehensive overview of the package **$ARGUMENTS**.
5151
Tests: unit ✓/✗ | conformance ✓/✗ | stories ✓/✗
5252
```
5353

54+
## Useful Commands for the Package
55+
56+
```bash
57+
yarn nx run <project>:build # Build
58+
yarn nx run <project>:test # Unit tests
59+
yarn nx run <project>:lint # Lint
60+
yarn nx run <project>:type-check # Type check
61+
yarn nx run <project>:generate-api # Regenerate API docs (etc/*.api.md)
62+
```
63+
5464
## References
5565

56-
- Package layers: [docs/architecture/layers.md](docs/architecture/layers.md)
57-
- Team routing: [docs/team-routing.md](docs/team-routing.md)
66+
- Package layers: [docs/architecture/layers.md](../../../docs/architecture/layers.md)
67+
- Team routing: [docs/team-routing.md](../../../docs/team-routing.md)

.agents/skills/v9-component/SKILL.md

Lines changed: 48 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,52 @@ allowed-tools: Read Write Bash Glob Grep
88

99
# Scaffold a V9 Component
1010

11-
Create a new v9 component named **$ARGUMENTS** following the exact patterns in [docs/architecture/component-patterns.md](docs/architecture/component-patterns.md).
11+
Create a new v9 component named **$ARGUMENTS** using the repo's Nx generators.
1212

1313
## Steps
1414

15-
1. **Determine the package path.** If creating inside an existing package, use that path. If creating a new package, the path is `packages/react-components/react-<lowercase-name>/library/src/`.
15+
### Adding a component to an existing package
1616

17-
2. **Read an existing well-structured component** for reference. Good examples:
17+
Use the `react-component` generator:
1818

19-
- `packages/react-components/react-badge/library/src/components/Badge/`
20-
- `packages/react-components/react-tag/library/src/components/Tag/`
21-
Read at least the types, hook, styles, render, and main component files from one of these.
19+
```bash
20+
yarn nx g @fluentui/workspace-plugin:react-component --name $ARGUMENTS --project <project-name>
21+
```
2222

23-
3. **Generate all required files** under `components/$ARGUMENTS/`:
23+
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.
2424

25-
| File | Purpose |
26-
| --------------------------------- | ---------------------------------------------------------------------------------------------------------- |
27-
| `$ARGUMENTS.tsx` | `ForwardRefComponent` with `React.forwardRef`. Never use `React.FC`. |
28-
| `$ARGUMENTS.types.ts` | Props, State, Slots types |
29-
| `use$ARGUMENTS.ts` | State hook — processes props/slots into normalized state |
30-
| `use${ARGUMENTS}Styles.styles.ts` | Griffel styling with `makeStyles` using design tokens from `@fluentui/react-theme`. Never hardcode values. |
31-
| `render$ARGUMENTS.tsx` | Pure JSX render using `assertSlots` |
32-
| `$ARGUMENTS.test.tsx` | Unit tests with React Testing Library |
33-
| `index.ts` | Barrel export for the component |
25+
### Creating a new package + component
3426

35-
4. **Update barrel exports**add the component to the package's root `index.ts`.
27+
Use the `react-library` generator first, then add the component:
3628

37-
5. **Create conformance test** at `testing/isConformant.ts` if it doesn't exist.
29+
```bash
30+
# Create the package (will prompt for owner team)
31+
yarn create-package
3832

39-
6. **Create a default story** at the appropriate stories package location.
33+
# Or non-interactively:
34+
yarn nx g @fluentui/workspace-plugin:react-library --name <package-name> --owner "<team>"
35+
36+
# Then add the component inside it:
37+
yarn nx g @fluentui/workspace-plugin:react-component --name $ARGUMENTS --project <package-name>
38+
```
39+
40+
### After scaffolding
41+
42+
1. **Review generated files** against [docs/architecture/component-patterns.md](../../../docs/architecture/component-patterns.md) and fill in component-specific logic.
43+
44+
2. **Add styles** in `use${ARGUMENTS}Styles.styles.ts` using design tokens:
45+
46+
```tsx
47+
import { makeStyles } from '@griffel/react';
48+
import { tokens } from '@fluentui/react-theme';
49+
```
50+
51+
3. **Create a default story** at the appropriate stories package location if not generated.
52+
53+
4. **Update API docs** after adding exports:
54+
```bash
55+
yarn nx run <project>:generate-api
56+
```
4057

4158
## Critical Rules
4259

@@ -45,4 +62,15 @@ Create a new v9 component named **$ARGUMENTS** following the exact patterns in [
4562
- Always preserve user `className` as the LAST argument in `mergeClasses()`
4663
- Use `_unstable` suffix on exported hooks: `use$ARGUMENTS_unstable`, `use${ARGUMENTS}Styles_unstable`, `render${ARGUMENTS}_unstable`
4764
- Guard any `window`/`document`/`navigator` access with `canUseDOM()` from `@fluentui/react-utilities`
48-
- Do not add dependencies on other Tier 3 component packages (see [docs/architecture/layers.md](docs/architecture/layers.md))
65+
- Do not add dependencies on other Tier 3 component packages (see [docs/architecture/layers.md](../../../docs/architecture/layers.md))
66+
67+
## Available Generators Reference
68+
69+
| Generator | Command | Purpose |
70+
| --------------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------- |
71+
| `react-component` | `yarn nx g @fluentui/workspace-plugin:react-component` | Add component to existing package |
72+
| `react-library` | `yarn nx g @fluentui/workspace-plugin:react-library` | Create new v9 package |
73+
| `recipe-generator` | `yarn nx g @fluentui/workspace-plugin:recipe-generator` | Create a v9 recipe |
74+
| `prepare-initial-release` | `yarn nx g @fluentui/workspace-plugin:prepare-initial-release` | Prepare package for release (compat/preview/stable) |
75+
| `bundle-size-configuration` | `yarn nx g @fluentui/workspace-plugin:bundle-size-configuration` | Setup bundle-size tracking |
76+
| `cypress-component-configuration` | `yarn nx g @fluentui/workspace-plugin:cypress-component-configuration` | Setup Cypress component tests |

0 commit comments

Comments
 (0)