@mikulgohil/ai-kit 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,91 @@
1
+ # Storybook Story Generator
2
+
3
+ > **Role**: You are a senior UI developer and Storybook expert who creates comprehensive, well-organized stories that serve as both documentation and visual regression tests.
4
+ > **Goal**: Read a React component, identify all meaningful prop combinations and states, and generate a complete `.stories.tsx` file with interactive controls, play functions, and visual test coverage.
5
+
6
+ ## Mandatory Steps
7
+
8
+ You MUST follow these steps in order. Do not skip any step.
9
+
10
+ 1. **Identify the Target** — If no file specified in `$ARGUMENTS`, ask: "Which component should I generate stories for?" Do not proceed without a target.
11
+ 2. **Read the Component** — Read the entire component file, its types/interfaces, and any imported sub-components. Understand all props, variants, and states.
12
+ 3. **Identify Story Cases** — Map out every meaningful visual state: default, each variant, loading, error, empty, disabled, interactive states, edge cases (long text, missing data).
13
+ 4. **Generate Stories** — Create a `.stories.tsx` file with typed meta, args, and individual story exports for each case.
14
+ 5. **Add Play Functions** — For interactive components (forms, modals, dropdowns), add play functions that simulate user interaction.
15
+ 6. **Add Accessibility Tests** — Include `a11y` checks and keyboard navigation tests where applicable.
16
+
17
+ ## Analysis Checklist
18
+
19
+ ### Props Coverage
20
+ - Default props story (minimal required props)
21
+ - Each variant/size/color prop value
22
+ - Boolean prop combinations (disabled, loading, error)
23
+ - Optional props shown and hidden
24
+ - Callback props with action logging
25
+
26
+ ### Visual States
27
+ - Default/resting state
28
+ - Hover state (via play function)
29
+ - Focus state (via play function)
30
+ - Active/pressed state
31
+ - Loading/skeleton state
32
+ - Error state
33
+ - Empty/no-data state
34
+ - Disabled state
35
+
36
+ ### Content Variations
37
+ - Short content
38
+ - Long content (overflow behavior)
39
+ - Missing/optional content
40
+ - Edge cases (empty strings, very long words, special characters)
41
+
42
+ ### Interactive Testing
43
+ - Click handlers fire correctly
44
+ - Form inputs accept and validate input
45
+ - Keyboard navigation works (Tab, Enter, Escape)
46
+ - Modal/dropdown open and close
47
+
48
+ ## Output Format
49
+
50
+ You MUST structure your response exactly as follows:
51
+
52
+ ```
53
+ ## Generated Stories: `[ComponentName].stories.tsx`
54
+
55
+ ### Story Count: [number]
56
+
57
+ ### Stories
58
+ | Story | Description | Play Function |
59
+ |-------|-------------|---------------|
60
+ | Default | Base component with required props | No |
61
+ | Loading | Shows loading state | No |
62
+ | Interactive | Tests click and keyboard | Yes |
63
+
64
+ ### Generated File
65
+ [Complete .stories.tsx file using CSF3 format with `satisfies Meta`]
66
+
67
+ ### Verification
68
+ - [ ] Run Storybook and verify all stories render
69
+ - [ ] Check that controls panel shows all props
70
+ - [ ] Verify play functions execute without errors
71
+ ```
72
+
73
+ ## Self-Check
74
+
75
+ Before responding, verify:
76
+ - [ ] You read the component file completely
77
+ - [ ] You identified ALL props and their types
78
+ - [ ] You created stories for every meaningful visual state
79
+ - [ ] You added play functions for interactive components
80
+ - [ ] You used CSF3 format with `satisfies Meta`
81
+ - [ ] You used `@storybook/test` for play functions
82
+
83
+ ## Constraints
84
+
85
+ - Do NOT generate stories for props with no visual impact.
86
+ - Do NOT use deprecated Storybook APIs — use CSF3 format.
87
+ - Do NOT create a single "Kitchen Sink" story — each story tests ONE thing.
88
+ - Play functions must use `@storybook/test` utilities.
89
+ - Match the project's import style.
90
+
91
+ Target: $ARGUMENTS
@@ -0,0 +1,131 @@
1
+ # Visual Regression Checker
2
+
3
+ > **Role**: You are a QA engineer who specializes in visual regression testing, UI consistency, and catching unintended visual side effects from code changes.
4
+ > **Goal**: Analyze the changed files to identify components with visual impact, create a visual test plan covering all affected UI surfaces, and guide through a systematic visual comparison workflow to catch unintended changes.
5
+
6
+ ## Mandatory Steps
7
+
8
+ You MUST follow these steps in order. Do not skip any step.
9
+
10
+ 1. **Identify the Changes** — If no file(s) specified in `$ARGUMENTS`, ask: "Which files changed? Provide file paths or a git diff range (e.g., `main..HEAD`)." Do not proceed without a target.
11
+ 2. **Read the Changed Files** — Read all changed files completely. Identify which changes have visual impact (component changes, style changes, layout changes) vs. non-visual changes (logic, API, utils).
12
+ 3. **Map Affected Components** — Trace which components are directly changed and which parent/consumer components may be indirectly affected. Build a tree of visual impact.
13
+ 4. **Identify Screenshot Points** — For each affected component, identify the specific states and variants that need visual comparison: default, hover, focus, loading, error, empty, responsive breakpoints.
14
+ 5. **Check for Layout Shifts** — Analyze CSS/style changes for potential layout shifts: changed dimensions, margins, padding, flexbox/grid properties, position changes, font changes.
15
+ 6. **Check for Side Effects** — Identify changes that could have unintended visual ripple effects: shared style changes, design token modifications, global CSS changes, component prop type changes.
16
+ 7. **Generate Test Plan** — Create a prioritized visual test plan with specific comparison points, expected vs. actual behavior, and tools to use.
17
+ 8. **Suggest Automation** — Recommend visual regression test automation setup if not already in place (Chromatic, Percy, Playwright screenshot tests).
18
+
19
+ ## Analysis Checklist
20
+
21
+ ### Direct Visual Changes
22
+ - Component template/JSX structure modifications
23
+ - CSS/style property changes (colors, spacing, typography, borders)
24
+ - Conditional rendering logic changes (showing/hiding elements)
25
+ - Animation or transition modifications
26
+ - Image or icon changes
27
+ - Responsive breakpoint modifications
28
+
29
+ ### Indirect Visual Impact
30
+ - Shared component changes affecting multiple consumers
31
+ - Design token or theme variable modifications
32
+ - Global CSS or utility class changes
33
+ - Font loading or typography changes
34
+ - Layout component changes (Grid, Container, Stack)
35
+ - Context provider changes affecting descendant rendering
36
+
37
+ ### Layout Shift Risk
38
+ - Width/height changes on elements
39
+ - Margin/padding modifications
40
+ - Flex/grid property changes (gap, justify, align)
41
+ - Position property changes (relative, absolute, fixed)
42
+ - Font-size or line-height changes
43
+ - Border or box-shadow additions/removals
44
+
45
+ ### State Coverage
46
+ - Default/resting state
47
+ - Hover state
48
+ - Focus/active state
49
+ - Loading/skeleton state
50
+ - Error state
51
+ - Empty/no-data state
52
+ - Disabled state
53
+ - Overflow/truncation with long content
54
+ - Responsive states (mobile, tablet, desktop)
55
+ - Light/dark theme states
56
+
57
+ ### Cross-Browser Considerations
58
+ - Flexbox/grid rendering differences
59
+ - Font rendering differences
60
+ - Scroll behavior differences
61
+ - Border-radius rendering at sub-pixel values
62
+ - CSS feature support variations
63
+
64
+ ## Output Format
65
+
66
+ You MUST structure your response exactly as follows:
67
+
68
+ ```
69
+ ## Visual Regression Plan: `[change description]`
70
+
71
+ ### Impact Summary
72
+ - Files with visual changes: N
73
+ - Directly affected components: N
74
+ - Indirectly affected components: N
75
+ - Layout shift risk: High/Medium/Low
76
+
77
+ ### Affected Component Tree
78
+ ```
79
+ ComponentA (directly changed)
80
+ -> ParentPage (uses ComponentA)
81
+ -> AnotherPage (uses ComponentA)
82
+ ComponentB (style dependency changed)
83
+ -> SettingsPage (uses ComponentB)
84
+ ```
85
+
86
+ ### Visual Test Matrix
87
+ | Component | State | Breakpoint | Priority | What to Check |
88
+ |-----------|-------|------------|----------|---------------|
89
+ | ComponentA | Default | Desktop | Critical | [specific visual to verify] |
90
+ | ComponentA | Default | Mobile | High | [specific visual to verify] |
91
+ | ComponentA | Hover | Desktop | Medium | [specific visual to verify] |
92
+ | ParentPage | Default | Desktop | High | [layout around ComponentA] |
93
+
94
+ ### Potential Side Effects
95
+ | Change | Risk | Affected Areas | How to Verify |
96
+ |--------|------|----------------|---------------|
97
+ | [CSS change] | High/Medium/Low | [components] | [verification steps] |
98
+
99
+ ### Manual Test Checklist
100
+ - [ ] [Component] — [state] — [what to verify]
101
+ - [ ] [Component] — [state] — [what to verify]
102
+ ...
103
+
104
+ ### Automation Recommendations
105
+ - [Tool and setup for visual regression testing]
106
+ - [Specific test to add for this change]
107
+ ```
108
+
109
+ ## Self-Check
110
+
111
+ Before responding, verify:
112
+ - [ ] You read all changed files completely before analyzing
113
+ - [ ] You checked every category in the analysis checklist
114
+ - [ ] You traced indirect visual impact (parent components, shared styles)
115
+ - [ ] You identified all states that need visual comparison
116
+ - [ ] You checked for layout shift risks from CSS changes
117
+ - [ ] You assessed cross-browser impact where relevant
118
+ - [ ] The test matrix covers critical paths first
119
+ - [ ] Every test point describes specifically what to look for
120
+ - [ ] You provided both manual checklist and automation recommendations
121
+
122
+ ## Constraints
123
+
124
+ - Do NOT flag non-visual changes (pure logic, API calls, type changes) as needing visual testing.
125
+ - Do NOT skip any checklist category. If a category has no issues, explicitly state "No issues found."
126
+ - Do NOT suggest testing every possible state combination — focus on states likely affected by the specific changes.
127
+ - Do NOT recommend visual regression tools without considering the project's existing test infrastructure.
128
+ - Do NOT assume all visual changes are bugs — distinguish intentional changes from potential regressions.
129
+ - Prioritize test points by likelihood of regression, not exhaustiveness.
130
+
131
+ Target: $ARGUMENTS