bluetemberg-skills-react-patterns 0.1.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.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: react-patterns
3
+ description: Apply React component patterns — composition, co-location, and hook extraction — before reaching for custom solutions.
4
+ profiles:
5
+ - frontend
6
+ - fullstack
7
+ ---
8
+
9
+ # react-patterns
10
+
11
+ Use this skill when implementing or reviewing React components, hooks, or state management.
12
+
13
+ ## Triggers
14
+
15
+ - New React component or hook implementation
16
+ - Component is growing too large or has mixed responsibilities
17
+ - State is being lifted or passed through multiple layers
18
+ - A custom hook is being written to wrap browser APIs or third-party libs
19
+
20
+ ## Required behavior
21
+
22
+ 1. The agent MUST prefer composition over prop-drilling: split into smaller components and pass children or render props before adding new props.
23
+ 2. The agent MUST co-locate state and effects with the component that owns them; only lift state when two siblings genuinely need it.
24
+ 3. The agent MUST extract logic into a custom hook when a component contains non-trivial side effects or derived state that could be reused.
25
+ 4. The agent MUST check for existing hooks or components in the codebase before introducing new abstractions.
26
+ 5. The agent SHOULD use the project's shared design-system components instead of reimplementing layout primitives.
27
+
28
+ ## When NOT to use
29
+
30
+ - Server components or non-React rendering contexts
31
+ - Trivial presentational components with no logic
32
+ - Generated or third-party component wrappers
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "bluetemberg-skills-react-patterns",
3
+ "version": "0.1.0",
4
+ "description": "React patterns skill for Bluetemberg — component composition, hook extraction, state co-location.",
5
+ "keywords": ["bluetemberg-pack", "skills"],
6
+ "author": "Prototyp Digital",
7
+ "license": "MIT",
8
+ "repository": {"type": "git", "url": "https://github.com/prototypdigital/bluetemberg-packs.git"},
9
+ "files": ["llm/"]
10
+ }