You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**YAGNI — simplicity above all.** Do not overcomplicate code for hypothetical future scenarios. The minimum viable implementation is the correct implementation. Three similar lines of code are better than a premature abstraction.
18
+
19
+
Signs of overengineering:
20
+
- A function guards against a case that will never happen
21
+
- A factory used in exactly one place that doesn't encapsulate state
22
+
- Abstraction for its own sake (a wrapper around a single line of code)
23
+
- Constants or patterns invented in advance without a real need
24
+
25
+
## 3. Architecture & Communication
16
26
17
27
**Strict Separation of Concerns:**
18
28
@@ -24,7 +34,16 @@ Follow these rules strictly when generating code for massCode.
Composables get a `use` prefix. The file name matches the exported function name: `useSnippets.ts` → `export function useSnippets()`.
45
+
46
+
## 5. Critical Rules & Conventions
28
47
29
48
### A. Imports (STRICT)
30
49
@@ -70,7 +89,7 @@ Follow these rules strictly when generating code for massCode.
70
89
-**Default Namespace:** The `ui` namespace is the default. You can use `i18n.t('key.path')` instead of `i18n.t('ui:key.path')`.
71
90
-**Imports:**`import { i18n } from '@/electron'`
72
91
73
-
## 4. UI/UX Guidelines
92
+
## 6. UI/UX Guidelines
74
93
75
94
-**Variants:** Use `cva` for component variants.
76
95
-**Classes:** Use `cn()` to merge Tailwind classes.
@@ -85,7 +104,18 @@ Follow these rules strictly when generating code for massCode.
85
104
-**Missing Elements:** If a required UI element does not exist, create it in `src/renderer/components/ui/` first, following established patterns (Tailwind, cva, cn), then use it.
86
105
-**Naming:** They are auto-imported with a `Ui` prefix (e.g., `<UiButton />`, `<UiInput />`, `<UiCheckbox />`).
87
106
88
-
## 5. Development Workflow & Commands
107
+
## 7. Component Decomposition
108
+
109
+
Split a component when it exceeds ~300 lines or has more than 3 unrelated responsibilities:
110
+
111
+
1. Extract constants and static data
112
+
2. Extract pure functions into utils (only if used in multiple places)
113
+
3. Move state and effects into a composable
114
+
4. Break the template into child components
115
+
116
+
Keep no logic in `<template>` more complex than a ternary operator.
117
+
118
+
## 8. Development Workflow & Commands
89
119
90
120
**Linting (CRITICAL):**
91
121
@@ -99,7 +129,7 @@ Follow these rules strictly when generating code for massCode.
99
129
-`pnpm api:generate`: Regenerate API client (required after API changes)
0 commit comments