fecode-cli 1.1.2 → 1.2.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.
- package/README.md +101 -10
- package/dist/error-D4a-8BXd.js +56 -0
- package/dist/index.js +9770 -4513
- package/dist/node.browser-2EgZAKSy.js +46 -0
- package/dist/node.browser-B5Gur0wd.js +46 -0
- package/dist/node.browser-BSlAsiSV.js +46 -0
- package/dist/node.browser-BraUi2yf.js +9 -0
- package/dist/node.browser-CdVAMgSg.js +46 -0
- package/dist/src-CSWdjU4j.js +31870 -0
- package/dist/src-DY3OmBmT.js +33646 -0
- package/dist/src-DcYf8vsK.js +31880 -0
- package/dist/src-DkWmcv2Q.js +33647 -0
- package/package.json +5 -2
- package/skills/accessibility/SKILL.md +98 -98
- package/skills/css/SKILL.md +90 -90
- package/skills/frontend-debugging/SKILL.md +201 -201
- package/skills/frontend-design/SKILL.md +358 -358
- package/skills/frontend-performance/SKILL.md +89 -89
- package/skills/frontend-testing/SKILL.md +87 -87
- package/skills/nextjs/SKILL.md +75 -75
- package/skills/react/SKILL.md +213 -213
- package/skills/responsive-design/SKILL.md +190 -190
- package/skills/svelte/SKILL.md +86 -86
- package/skills/tailwind/SKILL.md +74 -74
- package/skills/ui-review/SKILL.md +245 -245
- package/skills/vue/SKILL.md +72 -72
- package/dist/App.d.ts +0 -33
- package/dist/App.js +0 -2224
- package/dist/approvalResolver.d.ts +0 -12
- package/dist/approvalResolver.js +0 -112
- package/dist/commands.d.ts +0 -11
- package/dist/commands.js +0 -33
- package/dist/index.d.ts +0 -3
- package/dist/ui/AppShell.d.ts +0 -14
- package/dist/ui/AppShell.js +0 -25
- package/dist/ui/ApprovalPrompt.d.ts +0 -31
- package/dist/ui/ApprovalPrompt.js +0 -55
- package/dist/ui/BlockedView.d.ts +0 -13
- package/dist/ui/BlockedView.js +0 -7
- package/dist/ui/CommandPalette.d.ts +0 -8
- package/dist/ui/CommandPalette.js +0 -18
- package/dist/ui/CurrentStepView.d.ts +0 -16
- package/dist/ui/CurrentStepView.js +0 -28
- package/dist/ui/DiagnosticsView.d.ts +0 -45
- package/dist/ui/DiagnosticsView.js +0 -23
- package/dist/ui/ExecutionTimeline.d.ts +0 -15
- package/dist/ui/ExecutionTimeline.js +0 -51
- package/dist/ui/ExecutionView.d.ts +0 -42
- package/dist/ui/ExecutionView.js +0 -20
- package/dist/ui/Header.d.ts +0 -15
- package/dist/ui/Header.js +0 -47
- package/dist/ui/HelpView.d.ts +0 -3
- package/dist/ui/HelpView.js +0 -35
- package/dist/ui/MessageBubble.d.ts +0 -9
- package/dist/ui/MessageBubble.js +0 -58
- package/dist/ui/PlanStep.d.ts +0 -16
- package/dist/ui/PlanStep.js +0 -71
- package/dist/ui/PlanView.d.ts +0 -26
- package/dist/ui/PlanView.js +0 -24
- package/dist/ui/ProgressBar.d.ts +0 -10
- package/dist/ui/ProgressBar.js +0 -14
- package/dist/ui/RecoveryView.d.ts +0 -20
- package/dist/ui/RecoveryView.js +0 -19
- package/dist/ui/ReplanView.d.ts +0 -16
- package/dist/ui/ReplanView.js +0 -21
- package/dist/ui/ResumeView.d.ts +0 -15
- package/dist/ui/ResumeView.js +0 -25
- package/dist/ui/RiskNotice.d.ts +0 -10
- package/dist/ui/RiskNotice.js +0 -21
- package/dist/ui/RunHistoryView.d.ts +0 -15
- package/dist/ui/RunHistoryView.js +0 -39
- package/dist/ui/StatusBar.d.ts +0 -16
- package/dist/ui/StatusBar.js +0 -104
- package/dist/ui/TaskInput.d.ts +0 -15
- package/dist/ui/TaskInput.js +0 -8
- package/dist/ui/ThinkingBlock.d.ts +0 -8
- package/dist/ui/ThinkingBlock.js +0 -13
- package/dist/ui/ThinkingIndicator.d.ts +0 -7
- package/dist/ui/ThinkingIndicator.js +0 -20
- package/dist/ui/TurnView.d.ts +0 -13
- package/dist/ui/TurnView.js +0 -11
- package/dist/ui/WorkspaceStatus.d.ts +0 -20
- package/dist/ui/WorkspaceStatus.js +0 -23
- package/dist/ui/index.d.ts +0 -26
- package/dist/ui/index.js +0 -26
|
@@ -1,190 +1,190 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: responsive-design
|
|
3
|
-
description: Responsive layout design and debugging for interfaces that must work correctly across viewport sizes. Apply when creating new responsive layouts, fixing broken behavior at specific widths, adapting existing desktop UI for mobile, implementing fluid typography and spacing, debugging horizontal overflow, or reasoning about how UI components should behave between breakpoints.
|
|
4
|
-
category: frontend
|
|
5
|
-
version: 1.0.0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Responsive Design
|
|
9
|
-
|
|
10
|
-
## When to use
|
|
11
|
-
- Creating new layouts that must work at multiple viewport widths
|
|
12
|
-
- Fixing broken or degraded behavior at specific screen sizes
|
|
13
|
-
- Adapting existing desktop-first UI for mobile viewports
|
|
14
|
-
- Implementing fluid typography, spacing, or container sizing
|
|
15
|
-
- Debugging unexpected horizontal scrolling or overflow
|
|
16
|
-
- Reasoning about navigation behavior at small sizes
|
|
17
|
-
|
|
18
|
-
## When not to use
|
|
19
|
-
- Component-level logic with no layout impact
|
|
20
|
-
- Backend or data-layer work
|
|
21
|
-
- Accessibility-only improvements unrelated to layout
|
|
22
|
-
|
|
23
|
-
## Instructions
|
|
24
|
-
- Reason about content constraints and available space before reaching for media query solutions.
|
|
25
|
-
- Breakpoints should emerge from where content breaks, not from device specification lists.
|
|
26
|
-
- Design for behavior between breakpoints — not just at standard sm/md/lg values.
|
|
27
|
-
- Horizontal overflow is a defect unless explicitly required; treat it that way.
|
|
28
|
-
- Fluid sizing through relative units, clamp(), and intrinsic layout should reduce the need for many breakpoints.
|
|
29
|
-
- Inspect the project's existing responsive conventions before introducing new patterns.
|
|
30
|
-
|
|
31
|
-
## Design Thinking for Responsive Interfaces
|
|
32
|
-
|
|
33
|
-
Before implementing any responsive behavior, reason through:
|
|
34
|
-
|
|
35
|
-
1. **What does the content require?** Some content is inherently wide (data tables); some can reflow naturally (cards, text). Understand the content first.
|
|
36
|
-
2. **What is the most constrained valid layout?** Start from the narrowest layout that works, then consider how it should expand.
|
|
37
|
-
3. **Where does the layout actually break?** Find the real breakpoint by considering content, not by targeting device widths.
|
|
38
|
-
4. **What changes between viewport sizes?** Layout, typography, spacing, navigation, interaction — identify all axes of change.
|
|
39
|
-
5. **How should components behave?** Sidebars, tables, cards, modals, and navbars each have distinct responsive behaviors.
|
|
40
|
-
6. **What existing conventions does the project use?** Breakpoint values, container widths, column behavior — inspect before overriding.
|
|
41
|
-
|
|
42
|
-
## Breakpoints
|
|
43
|
-
|
|
44
|
-
**Use breakpoints where content requires them, not at arbitrary device widths.**
|
|
45
|
-
|
|
46
|
-
Signs a breakpoint is needed:
|
|
47
|
-
- Content becomes unreadable or inaccessible at a particular width
|
|
48
|
-
- A layout composition stops working (columns become too narrow, overflow occurs)
|
|
49
|
-
- Navigation must fundamentally change
|
|
50
|
-
|
|
51
|
-
Signs a breakpoint is unnecessary:
|
|
52
|
-
- You are adding it "for mobile" without a specific layout failure
|
|
53
|
-
- The layout was already fluid and would have worked without it
|
|
54
|
-
- You are targeting a device resolution rather than a content constraint
|
|
55
|
-
|
|
56
|
-
**Avoid breakpoint proliferation.** Three to four thoughtful breakpoints serve most layouts better than seven device-specific ones.
|
|
57
|
-
|
|
58
|
-
**Always check behavior between breakpoints.** Resize the viewport gradually, not just by snapping between predefined sizes.
|
|
59
|
-
|
|
60
|
-
## Fluid Layouts
|
|
61
|
-
|
|
62
|
-
**Container strategy**
|
|
63
|
-
- Max-width containers centered with `margin: auto` handle wide-screen scaling without additional breakpoints
|
|
64
|
-
- `min-width: 0` prevents flex/grid children from overflowing their containers
|
|
65
|
-
|
|
66
|
-
**Flexible columns**
|
|
67
|
-
- CSS Grid with `auto-fill` / `auto-fit` and `minmax()` handles column reflow without any media queries: `grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr))`
|
|
68
|
-
- Flexbox with `flex-wrap: wrap` and `flex-basis` allows natural reflow
|
|
69
|
-
|
|
70
|
-
**Relative and intrinsic sizing**
|
|
71
|
-
- Prefer `%`, `fr`, `ch`, `em`, `rem` over `px` for dimensions that should scale
|
|
72
|
-
- `min-width`, `max-width`, and `min-content` / `max-content` are layout tools, not edge cases
|
|
73
|
-
- `clamp(min, preferred, max)` handles fluid scaling without breakpoints for font sizes and spacing
|
|
74
|
-
|
|
75
|
-
## Typography in Responsive Layouts
|
|
76
|
-
|
|
77
|
-
**Heading size**
|
|
78
|
-
- Display headings that are appropriate at 1400px are often overwhelming on 375px
|
|
79
|
-
- Use `clamp()` for fluid heading sizes: `font-size: clamp(1.5rem, 4vw, 3rem)`
|
|
80
|
-
- Alternatively, reduce heading scale at narrower breakpoints
|
|
81
|
-
|
|
82
|
-
**Body text**
|
|
83
|
-
- Body text should remain readable at all widths — avoid sizes below 14px on mobile
|
|
84
|
-
- Line length (measure) should stay between 55–80ch; full-width body text on wide screens needs a `max-width` constraint
|
|
85
|
-
|
|
86
|
-
**Long content behavior**
|
|
87
|
-
- Define how long text behaves: truncation with ellipsis, clamped lines (`-webkit-line-clamp`), or full wrapping
|
|
88
|
-
- Labels, button text, and navigation items may need different truncation strategies
|
|
89
|
-
- Test with realistic content, not short placeholder text
|
|
90
|
-
|
|
91
|
-
## Navigation
|
|
92
|
-
|
|
93
|
-
Navigation often requires the most significant behavior change between viewport sizes.
|
|
94
|
-
|
|
95
|
-
**Desktop navigation**
|
|
96
|
-
- Horizontal nav bars work until they overflow; plan the overflow behavior before it becomes a bug
|
|
97
|
-
- Ensure keyboard and focus order remain logical
|
|
98
|
-
|
|
99
|
-
**Mobile navigation**
|
|
100
|
-
- Collapsed navigation (hamburger/drawer/bottom bar) each have different interaction models — choose deliberately based on depth and frequency of navigation
|
|
101
|
-
- Touch targets must be at least 44×44px
|
|
102
|
-
- Drawer/modal navigation must be keyboard-accessible and focusable
|
|
103
|
-
|
|
104
|
-
**Collapsing controls**
|
|
105
|
-
- Secondary toolbars, filter bars, and action sets often need to collapse or scroll on small screens
|
|
106
|
-
- Define the priority of visible actions when space is constrained
|
|
107
|
-
|
|
108
|
-
## Component Behavior Across Widths
|
|
109
|
-
|
|
110
|
-
Different components require different responsive strategies:
|
|
111
|
-
|
|
112
|
-
| Component | Common responsive behavior |
|
|
113
|
-
|-----------|---------------------------|
|
|
114
|
-
| **Tables** | Horizontal scroll, card reflow, or column collapsing |
|
|
115
|
-
| **Cards** | Reflow from multi-column to single-column grid |
|
|
116
|
-
| **Forms** | Stack labels above inputs; adjust field widths |
|
|
117
|
-
| **Sidebars** | Collapse into drawer, accordion, or hidden panel |
|
|
118
|
-
| **Dialogs/Modals** | Full-screen on mobile; centered overlay on desktop |
|
|
119
|
-
| **Toolbars** | Collapse secondary actions into overflow menu |
|
|
120
|
-
|
|
121
|
-
Do not apply the same responsive strategy to every component type. Match the strategy to the component's use case.
|
|
122
|
-
|
|
123
|
-
## Overflow
|
|
124
|
-
|
|
125
|
-
**Horizontal overflow is always a defect unless explicitly required.**
|
|
126
|
-
|
|
127
|
-
Common causes:
|
|
128
|
-
- Fixed-width children inside fluid parents
|
|
129
|
-
- Long unbreakable strings (URLs, code, long words without `overflow-wrap`)
|
|
130
|
-
- Tables without an overflow strategy
|
|
131
|
-
- Images without `max-width: 100%`
|
|
132
|
-
- Absolute/fixed positioned elements
|
|
133
|
-
|
|
134
|
-
Debugging overflow:
|
|
135
|
-
1. Add `outline: 1px solid red` to suspect elements temporarily
|
|
136
|
-
2. Check `min-width` constraints on flex/grid children (`min-width: 0` is frequently needed)
|
|
137
|
-
3. Inspect for any element with a hard-coded `width` wider than the viewport
|
|
138
|
-
|
|
139
|
-
## Design Workflow
|
|
140
|
-
|
|
141
|
-
1. Understand the content requirements and interaction model.
|
|
142
|
-
2. Inspect the project's existing responsive conventions (breakpoint values, container widths, grid patterns).
|
|
143
|
-
3. Identify the most constrained layout that must work.
|
|
144
|
-
4. Establish fluid base structure using relative units and intrinsic sizing.
|
|
145
|
-
5. Define breakpoints only where the layout genuinely breaks.
|
|
146
|
-
6. Implement responsive typography using `clamp()` or breakpoint-specific scale.
|
|
147
|
-
7. Handle navigation and component state changes at key widths.
|
|
148
|
-
8. Check for and eliminate horizontal overflow.
|
|
149
|
-
9. Review intermediate viewport widths — not just the breakpoint snap-points.
|
|
150
|
-
10. Verify with realistic content lengths, not just short placeholder text.
|
|
151
|
-
|
|
152
|
-
## Self-Review Checklist
|
|
153
|
-
|
|
154
|
-
Before considering responsive work complete:
|
|
155
|
-
|
|
156
|
-
- Does the layout work at 320px, 375px, 768px, 1024px, 1280px, and 1440px?
|
|
157
|
-
- Does anything break between those widths?
|
|
158
|
-
- Is there any horizontal overflow?
|
|
159
|
-
- Does the typography remain readable at all widths?
|
|
160
|
-
- Are touch targets at least 44×44px on mobile?
|
|
161
|
-
- Does navigation function at mobile sizes?
|
|
162
|
-
- Are all interactive states accessible at all widths (not just hover, which doesn't exist on touch)?
|
|
163
|
-
- Does the layout use the project's existing breakpoint conventions?
|
|
164
|
-
|
|
165
|
-
## Avoid
|
|
166
|
-
|
|
167
|
-
- Desktop layout simply shrinking linearly — content often requires structural changes, not just width reduction.
|
|
168
|
-
- Excessive breakpoints for every device size — let content drive breakpoints.
|
|
169
|
-
- Fixed pixel widths on components that must live in fluid parents.
|
|
170
|
-
- Horizontal overflow without an intentional overflow strategy.
|
|
171
|
-
- Touch targets smaller than 44×44px.
|
|
172
|
-
- `hover`-only interaction states — touch devices do not have hover.
|
|
173
|
-
- Duplicated desktop and mobile markup without a clear reason.
|
|
174
|
-
- Breakpoint-specific hacks that fix one width while breaking another.
|
|
175
|
-
|
|
176
|
-
## Examples
|
|
177
|
-
|
|
178
|
-
### Example: Card grid reflow without breakpoints
|
|
179
|
-
Use intrinsic responsive layout that reflows naturally:
|
|
180
|
-
```css
|
|
181
|
-
.card-grid {
|
|
182
|
-
display: grid;
|
|
183
|
-
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
|
184
|
-
gap: var(--space-4);
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
This single rule handles all viewport widths without any media queries.
|
|
188
|
-
|
|
189
|
-
### Example: Reasoning about a sidebar
|
|
190
|
-
Rather than hiding the sidebar at mobile widths with `display: none`, consider: What does the sidebar contain? If it contains navigation, it must be accessible somehow at mobile — as a drawer, a bottom nav, or an inline collapsed section. "Hide it" is not a responsive strategy.
|
|
1
|
+
---
|
|
2
|
+
name: responsive-design
|
|
3
|
+
description: Responsive layout design and debugging for interfaces that must work correctly across viewport sizes. Apply when creating new responsive layouts, fixing broken behavior at specific widths, adapting existing desktop UI for mobile, implementing fluid typography and spacing, debugging horizontal overflow, or reasoning about how UI components should behave between breakpoints.
|
|
4
|
+
category: frontend
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Responsive Design
|
|
9
|
+
|
|
10
|
+
## When to use
|
|
11
|
+
- Creating new layouts that must work at multiple viewport widths
|
|
12
|
+
- Fixing broken or degraded behavior at specific screen sizes
|
|
13
|
+
- Adapting existing desktop-first UI for mobile viewports
|
|
14
|
+
- Implementing fluid typography, spacing, or container sizing
|
|
15
|
+
- Debugging unexpected horizontal scrolling or overflow
|
|
16
|
+
- Reasoning about navigation behavior at small sizes
|
|
17
|
+
|
|
18
|
+
## When not to use
|
|
19
|
+
- Component-level logic with no layout impact
|
|
20
|
+
- Backend or data-layer work
|
|
21
|
+
- Accessibility-only improvements unrelated to layout
|
|
22
|
+
|
|
23
|
+
## Instructions
|
|
24
|
+
- Reason about content constraints and available space before reaching for media query solutions.
|
|
25
|
+
- Breakpoints should emerge from where content breaks, not from device specification lists.
|
|
26
|
+
- Design for behavior between breakpoints — not just at standard sm/md/lg values.
|
|
27
|
+
- Horizontal overflow is a defect unless explicitly required; treat it that way.
|
|
28
|
+
- Fluid sizing through relative units, clamp(), and intrinsic layout should reduce the need for many breakpoints.
|
|
29
|
+
- Inspect the project's existing responsive conventions before introducing new patterns.
|
|
30
|
+
|
|
31
|
+
## Design Thinking for Responsive Interfaces
|
|
32
|
+
|
|
33
|
+
Before implementing any responsive behavior, reason through:
|
|
34
|
+
|
|
35
|
+
1. **What does the content require?** Some content is inherently wide (data tables); some can reflow naturally (cards, text). Understand the content first.
|
|
36
|
+
2. **What is the most constrained valid layout?** Start from the narrowest layout that works, then consider how it should expand.
|
|
37
|
+
3. **Where does the layout actually break?** Find the real breakpoint by considering content, not by targeting device widths.
|
|
38
|
+
4. **What changes between viewport sizes?** Layout, typography, spacing, navigation, interaction — identify all axes of change.
|
|
39
|
+
5. **How should components behave?** Sidebars, tables, cards, modals, and navbars each have distinct responsive behaviors.
|
|
40
|
+
6. **What existing conventions does the project use?** Breakpoint values, container widths, column behavior — inspect before overriding.
|
|
41
|
+
|
|
42
|
+
## Breakpoints
|
|
43
|
+
|
|
44
|
+
**Use breakpoints where content requires them, not at arbitrary device widths.**
|
|
45
|
+
|
|
46
|
+
Signs a breakpoint is needed:
|
|
47
|
+
- Content becomes unreadable or inaccessible at a particular width
|
|
48
|
+
- A layout composition stops working (columns become too narrow, overflow occurs)
|
|
49
|
+
- Navigation must fundamentally change
|
|
50
|
+
|
|
51
|
+
Signs a breakpoint is unnecessary:
|
|
52
|
+
- You are adding it "for mobile" without a specific layout failure
|
|
53
|
+
- The layout was already fluid and would have worked without it
|
|
54
|
+
- You are targeting a device resolution rather than a content constraint
|
|
55
|
+
|
|
56
|
+
**Avoid breakpoint proliferation.** Three to four thoughtful breakpoints serve most layouts better than seven device-specific ones.
|
|
57
|
+
|
|
58
|
+
**Always check behavior between breakpoints.** Resize the viewport gradually, not just by snapping between predefined sizes.
|
|
59
|
+
|
|
60
|
+
## Fluid Layouts
|
|
61
|
+
|
|
62
|
+
**Container strategy**
|
|
63
|
+
- Max-width containers centered with `margin: auto` handle wide-screen scaling without additional breakpoints
|
|
64
|
+
- `min-width: 0` prevents flex/grid children from overflowing their containers
|
|
65
|
+
|
|
66
|
+
**Flexible columns**
|
|
67
|
+
- CSS Grid with `auto-fill` / `auto-fit` and `minmax()` handles column reflow without any media queries: `grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr))`
|
|
68
|
+
- Flexbox with `flex-wrap: wrap` and `flex-basis` allows natural reflow
|
|
69
|
+
|
|
70
|
+
**Relative and intrinsic sizing**
|
|
71
|
+
- Prefer `%`, `fr`, `ch`, `em`, `rem` over `px` for dimensions that should scale
|
|
72
|
+
- `min-width`, `max-width`, and `min-content` / `max-content` are layout tools, not edge cases
|
|
73
|
+
- `clamp(min, preferred, max)` handles fluid scaling without breakpoints for font sizes and spacing
|
|
74
|
+
|
|
75
|
+
## Typography in Responsive Layouts
|
|
76
|
+
|
|
77
|
+
**Heading size**
|
|
78
|
+
- Display headings that are appropriate at 1400px are often overwhelming on 375px
|
|
79
|
+
- Use `clamp()` for fluid heading sizes: `font-size: clamp(1.5rem, 4vw, 3rem)`
|
|
80
|
+
- Alternatively, reduce heading scale at narrower breakpoints
|
|
81
|
+
|
|
82
|
+
**Body text**
|
|
83
|
+
- Body text should remain readable at all widths — avoid sizes below 14px on mobile
|
|
84
|
+
- Line length (measure) should stay between 55–80ch; full-width body text on wide screens needs a `max-width` constraint
|
|
85
|
+
|
|
86
|
+
**Long content behavior**
|
|
87
|
+
- Define how long text behaves: truncation with ellipsis, clamped lines (`-webkit-line-clamp`), or full wrapping
|
|
88
|
+
- Labels, button text, and navigation items may need different truncation strategies
|
|
89
|
+
- Test with realistic content, not short placeholder text
|
|
90
|
+
|
|
91
|
+
## Navigation
|
|
92
|
+
|
|
93
|
+
Navigation often requires the most significant behavior change between viewport sizes.
|
|
94
|
+
|
|
95
|
+
**Desktop navigation**
|
|
96
|
+
- Horizontal nav bars work until they overflow; plan the overflow behavior before it becomes a bug
|
|
97
|
+
- Ensure keyboard and focus order remain logical
|
|
98
|
+
|
|
99
|
+
**Mobile navigation**
|
|
100
|
+
- Collapsed navigation (hamburger/drawer/bottom bar) each have different interaction models — choose deliberately based on depth and frequency of navigation
|
|
101
|
+
- Touch targets must be at least 44×44px
|
|
102
|
+
- Drawer/modal navigation must be keyboard-accessible and focusable
|
|
103
|
+
|
|
104
|
+
**Collapsing controls**
|
|
105
|
+
- Secondary toolbars, filter bars, and action sets often need to collapse or scroll on small screens
|
|
106
|
+
- Define the priority of visible actions when space is constrained
|
|
107
|
+
|
|
108
|
+
## Component Behavior Across Widths
|
|
109
|
+
|
|
110
|
+
Different components require different responsive strategies:
|
|
111
|
+
|
|
112
|
+
| Component | Common responsive behavior |
|
|
113
|
+
|-----------|---------------------------|
|
|
114
|
+
| **Tables** | Horizontal scroll, card reflow, or column collapsing |
|
|
115
|
+
| **Cards** | Reflow from multi-column to single-column grid |
|
|
116
|
+
| **Forms** | Stack labels above inputs; adjust field widths |
|
|
117
|
+
| **Sidebars** | Collapse into drawer, accordion, or hidden panel |
|
|
118
|
+
| **Dialogs/Modals** | Full-screen on mobile; centered overlay on desktop |
|
|
119
|
+
| **Toolbars** | Collapse secondary actions into overflow menu |
|
|
120
|
+
|
|
121
|
+
Do not apply the same responsive strategy to every component type. Match the strategy to the component's use case.
|
|
122
|
+
|
|
123
|
+
## Overflow
|
|
124
|
+
|
|
125
|
+
**Horizontal overflow is always a defect unless explicitly required.**
|
|
126
|
+
|
|
127
|
+
Common causes:
|
|
128
|
+
- Fixed-width children inside fluid parents
|
|
129
|
+
- Long unbreakable strings (URLs, code, long words without `overflow-wrap`)
|
|
130
|
+
- Tables without an overflow strategy
|
|
131
|
+
- Images without `max-width: 100%`
|
|
132
|
+
- Absolute/fixed positioned elements
|
|
133
|
+
|
|
134
|
+
Debugging overflow:
|
|
135
|
+
1. Add `outline: 1px solid red` to suspect elements temporarily
|
|
136
|
+
2. Check `min-width` constraints on flex/grid children (`min-width: 0` is frequently needed)
|
|
137
|
+
3. Inspect for any element with a hard-coded `width` wider than the viewport
|
|
138
|
+
|
|
139
|
+
## Design Workflow
|
|
140
|
+
|
|
141
|
+
1. Understand the content requirements and interaction model.
|
|
142
|
+
2. Inspect the project's existing responsive conventions (breakpoint values, container widths, grid patterns).
|
|
143
|
+
3. Identify the most constrained layout that must work.
|
|
144
|
+
4. Establish fluid base structure using relative units and intrinsic sizing.
|
|
145
|
+
5. Define breakpoints only where the layout genuinely breaks.
|
|
146
|
+
6. Implement responsive typography using `clamp()` or breakpoint-specific scale.
|
|
147
|
+
7. Handle navigation and component state changes at key widths.
|
|
148
|
+
8. Check for and eliminate horizontal overflow.
|
|
149
|
+
9. Review intermediate viewport widths — not just the breakpoint snap-points.
|
|
150
|
+
10. Verify with realistic content lengths, not just short placeholder text.
|
|
151
|
+
|
|
152
|
+
## Self-Review Checklist
|
|
153
|
+
|
|
154
|
+
Before considering responsive work complete:
|
|
155
|
+
|
|
156
|
+
- Does the layout work at 320px, 375px, 768px, 1024px, 1280px, and 1440px?
|
|
157
|
+
- Does anything break between those widths?
|
|
158
|
+
- Is there any horizontal overflow?
|
|
159
|
+
- Does the typography remain readable at all widths?
|
|
160
|
+
- Are touch targets at least 44×44px on mobile?
|
|
161
|
+
- Does navigation function at mobile sizes?
|
|
162
|
+
- Are all interactive states accessible at all widths (not just hover, which doesn't exist on touch)?
|
|
163
|
+
- Does the layout use the project's existing breakpoint conventions?
|
|
164
|
+
|
|
165
|
+
## Avoid
|
|
166
|
+
|
|
167
|
+
- Desktop layout simply shrinking linearly — content often requires structural changes, not just width reduction.
|
|
168
|
+
- Excessive breakpoints for every device size — let content drive breakpoints.
|
|
169
|
+
- Fixed pixel widths on components that must live in fluid parents.
|
|
170
|
+
- Horizontal overflow without an intentional overflow strategy.
|
|
171
|
+
- Touch targets smaller than 44×44px.
|
|
172
|
+
- `hover`-only interaction states — touch devices do not have hover.
|
|
173
|
+
- Duplicated desktop and mobile markup without a clear reason.
|
|
174
|
+
- Breakpoint-specific hacks that fix one width while breaking another.
|
|
175
|
+
|
|
176
|
+
## Examples
|
|
177
|
+
|
|
178
|
+
### Example: Card grid reflow without breakpoints
|
|
179
|
+
Use intrinsic responsive layout that reflows naturally:
|
|
180
|
+
```css
|
|
181
|
+
.card-grid {
|
|
182
|
+
display: grid;
|
|
183
|
+
grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
|
|
184
|
+
gap: var(--space-4);
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
This single rule handles all viewport widths without any media queries.
|
|
188
|
+
|
|
189
|
+
### Example: Reasoning about a sidebar
|
|
190
|
+
Rather than hiding the sidebar at mobile widths with `display: none`, consider: What does the sidebar contain? If it contains navigation, it must be accessible somehow at mobile — as a drawer, a bottom nav, or an inline collapsed section. "Hide it" is not a responsive strategy.
|
package/skills/svelte/SKILL.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: svelte
|
|
3
|
-
description: Svelte components, compiler-driven reactivity, local/derived state, and SvelteKit boundaries.
|
|
4
|
-
category: framework
|
|
5
|
-
version: 2.1.0
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## When to use
|
|
9
|
-
|
|
10
|
-
- authoring Svelte components
|
|
11
|
-
- handling Svelte reactive statements
|
|
12
|
-
- working with Svelte stores or SvelteKit
|
|
13
|
-
|
|
14
|
-
## Instructions
|
|
15
|
-
|
|
16
|
-
### Project Detection & Existing Rules
|
|
17
|
-
- **Version Detection**: The agent must inspect the project's Svelte version (e.g., Svelte 3/4 vs Svelte 5).
|
|
18
|
-
- Distinguish modern Svelte patterns (like runes in Svelte 5: `$state`, `$derived`) from older syntax.
|
|
19
|
-
- **Do not blindly apply legacy syntax** to a modern project, and do not force modern runes on older projects.
|
|
20
|
-
- **SvelteKit Check**: Inspect if the project uses SvelteKit. **Do not assume SvelteKit** when the project is plain Svelte.
|
|
21
|
-
|
|
22
|
-
### Core Mental Model
|
|
23
|
-
- **Component-based UI**: Svelte compiles components to highly efficient imperative code.
|
|
24
|
-
- **Compiler-driven reactivity**: Assignments (or runes) trigger updates, no virtual DOM overhead.
|
|
25
|
-
- **Local State**: State scoped to a component.
|
|
26
|
-
- **Derived State**: Values that automatically update when dependencies change.
|
|
27
|
-
- **Effects**: Side-effects triggered by state changes.
|
|
28
|
-
|
|
29
|
-
### Components
|
|
30
|
-
- Single-file components (`.svelte`) contain `<script>`, HTML markup, and scoped `<style>`.
|
|
31
|
-
- Understand composition, slots/snippets, and clear component boundaries.
|
|
32
|
-
|
|
33
|
-
### Props
|
|
34
|
-
- Explain the appropriate prop mechanism for the project's Svelte version (`export let` in Svelte 3/4 vs `let { prop } = $props()` in Svelte 5).
|
|
35
|
-
- Respect existing project conventions.
|
|
36
|
-
|
|
37
|
-
### Reactivity
|
|
38
|
-
- Cover local state, derived values, effects, and dependency tracking.
|
|
39
|
-
- Explain version-specific differences when relevant (`$:` vs runes).
|
|
40
|
-
|
|
41
|
-
### Events / Communication
|
|
42
|
-
- Parent-child communication via props and events.
|
|
43
|
-
- Use callbacks or event dispatchers (`createEventDispatcher`) appropriate to the project's Svelte version.
|
|
44
|
-
- Do not force legacy APIs when modern conventions are already used.
|
|
45
|
-
|
|
46
|
-
### Stores
|
|
47
|
-
- Stores are useful for shared state, cross-component state, or application-level state.
|
|
48
|
-
- **Do not use stores for state that naturally belongs to a component.** Keep local state local.
|
|
49
|
-
|
|
50
|
-
### Lifecycle
|
|
51
|
-
- Initialization, cleanup, subscriptions, and browser-only behavior (`onMount`, `onDestroy`).
|
|
52
|
-
|
|
53
|
-
### SvelteKit
|
|
54
|
-
- **Only apply SvelteKit guidance when the project actually uses SvelteKit.**
|
|
55
|
-
- Routing, load/data patterns (`+page.ts`, `+page.server.ts`).
|
|
56
|
-
- Form actions and server/client boundaries.
|
|
57
|
-
- Hooks and page/layout structure.
|
|
58
|
-
|
|
59
|
-
### Common Failure Modes
|
|
60
|
-
- **Incorrect reactive assumptions**: Expecting reactivity from object mutation without reassignment (Svelte 3/4).
|
|
61
|
-
- **Unnecessary stores**: Using a global store for a value that is only used inside one component.
|
|
62
|
-
- **Browser/server mistakes**: Using `window` during SSR.
|
|
63
|
-
- **Lifecycle misuse**: Running heavy logic in component initialization instead of `onMount`.
|
|
64
|
-
- **Unnecessary client-side work**: Failing to utilize SvelteKit server load functions.
|
|
65
|
-
|
|
66
|
-
## Anti-Patterns
|
|
67
|
-
|
|
68
|
-
- **Mutating objects without reassignment (Svelte 3/4)**
|
|
69
|
-
- *What*: Calling `.push()` on an array instead of reassigning it.
|
|
70
|
-
- *Why*: The Svelte compiler tracks assignments (`=`). Array `.push()` or object mutations won't trigger updates.
|
|
71
|
-
- *Instead*: Reassign the variable (e.g. `arr = [...arr, newItem]`).
|
|
72
|
-
- **Overusing global stores**
|
|
73
|
-
- *What*: Creating a store for simple component-level UI state (like an "isOpen" toggle).
|
|
74
|
-
- *Why*: It breaks encapsulation and makes components harder to test.
|
|
75
|
-
- *Instead*: Pass props or use context for localized tree state.
|
|
76
|
-
|
|
77
|
-
## Workflow
|
|
78
|
-
|
|
79
|
-
### Debugging
|
|
80
|
-
- Inspect reactive statements and dependencies.
|
|
81
|
-
- Use `console.log` inside reactive blocks to trace data flow.
|
|
82
|
-
- Follow `frontend-debugging` workflow when diagnosing rendering problems.
|
|
83
|
-
|
|
84
|
-
### Verification
|
|
85
|
-
- Typecheck using `svelte-check` or the project's `tsc` setup.
|
|
86
|
-
- Run project lint, test, and build scripts.
|
|
1
|
+
---
|
|
2
|
+
name: svelte
|
|
3
|
+
description: Svelte components, compiler-driven reactivity, local/derived state, and SvelteKit boundaries.
|
|
4
|
+
category: framework
|
|
5
|
+
version: 2.1.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## When to use
|
|
9
|
+
|
|
10
|
+
- authoring Svelte components
|
|
11
|
+
- handling Svelte reactive statements
|
|
12
|
+
- working with Svelte stores or SvelteKit
|
|
13
|
+
|
|
14
|
+
## Instructions
|
|
15
|
+
|
|
16
|
+
### Project Detection & Existing Rules
|
|
17
|
+
- **Version Detection**: The agent must inspect the project's Svelte version (e.g., Svelte 3/4 vs Svelte 5).
|
|
18
|
+
- Distinguish modern Svelte patterns (like runes in Svelte 5: `$state`, `$derived`) from older syntax.
|
|
19
|
+
- **Do not blindly apply legacy syntax** to a modern project, and do not force modern runes on older projects.
|
|
20
|
+
- **SvelteKit Check**: Inspect if the project uses SvelteKit. **Do not assume SvelteKit** when the project is plain Svelte.
|
|
21
|
+
|
|
22
|
+
### Core Mental Model
|
|
23
|
+
- **Component-based UI**: Svelte compiles components to highly efficient imperative code.
|
|
24
|
+
- **Compiler-driven reactivity**: Assignments (or runes) trigger updates, no virtual DOM overhead.
|
|
25
|
+
- **Local State**: State scoped to a component.
|
|
26
|
+
- **Derived State**: Values that automatically update when dependencies change.
|
|
27
|
+
- **Effects**: Side-effects triggered by state changes.
|
|
28
|
+
|
|
29
|
+
### Components
|
|
30
|
+
- Single-file components (`.svelte`) contain `<script>`, HTML markup, and scoped `<style>`.
|
|
31
|
+
- Understand composition, slots/snippets, and clear component boundaries.
|
|
32
|
+
|
|
33
|
+
### Props
|
|
34
|
+
- Explain the appropriate prop mechanism for the project's Svelte version (`export let` in Svelte 3/4 vs `let { prop } = $props()` in Svelte 5).
|
|
35
|
+
- Respect existing project conventions.
|
|
36
|
+
|
|
37
|
+
### Reactivity
|
|
38
|
+
- Cover local state, derived values, effects, and dependency tracking.
|
|
39
|
+
- Explain version-specific differences when relevant (`$:` vs runes).
|
|
40
|
+
|
|
41
|
+
### Events / Communication
|
|
42
|
+
- Parent-child communication via props and events.
|
|
43
|
+
- Use callbacks or event dispatchers (`createEventDispatcher`) appropriate to the project's Svelte version.
|
|
44
|
+
- Do not force legacy APIs when modern conventions are already used.
|
|
45
|
+
|
|
46
|
+
### Stores
|
|
47
|
+
- Stores are useful for shared state, cross-component state, or application-level state.
|
|
48
|
+
- **Do not use stores for state that naturally belongs to a component.** Keep local state local.
|
|
49
|
+
|
|
50
|
+
### Lifecycle
|
|
51
|
+
- Initialization, cleanup, subscriptions, and browser-only behavior (`onMount`, `onDestroy`).
|
|
52
|
+
|
|
53
|
+
### SvelteKit
|
|
54
|
+
- **Only apply SvelteKit guidance when the project actually uses SvelteKit.**
|
|
55
|
+
- Routing, load/data patterns (`+page.ts`, `+page.server.ts`).
|
|
56
|
+
- Form actions and server/client boundaries.
|
|
57
|
+
- Hooks and page/layout structure.
|
|
58
|
+
|
|
59
|
+
### Common Failure Modes
|
|
60
|
+
- **Incorrect reactive assumptions**: Expecting reactivity from object mutation without reassignment (Svelte 3/4).
|
|
61
|
+
- **Unnecessary stores**: Using a global store for a value that is only used inside one component.
|
|
62
|
+
- **Browser/server mistakes**: Using `window` during SSR.
|
|
63
|
+
- **Lifecycle misuse**: Running heavy logic in component initialization instead of `onMount`.
|
|
64
|
+
- **Unnecessary client-side work**: Failing to utilize SvelteKit server load functions.
|
|
65
|
+
|
|
66
|
+
## Anti-Patterns
|
|
67
|
+
|
|
68
|
+
- **Mutating objects without reassignment (Svelte 3/4)**
|
|
69
|
+
- *What*: Calling `.push()` on an array instead of reassigning it.
|
|
70
|
+
- *Why*: The Svelte compiler tracks assignments (`=`). Array `.push()` or object mutations won't trigger updates.
|
|
71
|
+
- *Instead*: Reassign the variable (e.g. `arr = [...arr, newItem]`).
|
|
72
|
+
- **Overusing global stores**
|
|
73
|
+
- *What*: Creating a store for simple component-level UI state (like an "isOpen" toggle).
|
|
74
|
+
- *Why*: It breaks encapsulation and makes components harder to test.
|
|
75
|
+
- *Instead*: Pass props or use context for localized tree state.
|
|
76
|
+
|
|
77
|
+
## Workflow
|
|
78
|
+
|
|
79
|
+
### Debugging
|
|
80
|
+
- Inspect reactive statements and dependencies.
|
|
81
|
+
- Use `console.log` inside reactive blocks to trace data flow.
|
|
82
|
+
- Follow `frontend-debugging` workflow when diagnosing rendering problems.
|
|
83
|
+
|
|
84
|
+
### Verification
|
|
85
|
+
- Typecheck using `svelte-check` or the project's `tsc` setup.
|
|
86
|
+
- Run project lint, test, and build scripts.
|