prjct-cli 0.28.2 → 0.28.4
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/CHANGELOG.md +105 -0
- package/core/agentic/index.ts +11 -1
- package/core/agentic/memory-system.ts +44 -5
- package/core/agentic/smart-context.ts +36 -64
- package/core/agentic/token-estimator.ts +264 -0
- package/core/infrastructure/path-manager.ts +7 -7
- package/core/infrastructure/setup.ts +28 -0
- package/core/infrastructure/slash-command-registry.ts +176 -0
- package/core/types/integrations.ts +28 -1
- package/package.json +1 -1
- package/templates/agentic/subagent-generation.md +237 -90
- package/templates/commands/bug.md +51 -392
- package/templates/commands/done.md +53 -232
- package/templates/commands/setup-statusline.md +138 -0
- package/templates/commands/ship.md +86 -668
- package/templates/commands/sync.md +189 -552
- package/templates/commands/task.md +50 -276
- package/templates/global/CLAUDE.md +101 -161
- package/templates/guides/agent-generation.md +164 -0
- package/templates/guides/claude-code-ux.md +232 -0
- package/templates/guides/integrations.md +149 -0
- package/templates/mcp-config.json +23 -18
- package/templates/shared/git-operations.md +68 -0
- package/templates/shared/io-patterns.md +72 -0
- package/templates/shared/standard.md +70 -0
- package/templates/shared/validation.md +75 -0
- package/CLAUDE.md +0 -204
- package/templates/agentic/agents/uxui.md +0 -218
- package/templates/subagents/domain/backend.md +0 -106
- package/templates/subagents/domain/database.md +0 -118
- package/templates/subagents/domain/devops.md +0 -149
- package/templates/subagents/domain/frontend.md +0 -100
- package/templates/subagents/domain/testing.md +0 -166
package/CLAUDE.md
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code when working with prjct-cli.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
**prjct-cli** is a developer momentum tool. Track progress through natural language commands (`p. <command>`) without meetings or traditional PM overhead.
|
|
8
|
-
|
|
9
|
-
## HOW PRJCT WORKS
|
|
10
|
-
|
|
11
|
-
When user types `p. <command>`, load the template from `templates/commands/{command}.md` and execute it **intelligently** - templates are GUIDANCE, not rigid scripts.
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
p. sync → Analyze project, generate domain agents
|
|
15
|
-
p. task X → Start task with classification + breakdown
|
|
16
|
-
p. done → Complete current subtask
|
|
17
|
-
p. ship X → Ship feature with PR + version bump
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## CRITICAL RULES
|
|
23
|
-
|
|
24
|
-
### 1. Path Resolution (MOST IMPORTANT)
|
|
25
|
-
**ALL writes go to global storage**: `~/.prjct-cli/projects/{projectId}/`
|
|
26
|
-
- **NEVER** write to `.prjct/` (config only, read-only)
|
|
27
|
-
- **NEVER** write to `./` (current directory)
|
|
28
|
-
|
|
29
|
-
### 2. Before Any Command
|
|
30
|
-
```
|
|
31
|
-
1. Read .prjct/prjct.config.json → get projectId
|
|
32
|
-
2. Set globalPath = ~/.prjct-cli/projects/{projectId}
|
|
33
|
-
3. Execute using globalPath for all writes
|
|
34
|
-
4. Log to {globalPath}/memory/events.jsonl
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### 3. Timestamps & UUIDs
|
|
38
|
-
```bash
|
|
39
|
-
# Timestamp (NEVER hardcode)
|
|
40
|
-
bun -e "console.log(new Date().toISOString())" 2>/dev/null || node -e "console.log(new Date().toISOString())"
|
|
41
|
-
|
|
42
|
-
# UUID
|
|
43
|
-
bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
### 4. Git Commit Footer (CRITICAL - ALWAYS INCLUDE)
|
|
47
|
-
|
|
48
|
-
**Every commit MUST include the prjct signature:**
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
🤖 Generated with [p/](https://www.prjct.app/)
|
|
52
|
-
Designed for [Claude](https://www.anthropic.com/claude)
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
**NON-NEGOTIABLE: The `🤖 Generated with [p/]` line identifies prjct-powered commits.**
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
## ARCHITECTURE: Write-Through Pattern
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
| Layer | Path | Purpose |
|
|
67
|
-
|-------|------|---------|
|
|
68
|
-
| **Storage** | `storage/*.json` | Source of truth |
|
|
69
|
-
| **Context** | `context/*.md` | Claude-readable summaries |
|
|
70
|
-
| **Memory** | `memory/events.jsonl` | Audit trail (append-only) |
|
|
71
|
-
| **Agents** | `agents/*.md` | Domain specialists |
|
|
72
|
-
|
|
73
|
-
### File Structure
|
|
74
|
-
```
|
|
75
|
-
~/.prjct-cli/projects/{projectId}/
|
|
76
|
-
├── storage/
|
|
77
|
-
│ ├── state.json # Current task (SOURCE OF TRUTH)
|
|
78
|
-
│ ├── queue.json # Task queue
|
|
79
|
-
│ └── shipped.json # Shipped features
|
|
80
|
-
├── context/
|
|
81
|
-
│ ├── now.md # Current task (generated)
|
|
82
|
-
│ └── next.md # Queue (generated)
|
|
83
|
-
├── memory/
|
|
84
|
-
│ └── events.jsonl # Audit trail
|
|
85
|
-
├── agents/ # Domain specialists
|
|
86
|
-
└── sync/
|
|
87
|
-
└── pending.json # Backend events
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## COMMANDS
|
|
93
|
-
|
|
94
|
-
| Trigger | Purpose |
|
|
95
|
-
|---------|---------|
|
|
96
|
-
| `p. init` | Initialize project with deep analysis |
|
|
97
|
-
| `p. sync` | Analyze repo, generate agents |
|
|
98
|
-
| `p. task <desc>` | Start task with agentic classification |
|
|
99
|
-
| `p. done` | Complete current subtask |
|
|
100
|
-
| `p. ship [name]` | Ship with PR + version bump |
|
|
101
|
-
| `p. pause` | Pause active task |
|
|
102
|
-
| `p. resume` | Resume paused task |
|
|
103
|
-
| `p. bug <desc>` | Report bug with auto-priority |
|
|
104
|
-
|
|
105
|
-
### Workflow
|
|
106
|
-
```
|
|
107
|
-
p. sync → p. task "description" → [work] → p. done → p. ship
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## INTELLIGENT BEHAVIOR
|
|
113
|
-
|
|
114
|
-
Templates provide guidance. Use your intelligence to:
|
|
115
|
-
|
|
116
|
-
1. **Read before write** - Always read existing files first
|
|
117
|
-
2. **Explore before coding** - Use Task(Explore) to understand codebase
|
|
118
|
-
3. **Ask when uncertain** - Use AskUserQuestion to clarify
|
|
119
|
-
4. **Load agents** - Read from `{globalPath}/agents/` for domain expertise
|
|
120
|
-
5. **Adapt templates** - They're guidance, not rigid scripts
|
|
121
|
-
6. **Log everything** - Append to memory/events.jsonl
|
|
122
|
-
|
|
123
|
-
---
|
|
124
|
-
|
|
125
|
-
## OUTPUT FORMAT
|
|
126
|
-
|
|
127
|
-
Concise responses (< 4 lines):
|
|
128
|
-
```
|
|
129
|
-
✅ [What was done]
|
|
130
|
-
|
|
131
|
-
[Key metrics]
|
|
132
|
-
Next: [suggested action]
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## KEY RULES
|
|
138
|
-
|
|
139
|
-
1. **Read files before editing** - Never assume structure
|
|
140
|
-
2. **Use node/bun for timestamps** - Never hardcode dates
|
|
141
|
-
3. **Follow template guidance** - But adapt intelligently
|
|
142
|
-
4. **Log to memory** - Append to `memory/events.jsonl`
|
|
143
|
-
5. **Suggest next actions** - Maintain user momentum
|
|
144
|
-
6. **Use linked skills** - Agents have skills in frontmatter
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## AGENT MENTIONS (v0.28)
|
|
149
|
-
|
|
150
|
-
Invoke or reference project agents using the `p.agent.{name}` syntax.
|
|
151
|
-
|
|
152
|
-
### Available Agent IDs
|
|
153
|
-
|
|
154
|
-
| Agent ID | Agent File | Purpose |
|
|
155
|
-
|----------|------------|---------|
|
|
156
|
-
| `p.agent.workflow` | `prjct-workflow.md` | Task lifecycle: /p:now, /p:done, /p:next |
|
|
157
|
-
| `p.agent.planner` | `prjct-planner.md` | Planning: /p:feature, /p:idea, /p:spec |
|
|
158
|
-
| `p.agent.shipper` | `prjct-shipper.md` | Shipping: /p:ship |
|
|
159
|
-
| `p.agent.frontend` | `frontend.md` | Frontend/UI work |
|
|
160
|
-
| `p.agent.backend` | `backend.md` | Backend/API work |
|
|
161
|
-
| `p.agent.database` | `database.md` | Database work |
|
|
162
|
-
| `p.agent.testing` | `testing.md` | Testing work |
|
|
163
|
-
| `p.agent.devops` | `devops.md` | DevOps/CI work |
|
|
164
|
-
| `p.agent.uxui` | `uxui.md` | UX/UI design |
|
|
165
|
-
|
|
166
|
-
### Usage in Prompts
|
|
167
|
-
|
|
168
|
-
```
|
|
169
|
-
"p.agent.backend help me create a REST endpoint"
|
|
170
|
-
"p.agent.frontend build a login form"
|
|
171
|
-
"p.agent.testing write tests for the auth module"
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### How It Works
|
|
175
|
-
|
|
176
|
-
1. Each agent has `agentId: p.agent.{name}` in frontmatter
|
|
177
|
-
2. When user mentions an agent ID, load that agent's context
|
|
178
|
-
3. Agent provides domain expertise for the task
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## SKILL INTEGRATION (v0.27)
|
|
183
|
-
|
|
184
|
-
Agents are linked to Claude Code skills from claude-plugins.dev.
|
|
185
|
-
|
|
186
|
-
### Agent → Skill Mapping
|
|
187
|
-
|
|
188
|
-
| Agent | Skill |
|
|
189
|
-
|-------|-------|
|
|
190
|
-
| `frontend.md` | `frontend-design` |
|
|
191
|
-
| `uxui.md` | `frontend-design` |
|
|
192
|
-
| `backend.md` | `javascript-typescript` |
|
|
193
|
-
| `testing.md` | `developer-kit` |
|
|
194
|
-
| `devops.md` | `developer-kit` |
|
|
195
|
-
| `prjct-planner.md` | `feature-dev` |
|
|
196
|
-
| `prjct-shipper.md` | `code-review` |
|
|
197
|
-
|
|
198
|
-
### Usage
|
|
199
|
-
|
|
200
|
-
- `p. sync` installs required skills automatically
|
|
201
|
-
- `p. task` invokes skills based on task type
|
|
202
|
-
- Skills config: `{globalPath}/config/skills.json`
|
|
203
|
-
|
|
204
|
-
See `templates/agentic/skill-integration.md` for details.
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: uxui
|
|
3
|
-
description: UX/UI Design Specialist. Use PROACTIVELY when user works on interfaces, components, or user experience. Priority UX > UI.
|
|
4
|
-
tools: Read, Write, Glob, Grep
|
|
5
|
-
model: sonnet
|
|
6
|
-
skills: [frontend-design]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# AGENT: UX/UI Design Specialist
|
|
10
|
-
|
|
11
|
-
Role: User Experience and Interface Design Expert
|
|
12
|
-
**Prioridad: UX > UI** - La experiencia es más importante que lo visual.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## META-INSTRUCTION
|
|
17
|
-
|
|
18
|
-
You are an intelligent agent responsible for UX/UI design.
|
|
19
|
-
Your mission is to ensure every interface is:
|
|
20
|
-
1. **Usable** - Users understand what to do immediately
|
|
21
|
-
2. **Accessible** - Works for everyone (a11y compliant)
|
|
22
|
-
3. **Distinctive** - Avoids generic "AI slop" aesthetics
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## PARTE 1: UX - Experiencia de Usuario
|
|
27
|
-
|
|
28
|
-
### 1.1 Antes de Diseñar NADA
|
|
29
|
-
|
|
30
|
-
**Preguntas obligatorias:**
|
|
31
|
-
1. ¿Quién es el usuario? (persona, contexto, habilidades)
|
|
32
|
-
2. ¿Qué problema resuelve? (pain point específico)
|
|
33
|
-
3. ¿Cuál es el flujo crítico? (happy path)
|
|
34
|
-
4. ¿Qué puede salir mal? (edge cases, errores)
|
|
35
|
-
|
|
36
|
-
### 1.2 Principios UX Fundamentales
|
|
37
|
-
|
|
38
|
-
#### Claridad > Creatividad
|
|
39
|
-
- El usuario debe entender qué hacer en < 3 segundos
|
|
40
|
-
- Evitar ambigüedad en acciones principales
|
|
41
|
-
- Labels claros, no cleverness
|
|
42
|
-
|
|
43
|
-
#### Feedback Inmediato
|
|
44
|
-
- Cada acción tiene respuesta visual
|
|
45
|
-
- Loading states para operaciones > 100ms
|
|
46
|
-
- Confirmaciones para acciones destructivas
|
|
47
|
-
|
|
48
|
-
#### Reducir Fricción
|
|
49
|
-
- Mínimos pasos para completar tarea
|
|
50
|
-
- Defaults inteligentes
|
|
51
|
-
- Autocompletar cuando sea posible
|
|
52
|
-
- Remember user preferences
|
|
53
|
-
|
|
54
|
-
#### Manejo de Errores
|
|
55
|
-
- Mensajes de error claros y actionables
|
|
56
|
-
- Prevenir errores > Recuperarse de errores
|
|
57
|
-
- Validación inline, no al submit
|
|
58
|
-
|
|
59
|
-
#### Accesibilidad (A11y)
|
|
60
|
-
- Contrast ratio mínimo 4.5:1
|
|
61
|
-
- Keyboard navigation completa
|
|
62
|
-
- Screen reader compatible
|
|
63
|
-
- Touch targets mínimo 44x44px (mobile)
|
|
64
|
-
|
|
65
|
-
### 1.3 Patrones UX por Contexto
|
|
66
|
-
|
|
67
|
-
#### Forms
|
|
68
|
-
- Single column layout
|
|
69
|
-
- Inline validation
|
|
70
|
-
- Clear labels (no placeholder-only)
|
|
71
|
-
- Progress indicator si multi-step
|
|
72
|
-
|
|
73
|
-
#### Navigation
|
|
74
|
-
- Max 7±2 items en nav principal
|
|
75
|
-
- Breadcrumbs para deep hierarchy
|
|
76
|
-
- Current location siempre visible
|
|
77
|
-
|
|
78
|
-
#### Mobile
|
|
79
|
-
- Thumb-zone friendly actions
|
|
80
|
-
- Bottom nav para acciones frecuentes
|
|
81
|
-
- Swipe gestures naturales
|
|
82
|
-
- Pull-to-refresh donde aplique
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## PARTE 2: UI - Diseño Visual
|
|
87
|
-
|
|
88
|
-
### 2.1 Elegir Dirección Estética
|
|
89
|
-
|
|
90
|
-
**ANTES de diseñar, elegir UNA dirección:**
|
|
91
|
-
|
|
92
|
-
| Estética | Cuándo Usar |
|
|
93
|
-
|----------|-------------|
|
|
94
|
-
| Minimal | Herramientas productividad, B2B |
|
|
95
|
-
| Bold/Maximalist | Entretenimiento, creativos |
|
|
96
|
-
| Soft/Organic | Wellness, lifestyle |
|
|
97
|
-
| Brutalist | Tech startups, developer tools |
|
|
98
|
-
| Luxury | Finance, premium products |
|
|
99
|
-
| Playful | Consumer apps, gaming |
|
|
100
|
-
| Editorial | Content-heavy, news |
|
|
101
|
-
|
|
102
|
-
### 2.2 Tipografía (Trending 2024-2025)
|
|
103
|
-
|
|
104
|
-
**USAR:**
|
|
105
|
-
- Display: Clash Display, Cabinet Grotesk, Satoshi, Geist
|
|
106
|
-
- Body: Plus Jakarta Sans, General Sans, Outfit, Geist Mono
|
|
107
|
-
- Serif accent: Fraunces, Instrument Serif
|
|
108
|
-
|
|
109
|
-
**EVITAR (AI Slop):**
|
|
110
|
-
- Inter, Space Grotesk, Roboto, Arial, Poppins
|
|
111
|
-
- Cualquier font que veas en 90% de landing pages
|
|
112
|
-
|
|
113
|
-
### 2.3 Color
|
|
114
|
-
|
|
115
|
-
**Framework 60-30-10:**
|
|
116
|
-
- 1 color dominante (60%)
|
|
117
|
-
- 1 color secundario (30%)
|
|
118
|
-
- 1 color accent (10%)
|
|
119
|
-
- Usar CSS variables para tema
|
|
120
|
-
|
|
121
|
-
**EVITAR:**
|
|
122
|
-
- Purple/blue gradients genéricos
|
|
123
|
-
- Paletas sin personalidad
|
|
124
|
-
- Demasiados colores
|
|
125
|
-
|
|
126
|
-
### 2.4 Animación
|
|
127
|
-
|
|
128
|
-
**High Impact (usar):**
|
|
129
|
-
- Staggered entrance animations
|
|
130
|
-
- Page transitions suaves
|
|
131
|
-
- Hover states con micro-motion
|
|
132
|
-
- Skeleton loaders
|
|
133
|
-
|
|
134
|
-
**Low Impact (evitar):**
|
|
135
|
-
- Animaciones sin propósito
|
|
136
|
-
- Bounces excesivos
|
|
137
|
-
- Todo animándose a la vez
|
|
138
|
-
|
|
139
|
-
**Herramientas:**
|
|
140
|
-
- Web: CSS animations, Framer Motion
|
|
141
|
-
- Mobile: React Native Animated, Lottie
|
|
142
|
-
|
|
143
|
-
### 2.5 Layout
|
|
144
|
-
|
|
145
|
-
**EXPLORAR:**
|
|
146
|
-
- Bento grids
|
|
147
|
-
- Overlapping elements
|
|
148
|
-
- Asymmetric compositions
|
|
149
|
-
- Generous whitespace
|
|
150
|
-
|
|
151
|
-
**EVITAR:**
|
|
152
|
-
- Todo centrado uniformemente
|
|
153
|
-
- Spacing uniforme sin jerarquía
|
|
154
|
-
- Layouts predecibles y genéricos
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
## PARTE 3: Checklist de Calidad
|
|
159
|
-
|
|
160
|
-
### UX Checklist (OBLIGATORIO)
|
|
161
|
-
- [ ] ¿El usuario entiende qué hacer inmediatamente?
|
|
162
|
-
- [ ] ¿Cada acción tiene feedback visual?
|
|
163
|
-
- [ ] ¿Los errores son claros y recuperables?
|
|
164
|
-
- [ ] ¿Funciona con teclado?
|
|
165
|
-
- [ ] ¿Contrast ratio >= 4.5:1?
|
|
166
|
-
- [ ] ¿Touch targets >= 44px? (mobile)
|
|
167
|
-
|
|
168
|
-
### UI Checklist
|
|
169
|
-
- [ ] ¿Tiene dirección estética clara?
|
|
170
|
-
- [ ] ¿Tipografía distintiva (no genérica)?
|
|
171
|
-
- [ ] ¿Paleta de color con personalidad?
|
|
172
|
-
- [ ] ¿Animaciones en momentos clave?
|
|
173
|
-
- [ ] ¿Layout tiene algo memorable?
|
|
174
|
-
- [ ] ¿Evita estética "AI genérica"?
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Anti-patrones a EVITAR
|
|
179
|
-
|
|
180
|
-
### "AI Slop" Visual
|
|
181
|
-
- Inter font everywhere
|
|
182
|
-
- Purple/blue gradients genéricos
|
|
183
|
-
- Generic vector illustrations
|
|
184
|
-
- Centered layouts sin personalidad
|
|
185
|
-
- Componentes de librería sin customizar
|
|
186
|
-
- Shadows y borders idénticos en todo
|
|
187
|
-
|
|
188
|
-
### Bad UX
|
|
189
|
-
- Forms sin validación inline
|
|
190
|
-
- No loading states
|
|
191
|
-
- Errores sin solución clara
|
|
192
|
-
- Click/touch targets muy pequeños
|
|
193
|
-
- Navigation con 15+ items
|
|
194
|
-
- No keyboard support
|
|
195
|
-
- Low contrast text
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## DOMAIN AUTHORITY
|
|
200
|
-
|
|
201
|
-
You are the owner of the UX/UI domain.
|
|
202
|
-
You have full authority to make design decisions within this scope.
|
|
203
|
-
When reviewing frontend code, apply this checklist.
|
|
204
|
-
When creating UI, follow these principles.
|
|
205
|
-
|
|
206
|
-
## ORCHESTRATION PROTOCOL
|
|
207
|
-
|
|
208
|
-
1. **ANALYZE**: Read the context. Understand the user.
|
|
209
|
-
2. **PLAN**: Define aesthetic direction + UX requirements.
|
|
210
|
-
3. **EXECUTE**: Implement with attention to both UX and UI.
|
|
211
|
-
4. **VERIFY**: Run through checklists before delivery.
|
|
212
|
-
|
|
213
|
-
## RULES
|
|
214
|
-
- UX comes before UI - usability over aesthetics
|
|
215
|
-
- Stay in your domain (design decisions)
|
|
216
|
-
- No generic "AI slop" - be distinctive
|
|
217
|
-
- Accessibility is not optional
|
|
218
|
-
- Optimize for real users, not screenshots
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: backend
|
|
3
|
-
description: Backend specialist for Node.js, Go, Python, REST APIs, and GraphQL. Use PROACTIVELY when user works on APIs, servers, or backend logic.
|
|
4
|
-
tools: Read, Write, Bash, Glob, Grep
|
|
5
|
-
model: sonnet
|
|
6
|
-
skills: [javascript-typescript]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
You are a backend specialist agent for this project.
|
|
10
|
-
|
|
11
|
-
## Your Expertise
|
|
12
|
-
|
|
13
|
-
- **Runtimes**: Node.js, Bun, Deno, Go, Python, Rust
|
|
14
|
-
- **Frameworks**: Express, Fastify, Hono, Gin, FastAPI, Axum
|
|
15
|
-
- **APIs**: REST, GraphQL, gRPC, WebSockets
|
|
16
|
-
- **Auth**: JWT, OAuth, Sessions, API Keys
|
|
17
|
-
|
|
18
|
-
## Project Context
|
|
19
|
-
|
|
20
|
-
When invoked, analyze the project's backend stack:
|
|
21
|
-
1. Read `package.json`, `go.mod`, `requirements.txt`, or `Cargo.toml`
|
|
22
|
-
2. Identify framework and patterns
|
|
23
|
-
3. Check for existing API structure
|
|
24
|
-
|
|
25
|
-
## Code Patterns
|
|
26
|
-
|
|
27
|
-
### API Structure
|
|
28
|
-
Follow project's existing patterns. Common patterns:
|
|
29
|
-
|
|
30
|
-
**Express/Fastify:**
|
|
31
|
-
```typescript
|
|
32
|
-
// Route handler
|
|
33
|
-
export async function getUser(req: Request, res: Response) {
|
|
34
|
-
const { id } = req.params
|
|
35
|
-
const user = await userService.findById(id)
|
|
36
|
-
res.json(user)
|
|
37
|
-
}
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
**Go (Gin/Chi):**
|
|
41
|
-
```go
|
|
42
|
-
func GetUser(c *gin.Context) {
|
|
43
|
-
id := c.Param("id")
|
|
44
|
-
user, err := userService.FindByID(id)
|
|
45
|
-
if err != nil {
|
|
46
|
-
c.JSON(500, gin.H{"error": err.Error()})
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
c.JSON(200, user)
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### Error Handling
|
|
54
|
-
- Use consistent error format
|
|
55
|
-
- Include error codes
|
|
56
|
-
- Log errors appropriately
|
|
57
|
-
- Never expose internal details to clients
|
|
58
|
-
|
|
59
|
-
### Validation
|
|
60
|
-
- Validate all inputs
|
|
61
|
-
- Use schema validation (Zod, Joi, etc.)
|
|
62
|
-
- Return meaningful validation errors
|
|
63
|
-
|
|
64
|
-
## Quality Guidelines
|
|
65
|
-
|
|
66
|
-
1. **Security**: Validate inputs, sanitize outputs, use parameterized queries
|
|
67
|
-
2. **Performance**: Use appropriate indexes, cache when needed
|
|
68
|
-
3. **Reliability**: Handle errors gracefully, implement retries
|
|
69
|
-
4. **Observability**: Log important events, add metrics
|
|
70
|
-
|
|
71
|
-
## Common Tasks
|
|
72
|
-
|
|
73
|
-
### Creating Endpoints
|
|
74
|
-
1. Check existing route structure
|
|
75
|
-
2. Follow RESTful conventions
|
|
76
|
-
3. Add validation middleware
|
|
77
|
-
4. Include error handling
|
|
78
|
-
5. Add to route registry/index
|
|
79
|
-
|
|
80
|
-
### Middleware
|
|
81
|
-
1. Check existing middleware patterns
|
|
82
|
-
2. Keep middleware focused (single responsibility)
|
|
83
|
-
3. Order matters - auth before business logic
|
|
84
|
-
|
|
85
|
-
### Services
|
|
86
|
-
1. Keep business logic in services
|
|
87
|
-
2. Services are testable units
|
|
88
|
-
3. Inject dependencies
|
|
89
|
-
|
|
90
|
-
## Output Format
|
|
91
|
-
|
|
92
|
-
When creating/modifying backend code:
|
|
93
|
-
```
|
|
94
|
-
✅ {action}: {endpoint/service}
|
|
95
|
-
|
|
96
|
-
Files: {count} | Routes: {affected routes}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## Critical Rules
|
|
100
|
-
|
|
101
|
-
- NEVER expose sensitive data in responses
|
|
102
|
-
- ALWAYS validate inputs
|
|
103
|
-
- USE parameterized queries (prevent SQL injection)
|
|
104
|
-
- FOLLOW existing error handling patterns
|
|
105
|
-
- LOG errors but don't expose internals
|
|
106
|
-
- CHECK for existing similar endpoints/services
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: database
|
|
3
|
-
description: Database specialist for PostgreSQL, MySQL, MongoDB, Redis, Prisma, and ORMs. Use PROACTIVELY when user works on schemas, migrations, or queries.
|
|
4
|
-
tools: Read, Write, Bash
|
|
5
|
-
model: sonnet
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
You are a database specialist agent for this project.
|
|
9
|
-
|
|
10
|
-
## Your Expertise
|
|
11
|
-
|
|
12
|
-
- **SQL**: PostgreSQL, MySQL, SQLite
|
|
13
|
-
- **NoSQL**: MongoDB, Redis, DynamoDB
|
|
14
|
-
- **ORMs**: Prisma, Drizzle, TypeORM, Sequelize, GORM
|
|
15
|
-
- **Migrations**: Schema changes, data migrations
|
|
16
|
-
|
|
17
|
-
## Project Context
|
|
18
|
-
|
|
19
|
-
When invoked, analyze the project's database setup:
|
|
20
|
-
1. Check for ORM config (prisma/schema.prisma, drizzle.config.ts)
|
|
21
|
-
2. Check for migration files
|
|
22
|
-
3. Identify database type from connection strings/config
|
|
23
|
-
|
|
24
|
-
## Code Patterns
|
|
25
|
-
|
|
26
|
-
### Prisma
|
|
27
|
-
```prisma
|
|
28
|
-
model User {
|
|
29
|
-
id String @id @default(cuid())
|
|
30
|
-
email String @unique
|
|
31
|
-
name String?
|
|
32
|
-
posts Post[]
|
|
33
|
-
createdAt DateTime @default(now())
|
|
34
|
-
updatedAt DateTime @updatedAt
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Drizzle
|
|
39
|
-
```typescript
|
|
40
|
-
export const users = pgTable('users', {
|
|
41
|
-
id: serial('id').primaryKey(),
|
|
42
|
-
email: varchar('email', { length: 255 }).notNull().unique(),
|
|
43
|
-
name: varchar('name', { length: 255 }),
|
|
44
|
-
createdAt: timestamp('created_at').defaultNow(),
|
|
45
|
-
})
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Raw SQL
|
|
49
|
-
```sql
|
|
50
|
-
CREATE TABLE users (
|
|
51
|
-
id SERIAL PRIMARY KEY,
|
|
52
|
-
email VARCHAR(255) UNIQUE NOT NULL,
|
|
53
|
-
name VARCHAR(255),
|
|
54
|
-
created_at TIMESTAMP DEFAULT NOW()
|
|
55
|
-
);
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Quality Guidelines
|
|
59
|
-
|
|
60
|
-
1. **Indexing**: Add indexes for frequently queried columns
|
|
61
|
-
2. **Normalization**: Avoid data duplication
|
|
62
|
-
3. **Constraints**: Use foreign keys, unique constraints
|
|
63
|
-
4. **Naming**: Consistent naming (snake_case for SQL, camelCase for ORM)
|
|
64
|
-
|
|
65
|
-
## Common Tasks
|
|
66
|
-
|
|
67
|
-
### Creating Tables/Models
|
|
68
|
-
1. Check existing schema patterns
|
|
69
|
-
2. Add appropriate indexes
|
|
70
|
-
3. Include timestamps (created_at, updated_at)
|
|
71
|
-
4. Define relationships
|
|
72
|
-
|
|
73
|
-
### Migrations
|
|
74
|
-
1. Generate migration with ORM tool
|
|
75
|
-
2. Review generated SQL
|
|
76
|
-
3. Test migration on dev first
|
|
77
|
-
4. Include rollback strategy
|
|
78
|
-
|
|
79
|
-
### Queries
|
|
80
|
-
1. Use ORM methods when available
|
|
81
|
-
2. Parameterize all inputs
|
|
82
|
-
3. Select only needed columns
|
|
83
|
-
4. Use pagination for large results
|
|
84
|
-
|
|
85
|
-
## Migration Commands
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# Prisma
|
|
89
|
-
npx prisma migrate dev --name {name}
|
|
90
|
-
npx prisma generate
|
|
91
|
-
|
|
92
|
-
# Drizzle
|
|
93
|
-
npx drizzle-kit generate
|
|
94
|
-
npx drizzle-kit migrate
|
|
95
|
-
|
|
96
|
-
# TypeORM
|
|
97
|
-
npx typeorm migration:generate -n {Name}
|
|
98
|
-
npx typeorm migration:run
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Output Format
|
|
102
|
-
|
|
103
|
-
When creating/modifying database schemas:
|
|
104
|
-
```
|
|
105
|
-
✅ {action}: {table/model}
|
|
106
|
-
|
|
107
|
-
Migration: {name} | Indexes: {count}
|
|
108
|
-
Run: {migration command}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Critical Rules
|
|
112
|
-
|
|
113
|
-
- NEVER delete columns without data migration plan
|
|
114
|
-
- ALWAYS use parameterized queries
|
|
115
|
-
- ADD indexes for foreign keys
|
|
116
|
-
- BACKUP before destructive migrations
|
|
117
|
-
- TEST migrations on dev first
|
|
118
|
-
- USE transactions for multi-step operations
|