ghcopilot-hub 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.
- package/README.md +176 -0
- package/hub/agents/README.md +243 -0
- package/hub/agents/archiver.agent.md +231 -0
- package/hub/agents/explore.agent.md +49 -0
- package/hub/agents/implementador.agent.md +176 -0
- package/hub/agents/librarian.agent.md +34 -0
- package/hub/agents/momus.agent.md +130 -0
- package/hub/agents/oracle.agent.md +52 -0
- package/hub/agents/plan-guardian.agent.md +109 -0
- package/hub/agents/planificador.agent.md +295 -0
- package/hub/agents/test-sentinel.agent.md +106 -0
- package/hub/base/.github/copilot-instructions.md +10 -0
- package/hub/base/.github/instructions/ghcopilot-hub.instructions.md +6 -0
- package/hub/base/.github/prompts/ghcopilot-hub-maintenance.prompt.md +8 -0
- package/hub/base/.vscode/settings.json +1 -0
- package/hub/packs/base-web.json +4 -0
- package/hub/packs/nextjs-ssr.json +4 -0
- package/hub/packs/node-api.json +4 -0
- package/hub/packs/spa-tanstack.json +4 -0
- package/hub/skills/architecture-testing/SKILL.md +108 -0
- package/hub/skills/architecture-testing/references/archunitts.md +46 -0
- package/hub/skills/ghcopilot-hub-consumer/SKILL.md +115 -0
- package/hub/skills/ghcopilot-hub-consumer/references/workflow.md +39 -0
- package/hub/skills/mermaid-expert/SKILL.md +152 -0
- package/hub/skills/mermaid-expert/assets/examples/c4_model.md +121 -0
- package/hub/skills/mermaid-expert/assets/examples/flowchart.md +123 -0
- package/hub/skills/mermaid-expert/assets/examples/img/base_minimal.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/corporate.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/dark.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/dark_neo.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/default_neo.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/forest_corp.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/handdrawn.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/neo.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/neutral_sketch.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/img/retro.png +0 -0
- package/hub/skills/mermaid-expert/assets/examples/sequence.md +116 -0
- package/hub/skills/mermaid-expert/assets/examples/styles_and_looks.md +102 -0
- package/hub/skills/mermaid-expert/assets/examples/technical.md +130 -0
- package/hub/skills/mermaid-expert/assets/examples.md +57 -0
- package/hub/skills/mermaid-expert/references/cheatsheet.md +88 -0
- package/hub/skills/mermaid-expert/references/validation.md +66 -0
- package/hub/skills/react/SKILL.md +235 -0
- package/hub/skills/react/references/common-mistakes.md +518 -0
- package/hub/skills/react/references/composition-patterns.md +526 -0
- package/hub/skills/react/references/effects-patterns.md +396 -0
- package/hub/skills/react/references/react-compiler.md +268 -0
- package/hub/skills/react-hook-form/SKILL.md +291 -0
- package/hub/skills/react-hook-form/references/field-arrays.md +98 -0
- package/hub/skills/react-hook-form/references/integration.md +102 -0
- package/hub/skills/react-hook-form/references/performance.md +96 -0
- package/hub/skills/skill-creator/SKILL.md +152 -0
- package/hub/skills/skill-creator/assets/SKILL-TEMPLATE.md +84 -0
- package/hub/skills/skill-judge/README.md +261 -0
- package/hub/skills/skill-judge/SKILL.md +806 -0
- package/hub/skills/tailwind/SKILL.md +200 -0
- package/hub/skills/tanstack/SKILL.md +284 -0
- package/hub/skills/tanstack/references/loader-adapter-examples.md +79 -0
- package/hub/skills/tanstack/references/query-options-examples.md +115 -0
- package/hub/skills/tanstack/references/resilience-patterns.md +110 -0
- package/hub/skills/tanstack/references/suspense-consumption-examples.md +82 -0
- package/hub/skills/tanstack-query/SKILL.md +241 -0
- package/hub/skills/tanstack-query/references/advanced-hooks.md +126 -0
- package/hub/skills/tanstack-query/references/best-practices.md +241 -0
- package/hub/skills/tanstack-query/references/cache-strategies.md +474 -0
- package/hub/skills/tanstack-query/references/common-patterns.md +239 -0
- package/hub/skills/tanstack-query/references/migration-v5.md +93 -0
- package/hub/skills/tanstack-query/references/resilience-and-mutations.md +63 -0
- package/hub/skills/tanstack-query/references/testing.md +116 -0
- package/hub/skills/tanstack-query/references/top-errors.md +148 -0
- package/hub/skills/tanstack-query/references/typescript.md +176 -0
- package/hub/skills/tanstack-router/SKILL.md +145 -0
- package/hub/skills/tanstack-router/references/code-splitting.md +31 -0
- package/hub/skills/tanstack-router/references/errors-and-boundaries.md +44 -0
- package/hub/skills/tanstack-router/references/loaders-and-preload.md +51 -0
- package/hub/skills/tanstack-router/references/navigation.md +24 -0
- package/hub/skills/tanstack-router/references/private-routes.md +169 -0
- package/hub/skills/tanstack-router/references/router-context.md +35 -0
- package/hub/skills/tanstack-router/references/search-params.md +29 -0
- package/hub/skills/tanstack-router/references/typescript.md +24 -0
- package/hub/skills/testing/SKILL.md +187 -0
- package/hub/skills/testing/references/assertions.md +64 -0
- package/hub/skills/testing/references/async-testing.md +66 -0
- package/hub/skills/testing/references/e2e-strategy.md +69 -0
- package/hub/skills/testing/references/layer-matrix.md +67 -0
- package/hub/skills/testing/references/performance.md +49 -0
- package/hub/skills/testing/references/tooling-map.md +81 -0
- package/hub/skills/testing/references/zustand-mocking.md +84 -0
- package/hub/skills/typescript/SKILL.md +232 -0
- package/hub/skills/typescript/references/perf-additional-concerns.md +248 -0
- package/hub/skills/typescript/references/perf-execution-cache-locality.md +178 -0
- package/hub/skills/typescript/references/reduce-branching.md +147 -0
- package/hub/skills/typescript/references/reduce-looping.md +203 -0
- package/hub/skills/typescript/references/style-and-types.md +171 -0
- package/hub/skills/typescript/references/type-vs-interface.md +27 -0
- package/hub/skills/zod/SKILL.md +219 -0
- package/hub/skills/zustand/SKILL.md +273 -0
- package/package.json +59 -0
- package/tooling/cli/src/bin.js +11 -0
- package/tooling/cli/src/cli.js +409 -0
- package/tooling/cli/src/lib/catalog-loader.js +191 -0
- package/tooling/cli/src/lib/constants.js +39 -0
- package/tooling/cli/src/lib/errors.js +8 -0
- package/tooling/cli/src/lib/frontmatter.js +41 -0
- package/tooling/cli/src/lib/fs-utils.js +77 -0
- package/tooling/cli/src/lib/managed-header.js +74 -0
- package/tooling/cli/src/lib/manifest.js +105 -0
- package/tooling/cli/src/lib/resolver.js +53 -0
- package/tooling/cli/src/lib/sync-engine.js +262 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react
|
|
3
|
+
description: >
|
|
4
|
+
React 19 patterns with Compiler-aware guidance, composition, refs, and effects. Trigger: When working with React
|
|
5
|
+
components (.tsx, .jsx), effects, refs, context APIs, or render performance/memoization decisions.
|
|
6
|
+
license: Apache-2.0
|
|
7
|
+
metadata:
|
|
8
|
+
author: jmgomezdev
|
|
9
|
+
version: "1.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# React 19 + Compiler Patterns
|
|
13
|
+
|
|
14
|
+
This skill is optimized for React 19 projects and prioritizes decision quality over cookbook snippets.
|
|
15
|
+
|
|
16
|
+
## Activation Gates (MANDATORY)
|
|
17
|
+
|
|
18
|
+
Before applying recommendations, choose the path below.
|
|
19
|
+
|
|
20
|
+
| User task | Load | Do NOT load |
|
|
21
|
+
| ---------------------------------------------------------------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
22
|
+
| Performance/memoization (`useMemo`, `useCallback`, `React.memo`) | **MANDATORY**: [references/react-compiler.md](references/react-compiler.md) | `common-mistakes.md` unless user also asks basics |
|
|
23
|
+
| Effect dependencies, cleanup, reconnection bugs | **MANDATORY**: [references/effects-patterns.md](references/effects-patterns.md) | `react-compiler.md` unless also perf-related |
|
|
24
|
+
| Compound components / provider architecture | **MANDATORY**: [references/composition-patterns.md](references/composition-patterns.md) | `react-compiler.md`, `effects-patterns.md` unless needed |
|
|
25
|
+
| React basics / common pitfalls | [references/common-mistakes.md](references/common-mistakes.md) | Advanced references unless requested |
|
|
26
|
+
|
|
27
|
+
If the required reference is not loaded, do not give prescriptive advice for that area.
|
|
28
|
+
|
|
29
|
+
## Symptom Router (Fast Path)
|
|
30
|
+
|
|
31
|
+
| Symptom / user ask | Go to |
|
|
32
|
+
| ---------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
33
|
+
| "Can I remove useMemo/useCallback/React.memo?" | [references/react-compiler.md](references/react-compiler.md) → Mandatory Verification Gate |
|
|
34
|
+
| "Effect keeps reconnecting / rerunning" | [references/effects-patterns.md](references/effects-patterns.md) → Effect Dependencies |
|
|
35
|
+
| "Need non-reactive logic in Effect" | [references/effects-patterns.md](references/effects-patterns.md) → useEffectEvent + fallback |
|
|
36
|
+
| "Too many boolean props / variant explosion" | [references/composition-patterns.md](references/composition-patterns.md) |
|
|
37
|
+
| "Basic React pitfall" | [references/common-mistakes.md](references/common-mistakes.md) |
|
|
38
|
+
|
|
39
|
+
## Pair with TypeScript
|
|
40
|
+
|
|
41
|
+
When working with React, always load both this skill and `typescript` together. TypeScript patterns (type-first
|
|
42
|
+
development, discriminated unions, Zod validation) apply to React code.
|
|
43
|
+
|
|
44
|
+
## React Compiler
|
|
45
|
+
|
|
46
|
+
**Impact: CRITICAL**
|
|
47
|
+
|
|
48
|
+
Compiler guidance is valid only when compiler activation is verified.
|
|
49
|
+
|
|
50
|
+
Requires:
|
|
51
|
+
|
|
52
|
+
- Project is on React 19 compiler-compatible setup
|
|
53
|
+
- Compiler is enabled/active (see [references/react-compiler.md](references/react-compiler.md))
|
|
54
|
+
|
|
55
|
+
Fallback if not verified:
|
|
56
|
+
|
|
57
|
+
- Keep existing manual `useMemo` / `useCallback` / `React.memo`
|
|
58
|
+
- Prefer targeted profiling before removing memoization
|
|
59
|
+
|
|
60
|
+
Use plain code by default only after verification gate passes. For full before/after examples and edge cases, read
|
|
61
|
+
[references/react-compiler.md](references/react-compiler.md).
|
|
62
|
+
|
|
63
|
+
See [references/react-compiler.md](references/react-compiler.md) for verification and edge cases.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## React 19 API Changes
|
|
68
|
+
|
|
69
|
+
**Impact: MEDIUM**
|
|
70
|
+
|
|
71
|
+
Apply these recommendations only when the project runtime/toolchain supports them. If support is uncertain, use the
|
|
72
|
+
fallback and avoid forced migration advice.
|
|
73
|
+
|
|
74
|
+
### ref as Regular Prop (No forwardRef)
|
|
75
|
+
|
|
76
|
+
Requires React 19-compatible setup.
|
|
77
|
+
|
|
78
|
+
Fallback:
|
|
79
|
+
|
|
80
|
+
- If project is on React 18, keep `forwardRef`.
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
// Legacy-compatible: forwardRef wrapper (React 18 pattern)
|
|
84
|
+
const ComposerInput = forwardRef<HTMLInputElement, Props>((props, ref) => {
|
|
85
|
+
return <input ref={ref} {...props} />;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Preferred in React 19-capable setups: ref as regular prop
|
|
89
|
+
function ComposerInput({ ref, ...props }: Props & { ref?: React.Ref<HTMLInputElement> }) {
|
|
90
|
+
return <input ref={ref} {...props} />;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### use() Instead of useContext()
|
|
95
|
+
|
|
96
|
+
Use with caution and only when project tooling/runtime fully supports this pattern.
|
|
97
|
+
|
|
98
|
+
Fallback:
|
|
99
|
+
|
|
100
|
+
- `useContext(MyContext)` is valid and preferred for compatibility-sensitive codebases.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
// Compatible baseline: useContext
|
|
104
|
+
const value = useContext(MyContext);
|
|
105
|
+
|
|
106
|
+
// Preferred when runtime/tooling supports it: use()
|
|
107
|
+
const value = use(MyContext);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## State & Composition Baselines
|
|
113
|
+
|
|
114
|
+
Keep baseline React guidance in references to preserve context budget.
|
|
115
|
+
|
|
116
|
+
- Impossible states, state principles, custom hooks, and conditional rendering pitfalls:
|
|
117
|
+
[references/common-mistakes.md](references/common-mistakes.md)
|
|
118
|
+
- Compound components and provider patterns:
|
|
119
|
+
[references/composition-patterns.md](references/composition-patterns.md)
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Refs & Effects Rules
|
|
124
|
+
|
|
125
|
+
**Impact: CRITICAL**
|
|
126
|
+
|
|
127
|
+
### Core Principle: Effects Are Escape Hatches
|
|
128
|
+
|
|
129
|
+
Effects let you "step outside" React to synchronize with external systems. **Most component logic should NOT use
|
|
130
|
+
Effects.** Before writing an Effect, ask: "Is there a way to do this without an Effect?"
|
|
131
|
+
|
|
132
|
+
### When to Use Effects
|
|
133
|
+
|
|
134
|
+
Effects are for synchronizing with **external systems**:
|
|
135
|
+
|
|
136
|
+
- Subscribing to browser APIs (WebSocket, IntersectionObserver, resize)
|
|
137
|
+
- Connecting to third-party libraries not written in React
|
|
138
|
+
- Setting up/cleaning up event listeners on window/document
|
|
139
|
+
- Controlling non-React DOM elements (video players, maps)
|
|
140
|
+
|
|
141
|
+
### When NOT to Use Effects
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
// ❌ NEVER: Derived state in Effect
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
setFullName(firstName + " " + lastName);
|
|
147
|
+
}, [firstName, lastName]);
|
|
148
|
+
|
|
149
|
+
// ✅ ALWAYS: Calculate during render
|
|
150
|
+
const fullName = firstName + " " + lastName;
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
// ❌ NEVER: Reset state in Effect
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
setComment("");
|
|
157
|
+
}, [userId]);
|
|
158
|
+
|
|
159
|
+
// ✅ ALWAYS: Use key to reset
|
|
160
|
+
<Profile userId={userId} key={userId} />;
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
// ❌ NEVER: Event-specific logic in Effect
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (product.isInCart) {
|
|
167
|
+
showNotification("Added to cart");
|
|
168
|
+
}
|
|
169
|
+
}, [product]);
|
|
170
|
+
|
|
171
|
+
// ✅ ALWAYS: Logic in event handler
|
|
172
|
+
function handleAddToCart() {
|
|
173
|
+
addToCart(product);
|
|
174
|
+
showNotification("Added to cart");
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
See [references/effects-patterns.md](references/effects-patterns.md) for advanced patterns and `useEffectEvent`
|
|
179
|
+
fallbacks.
|
|
180
|
+
|
|
181
|
+
### Don't Read/Write Refs During Render
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
// ❌ NEVER: Read/write ref.current during render
|
|
185
|
+
function MyComponent() {
|
|
186
|
+
const myRef = useRef(null);
|
|
187
|
+
myRef.current = 123; // Writing during render!
|
|
188
|
+
|
|
189
|
+
return <h1>{myOtherRef.current}</h1>; // Reading during render!
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// ✅ ALWAYS: Use refs in effects or event handlers
|
|
193
|
+
function MyComponent() {
|
|
194
|
+
const myRef = useRef<number | null>(null);
|
|
195
|
+
|
|
196
|
+
useEffect(() => {
|
|
197
|
+
myRef.current = 123; // Effect - OK
|
|
198
|
+
}, []);
|
|
199
|
+
|
|
200
|
+
const handleClick = () => {
|
|
201
|
+
console.log(myRef.current); // Event handler - OK
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Additional baseline rules
|
|
207
|
+
|
|
208
|
+
For custom hooks naming, lifecycle anti-patterns, and conditional rendering basics, load
|
|
209
|
+
[references/common-mistakes.md](references/common-mistakes.md).
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Decision Tree
|
|
214
|
+
|
|
215
|
+
When deciding how to implement logic:
|
|
216
|
+
|
|
217
|
+
1. **Need to respond to user interaction?** → Use event handler
|
|
218
|
+
2. **Need computed value from props/state?** → Calculate during render
|
|
219
|
+
3. **Need to reset state on prop change?** → Use `key` prop
|
|
220
|
+
4. **Need to synchronize with external system?** → Use Effect with cleanup
|
|
221
|
+
5. **Need mutable value that doesn't trigger render?** → Use ref
|
|
222
|
+
6. **Need perf advice around memoization?** → Load `react-compiler.md` first, verify compiler, then decide
|
|
223
|
+
7. **Need non-reactive logic inside Effect?** → Load `effects-patterns.md`, prefer fallback-safe approach if
|
|
224
|
+
`useEffectEvent` is unavailable
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Resources
|
|
229
|
+
|
|
230
|
+
| Task | Mandatory reference | Do NOT load |
|
|
231
|
+
| ----------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------- |
|
|
232
|
+
| Memoization/performance | [references/react-compiler.md](references/react-compiler.md) | `common-mistakes.md` |
|
|
233
|
+
| Effects/dependency bugs | [references/effects-patterns.md](references/effects-patterns.md) | `react-compiler.md` unless perf is requested |
|
|
234
|
+
| Provider/compound composition | [references/composition-patterns.md](references/composition-patterns.md) | `effects-patterns.md` unless effect logic is involved |
|
|
235
|
+
| Basics/pitfalls | [references/common-mistakes.md](references/common-mistakes.md) | Advanced references unless explicitly needed |
|