erne-universal 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.
- package/.claude-plugin/plugin.json +92 -0
- package/LICENSE +21 -0
- package/README.md +73 -0
- package/agents/architect.md +64 -0
- package/agents/code-reviewer.md +72 -0
- package/agents/expo-config-resolver.md +77 -0
- package/agents/native-bridge-builder.md +98 -0
- package/agents/performance-profiler.md +89 -0
- package/agents/tdd-guide.md +86 -0
- package/agents/ui-designer.md +100 -0
- package/agents/upgrade-assistant.md +106 -0
- package/bin/cli.js +55 -0
- package/commands/animate.md +70 -0
- package/commands/build-fix.md +57 -0
- package/commands/code-review.md +51 -0
- package/commands/component.md +93 -0
- package/commands/debug.md +74 -0
- package/commands/deploy.md +82 -0
- package/commands/learn.md +56 -0
- package/commands/native-module.md +51 -0
- package/commands/navigate.md +69 -0
- package/commands/perf.md +68 -0
- package/commands/plan.md +49 -0
- package/commands/quality-gate.md +80 -0
- package/commands/retrospective.md +70 -0
- package/commands/setup-device.md +99 -0
- package/commands/tdd.md +51 -0
- package/commands/upgrade.md +78 -0
- package/contexts/dev.md +29 -0
- package/contexts/review.md +32 -0
- package/contexts/vibe.md +44 -0
- package/docs/agents.md +41 -0
- package/docs/commands.md +53 -0
- package/docs/creating-skills.md +63 -0
- package/docs/getting-started.md +60 -0
- package/docs/hooks-profiles.md +73 -0
- package/docs/superpowers/plans/2026-03-10-erne-plan-1-infrastructure-hooks.md +3973 -0
- package/docs/superpowers/plans/2026-03-10-erne-plan-2-content-layer.md +4496 -0
- package/docs/superpowers/plans/2026-03-10-erne-plan-3-skills-knowledge-base.md +1952 -0
- package/docs/superpowers/plans/2026-03-10-erne-plan-4-install-cli-distribution.md +1624 -0
- package/docs/superpowers/specs/2026-03-10-everything-react-native-expo-design.md +581 -0
- package/examples/claude-md-bare-rn.md +46 -0
- package/examples/claude-md-expo-managed.md +45 -0
- package/examples/eas-json-standard.json +41 -0
- package/hooks/hooks.json +113 -0
- package/hooks/profiles/minimal.json +9 -0
- package/hooks/profiles/standard.json +17 -0
- package/hooks/profiles/strict.json +22 -0
- package/install.sh +50 -0
- package/mcp-configs/agent-device.json +10 -0
- package/mcp-configs/appstore-connect.json +15 -0
- package/mcp-configs/expo-api.json +13 -0
- package/mcp-configs/figma.json +13 -0
- package/mcp-configs/firebase.json +14 -0
- package/mcp-configs/github.json +13 -0
- package/mcp-configs/memory.json +13 -0
- package/mcp-configs/play-console.json +14 -0
- package/mcp-configs/sentry.json +15 -0
- package/mcp-configs/supabase.json +14 -0
- package/package.json +50 -0
- package/rules/bare-rn/coding-style.md +62 -0
- package/rules/bare-rn/patterns.md +54 -0
- package/rules/bare-rn/security.md +58 -0
- package/rules/bare-rn/testing.md +78 -0
- package/rules/common/coding-style.md +50 -0
- package/rules/common/development-workflow.md +55 -0
- package/rules/common/git-workflow.md +40 -0
- package/rules/common/navigation.md +56 -0
- package/rules/common/patterns.md +59 -0
- package/rules/common/performance.md +55 -0
- package/rules/common/security.md +64 -0
- package/rules/common/state-management.md +86 -0
- package/rules/common/testing.md +61 -0
- package/rules/expo/coding-style.md +54 -0
- package/rules/expo/patterns.md +71 -0
- package/rules/expo/security.md +41 -0
- package/rules/expo/testing.md +68 -0
- package/rules/native-android/coding-style.md +81 -0
- package/rules/native-android/patterns.md +77 -0
- package/rules/native-android/security.md +80 -0
- package/rules/native-android/testing.md +94 -0
- package/rules/native-ios/coding-style.md +72 -0
- package/rules/native-ios/patterns.md +72 -0
- package/rules/native-ios/security.md +59 -0
- package/rules/native-ios/testing.md +79 -0
- package/schemas/hooks.schema.json +34 -0
- package/schemas/plugin.schema.json +55 -0
- package/scripts/hooks/accessibility-check.js +117 -0
- package/scripts/hooks/bundle-size-check.js +31 -0
- package/scripts/hooks/check-console-log.js +37 -0
- package/scripts/hooks/check-expo-config.js +40 -0
- package/scripts/hooks/check-platform-specific.js +40 -0
- package/scripts/hooks/check-reanimated-worklet.js +51 -0
- package/scripts/hooks/continuous-learning-observer.js +24 -0
- package/scripts/hooks/evaluate-session.js +26 -0
- package/scripts/hooks/lib/hook-utils.js +52 -0
- package/scripts/hooks/native-compat-check.js +42 -0
- package/scripts/hooks/performance-budget.js +57 -0
- package/scripts/hooks/post-edit-format.js +38 -0
- package/scripts/hooks/post-edit-typecheck.js +31 -0
- package/scripts/hooks/pre-commit-lint.js +44 -0
- package/scripts/hooks/pre-edit-test-gate.js +68 -0
- package/scripts/hooks/run-with-flags.js +93 -0
- package/scripts/hooks/security-scan.js +65 -0
- package/scripts/hooks/session-start.js +77 -0
- package/scripts/lint-content.js +62 -0
- package/scripts/validate-all.js +137 -0
- package/skills/coding-standards/SKILL.md +88 -0
- package/skills/continuous-learning-v2/SKILL.md +61 -0
- package/skills/continuous-learning-v2/agent-prompts/pattern-analyzer.md +51 -0
- package/skills/continuous-learning-v2/agent-prompts/skill-generator.md +74 -0
- package/skills/continuous-learning-v2/config.json +25 -0
- package/skills/continuous-learning-v2/hook-templates/evaluate-session.cjs.template +69 -0
- package/skills/continuous-learning-v2/hook-templates/observer-hook.cjs.template +54 -0
- package/skills/continuous-learning-v2/scripts/analyze-patterns.js +50 -0
- package/skills/continuous-learning-v2/scripts/extract-session-patterns.js +54 -0
- package/skills/continuous-learning-v2/scripts/validate-content.js +88 -0
- package/skills/native-module-scaffold/SKILL.md +118 -0
- package/skills/performance-optimization/SKILL.md +103 -0
- package/skills/security-review/SKILL.md +99 -0
- package/skills/tdd-workflow/SKILL.md +142 -0
- package/skills/upgrade-workflow/SKILL.md +140 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: learn
|
|
3
|
+
description: Manual skill generation — runs continuous-learning-v2 scripts to extract patterns from session
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /learn — Generate Skills from Session
|
|
7
|
+
|
|
8
|
+
You are executing the `/learn` command. This is **script-driven** — it runs the continuous-learning-v2 pipeline directly.
|
|
9
|
+
|
|
10
|
+
## What This Does
|
|
11
|
+
|
|
12
|
+
Analyzes the current coding session to extract reusable patterns and save them as skills or rule amendments for future sessions. This is the manual trigger for what `PostToolUse` hooks do automatically.
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
1. **Run the extraction script:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
node .claude/hooks/scripts/extract-session-patterns.js
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This script:
|
|
23
|
+
- Scans recent tool calls and file changes
|
|
24
|
+
- Identifies patterns (repeated fixes, style corrections, common architectures)
|
|
25
|
+
- Compares against existing rules and skills
|
|
26
|
+
- Generates candidates for new content
|
|
27
|
+
|
|
28
|
+
2. **Review candidates:**
|
|
29
|
+
The script outputs a list of potential learnings:
|
|
30
|
+
```
|
|
31
|
+
[PATTERN] Zustand store always uses immer middleware → Suggest rule amendment
|
|
32
|
+
[PATTERN] All screens use SafeAreaView wrapper → Suggest coding-style rule
|
|
33
|
+
[PATTERN] API calls always retry 3 times → Suggest pattern rule
|
|
34
|
+
[SKILL] Complex form validation flow → Suggest skill creation
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
3. **Approve or reject each candidate:**
|
|
38
|
+
For each candidate, decide:
|
|
39
|
+
- **Approve** → Script writes to `.claude/rules/` or `.claude/skills/`
|
|
40
|
+
- **Reject** → Skip this pattern
|
|
41
|
+
- **Edit** → Modify before saving
|
|
42
|
+
|
|
43
|
+
4. **Validate new content:**
|
|
44
|
+
```bash
|
|
45
|
+
node .claude/hooks/scripts/validate-content.js
|
|
46
|
+
```
|
|
47
|
+
Ensures new rules/skills have valid frontmatter and don't conflict with existing content.
|
|
48
|
+
|
|
49
|
+
## When to Use
|
|
50
|
+
- After a long coding session where you established new patterns
|
|
51
|
+
- When you notice yourself repeatedly making the same corrections
|
|
52
|
+
- After integrating a new library and establishing conventions
|
|
53
|
+
- Periodically to capture accumulated project knowledge
|
|
54
|
+
|
|
55
|
+
## Note
|
|
56
|
+
The automatic `PostToolUse` hook (`continuous-learning-v2.cjs`) does lightweight extraction after every tool call. This `/learn` command runs a comprehensive analysis that catches patterns the real-time hook might miss.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: native-module
|
|
3
|
+
description: Create native modules with sequential native-bridge-builder then code-reviewer agents
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /native-module — Create Native Module
|
|
7
|
+
|
|
8
|
+
You are executing the `/native-module` command. Run **native-bridge-builder** first (create the module), then **code-reviewer** (review it). This is sequential, not parallel.
|
|
9
|
+
|
|
10
|
+
## Phase 1: native-bridge-builder — Scaffold & Implement
|
|
11
|
+
|
|
12
|
+
### Determine Module Type
|
|
13
|
+
Ask the user or detect from project:
|
|
14
|
+
1. **Expo Modules API** — For Expo managed projects (recommended)
|
|
15
|
+
2. **Turbo Module** — For bare React Native projects (New Architecture)
|
|
16
|
+
3. **Fabric Component** — For custom native views
|
|
17
|
+
|
|
18
|
+
### Scaffold the Module
|
|
19
|
+
Generate all required files based on module type:
|
|
20
|
+
|
|
21
|
+
**Expo Module (6 files):**
|
|
22
|
+
```
|
|
23
|
+
modules/[module-name]/
|
|
24
|
+
expo-module.config.json # Module configuration
|
|
25
|
+
src/[ModuleName]Module.ts # TypeScript API definition
|
|
26
|
+
ios/[ModuleName]Module.swift # Swift implementation
|
|
27
|
+
android/src/main/java/.../[ModuleName]Module.kt # Kotlin implementation
|
|
28
|
+
src/__tests__/[ModuleName].test.ts # Unit tests
|
|
29
|
+
README.md # Usage documentation
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Implementation Guidelines
|
|
33
|
+
- Define clear TypeScript interface first (contract)
|
|
34
|
+
- Implement Swift and Kotlin to match the contract
|
|
35
|
+
- Handle errors consistently (reject Promises with error codes)
|
|
36
|
+
- Use `async/await` in Swift, coroutines in Kotlin
|
|
37
|
+
- Include JSDoc comments on the TypeScript API
|
|
38
|
+
|
|
39
|
+
## Phase 2: code-reviewer — Review the Module
|
|
40
|
+
|
|
41
|
+
After module creation, automatically run code review:
|
|
42
|
+
- Verify TypeScript types match native implementations
|
|
43
|
+
- Check error handling on both platforms
|
|
44
|
+
- Validate threading (no main thread blocking)
|
|
45
|
+
- Review memory management (cleanup, listeners)
|
|
46
|
+
- Check platform parity (same behavior iOS/Android)
|
|
47
|
+
|
|
48
|
+
## Output
|
|
49
|
+
- Scaffolded module files with implementation
|
|
50
|
+
- Code review results
|
|
51
|
+
- Usage example in React Native
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: navigate
|
|
3
|
+
description: Design navigation architecture using the architect agent
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /navigate — Navigation Design
|
|
7
|
+
|
|
8
|
+
You are executing the `/navigate` command. Use the **architect** agent to design navigation structure.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. **Map the screens** — List all screens and their relationships
|
|
13
|
+
2. **Design the hierarchy** — Determine navigation stacks, tabs, drawers
|
|
14
|
+
3. **Plan Expo Router file structure** — Map screens to file-based routes
|
|
15
|
+
|
|
16
|
+
## Output: Expo Router File Structure
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
app/
|
|
20
|
+
_layout.tsx # Root Stack
|
|
21
|
+
index.tsx # Redirect to (tabs)
|
|
22
|
+
+not-found.tsx # 404 screen
|
|
23
|
+
(tabs)/
|
|
24
|
+
_layout.tsx # Tab navigator
|
|
25
|
+
index.tsx # Home tab
|
|
26
|
+
search.tsx # Search tab
|
|
27
|
+
profile.tsx # Profile tab
|
|
28
|
+
(auth)/
|
|
29
|
+
_layout.tsx # Auth stack (no tabs)
|
|
30
|
+
login.tsx
|
|
31
|
+
register.tsx
|
|
32
|
+
forgot-password.tsx
|
|
33
|
+
[entity]/
|
|
34
|
+
_layout.tsx # Entity detail stack
|
|
35
|
+
[id].tsx # Entity detail screen
|
|
36
|
+
[id]/edit.tsx # Edit screen
|
|
37
|
+
modal/
|
|
38
|
+
_layout.tsx # Modal group
|
|
39
|
+
settings.tsx # Settings modal
|
|
40
|
+
create-post.tsx # Create post modal
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. **Define navigation patterns**:
|
|
44
|
+
- Tab-to-detail: How tabs navigate to detail screens
|
|
45
|
+
- Auth flow: How unauthenticated users are redirected
|
|
46
|
+
- Deep linking: URL scheme mapping
|
|
47
|
+
- Modal presentation: Full-screen vs bottom sheet
|
|
48
|
+
|
|
49
|
+
4. **Generate layout files** — Create `_layout.tsx` files with proper configuration:
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
// app/(tabs)/_layout.tsx
|
|
53
|
+
import { Tabs } from 'expo-router';
|
|
54
|
+
|
|
55
|
+
export default function TabLayout() {
|
|
56
|
+
return (
|
|
57
|
+
<Tabs screenOptions={{ tabBarActiveTintColor: '#007AFF' }}>
|
|
58
|
+
<Tabs.Screen name="index" options={{ title: 'Home', tabBarIcon: ... }} />
|
|
59
|
+
<Tabs.Screen name="search" options={{ title: 'Search', tabBarIcon: ... }} />
|
|
60
|
+
<Tabs.Screen name="profile" options={{ title: 'Profile', tabBarIcon: ... }} />
|
|
61
|
+
</Tabs>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Notes
|
|
67
|
+
- Reference `rules/common/navigation.md` for conventions
|
|
68
|
+
- Consider deep link testing: `npx uri-scheme open [url] --ios`
|
|
69
|
+
- Include typed route definitions
|
package/commands/perf.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf
|
|
3
|
+
description: Performance profiling and optimization using the performance-profiler agent
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /perf — Performance Profiling
|
|
7
|
+
|
|
8
|
+
You are executing the `/perf` command. Use the **performance-profiler** agent to diagnose and fix performance issues.
|
|
9
|
+
|
|
10
|
+
## Diagnostic Areas
|
|
11
|
+
|
|
12
|
+
### 1. Rendering Performance (FPS)
|
|
13
|
+
- Check for unnecessary re-renders with React DevTools Profiler
|
|
14
|
+
- Identify components re-rendering without prop changes
|
|
15
|
+
- Look for missing `React.memo`, `useCallback`, `useMemo`
|
|
16
|
+
- Detect inline function/object creation in render
|
|
17
|
+
|
|
18
|
+
### 2. Time to Interactive (TTI)
|
|
19
|
+
- Analyze app startup sequence
|
|
20
|
+
- Check for heavy `useEffect` chains on mount
|
|
21
|
+
- Identify blocking operations on main thread
|
|
22
|
+
- Verify Hermes bytecode compilation
|
|
23
|
+
|
|
24
|
+
### 3. Bundle Size
|
|
25
|
+
- Run `npx react-native-bundle-visualizer`
|
|
26
|
+
- Identify large dependencies
|
|
27
|
+
- Check for unused imports and dead code
|
|
28
|
+
- Verify tree-shaking is working
|
|
29
|
+
|
|
30
|
+
### 4. Memory
|
|
31
|
+
- Check for listener/subscription cleanup in `useEffect`
|
|
32
|
+
- Identify large objects retained in closures
|
|
33
|
+
- Look for image caching issues
|
|
34
|
+
- Detect circular references
|
|
35
|
+
|
|
36
|
+
### 5. Animations
|
|
37
|
+
- Verify all animations use Reanimated (not Animated API)
|
|
38
|
+
- Check for JS thread bottlenecks in animation callbacks
|
|
39
|
+
- Identify layout thrashing during animations
|
|
40
|
+
- Measure actual FPS during animations
|
|
41
|
+
|
|
42
|
+
### 6. Hermes Engine
|
|
43
|
+
- Verify Hermes is enabled
|
|
44
|
+
- Check for unsupported JS features
|
|
45
|
+
- Profile with Hermes sampling profiler
|
|
46
|
+
- Analyze bytecode compilation output
|
|
47
|
+
|
|
48
|
+
## Output Format
|
|
49
|
+
```
|
|
50
|
+
## Performance Metrics
|
|
51
|
+
| Metric | Current | Target | Status |
|
|
52
|
+
|--------|---------|--------|--------|
|
|
53
|
+
| JS FPS | 45 | 60 | ⚠️ |
|
|
54
|
+
| UI FPS | 58 | 60 | ✅ |
|
|
55
|
+
| TTI | 3.2s | <2s | ❌ |
|
|
56
|
+
| Bundle | 8.2MB | <5MB | ❌ |
|
|
57
|
+
|
|
58
|
+
## Critical Issues
|
|
59
|
+
[Issues that must be fixed]
|
|
60
|
+
|
|
61
|
+
## Optimization Opportunities
|
|
62
|
+
[Improvements ranked by impact]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
- If agent-device is available, measure actual FPS on device
|
|
67
|
+
- Reference `rules/common/performance.md` for optimization patterns
|
|
68
|
+
- Profile on real devices, not simulator/emulator
|
package/commands/plan.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan
|
|
3
|
+
description: Design feature architecture using the architect agent
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /plan — Feature Architecture Design
|
|
7
|
+
|
|
8
|
+
You are executing the `/plan` command. Use the **architect** agent to design a feature architecture.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. **Understand the requirement** — Ask clarifying questions if the feature description is vague
|
|
13
|
+
2. **Analyze existing codebase** — Read relevant files, understand current navigation structure, state management, and API patterns
|
|
14
|
+
3. **Design the architecture** — Using the architect agent's process:
|
|
15
|
+
- Decompose into components and screens
|
|
16
|
+
- Plan Expo Router file structure
|
|
17
|
+
- Select state management approach (Zustand / TanStack Query / local)
|
|
18
|
+
- Design data flow and API layer
|
|
19
|
+
- Consider platform-specific requirements
|
|
20
|
+
4. **Output the plan** — Use the architect agent's output format:
|
|
21
|
+
|
|
22
|
+
### Architecture Output
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
## Overview
|
|
26
|
+
[1-2 sentence description of the feature]
|
|
27
|
+
|
|
28
|
+
## File Structure
|
|
29
|
+
[New files to create with paths]
|
|
30
|
+
|
|
31
|
+
## Component Design
|
|
32
|
+
[Component hierarchy and responsibilities]
|
|
33
|
+
|
|
34
|
+
## Data Flow
|
|
35
|
+
[State management approach, API calls, caching strategy]
|
|
36
|
+
|
|
37
|
+
## Navigation
|
|
38
|
+
[New routes, layout changes, deep link support]
|
|
39
|
+
|
|
40
|
+
## Implementation Tasks
|
|
41
|
+
[Ordered list of implementation steps]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
5. **Review with user** — Present the plan and ask for approval before implementation
|
|
45
|
+
|
|
46
|
+
## Notes
|
|
47
|
+
- Reference `rules/common/patterns.md` and `rules/common/navigation.md` for conventions
|
|
48
|
+
- Consider whether this is Expo managed, bare RN, or has native modules
|
|
49
|
+
- Include test strategy in the plan
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quality-gate
|
|
3
|
+
description: Pre-merge quality checks using parallel code-reviewer and performance-profiler agents
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /quality-gate — Pre-Merge Checks
|
|
7
|
+
|
|
8
|
+
You are executing the `/quality-gate` command. Run **code-reviewer** and **performance-profiler** in parallel for comprehensive pre-merge validation.
|
|
9
|
+
|
|
10
|
+
## Parallel Execution
|
|
11
|
+
|
|
12
|
+
### Agent 1: code-reviewer — Code Quality
|
|
13
|
+
|
|
14
|
+
Run a full code review focused on merge readiness:
|
|
15
|
+
|
|
16
|
+
**Correctness:**
|
|
17
|
+
- Logic errors, edge cases
|
|
18
|
+
- TypeScript type safety (no `any` escapes)
|
|
19
|
+
- Error handling completeness
|
|
20
|
+
|
|
21
|
+
**Style & Conventions:**
|
|
22
|
+
- Follows project rules (check `.claude/rules/`)
|
|
23
|
+
- NativeWind usage is consistent
|
|
24
|
+
- Component structure matches patterns
|
|
25
|
+
|
|
26
|
+
**Security:**
|
|
27
|
+
- No secrets in code
|
|
28
|
+
- Input validation at boundaries
|
|
29
|
+
- Secure storage used for sensitive data
|
|
30
|
+
|
|
31
|
+
**Testing:**
|
|
32
|
+
- All new code has tests
|
|
33
|
+
- Tests actually test behavior (not implementation)
|
|
34
|
+
- Edge cases covered
|
|
35
|
+
|
|
36
|
+
### Agent 2: performance-profiler — Performance Checks
|
|
37
|
+
|
|
38
|
+
Run performance validation:
|
|
39
|
+
|
|
40
|
+
**Bundle Impact:**
|
|
41
|
+
```bash
|
|
42
|
+
# Compare bundle size before/after changes
|
|
43
|
+
npx react-native-bundle-visualizer
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Runtime Checks:**
|
|
47
|
+
- No unnecessary re-renders introduced
|
|
48
|
+
- Lists use `FlashList` with `estimatedItemSize`
|
|
49
|
+
- Images are optimized (expo-image with caching)
|
|
50
|
+
- Animations run on UI thread (worklets)
|
|
51
|
+
|
|
52
|
+
**Memory:**
|
|
53
|
+
- Event listeners and subscriptions cleaned up
|
|
54
|
+
- No circular references in state
|
|
55
|
+
- Large data sets paginated
|
|
56
|
+
|
|
57
|
+
## Gate Result
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
## Quality Gate Result: PASS / FAIL
|
|
61
|
+
|
|
62
|
+
### Code Review: PASS
|
|
63
|
+
- 0 Critical issues
|
|
64
|
+
- 1 Warning (TODO in checkout.tsx:45)
|
|
65
|
+
- 3 Suggestions
|
|
66
|
+
|
|
67
|
+
### Performance: PASS
|
|
68
|
+
- Bundle size: +12KB (within threshold)
|
|
69
|
+
- No new re-render issues detected
|
|
70
|
+
- Memory: No leaks detected
|
|
71
|
+
|
|
72
|
+
### Verdict: PASS ✓
|
|
73
|
+
Ready for merge. Address 1 warning in next iteration.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The gate produces a binary PASS/FAIL. FAIL if:
|
|
77
|
+
- Any critical code review issue
|
|
78
|
+
- Bundle size increase > 50KB without justification
|
|
79
|
+
- Performance regression detected
|
|
80
|
+
- Missing tests for new code paths
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: retrospective
|
|
3
|
+
description: Session analysis — runs evaluate-session.js to review work quality and suggest improvements
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /retrospective — Session Analysis
|
|
7
|
+
|
|
8
|
+
You are executing the `/retrospective` command. This is **script-driven** — it runs the session evaluation pipeline.
|
|
9
|
+
|
|
10
|
+
## What This Does
|
|
11
|
+
|
|
12
|
+
Analyzes the completed coding session to evaluate quality, identify improvements, and suggest harness enhancements.
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
1. **Run the evaluation script:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
node .claude/hooks/scripts/evaluate-session.js
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
This script analyzes:
|
|
23
|
+
- Files created/modified during the session
|
|
24
|
+
- Test results and coverage changes
|
|
25
|
+
- Build success/failure history
|
|
26
|
+
- Hook trigger patterns (which rules fired, which were ignored)
|
|
27
|
+
- Time spent in different phases (planning, coding, testing, debugging)
|
|
28
|
+
|
|
29
|
+
2. **Generate session report:**
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
## Session Retrospective
|
|
33
|
+
|
|
34
|
+
### Work Summary
|
|
35
|
+
- Files changed: 12
|
|
36
|
+
- Tests added: 8
|
|
37
|
+
- Tests passing: 47/47
|
|
38
|
+
- Build status: Success
|
|
39
|
+
|
|
40
|
+
### Quality Metrics
|
|
41
|
+
- Type safety: 100% (no new `any`)
|
|
42
|
+
- Test coverage delta: +3.2%
|
|
43
|
+
- Bundle size delta: +8KB
|
|
44
|
+
|
|
45
|
+
### Patterns Observed
|
|
46
|
+
- [GOOD] Consistent use of error boundaries
|
|
47
|
+
- [GOOD] All new components have tests
|
|
48
|
+
- [IMPROVE] 3 files missing JSDoc on public API
|
|
49
|
+
- [IMPROVE] 2 effects missing cleanup
|
|
50
|
+
|
|
51
|
+
### Harness Feedback
|
|
52
|
+
- Rule `common/state-management.md` triggered 5 times → Well calibrated
|
|
53
|
+
- Rule `expo/patterns.md` never triggered → May need broader globs
|
|
54
|
+
- Hook `lint-staged.cjs` caught 2 issues → Working as intended
|
|
55
|
+
- Suggestion: Add rule for consistent error message format
|
|
56
|
+
|
|
57
|
+
### Recommendations
|
|
58
|
+
1. Add error message formatting rule
|
|
59
|
+
2. Review expo/patterns.md glob coverage
|
|
60
|
+
3. Consider adding pre-commit test hook
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
3. **Act on recommendations:**
|
|
64
|
+
Review each recommendation and decide whether to implement it now or add to backlog.
|
|
65
|
+
|
|
66
|
+
## When to Use
|
|
67
|
+
- At the end of a significant coding session
|
|
68
|
+
- After completing a feature or milestone
|
|
69
|
+
- When the harness feels miscalibrated (too many or too few rule triggers)
|
|
70
|
+
- Periodically for continuous improvement
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-device
|
|
3
|
+
description: Install and configure agent-device MCP server for simulator/emulator control
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /setup-device — Setup Device Control
|
|
7
|
+
|
|
8
|
+
You are executing the `/setup-device` command. This is **script-driven** — it sets up the agent-device MCP server.
|
|
9
|
+
|
|
10
|
+
## What This Does
|
|
11
|
+
|
|
12
|
+
Installs and configures the agent-device MCP server so commands like `/debug`, `/perf`, `/component`, and `/deploy` gain visual device interaction capabilities.
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### Step 1: Check Prerequisites
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# iOS: Check for Xcode and simulator
|
|
20
|
+
xcodebuild -version
|
|
21
|
+
xcrun simctl list devices
|
|
22
|
+
|
|
23
|
+
# Android: Check for Android Studio and emulator
|
|
24
|
+
adb version
|
|
25
|
+
emulator -list-avds
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Step 2: Install agent-device MCP
|
|
29
|
+
|
|
30
|
+
Check if already configured in `.claude/settings.json`:
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"agent-device": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": ["-y", "agent-device"]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If not present, add the configuration.
|
|
43
|
+
|
|
44
|
+
### Step 3: Verify Connection
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Boot a simulator (iOS)
|
|
48
|
+
xcrun simctl boot "iPhone 16 Pro"
|
|
49
|
+
|
|
50
|
+
# Or start an emulator (Android)
|
|
51
|
+
emulator -avd Pixel_8_API_35 &
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Test that agent-device can:
|
|
55
|
+
- Take a screenshot
|
|
56
|
+
- Detect booted device
|
|
57
|
+
- Perform a tap action
|
|
58
|
+
|
|
59
|
+
### Step 4: Configure Command Integration
|
|
60
|
+
|
|
61
|
+
After setup, these commands gain enhanced capabilities:
|
|
62
|
+
|
|
63
|
+
| Command | Enhancement |
|
|
64
|
+
|---------|-------------|
|
|
65
|
+
| `/debug` | Screenshot reproduction steps, tap through UI |
|
|
66
|
+
| `/perf` | Measure real FPS, capture actual jank frames |
|
|
67
|
+
| `/component` | Render on device, visual verification screenshot |
|
|
68
|
+
| `/deploy` | Launch preview build, verify UI before submit |
|
|
69
|
+
| `/build-fix` | Build, install, and launch to verify fix |
|
|
70
|
+
|
|
71
|
+
### Output
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
## agent-device Setup Complete
|
|
75
|
+
|
|
76
|
+
### Status
|
|
77
|
+
- MCP server: Configured ✓
|
|
78
|
+
- iOS Simulator: Available (iPhone 16 Pro)
|
|
79
|
+
- Android Emulator: Available (Pixel 8 API 35)
|
|
80
|
+
|
|
81
|
+
### Capabilities Enabled
|
|
82
|
+
- Screenshot capture
|
|
83
|
+
- Tap/type/swipe interaction
|
|
84
|
+
- App navigation
|
|
85
|
+
- Visual verification
|
|
86
|
+
|
|
87
|
+
### Commands Enhanced
|
|
88
|
+
/debug, /perf, /component, /deploy, /build-fix
|
|
89
|
+
now have visual device control.
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Troubleshooting
|
|
93
|
+
|
|
94
|
+
| Problem | Solution |
|
|
95
|
+
|---------|----------|
|
|
96
|
+
| iOS simulator not found | Install Xcode, run `xcode-select --install` |
|
|
97
|
+
| Android emulator not found | Install Android Studio, create AVD in AVD Manager |
|
|
98
|
+
| agent-device fails to connect | Check MCP server config in `.claude/settings.json` |
|
|
99
|
+
| Screenshots are black | Wait for device to finish booting, retry |
|
package/commands/tdd.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development workflow with Jest and React Native Testing Library
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /tdd — Test-Driven Development
|
|
7
|
+
|
|
8
|
+
You are executing the `/tdd` command. Use the **tdd-guide** agent to implement features test-first.
|
|
9
|
+
|
|
10
|
+
## Red-Green-Refactor Cycle
|
|
11
|
+
|
|
12
|
+
### 1. RED — Write Failing Test First
|
|
13
|
+
```tsx
|
|
14
|
+
// Write the test BEFORE any implementation
|
|
15
|
+
test('LoginButton shows loading state during auth', () => {
|
|
16
|
+
render(<LoginButton onPress={mockAuth} />);
|
|
17
|
+
fireEvent.press(screen.getByRole('button', { name: 'Log In' }));
|
|
18
|
+
expect(screen.getByTestId('loading-spinner')).toBeVisible();
|
|
19
|
+
});
|
|
20
|
+
```
|
|
21
|
+
Run the test — confirm it FAILS (red).
|
|
22
|
+
|
|
23
|
+
### 2. GREEN — Write Minimum Code to Pass
|
|
24
|
+
Implement only enough code to make the test pass. Do not over-engineer.
|
|
25
|
+
|
|
26
|
+
### 3. REFACTOR — Clean Up
|
|
27
|
+
Improve code quality while keeping tests green:
|
|
28
|
+
- Extract shared logic into hooks
|
|
29
|
+
- Improve naming and readability
|
|
30
|
+
- Remove duplication
|
|
31
|
+
|
|
32
|
+
## Testing Stack
|
|
33
|
+
- **Unit/Component**: Jest + React Native Testing Library
|
|
34
|
+
- **E2E**: Detox (when needed for user flows)
|
|
35
|
+
|
|
36
|
+
## Workflow
|
|
37
|
+
1. User describes the feature to implement
|
|
38
|
+
2. Write test(s) for the first behavior
|
|
39
|
+
3. Run test — verify it fails
|
|
40
|
+
4. Implement minimum code
|
|
41
|
+
5. Run test — verify it passes
|
|
42
|
+
6. Refactor if needed
|
|
43
|
+
7. Repeat for next behavior
|
|
44
|
+
8. When feature is complete, run full test suite
|
|
45
|
+
|
|
46
|
+
## Rules
|
|
47
|
+
- Never write implementation code without a failing test first
|
|
48
|
+
- Test behavior, not implementation details
|
|
49
|
+
- Query elements by role, text, or label (not testID unless necessary)
|
|
50
|
+
- Mock at boundaries (API, native modules), not internals
|
|
51
|
+
- Reference `rules/common/testing.md` for conventions
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: upgrade
|
|
3
|
+
description: Version migration for Expo SDK and React Native using the upgrade-assistant agent
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /upgrade — Version Migration
|
|
7
|
+
|
|
8
|
+
You are executing the `/upgrade` command. Use the **upgrade-assistant** agent for guided version migration.
|
|
9
|
+
|
|
10
|
+
## 5-Step Upgrade Process
|
|
11
|
+
|
|
12
|
+
### Step 1: Pre-Assessment
|
|
13
|
+
- Identify current versions (Expo SDK, React Native, key dependencies)
|
|
14
|
+
- Identify target versions
|
|
15
|
+
- Check release notes and breaking changes
|
|
16
|
+
- Backup current state (`git stash` or commit)
|
|
17
|
+
|
|
18
|
+
### Step 2: Dependency Compatibility Matrix
|
|
19
|
+
Generate a compatibility table:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
| Package | Current | Target | Compatible? | Notes |
|
|
23
|
+
|---------|---------|--------|-------------|-------|
|
|
24
|
+
| expo | 51.0.0 | 52.0.0 | ✅ | Major upgrade |
|
|
25
|
+
| react-native | 0.74 | 0.76 | ✅ | Via Expo SDK |
|
|
26
|
+
| @react-navigation | 6.x | 7.x | ⚠️ | Breaking changes |
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Step 3: Breaking Change Detection
|
|
30
|
+
- Scan codebase for deprecated APIs being used
|
|
31
|
+
- Identify removed features
|
|
32
|
+
- Check for changed behavior in dependencies
|
|
33
|
+
- Flag native module compatibility issues
|
|
34
|
+
|
|
35
|
+
### Step 4: Migration Steps
|
|
36
|
+
Execute the upgrade:
|
|
37
|
+
|
|
38
|
+
**Expo projects:**
|
|
39
|
+
```bash
|
|
40
|
+
npx expo install expo@latest
|
|
41
|
+
npx expo install --fix # Fix peer dependency issues
|
|
42
|
+
npx expo prebuild --clean # Regenerate native projects
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Bare RN projects:**
|
|
46
|
+
```bash
|
|
47
|
+
npx react-native upgrade
|
|
48
|
+
# Or use upgrade-helper: https://react-native-community.github.io/upgrade-helper/
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
- Apply codemods when available
|
|
52
|
+
- Update deprecated API calls
|
|
53
|
+
- Fix TypeScript type changes
|
|
54
|
+
- Update config files
|
|
55
|
+
|
|
56
|
+
### Step 5: Post-Upgrade Verification
|
|
57
|
+
- [ ] TypeScript compiles without errors
|
|
58
|
+
- [ ] ESLint passes
|
|
59
|
+
- [ ] All tests pass
|
|
60
|
+
- [ ] iOS build succeeds
|
|
61
|
+
- [ ] Android build succeeds
|
|
62
|
+
- [ ] Manual smoke test on both platforms
|
|
63
|
+
|
|
64
|
+
## Output Format
|
|
65
|
+
```
|
|
66
|
+
## Upgrade Summary
|
|
67
|
+
From: [current versions]
|
|
68
|
+
To: [target versions]
|
|
69
|
+
|
|
70
|
+
## Breaking Changes Found
|
|
71
|
+
[List with file locations]
|
|
72
|
+
|
|
73
|
+
## Changes Applied
|
|
74
|
+
[Files modified with descriptions]
|
|
75
|
+
|
|
76
|
+
## Verification Checklist
|
|
77
|
+
[Status of each verification step]
|
|
78
|
+
```
|