fecode-cli 1.0.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.
Files changed (74) hide show
  1. package/dist/App.d.ts +33 -0
  2. package/dist/App.js +2224 -0
  3. package/dist/approvalResolver.d.ts +12 -0
  4. package/dist/approvalResolver.js +112 -0
  5. package/dist/commands.d.ts +11 -0
  6. package/dist/commands.js +33 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +15175 -0
  9. package/dist/ui/AppShell.d.ts +14 -0
  10. package/dist/ui/AppShell.js +25 -0
  11. package/dist/ui/ApprovalPrompt.d.ts +31 -0
  12. package/dist/ui/ApprovalPrompt.js +55 -0
  13. package/dist/ui/BlockedView.d.ts +13 -0
  14. package/dist/ui/BlockedView.js +7 -0
  15. package/dist/ui/CommandPalette.d.ts +8 -0
  16. package/dist/ui/CommandPalette.js +18 -0
  17. package/dist/ui/CurrentStepView.d.ts +16 -0
  18. package/dist/ui/CurrentStepView.js +28 -0
  19. package/dist/ui/DiagnosticsView.d.ts +45 -0
  20. package/dist/ui/DiagnosticsView.js +23 -0
  21. package/dist/ui/ExecutionTimeline.d.ts +15 -0
  22. package/dist/ui/ExecutionTimeline.js +51 -0
  23. package/dist/ui/ExecutionView.d.ts +42 -0
  24. package/dist/ui/ExecutionView.js +20 -0
  25. package/dist/ui/Header.d.ts +15 -0
  26. package/dist/ui/Header.js +47 -0
  27. package/dist/ui/HelpView.d.ts +3 -0
  28. package/dist/ui/HelpView.js +35 -0
  29. package/dist/ui/MessageBubble.d.ts +9 -0
  30. package/dist/ui/MessageBubble.js +58 -0
  31. package/dist/ui/PlanStep.d.ts +16 -0
  32. package/dist/ui/PlanStep.js +71 -0
  33. package/dist/ui/PlanView.d.ts +26 -0
  34. package/dist/ui/PlanView.js +24 -0
  35. package/dist/ui/ProgressBar.d.ts +10 -0
  36. package/dist/ui/ProgressBar.js +14 -0
  37. package/dist/ui/RecoveryView.d.ts +20 -0
  38. package/dist/ui/RecoveryView.js +19 -0
  39. package/dist/ui/ReplanView.d.ts +16 -0
  40. package/dist/ui/ReplanView.js +21 -0
  41. package/dist/ui/ResumeView.d.ts +15 -0
  42. package/dist/ui/ResumeView.js +25 -0
  43. package/dist/ui/RiskNotice.d.ts +10 -0
  44. package/dist/ui/RiskNotice.js +21 -0
  45. package/dist/ui/RunHistoryView.d.ts +15 -0
  46. package/dist/ui/RunHistoryView.js +39 -0
  47. package/dist/ui/StatusBar.d.ts +16 -0
  48. package/dist/ui/StatusBar.js +104 -0
  49. package/dist/ui/TaskInput.d.ts +15 -0
  50. package/dist/ui/TaskInput.js +8 -0
  51. package/dist/ui/ThinkingBlock.d.ts +8 -0
  52. package/dist/ui/ThinkingBlock.js +13 -0
  53. package/dist/ui/ThinkingIndicator.d.ts +7 -0
  54. package/dist/ui/ThinkingIndicator.js +20 -0
  55. package/dist/ui/TurnView.d.ts +13 -0
  56. package/dist/ui/TurnView.js +11 -0
  57. package/dist/ui/WorkspaceStatus.d.ts +20 -0
  58. package/dist/ui/WorkspaceStatus.js +23 -0
  59. package/dist/ui/index.d.ts +26 -0
  60. package/dist/ui/index.js +26 -0
  61. package/package.json +42 -0
  62. package/skills/accessibility/SKILL.md +98 -0
  63. package/skills/css/SKILL.md +90 -0
  64. package/skills/frontend-debugging/SKILL.md +201 -0
  65. package/skills/frontend-design/SKILL.md +358 -0
  66. package/skills/frontend-performance/SKILL.md +89 -0
  67. package/skills/frontend-testing/SKILL.md +87 -0
  68. package/skills/nextjs/SKILL.md +75 -0
  69. package/skills/react/SKILL.md +213 -0
  70. package/skills/responsive-design/SKILL.md +190 -0
  71. package/skills/svelte/SKILL.md +86 -0
  72. package/skills/tailwind/SKILL.md +74 -0
  73. package/skills/ui-review/SKILL.md +245 -0
  74. package/skills/vue/SKILL.md +72 -0
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: react
3
+ description: React component architecture, state management, effect guidelines, and rendering behavior.
4
+ category: framework
5
+ version: 2.1.0
6
+ ---
7
+
8
+ ## When to use
9
+
10
+ - writing React components
11
+ - managing React state
12
+ - authoring custom hooks
13
+ - React application
14
+ - JSX/TSX React work
15
+
16
+ ## When not to use
17
+
18
+ - non-React frontend work
19
+
20
+ ## Instructions
21
+
22
+ ### Project Detection & Existing Rules
23
+ - **Inspect package.json**: Identify the React version (e.g. 17 vs 18 vs 19).
24
+ - **Inspect established conventions**: Check how the project handles state, side effects, and composition.
25
+ - **Follow existing patterns**: Do not impose a new architecture (like switching state management libraries) simply because it is preferred, unless explicitly requested.
26
+
27
+ ### Core Mental Model
28
+ - **Components**: UI rendering units receiving inputs (props) and returning UI.
29
+ - **Props**: Immutable inputs from parents.
30
+ - **State**: Owned mutable UI state; changing it triggers re-renders.
31
+ - **Derived Values**: Variables calculated from props or state during render. They are not state themselves.
32
+ - **One-way Data Flow**: Data flows down, actions flow up.
33
+
34
+ ### Common Failure Modes
35
+ - **Stale Closure**:
36
+ - *What it looks like*: A function (like inside an effect or timeout) uses an old value of state or props, rather than the latest.
37
+ - *Common cause*: Missing or incorrect dependency arrays in hooks (`useEffect`, `useCallback`).
38
+ - *What to inspect*: The dependency array of the hook and the variables referenced inside the closure.
39
+ - *Appropriate fix*: Add missing dependencies, use the functional state updater (e.g., `setCount(c => c + 1)`), or use `useRef` for values that shouldn't trigger renders but need to be fresh.
40
+ - **Infinite Effect Loop**:
41
+ - *What it looks like*: The browser hangs or the console floods with re-render warnings.
42
+ - *Common cause*: Unstable dependencies (e.g., creating a new object/array/function on every render and passing it to a dependency array) or state updates inside effects that re-trigger the same effect.
43
+ - *What to inspect*: The dependency array and state setters inside the effect.
44
+ - *Appropriate fix*: Stabilize dependencies with `useMemo`/`useCallback`, move logic inside the effect, or determine whether the effect should exist at all (often it can be derived during render).
45
+ - **State Out of Sync**:
46
+ - *What it looks like*: Updating one piece of state doesn't update related UI.
47
+ - *Common cause*: Duplicated state (e.g., passing a prop and storing it in state) or derived state stored separately.
48
+ - *What to inspect*: Multiple competing sources of truth.
49
+ - *Appropriate fix*: Lift state up or compute the derived value directly during render.
50
+ - **Incorrect Keys**:
51
+ - *What it looks like*: List items re-render completely, input focus is lost, or the wrong item is deleted.
52
+ - *Common cause*: Using array indexes as keys when list ordering or identity changes (e.g., filtering, sorting, or prepending items).
53
+ - *What to inspect*: The `key` prop on mapped list elements.
54
+ - *Appropriate fix*: Use a unique, stable identifier (like a database ID) for the `key`. Array indexes are only acceptable if the list is completely static and never changes order or size.
55
+ - **Hydration / Server Rendering Problems**:
56
+ - *What it looks like*: Console warnings about text content not matching between server and client, or broken styling on load. (Only relevant when the project uses SSR/server rendering like Next.js or Remix).
57
+ - *Common cause*: Using browser-only values (like `window.innerWidth` or `localStorage`) during the initial render.
58
+ - *Appropriate fix*: Wait until the component mounts (inside `useEffect`) to read browser-only values, or conditionally render the client-specific UI.
59
+
60
+ ## Rules
61
+
62
+ ### State
63
+ Before adding state, determine:
64
+ - Is the value independently mutable?
65
+ - Can it be derived from existing props/state?
66
+ - Who owns the value?
67
+ - Does another component need it?
68
+ Prefer derived values when possible. Avoid duplicated sources of truth.
69
+ *Why*: Deriving values guarantees they are always in sync with the source of truth, eliminating entire classes of synchronization bugs.
70
+
71
+ ### Effects
72
+ Before adding `useEffect`, determine:
73
+ - Is React synchronizing with an external system?
74
+ - Could this logic happen during render?
75
+ - Could this logic happen inside an event handler?
76
+ - Is this actually derived state?
77
+ Prefer avoiding an effect when no external synchronization is required.
78
+ *Good*: subscriptions, timers, DOM synchronization, external APIs where appropriate.
79
+ *Bad*: deriving one state value from another, transforming props into state unnecessarily, responding to a button click that belongs in an event handler.
80
+
81
+ ### Component Extraction
82
+ Before extracting a component, determine:
83
+ - Does it have a clear responsibility?
84
+ - Does extraction improve readability?
85
+ - Is the component actually reusable?
86
+ - Does extraction clarify state ownership?
87
+ Do not extract every small JSX fragment. Only extract when it serves a structural, reuse, or performance purpose.
88
+
89
+ ### Custom Hooks
90
+ Before creating a custom hook, determine whether:
91
+ - stateful behavior is reused
92
+ - effect/subscription logic is reused
93
+ - a meaningful behavioral abstraction exists
94
+ Do not create hooks merely to move code into another file.
95
+
96
+ ### Context
97
+ Before introducing Context, determine:
98
+ - Is the value genuinely shared across a subtree?
99
+ - Would composition (passing components as props/children) solve the problem?
100
+ - Is the value application-wide or merely needed by nearby components?
101
+ Do not use Context as a default replacement for props.
102
+ Do not introduce a state-management library unless requested or already used.
103
+
104
+ ### Memoization
105
+ Before using `useMemo`, `useCallback`, or `React.memo`, determine whether there is an actual performance problem.
106
+ Prefer simple code unless profiling or a clear rendering-cost problem justifies memoization. Memoization has its own complexity, costs memory, and is not automatically an optimization.
107
+
108
+ ### Controlled vs Uncontrolled Inputs
109
+ Controlled when:
110
+ - UI state must immediately drive application state
111
+ - validation depends on current value
112
+ - other UI reacts to the value
113
+ Uncontrolled when:
114
+ - the form is simple
115
+ - DOM ownership is sufficient
116
+ - continuous React state updates are unnecessary
117
+ Do not prescribe one universally.
118
+
119
+ ### Server State vs UI State
120
+ Make the distinction clear:
121
+ - *UI state*: modal open/closed, selected tab, input value.
122
+ - *Server state*: API data, remote resources, cacheable backend data.
123
+ Do not treat server data as ordinary local component state when the project already has an established server-state/data-fetching solution (like React Query, SWR, Apollo, or framework-specific routers). Do not introduce a new library.
124
+
125
+ ## Workflow
126
+
127
+ 1. **Inspect package.json and React version**: Understand what APIs are available.
128
+ 2. **Inspect nearby components**: Understand the context of the files you are modifying.
129
+ 3. **Identify existing state/data-fetching conventions**: Respect the established architecture.
130
+ 4. **Identify ownership of the state being changed**: Ensure you modify the state at the correct level of the component tree.
131
+ 5. **Determine whether the change needs state, derived values, effects, context, or a custom hook**: Apply the decision rules before writing code.
132
+ 6. **Make the smallest change consistent with existing architecture**: Do not blindly rewrite surrounding code or impose new patterns.
133
+ 7. **Check loading, error, empty, and interaction states**: Ensure the UI handles edge cases gracefully where relevant.
134
+ 8. **Run the project's appropriate verification commands**: Verify the changes using the project's actual lint, typecheck, and test scripts.
135
+
136
+ ## Anti-Patterns
137
+
138
+ - **Unnecessary useEffect**
139
+ - *What*: Using an effect to update a state variable based on a change in another state variable or prop.
140
+ - *Why*: It causes unnecessary extra renders (cascading renders) and makes data flow harder to trace.
141
+ - *Instead*: Compute the value directly during render.
142
+ - **Duplicated derived state**
143
+ - *What*: Copying a prop into local state to format it or modify it slightly.
144
+ - *Why*: The local state becomes disconnected from the prop. If the parent updates the prop, the local state won't automatically update without complicated effect synchronization.
145
+ - *Instead*: Derive the formatted value during render.
146
+ - **Premature memoization**
147
+ - *What*: Wrapping every function in `useCallback` and every variable in `useMemo` by default.
148
+ - *Why*: It harms code readability, increases memory overhead, and often provides zero performance benefit unless passed to a heavily re-rendered or explicitly memoized child component.
149
+ - *Instead*: Write simple code first. Optimize only when a performance issue is observed.
150
+ - **Giant components**
151
+ - *What*: Placing hundreds of lines of JSX and complex state logic into a single monolithic component.
152
+ - *Why*: It creates a maintenance nightmare, mixes concerns, and causes the entire tree to re-render for minor local state changes.
153
+ - *Instead*: Extract focused child components with clear responsibilities.
154
+ - **Unnecessary context**
155
+ - *What*: Putting a value into a React Context provider just to avoid passing it down one or two levels.
156
+ - *Why*: Context couples components to the provider, making them harder to reuse, and causes all consumers to re-render when the context value changes.
157
+ - *Instead*: Use prop drilling for shallow trees, or component composition (passing JSX as `children`).
158
+ - **Unnecessary abstraction**
159
+ - *What*: Creating highly generic, prop-heavy "smart" components (like a `BaseButton` that takes 30 props) instead of keeping things simple.
160
+ - *Why*: The abstraction becomes too rigid and hard to understand.
161
+ - *Instead*: Prefer simple, composable components over complex configurations.
162
+ - **Direct mutation**
163
+ - *What*: Writing `state.user.name = "Alice"` instead of using a setter function.
164
+ - *Why*: React relies on object identity (reference equality) to trigger re-renders. Direct mutation silently changes the object but skips the render.
165
+ - *Instead*: Always create new objects/arrays when updating state (`setUser({ ...user, name: "Alice" })`).
166
+ - **Changing architecture without inspecting the project**
167
+ - *What*: Installing a state management library like Zustand or Redux into a project that successfully uses React Context.
168
+ - *Why*: It fragments the codebase and creates inconsistencies.
169
+ - *Instead*: Adapt to the existing patterns unless explicitly requested to migrate.
170
+
171
+ ## Examples
172
+
173
+ ### Derived Value
174
+
175
+ Bad:
176
+ ```tsx
177
+ const [fullName, setFullName] = useState("");
178
+
179
+ useEffect(() => {
180
+ setFullName(`${firstName} ${lastName}`);
181
+ }, [firstName, lastName]);
182
+ ```
183
+
184
+ Better:
185
+ ```tsx
186
+ const fullName = `${firstName} ${lastName}`;
187
+ ```
188
+
189
+ ### Event Handler vs Effect
190
+
191
+ Bad:
192
+ ```tsx
193
+ const [isSubmitting, setIsSubmitting] = useState(false);
194
+
195
+ useEffect(() => {
196
+ if (isSubmitting) {
197
+ postData().then(() => setIsSubmitting(false));
198
+ }
199
+ }, [isSubmitting]);
200
+
201
+ const handleClick = () => setIsSubmitting(true);
202
+ ```
203
+
204
+ Better:
205
+ ```tsx
206
+ const [isSubmitting, setIsSubmitting] = useState(false);
207
+
208
+ const handleClick = async () => {
209
+ setIsSubmitting(true);
210
+ await postData();
211
+ setIsSubmitting(false);
212
+ };
213
+ ```
@@ -0,0 +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.
@@ -0,0 +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.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: tailwind
3
+ description: Tailwind CSS utility composition, responsive behavior, design tokens, and state variants.
4
+ category: styling
5
+ version: 2.1.0
6
+ ---
7
+
8
+ ## When to use
9
+
10
+ - styling components with Tailwind CSS
11
+ - building responsive layouts with utility classes
12
+
13
+ ## Instructions
14
+
15
+ ### Project Detection & Existing Rules
16
+ - **Inspect package.json & Configuration**: Check Tailwind version, `tailwind.config.js`, CSS entrypoints, and existing utility conventions.
17
+ - **Design Tokens**: Identify existing design tokens (custom colors, spacing, typography, radius, shadows). **Prefer existing project tokens.**
18
+ - **Do not force Tailwind** onto projects that do not use Tailwind.
19
+
20
+ ### Design Tokens
21
+ - Do not introduce arbitrary values (`[#ff0000]`) when existing project tokens or standard scales can be used.
22
+
23
+ ### Composition
24
+ - Group utilities logically (e.g., layout first, then spacing, typography, visual).
25
+ - Build reusable component patterns cleanly.
26
+ - Keep class strings understandable.
27
+ - Avoid duplicated utility combinations by extracting heavily repeated patterns into component abstractions (use React/Vue/Svelte components, avoid `@apply` unless it is a strong project convention).
28
+
29
+ ### Responsive
30
+ - Use responsive variants (`sm:`, `md:`, `lg:`) for fluid viewport adaptations.
31
+ - Understand mobile-first behavior (unprefixed is mobile).
32
+ - **Do not simply add every breakpoint.** Design for fluidity.
33
+ - Follow `responsive-design` guidance for viewport behavior.
34
+
35
+ ### State
36
+ - Use interactive state modifiers (`hover:`, `focus:`, `focus-visible:`, `active:`, `disabled:`).
37
+ - Use `group` and `peer` for complex relational state styling.
38
+
39
+ ### Dark Mode
40
+ - Respect the project's existing dark-mode strategy (e.g., `class` strategy vs `media`).
41
+ - Do not introduce a new strategy. Use `dark:` variants appropriately.
42
+
43
+ ### Arbitrary Values
44
+ - Arbitrary values are justified for highly specific, one-off cases (e.g., a specific background image position or precise translation).
45
+ - Prefer project tokens or standard scales when appropriate.
46
+ - Do NOT make arbitrary values categorically forbidden, but use them sparingly.
47
+
48
+ ### Component Boundaries
49
+ - Do not create component abstractions solely because a class list is long.
50
+ - Balance readability, reuse, and project conventions.
51
+
52
+ ### Common Failure Modes
53
+ - **Contradictory utilities**: Applying both `p-4` and `p-6` to the same element, causing specificity surprises.
54
+ - **Excessive arbitrary values**: Flooding the codebase with `[14px]` instead of using `text-sm`.
55
+ - **Duplicated classes**: Repeating the exact same long string of classes across multiple sibling elements instead of mapping over data or extracting a component.
56
+ - **Breakpoint proliferation**: Hardcoding too many breakpoint overrides instead of trusting flexible layouts like Flexbox or Grid.
57
+ - **Ignoring existing tokens**: Hardcoding hex codes instead of using the theme configuration.
58
+ - **Inconsistent responsive behavior**: Forgetting to scale typography along with layout at different viewports.
59
+
60
+ ## Anti-Patterns
61
+
62
+ - **Arbitrary Values over Scale Tokens**
63
+ - *What*: Writing `w-[64px]` instead of `w-16`.
64
+ - *Why*: It breaks design consistency and bloats the generated CSS.
65
+ - *Instead*: Use the standard tailwind scale.
66
+ - **Heavy use of @apply**
67
+ - *What*: Putting `@apply text-sm font-bold text-red-500` inside CSS files frequently.
68
+ - *Why*: It defeats the purpose of utility-first CSS and creates hidden specificity issues.
69
+ - *Instead*: Extract the HTML into a reusable framework component (React/Vue/Svelte).
70
+
71
+ ## Workflow
72
+
73
+ ### Verification
74
+ - Use project linting, build, typecheck, and test scripts to verify the styling does not break UI components.