rex-claude 2.2.0 → 3.0.1
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/dist/chunk-7AGI43F5.js +42 -0
- package/dist/context-FN5O5YBI.js +114 -0
- package/dist/gateway-EOVQXRON.js +198 -0
- package/dist/guards/completion-guard.sh +15 -2
- package/dist/guards/dangerous-cmd-guard.sh +2 -2
- package/dist/guards/error-pattern-guard.sh +45 -0
- package/dist/guards/notify-telegram.sh +34 -0
- package/dist/guards/test-protect-guard.sh +2 -2
- package/dist/guards/ui-checklist-guard.sh +1 -1
- package/dist/index.js +52 -13
- package/dist/{init-NXU37FCV.js → init-W3XGDQ6D.js} +159 -1
- package/dist/llm-YRORUH7E.js +9 -0
- package/dist/optimize-UKMAGQQE.js +148 -0
- package/dist/setup-AO3MW46W.js +252 -0
- package/dist/skills/build-validate/SKILL.md +23 -0
- package/dist/skills/code-review/SKILL.md +25 -0
- package/dist/skills/context-loader/SKILL.md +25 -0
- package/dist/skills/debug-assist/SKILL.md +26 -0
- package/dist/skills/deploy-checklist/SKILL.md +61 -0
- package/dist/skills/dstudio-design-system/SKILL.md +120 -0
- package/dist/skills/figma-workflow/SKILL.md +23 -0
- package/dist/skills/fix-issue/SKILL.md +43 -0
- package/dist/skills/new-rule/SKILL.md +19 -0
- package/dist/skills/notify/SKILL.md +26 -0
- package/dist/skills/one-shot/SKILL.md +18 -0
- package/dist/skills/pr-review-loop/SKILL.md +48 -0
- package/dist/skills/project-init/SKILL.md +45 -0
- package/dist/skills/research/SKILL.md +17 -0
- package/dist/skills/rex-boot/SKILL.md +64 -0
- package/dist/skills/spec-interview/SKILL.md +20 -0
- package/dist/skills/token-guard/SKILL.md +26 -0
- package/package.json +4 -4
- package/dist/optimize-NE47FMOP.js +0 -111
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context-loader
|
|
3
|
+
description: Load relevant documentation and project context before starting work. Reads local docs cache, project CLAUDE.md, and REX memory. Use at session start or project switch.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Loader
|
|
7
|
+
|
|
8
|
+
Load context for: $ARGUMENTS (project path or framework name)
|
|
9
|
+
|
|
10
|
+
## If project path given:
|
|
11
|
+
1. Read project's `CLAUDE.md` if exists
|
|
12
|
+
2. Read `package.json` / `composer.json` / `pubspec.yaml` to detect stack
|
|
13
|
+
3. Call `rex_context(project_path)` for past session insights
|
|
14
|
+
4. For each framework detected, read `~/.claude/docs/{framework}.md` if exists
|
|
15
|
+
5. Report: stack detected, relevant docs loaded, past context found
|
|
16
|
+
|
|
17
|
+
## If framework name given:
|
|
18
|
+
1. Check `~/.claude/docs/{framework}.md` — if exists, read it
|
|
19
|
+
2. If not exists, fetch via Context7 and save key patterns to `~/.claude/docs/{framework}.md`
|
|
20
|
+
3. Report: doc loaded/created, key patterns summarized
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
- NEVER load docs that aren't relevant to the current task
|
|
24
|
+
- Always check local cache before fetching from network
|
|
25
|
+
- Keep doc files under 100 lines — patterns and gotchas only, not full API reference
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-assist
|
|
3
|
+
description: Systematic debugging. Reads error, searches REX memory for past solutions, checks docs, identifies root cause. Use when stuck on an error.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debug Assist
|
|
7
|
+
|
|
8
|
+
Debug: $ARGUMENTS (paste the error message or describe the issue)
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
1. **Parse the error**: extract file, line, error type, stack trace
|
|
12
|
+
2. **Check REX memory**: `rex_search("error message keywords")` for past solutions
|
|
13
|
+
3. **Check local docs**: read `~/.claude/docs/{framework}.md` for known gotchas
|
|
14
|
+
4. **Search codebase**: find the failing code, read surrounding context
|
|
15
|
+
5. **Identify root cause**: not the symptom — what ACTUALLY caused it
|
|
16
|
+
6. **Propose fix**: with code snippet and explanation
|
|
17
|
+
|
|
18
|
+
## Anti-patterns (NEVER do these)
|
|
19
|
+
- Never suppress the error without understanding it
|
|
20
|
+
- Never delete a test to make it pass
|
|
21
|
+
- Never add `@ts-ignore` or `eslint-disable` as a fix
|
|
22
|
+
- Never retry the same approach more than twice — try a different angle
|
|
23
|
+
|
|
24
|
+
## After fixing
|
|
25
|
+
- Save the pattern to REX: `rex_learn("Error X was caused by Y, fix is Z", "debug")`
|
|
26
|
+
- Update `~/.claude/docs/{framework}.md` if it's a framework gotcha
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy-checklist
|
|
3
|
+
description: Pre-deployment checklist. Use when user says "deploy", "push to prod", "push to beta", "ship it", or before any deployment. Runs verification steps before allowing deploy.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Deploy Checklist
|
|
8
|
+
|
|
9
|
+
Run this checklist BEFORE any deployment. $ARGUMENTS can specify the target (beta/prod).
|
|
10
|
+
|
|
11
|
+
## Pre-Deploy Verification
|
|
12
|
+
|
|
13
|
+
1. **Check git status**:
|
|
14
|
+
- All changes committed? No uncommitted work?
|
|
15
|
+
- On the correct branch?
|
|
16
|
+
- Branch is up to date with remote?
|
|
17
|
+
|
|
18
|
+
2. **Run tests** (if test suite exists):
|
|
19
|
+
```bash
|
|
20
|
+
# Detect and run project tests
|
|
21
|
+
# PHP: composer test or vendor/bin/phpunit
|
|
22
|
+
# Node/Angular: npm test
|
|
23
|
+
# Flutter: flutter test
|
|
24
|
+
# Python: pytest
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. **Run linter/formatter** (if configured):
|
|
28
|
+
```bash
|
|
29
|
+
# Detect and run linter
|
|
30
|
+
# PHP: composer lint or vendor/bin/phpcs
|
|
31
|
+
# Node: npm run lint
|
|
32
|
+
# Flutter: flutter analyze
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
4. **Build check**:
|
|
36
|
+
- Run production build to catch compile errors
|
|
37
|
+
- Verify build output exists and looks correct
|
|
38
|
+
|
|
39
|
+
5. **Environment check**:
|
|
40
|
+
- Verify environment config points to the correct target (beta vs prod)
|
|
41
|
+
- NEVER deploy with local/dev config pointing to wrong DB or API
|
|
42
|
+
- Check for hardcoded localhost URLs
|
|
43
|
+
|
|
44
|
+
6. **PR status** (if deploying from a PR):
|
|
45
|
+
- All CI checks passing?
|
|
46
|
+
- Gemini Code Assist review: any critical issues?
|
|
47
|
+
- GitHub Copilot review: any critical issues?
|
|
48
|
+
|
|
49
|
+
## Deploy Decision
|
|
50
|
+
|
|
51
|
+
- If ANY check fails: STOP and report to user
|
|
52
|
+
- If all checks pass: proceed with deploy and confirm target with user
|
|
53
|
+
|
|
54
|
+
IMPORTANT: Always ask "beta or prod?" if not specified. Never assume prod.
|
|
55
|
+
|
|
56
|
+
## Auto-Learn
|
|
57
|
+
|
|
58
|
+
If any deploy issue is found, call `rex_learn` MCP tool:
|
|
59
|
+
- category: `"lesson"`
|
|
60
|
+
- fact: the deploy issue + environment + fix (e.g. "Cloudflare deploy failed: missing wrangler.toml env binding for PROD")
|
|
61
|
+
- Helps prevent repeating the same deploy mistakes
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dstudio-design-system
|
|
3
|
+
description: Load the dstudio-ui design system context — tokens, components, patterns, and import guide. Use when building UI with @dstudio/ui components or design tokens.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# dstudio-ui Design System
|
|
8
|
+
|
|
9
|
+
You are working with the **@dstudio/ui** design system. Use this reference for all UI implementation.
|
|
10
|
+
|
|
11
|
+
## Architecture
|
|
12
|
+
|
|
13
|
+
- **Repo**: `/Users/keiy/Documents/Developer/dstudio-ui`
|
|
14
|
+
- **Package**: `@dstudio/ui` — exported from `src/index.ts`
|
|
15
|
+
- **Stack**: Next.js 16, Tailwind v4, Framer Motion (`motion/react`), Storybook v8, pnpm
|
|
16
|
+
- **`@` alias** maps to `src/` (NOT project root)
|
|
17
|
+
|
|
18
|
+
## Using in Another Project
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
// package.json
|
|
22
|
+
"@dstudio/ui": "file:../dstudio-ui"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then `pnpm install` and import:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { DSButton, MagicCard, KanbanBoard } from "@dstudio/ui"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The consumer project **must** share the same Tailwind v4 setup with CSS vars from `globals.css`. Tokens are CSS variables, not bundled.
|
|
32
|
+
|
|
33
|
+
## Design Tokens (Style Dictionary v4)
|
|
34
|
+
|
|
35
|
+
- **Format**: W3C DTCG `{ "$value": "...", "$type": "color" }`
|
|
36
|
+
- **Token files**: `tokens/core/*.json` + `tokens/semantic/colors.json`
|
|
37
|
+
- **Build**: `pnpm build:tokens` → `build/css/`, `build/tailwind/`, `build/figma/`, `build/js/`
|
|
38
|
+
- **Config**: `sd.config.ts` at repo root
|
|
39
|
+
|
|
40
|
+
### Key Semantic Colors
|
|
41
|
+
|
|
42
|
+
| Token | Value | CSS var |
|
|
43
|
+
|-------|-------|---------|
|
|
44
|
+
| background | #000000 | `--color-background` |
|
|
45
|
+
| foreground | #ffffff | `--color-foreground` |
|
|
46
|
+
| card | #080808 | `--color-card` |
|
|
47
|
+
| primary | #18181b | `--color-primary` |
|
|
48
|
+
| secondary | #f4f4f5 | `--color-secondary` |
|
|
49
|
+
| muted | #1a1a1a | `--color-muted` |
|
|
50
|
+
| border | #e4e4e7 | `--color-border` |
|
|
51
|
+
| destructive | #ef4444 | `--color-destructive` |
|
|
52
|
+
|
|
53
|
+
### Using tokens in Tailwind
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
// Tokens live in @theme {} block → Tailwind v4 auto-generates utilities
|
|
57
|
+
className="bg-background text-foreground border-border"
|
|
58
|
+
className="text-gray-400 bg-dark-100"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Adding a new token
|
|
62
|
+
|
|
63
|
+
1. Add to `tokens/core/*.json` or `tokens/semantic/colors.json`
|
|
64
|
+
2. `pnpm build:tokens`
|
|
65
|
+
3. Copy new var into `src/styles/globals.css` inside `@theme {}` block
|
|
66
|
+
4. Commit `build/` directory + `globals.css`
|
|
67
|
+
|
|
68
|
+
## Available Components
|
|
69
|
+
|
|
70
|
+
### D-Studio branded
|
|
71
|
+
GradientButton, GlassBadge, SmallButton, MultiLayerCard, SlightSeparator, DSButton, SquaredBadge
|
|
72
|
+
|
|
73
|
+
### Base UI (shadcn-style)
|
|
74
|
+
Badge, Button, Card, Input, Accordion, Dialog, Tabs, OrbitingCircles, Skeleton, Textarea, DropdownMenu
|
|
75
|
+
|
|
76
|
+
### Motion
|
|
77
|
+
BlurFade, InfiniteSlider, TextEffect, Tilt, GlowEffect, Magnetic, MagicCard, BorderTrail, TextScramble, SpinningText, TextReveal, Cursor
|
|
78
|
+
|
|
79
|
+
### Bits
|
|
80
|
+
StarBorder, GradualBlur, StackingCards
|
|
81
|
+
|
|
82
|
+
### PM (Project Management)
|
|
83
|
+
StatusBadge, AvatarStack, BoardTable, KanbanBoard, GanttChart, TimelineCalendar, DatePicker, StatusSelector, Notepad, NeonGlow, AnimatedBlob, PrioritySlider
|
|
84
|
+
|
|
85
|
+
### AI
|
|
86
|
+
AskAiButton, SuggestionChips
|
|
87
|
+
|
|
88
|
+
### Contact
|
|
89
|
+
ContactForm, MultiStateButton
|
|
90
|
+
|
|
91
|
+
### Shared
|
|
92
|
+
ScrambleRevealText, ProgressiveScrambleText, AnimatedSection
|
|
93
|
+
|
|
94
|
+
## Key Files
|
|
95
|
+
|
|
96
|
+
| File | Purpose |
|
|
97
|
+
|------|---------|
|
|
98
|
+
| `src/index.ts` | Main package export |
|
|
99
|
+
| `sd.config.ts` | Style Dictionary config |
|
|
100
|
+
| `tokens/core/colors.json` | Primitive color palette |
|
|
101
|
+
| `tokens/semantic/colors.json` | Semantic color aliases |
|
|
102
|
+
| `src/styles/globals.css` | `@theme` block (must be inline) |
|
|
103
|
+
| `src/app/components/page.tsx` | Components showcase page |
|
|
104
|
+
| `src/app/docs/components/component-data.ts` | Docs prop tables |
|
|
105
|
+
|
|
106
|
+
## Gotchas
|
|
107
|
+
|
|
108
|
+
- **`@theme {}` must be inline** in `globals.css` — `@import` of a file containing `@theme` breaks Vite/Storybook
|
|
109
|
+
- **`build/` directory is committed** (generated token outputs)
|
|
110
|
+
- **`Transition` type** import must come from `motion/react`
|
|
111
|
+
- **Framer Motion** — use `motion/react` not `framer-motion` for imports
|
|
112
|
+
- Nav variants: `floating-nav-landing.tsx` (next-intl), `floating-nav.tsx` (no i18n)
|
|
113
|
+
|
|
114
|
+
## When building UI with this system
|
|
115
|
+
|
|
116
|
+
1. Read the relevant component source in `dstudio-ui/src/` before using it
|
|
117
|
+
2. Follow existing Tailwind v4 patterns (CSS vars, not hardcoded colors)
|
|
118
|
+
3. Use `motion/react` for all animations
|
|
119
|
+
4. Check `src/index.ts` to see what's exported before importing
|
|
120
|
+
5. Run `pnpm build` in the consumer project to verify
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: figma-workflow
|
|
3
|
+
description: Implement UI from Figma designs using get_design_context, mapping to dstudio-ui components and project design tokens. Use when given a Figma URL or node ID.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Figma to Code Workflow
|
|
7
|
+
|
|
8
|
+
Use this skill when implementing UI from Figma designs.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
1. Call `get_design_context` with the Figma node ID and file key
|
|
12
|
+
2. Review the returned code, screenshot, and metadata
|
|
13
|
+
3. Map to existing dstudio-ui components — NEVER recreate what already exists
|
|
14
|
+
4. Extract design tokens (colors, spacing, typography) and map to project tokens
|
|
15
|
+
5. Adapt the reference code to the project's stack and conventions
|
|
16
|
+
6. Use Code Connect to link Figma components ↔ codebase components
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Always check dstudio-ui for existing components first
|
|
20
|
+
- Use project's design tokens, not raw hex values
|
|
21
|
+
- Responsive: mobile-first approach
|
|
22
|
+
- Accessibility: proper ARIA labels, semantic HTML
|
|
23
|
+
- Loading/empty/error states for dynamic content
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix-issue
|
|
3
|
+
description: Fix a GitHub issue end-to-end. Use when user says "/fix-issue 123" or "fix issue #123".
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Fix GitHub Issue
|
|
8
|
+
|
|
9
|
+
Analyze and fix the GitHub issue: $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
1. **Get issue details**:
|
|
12
|
+
```bash
|
|
13
|
+
gh issue view $ARGUMENTS
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. **Understand the problem**:
|
|
17
|
+
- Read the issue description, labels, and comments
|
|
18
|
+
- Identify the affected area of the codebase
|
|
19
|
+
- Search for relevant files using Grep/Glob
|
|
20
|
+
|
|
21
|
+
3. **Create a feature branch**:
|
|
22
|
+
```bash
|
|
23
|
+
gh issue view $ARGUMENTS --json title -q .title
|
|
24
|
+
# Branch name: fix/issue-NUMBER-short-description
|
|
25
|
+
git checkout -b fix/issue-$ARGUMENTS-<short-description>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
4. **Implement the fix**:
|
|
29
|
+
- Read relevant code before modifying
|
|
30
|
+
- Follow existing patterns in the codebase
|
|
31
|
+
- Make minimal, focused changes
|
|
32
|
+
|
|
33
|
+
5. **Verify the fix**:
|
|
34
|
+
- Run tests if they exist
|
|
35
|
+
- Run linter if configured
|
|
36
|
+
- Build the project to check for errors
|
|
37
|
+
|
|
38
|
+
6. **Commit and create PR**:
|
|
39
|
+
- Commit with message referencing the issue: `fix: <description> (closes #$ARGUMENTS)`
|
|
40
|
+
- Push branch and create PR linking to the issue
|
|
41
|
+
- Wait for Gemini/Copilot reviews
|
|
42
|
+
|
|
43
|
+
7. **Report to user**: show what was changed and ask for review
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: new-rule
|
|
3
|
+
description: Create a new rule in ~/.claude/rules/ when a recurring error or anti-pattern is identified. Implements "Mistakes become rules" automatically.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# New Rule
|
|
7
|
+
|
|
8
|
+
When an error or anti-pattern has been encountered multiple times (3+), create a permanent rule.
|
|
9
|
+
|
|
10
|
+
1. **Identify the pattern**: What went wrong? What's the root cause?
|
|
11
|
+
2. **Check existing rules**: Read `~/.claude/rules/` — does a similar rule already exist?
|
|
12
|
+
3. **Write the rule**:
|
|
13
|
+
- File: `~/.claude/rules/{topic}.md` (new or append to existing)
|
|
14
|
+
- Format: `JAMAIS X → TOUJOURS Y à la place` (every prohibition MUST have an alternative)
|
|
15
|
+
- Include a concrete code example (good vs bad)
|
|
16
|
+
4. **Memorize**: Call `rex_learn` with category `"lesson"` and the rule summary
|
|
17
|
+
5. **Report**: Tell the user what rule was created and why
|
|
18
|
+
|
|
19
|
+
Rules must be actionable, not vague. "Don't do X" is insufficient — always specify what to do instead.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: notify
|
|
3
|
+
description: Send a Telegram notification to Kevin. Use when user says "/notify", "notify me", "send telegram", or at end of important tasks. Arguments become the message body.
|
|
4
|
+
user_invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Notify via Telegram
|
|
8
|
+
|
|
9
|
+
Send a notification to Kevin's Telegram using the notify script. Zero tokens — pure shell.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bash ~/notify-telegram.sh "$ARGUMENTS"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If `$ARGUMENTS` is empty, auto-generate a one-line summary of what was just accomplished:
|
|
18
|
+
- Project name + branch
|
|
19
|
+
- What changed (brief)
|
|
20
|
+
|
|
21
|
+
Example:
|
|
22
|
+
```bash
|
|
23
|
+
bash ~/notify-telegram.sh "PR #42 created on rex" "feat/v3 — 33 files, 1800+ lines"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
IMPORTANT: This is a shell script call, NOT an LLM task. Do not elaborate. Just call the script.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: one-shot
|
|
3
|
+
description: Generate a complete production-ready project in one shot. Next.js + Shadcn UI + dstudio-ui. Use for rapid prototyping and SAAS scaffolding.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# One-Shot Project Generator
|
|
7
|
+
|
|
8
|
+
Create a complete project: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
1. Read `~/.claude/docs/nextjs.md` and `~/.claude/docs/react.md` for current patterns
|
|
11
|
+
2. Load dstudio-ui design system context: `/dstudio-design-system`
|
|
12
|
+
3. Scaffold with: Next.js App Router, TypeScript, Tailwind v4, dstudio-ui components
|
|
13
|
+
4. Include: auth scaffold, API routes with validation, DB schema, loading/empty/error states
|
|
14
|
+
5. Apply all defensive engineering rules (pagination, error handling, rate limits)
|
|
15
|
+
6. Setup: `package.json`, `tsconfig.json`, `.env.example`, `README.md`
|
|
16
|
+
7. Run `npm install && npm run build` to verify
|
|
17
|
+
|
|
18
|
+
Output a working project, not a template.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr-review-loop
|
|
3
|
+
description: Automated PR review loop. Use when user says "review loop", "check PR comments", "fix PR feedback", or after creating a PR. Pulls comments from Gemini Code Assist and GitHub Copilot, fixes valid issues, and pushes updates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PR Review Loop
|
|
7
|
+
|
|
8
|
+
After a PR is created or when asked to check PR feedback:
|
|
9
|
+
|
|
10
|
+
1. **Pull review comments** from the PR:
|
|
11
|
+
```bash
|
|
12
|
+
# Get PR number from current branch
|
|
13
|
+
PR_NUMBER=$(gh pr view --json number -q .number 2>/dev/null)
|
|
14
|
+
|
|
15
|
+
# Get all review comments (inline code comments)
|
|
16
|
+
gh api repos/{owner}/{repo}/pulls/$PR_NUMBER/comments --jq '.[] | "[\(.user.login)] \(.path):\(.line // .original_line) - \(.body)"'
|
|
17
|
+
|
|
18
|
+
# Get PR review summaries
|
|
19
|
+
gh pr view $PR_NUMBER --comments
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
2. **Categorize each comment**:
|
|
23
|
+
- **Valid fix needed**: bug, security issue, logic error, missing edge case
|
|
24
|
+
- **Good suggestion**: improvement worth making (cleaner code, better naming)
|
|
25
|
+
- **Dismiss**: style preference, false positive, or not applicable
|
|
26
|
+
|
|
27
|
+
3. **Fix valid issues**:
|
|
28
|
+
- Address each valid comment with a targeted fix
|
|
29
|
+
- Run tests/lint after each fix to ensure no regressions
|
|
30
|
+
- Do NOT introduce unrelated changes
|
|
31
|
+
|
|
32
|
+
4. **Commit and push fixes**:
|
|
33
|
+
- One commit for all review fixes: `fix: address PR review feedback`
|
|
34
|
+
- Push to the same branch (the PR updates automatically)
|
|
35
|
+
|
|
36
|
+
5. **Report to user**:
|
|
37
|
+
- List what was fixed and why
|
|
38
|
+
- List what was dismissed and why
|
|
39
|
+
- Ask user to review the diff between v1 and v2
|
|
40
|
+
|
|
41
|
+
IMPORTANT: Never force-push. Always regular push. The user reviews the incremental diff.
|
|
42
|
+
|
|
43
|
+
## Auto-Learn
|
|
44
|
+
|
|
45
|
+
After processing all comments, call `rex_learn` MCP tool for each valid fix:
|
|
46
|
+
- category: `"lesson"`
|
|
47
|
+
- fact: the reviewer feedback pattern + fix (e.g. "Copilot flagged missing null check on X — added guard clause")
|
|
48
|
+
- Skip dismissed comments — only learn from actionable feedback
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: project-init
|
|
3
|
+
description: Initialize a new project with CLAUDE.md, proper git setup, and documentation cache. Use when starting a new project or onboarding an existing one.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Init
|
|
7
|
+
|
|
8
|
+
Initialize project: $ARGUMENTS (path or name)
|
|
9
|
+
|
|
10
|
+
## For new projects
|
|
11
|
+
1. Create project directory structure
|
|
12
|
+
2. Generate `CLAUDE.md` with project-specific instructions
|
|
13
|
+
3. Detect stack from user input, create appropriate config files
|
|
14
|
+
4. Load relevant docs from `~/.claude/docs/` or fetch via Context7
|
|
15
|
+
5. Git init, create `.gitignore`, initial commit
|
|
16
|
+
6. Save project context: `rex_learn("Project X uses stack Y, structure Z", "architecture")`
|
|
17
|
+
|
|
18
|
+
## For existing projects (onboarding)
|
|
19
|
+
1. Read existing `package.json` / `composer.json` / config files to detect stack
|
|
20
|
+
2. Read existing `CLAUDE.md` if present, or create one
|
|
21
|
+
3. Scan project structure: key directories, entry points, routing
|
|
22
|
+
4. Load relevant framework docs from `~/.claude/docs/`
|
|
23
|
+
5. Call `rex_context(project_path)` for any past work history
|
|
24
|
+
6. Report: stack, structure, key files, any issues noticed
|
|
25
|
+
|
|
26
|
+
## CLAUDE.md template
|
|
27
|
+
```markdown
|
|
28
|
+
# Project Name
|
|
29
|
+
|
|
30
|
+
## Stack
|
|
31
|
+
- Framework: ...
|
|
32
|
+
- Language: ...
|
|
33
|
+
- Database: ...
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
- Dev: `npm run dev`
|
|
37
|
+
- Build: `npm run build`
|
|
38
|
+
- Test: `npm test`
|
|
39
|
+
- Lint: `npm run lint`
|
|
40
|
+
|
|
41
|
+
## Key Files
|
|
42
|
+
- Entry: ...
|
|
43
|
+
- Config: ...
|
|
44
|
+
- Routes: ...
|
|
45
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research
|
|
3
|
+
description: Deep research on a topic using web, docs, codebase. Returns concise actionable summary with sources. Use for architecture decisions, library comparisons, debugging.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Research
|
|
7
|
+
|
|
8
|
+
Research: $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
1. Check `~/.claude/docs/` for local cached documentation first
|
|
11
|
+
2. Search web for documentation, best practices, recent changes
|
|
12
|
+
3. Query Context7 for versioned library docs if relevant
|
|
13
|
+
4. Search codebase for existing patterns and usage
|
|
14
|
+
5. Synthesize into concise summary with recommendations
|
|
15
|
+
|
|
16
|
+
Return: key findings, recommended approach, code references, links.
|
|
17
|
+
Keep it actionable — the goal is to inform a decision, not write an essay.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rex-boot
|
|
3
|
+
description: Session startup companion. Auto-detects project, loads context, checks environment, asks what to work on. Runs automatically at every session start.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# REX Boot — Session Companion
|
|
7
|
+
|
|
8
|
+
Tu es REX, senior dev companion de Kevin. A chaque début de session, tu fais ce briefing.
|
|
9
|
+
|
|
10
|
+
## 1. Detect project context
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Where are we?
|
|
14
|
+
pwd
|
|
15
|
+
# Git state
|
|
16
|
+
git branch --show-current 2>/dev/null
|
|
17
|
+
git status --short 2>/dev/null | head -20
|
|
18
|
+
# What project is this?
|
|
19
|
+
cat package.json 2>/dev/null | jq '{name, scripts: .scripts | keys}' 2>/dev/null || cat composer.json 2>/dev/null | jq '.name' 2>/dev/null || echo "No project detected"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 2. Check for in-progress work
|
|
23
|
+
|
|
24
|
+
- Open branches with uncommitted changes?
|
|
25
|
+
- Stashed work? (`git stash list`)
|
|
26
|
+
- Open PRs on this repo? (`gh pr list --state open --limit 5`)
|
|
27
|
+
- Failing CI on current branch?
|
|
28
|
+
|
|
29
|
+
## 3. Load relevant context (ON-DEMAND only)
|
|
30
|
+
|
|
31
|
+
- If a project is detected: call `rex_context(project_path)` for past session memory
|
|
32
|
+
- If CLAUDE.md exists in project: mention its key points
|
|
33
|
+
- Do NOT load `~/.claude/docs/` yet — wait until the task is clear
|
|
34
|
+
|
|
35
|
+
## 4. Briefing to Kevin
|
|
36
|
+
|
|
37
|
+
Format the output as a short briefing:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
REX Boot
|
|
41
|
+
---
|
|
42
|
+
Projet: {name} ({path})
|
|
43
|
+
Branche: {branch} | {clean/dirty}
|
|
44
|
+
Stack: {detected stack}
|
|
45
|
+
PR ouvertes: {count}
|
|
46
|
+
Travail en cours: {stash/uncommitted summary}
|
|
47
|
+
Mémoire REX: {brief context if found}
|
|
48
|
+
---
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 5. Ask what to work on
|
|
52
|
+
|
|
53
|
+
Use AskUserQuestion with smart options based on context:
|
|
54
|
+
- If dirty git state → "Continuer le travail en cours?"
|
|
55
|
+
- If open PRs → "Review la PR #{number}?"
|
|
56
|
+
- If nothing → "Quel est l'objectif aujourd'hui?"
|
|
57
|
+
|
|
58
|
+
Always offer these options contextually, not a generic menu.
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
- Keep the boot FAST — no heavy operations, no doc loading
|
|
62
|
+
- Max 3 bash commands total
|
|
63
|
+
- If no project detected (home dir), just ask what Kevin veut faire
|
|
64
|
+
- NEVER read doc files at boot — they load when the task is clear
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-interview
|
|
3
|
+
description: Interview the user to write a complete feature spec before coding. Use when user says "/spec-interview" or "interview me about" a feature.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Feature Spec Interview
|
|
8
|
+
|
|
9
|
+
I want to build: $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
Interview me in depth using the AskUserQuestion tool. Cover:
|
|
12
|
+
- Technical implementation and architecture choices
|
|
13
|
+
- UI/UX and user flows
|
|
14
|
+
- Edge cases and failure modes
|
|
15
|
+
- Security implications
|
|
16
|
+
- Performance at scale (10x users/requests)
|
|
17
|
+
- Tradeoffs and alternatives considered
|
|
18
|
+
|
|
19
|
+
Don't ask obvious questions. Dig into the hard parts I haven't thought through.
|
|
20
|
+
Keep interviewing until we've covered everything, then write a complete spec to `SPEC.md`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: token-guard
|
|
3
|
+
description: Optimize context usage. Audit what's loaded, suggest cleanup, compact if needed. Use when context feels bloated or before long sessions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Token Guard
|
|
7
|
+
|
|
8
|
+
Audit and optimize the current context usage.
|
|
9
|
+
|
|
10
|
+
## Checks
|
|
11
|
+
1. **Files in context**: list all files that have been read this session
|
|
12
|
+
2. **Redundant reads**: flag files read multiple times
|
|
13
|
+
3. **Large outputs**: flag tool results > 200 lines that could have been scoped
|
|
14
|
+
4. **Stale context**: flag information from early in session that's no longer relevant
|
|
15
|
+
|
|
16
|
+
## Actions
|
|
17
|
+
- Suggest `/compact` if context > 70%
|
|
18
|
+
- Suggest `/clear` if switching to unrelated task
|
|
19
|
+
- Identify docs/files that could be read on-demand instead of upfront
|
|
20
|
+
- Flag any MCP server responses that returned excessive data
|
|
21
|
+
|
|
22
|
+
## Reminders
|
|
23
|
+
- Use subagents for heavy research (keeps main context clean)
|
|
24
|
+
- Use `limit` and `offset` when reading large files
|
|
25
|
+
- Use `head_limit` on Grep results
|
|
26
|
+
- Prefer Glob/Grep over Agent for simple lookups
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rex-claude",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Claude Code sous steroides — guards, health checks, memory RAG",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@rex/core": "workspace:*",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
39
|
+
"@types/node": "^25.3.3",
|
|
40
|
+
"tsup": "^8.5.1",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
42
42
|
}
|
|
43
43
|
}
|