@juancr11/sibu 0.19.0 → 0.20.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/package.json
CHANGED
package/templates/manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"templateVersion": "
|
|
2
|
+
"templateVersion": "136",
|
|
3
3
|
"templates": {
|
|
4
4
|
"AGENTS.md": {
|
|
5
5
|
"version": "35",
|
|
@@ -140,10 +140,10 @@
|
|
|
140
140
|
]
|
|
141
141
|
},
|
|
142
142
|
"skills/react/SKILL.md": {
|
|
143
|
-
"version": "
|
|
143
|
+
"version": "4",
|
|
144
144
|
"description": "Selectable React skill for component design, props, state ownership, and presentational boundaries.",
|
|
145
145
|
"changes": [
|
|
146
|
-
"
|
|
146
|
+
"Strengthens React guidance to require one component per nearby file by default, disallow same-file helper subcomponents, and add a before-finish component-boundary self-check."
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
149
|
"skills/scrum-master-planner/SKILL.md": {
|
|
@@ -61,19 +61,21 @@ This skill covers React componentization, component responsibility, state owners
|
|
|
61
61
|
### 7. Prefer composition over configuration-heavy components
|
|
62
62
|
- Compose smaller components instead of building one component with many modes and flags.
|
|
63
63
|
- If a component needs many boolean props, consider whether it is doing too much.
|
|
64
|
-
- Use `children` or named
|
|
64
|
+
- Use `children` or named child component APIs when composition makes the API clearer, but keep each component implementation in its own nearby file.
|
|
65
65
|
|
|
66
66
|
### 8. Make component boundaries visible
|
|
67
67
|
- Name components by what they represent in the UI or product.
|
|
68
68
|
- Keep server-interacting, stateful, and presentational responsibilities easy to identify from the component shape.
|
|
69
69
|
- Avoid mixing data fetching, mutation, layout, formatting, and low-level UI rendering in one component.
|
|
70
|
-
- Each component
|
|
71
|
-
-
|
|
70
|
+
- Each React component belongs in its own nearby file by default.
|
|
71
|
+
- Do not define helper subcomponents in a parent component file, even when they are small, file-local, currently unreused, named only for readability, or part of a compound component API.
|
|
72
|
+
- Same-file helpers are acceptable only when they are not React components, do not return JSX, and do not represent a UI responsibility. Constants, type aliases, and pure non-JSX helpers such as `formatStatusLabel()` may stay when they support the component without becoming UI.
|
|
73
|
+
- A function that returns JSX, represents a named UI region, renders a repeated unit, or owns UI state/interaction is a component. Move it to its own nearby file before finishing.
|
|
72
74
|
|
|
73
75
|
### 9. Build screens as composition roots, not component dumping grounds
|
|
74
76
|
- Treat page-level components, route-level containers, and major feature components as composition roots: they should assemble focused child components, not define every section, repeated item, overlay, menu, state, helper, and interaction inline.
|
|
75
77
|
- A top-level screen component may own data loading, high-level layout, route states, and wiring, but should delegate meaningful UI regions to named components.
|
|
76
|
-
- If a UI region has its own state, interaction, repeated rendering, overlay, menu, empty/error/loading state, or domain formatting concern,
|
|
78
|
+
- If a UI region has its own state, interaction, repeated rendering, overlay, menu, empty/error/loading state, or domain formatting concern, extract it to a focused nearby file.
|
|
77
79
|
- Keep route entry files especially thin: they should fetch or prepare data, handle route-level states, and compose the screen. Avoid placing substantial presentational or interactive subcomponents directly inside them.
|
|
78
80
|
- Route-local or feature-local components are good defaults for UI that belongs to one screen or feature. Shared components should be extracted only when reuse is real, not speculative.
|
|
79
81
|
|
|
@@ -103,6 +105,59 @@ feature-format.ts
|
|
|
103
105
|
feature-types.ts
|
|
104
106
|
```
|
|
105
107
|
|
|
108
|
+
Prefer separated component files:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
// feature-shell.tsx
|
|
112
|
+
export function FeatureShell() {
|
|
113
|
+
return <FeatureList />;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// feature-list.tsx
|
|
117
|
+
export function FeatureList() {
|
|
118
|
+
return <FeatureListItem />;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// feature-list-item.tsx
|
|
122
|
+
export function FeatureListItem() {
|
|
123
|
+
return <li>Item</li>;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Avoid multiple component implementations in one parent file:
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
export function FeatureShell() {
|
|
131
|
+
return <FeatureList />;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function FeatureList() {
|
|
135
|
+
return <FeatureListItem />;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function FeatureListItem() {
|
|
139
|
+
return <li>Item</li>;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Allowed same-file helpers are non-components:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
const statusLabels = { active: "Active" };
|
|
147
|
+
|
|
148
|
+
function formatStatusLabel(status: string) {
|
|
149
|
+
return statusLabels[status] ?? "Unknown";
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Avoid same-file JSX helpers:
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
function StatusBadge({ status }: { status: string }) {
|
|
157
|
+
return <span>{formatStatusLabel(status)}</span>;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
106
161
|
## Decision rule
|
|
107
162
|
|
|
108
163
|
When unsure, prefer:
|
|
@@ -110,7 +165,7 @@ When unsure, prefer:
|
|
|
110
165
|
2. route-level or feature-level containers that own only the interaction state they coordinate
|
|
111
166
|
3. one clear responsibility per component
|
|
112
167
|
4. more focused components instead of fewer overloaded components
|
|
113
|
-
5. one
|
|
168
|
+
5. one React component per nearby file by default
|
|
114
169
|
6. nearby component files before shared abstractions
|
|
115
170
|
7. stateless presentational components that render from props
|
|
116
171
|
8. stateful components only where local interaction state is genuinely owned
|
|
@@ -121,10 +176,12 @@ When unsure, prefer:
|
|
|
121
176
|
|
|
122
177
|
## Componentization self-review
|
|
123
178
|
|
|
124
|
-
Before finishing a React change, ask:
|
|
179
|
+
Before finishing a React change, inspect every changed React file and ask:
|
|
125
180
|
|
|
126
181
|
- Can I understand the screen structure from the top-level file without reading repeated item, action surface, overlay, state, or formatting internals?
|
|
127
182
|
- Are meaningful UI regions and repeated units in named components?
|
|
128
183
|
- Does each file have one obvious reason to change?
|
|
184
|
+
- Does any changed file define more than one React component implementation, including small, file-local, currently unreused, named helper, or compound subcomponents?
|
|
185
|
+
- If multiple component implementations remain, did I split them into nearby files before finishing or explicitly explain why the remaining same-file helper is not a React component, does not return JSX, and does not represent UI responsibility?
|
|
129
186
|
- Are server/client boundaries still as small as practical?
|
|
130
187
|
- Did I avoid creating shared abstractions before there is real reuse?
|