Skip to content

Commit 0f5507d

Browse files
authored
Merge pull request #12 from storybookjs/improve-instructions-2
Add instructions on when to write stories
2 parents c111bff + b448cd4 commit 0f5507d

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

.changeset/large-sides-jam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@storybook/addon-mcp": patch
3+
---
4+
5+
Add instructions on when to write stories

src/ui-building-instructions.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
# Storybook 9 Essential Changes for Story Writing
1+
# Writing User Interfaces
22

3-
## Package Consolidation
3+
When writing UI, prefer breaking larger components up into smaller parts.
44

5-
### `Meta` and `StoryObj` imports
5+
ALWAYS write a Storybook story for any component written. If editing a component, ensure appropriate changes have been made to stories for that component.
6+
7+
## Storybook 9 Essential Changes for Story Writing
8+
9+
### Package Consolidation
10+
11+
#### `Meta` and `StoryObj` imports
612

713
Update story imports to use the framework package:
814

@@ -11,7 +17,7 @@ Update story imports to use the framework package:
1117
+ import { Meta, StoryObj } from '{{FRAMEWORK}}';
1218
```
1319

14-
### Test utility imports
20+
#### Test utility imports
1521

1622
Update test imports to use `storybook/test` instead of `@storybook/test`
1723

@@ -20,7 +26,7 @@ Update test imports to use `storybook/test` instead of `@storybook/test`
2026
+ import { fn } from 'storybook/test';
2127
```
2228

23-
## Global State Changes
29+
### Global State Changes
2430

2531
The `globals` annotation has be renamed to `initialGlobals`:
2632

@@ -32,7 +38,7 @@ export default {
3238
};
3339
```
3440

35-
## Autodocs Configuration
41+
### Autodocs Configuration
3642

3743
Instead of `parameters.docs.autodocs` in main.js, use tags:
3844

@@ -43,7 +49,7 @@ export default {
4349
};
4450
```
4551

46-
## Mocking imports in Storybook
52+
### Mocking imports in Storybook
4753

4854
To mock imports in Storybook, use Storybook's mocking features. ALWAYS mock external dependencies to ensure stories render consistently.
4955

@@ -80,13 +86,13 @@ export const LoggedIn: Story = {
8086

8187
Before doing this ensure you have mocked the import in the preview file.
8288

83-
## Key Requirements
89+
### Key Requirements
8490

8591
- **Node.js 20+**, **TypeScript 4.9+**, **Vite 5+**
8692
- React Native uses `.rnstorybook` directory
8793
- `afterEach` hook is now stable (was `experimental_afterEach`)
8894

89-
# Story Linking Agent Behavior
95+
## Story Linking Agent Behavior
9096

9197
- ALWAYS provide story links after any changes to stories files, including changes to existing stories.
9298
- After changing any UI components, ALWAYS search for related stories that might cover the changes you've made. If you find any, provide the story links to the user. THIS IS VERY IMPORTANT, as it allows the user to visually inspect the changes you've made. Even later in a session when changing UI components or stories that have already been linked to previously, YOU MUST PROVIDE THE LINKS AGAIN.

0 commit comments

Comments
 (0)