class-ai-agent 1.4.1 → 1.5.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/.agent/README.md +10 -5
- package/.agent/rules/agent-continuity.md +44 -0
- package/.agent/rules/antigravity-overview.md +38 -0
- package/.agent/rules/api-conventions.md +85 -0
- package/.agent/rules/clean-code.md +211 -0
- package/.agent/rules/code-style.md +92 -0
- package/.agent/rules/codegraph.md +47 -0
- package/.agent/rules/database.md +66 -0
- package/.agent/rules/error-handling.md +98 -0
- package/.agent/rules/git-workflow.md +83 -0
- package/.agent/rules/monitoring.md +317 -0
- package/.agent/rules/naming-conventions.md +266 -0
- package/.agent/rules/project-structure.md +71 -0
- package/.agent/rules/security.md +95 -0
- package/.agent/rules/system-design.md +168 -0
- package/.agent/rules/tech-stack.md +463 -0
- package/.agent/rules/testing.md +110 -0
- package/.agents/agents/backend.md +395 -0
- package/.agents/agents/business-analyst.md +380 -0
- package/.agents/agents/code-reviewer.md +110 -0
- package/.agents/agents/copywriter-seo.md +236 -0
- package/.agents/agents/frontend.md +384 -0
- package/.agents/agents/project-manager.md +201 -0
- package/.agents/agents/qa.md +221 -0
- package/.agents/agents/security-auditor.md +143 -0
- package/.agents/agents/systems-architect.md +211 -0
- package/.agents/agents/test-engineer.md +123 -0
- package/.agents/agents/ui-ux-designer.md +210 -0
- package/.agents/references/accessibility-checklist.md +174 -0
- package/.agents/references/agent-continuity.md +42 -0
- package/.agents/references/codegraph.md +90 -0
- package/.agents/references/mcp-antigravity.md +71 -0
- package/.agents/references/performance-checklist.md +150 -0
- package/.agents/references/security-checklist.md +94 -0
- package/.agents/references/supabase.md +55 -0
- package/.agents/references/testing-patterns.md +183 -0
- package/.agents/skills/agent-continuity/SKILL.md +70 -0
- package/.agents/skills/code-review/SKILL.md +208 -0
- package/.agents/skills/deploy/SKILL.md +68 -0
- package/.agents/skills/deploy/deploy.md +735 -0
- package/.agents/skills/incremental-implementation/SKILL.md +210 -0
- package/.agents/skills/security-review/SKILL.md +71 -0
- package/.agents/skills/supabase/SKILL.md +135 -0
- package/.agents/skills/supabase/UPSTREAM.md +16 -0
- package/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/.agents/skills/supabase/references/skill-feedback.md +17 -0
- package/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/.agents/skills/supabase-postgres-best-practices/UPSTREAM.md +16 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
- package/.agents/skills/tdd/SKILL.md +217 -0
- package/.agents/skills/ui-ux-pro-max/SKILL.md +288 -0
- package/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/.agents/workflows/build.md +132 -0
- package/.agents/workflows/debug.md +242 -0
- package/.agents/workflows/deploy.md +43 -0
- package/.agents/workflows/fix-issue.md +45 -0
- package/.agents/workflows/handoff.md +93 -0
- package/.agents/workflows/plan.md +125 -0
- package/.agents/workflows/publish-npm.md +122 -0
- package/.agents/workflows/resume.md +106 -0
- package/.agents/workflows/review.md +53 -0
- package/.agents/workflows/simplify.md +221 -0
- package/.agents/workflows/spec.md +95 -0
- package/.agents/workflows/test.md +213 -0
- package/.cursor/rules/cursor-overview.mdc +3 -2
- package/.kiro/steering/kiro-overview.md +2 -2
- package/AGENTS.md +4 -1
- package/GEMINI.md +152 -0
- package/README.md +58 -15
- package/bin/class-ai-agent.cjs +85 -9
- package/package.json +9 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
"""
|
|
4
|
+
UI/UX Pro Max Search - BM25 search engine for UI/UX style guides
|
|
5
|
+
Usage: python search.py "<query>" [--domain <domain>] [--stack <stack>] [--max-results 3]
|
|
6
|
+
python search.py "<query>" --design-system [-p "Project Name"]
|
|
7
|
+
python search.py "<query>" --design-system --persist [-p "Project Name"] [--page "dashboard"]
|
|
8
|
+
|
|
9
|
+
Domains: style, prompt, color, chart, landing, product, ux, typography
|
|
10
|
+
Stacks: html-tailwind, react, nextjs
|
|
11
|
+
|
|
12
|
+
Persistence (Master + Overrides pattern):
|
|
13
|
+
--persist Save design system to design-system/MASTER.md
|
|
14
|
+
--page Also create a page-specific override file in design-system/pages/
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import argparse
|
|
18
|
+
import sys
|
|
19
|
+
import io
|
|
20
|
+
from core import CSV_CONFIG, AVAILABLE_STACKS, MAX_RESULTS, search, search_stack
|
|
21
|
+
from design_system import generate_design_system, persist_design_system
|
|
22
|
+
|
|
23
|
+
# Force UTF-8 for stdout/stderr to handle emojis on Windows (cp1252 default)
|
|
24
|
+
if sys.stdout.encoding and sys.stdout.encoding.lower() != 'utf-8':
|
|
25
|
+
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
26
|
+
if sys.stderr.encoding and sys.stderr.encoding.lower() != 'utf-8':
|
|
27
|
+
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def format_output(result):
|
|
31
|
+
"""Format results for Claude consumption (token-optimized)"""
|
|
32
|
+
if "error" in result:
|
|
33
|
+
return f"Error: {result['error']}"
|
|
34
|
+
|
|
35
|
+
output = []
|
|
36
|
+
if result.get("stack"):
|
|
37
|
+
output.append(f"## UI Pro Max Stack Guidelines")
|
|
38
|
+
output.append(f"**Stack:** {result['stack']} | **Query:** {result['query']}")
|
|
39
|
+
else:
|
|
40
|
+
output.append(f"## UI Pro Max Search Results")
|
|
41
|
+
output.append(f"**Domain:** {result['domain']} | **Query:** {result['query']}")
|
|
42
|
+
output.append(f"**Source:** {result['file']} | **Found:** {result['count']} results\n")
|
|
43
|
+
|
|
44
|
+
for i, row in enumerate(result['results'], 1):
|
|
45
|
+
output.append(f"### Result {i}")
|
|
46
|
+
for key, value in row.items():
|
|
47
|
+
value_str = str(value)
|
|
48
|
+
if len(value_str) > 300:
|
|
49
|
+
value_str = value_str[:300] + "..."
|
|
50
|
+
output.append(f"- **{key}:** {value_str}")
|
|
51
|
+
output.append("")
|
|
52
|
+
|
|
53
|
+
return "\n".join(output)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
parser = argparse.ArgumentParser(description="UI Pro Max Search")
|
|
58
|
+
parser.add_argument("query", help="Search query")
|
|
59
|
+
parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()), help="Search domain")
|
|
60
|
+
parser.add_argument("--stack", "-s", choices=AVAILABLE_STACKS, help="Stack-specific search (html-tailwind, react, nextjs)")
|
|
61
|
+
parser.add_argument("--max-results", "-n", type=int, default=MAX_RESULTS, help="Max results (default: 3)")
|
|
62
|
+
parser.add_argument("--json", action="store_true", help="Output as JSON")
|
|
63
|
+
# Design system generation
|
|
64
|
+
parser.add_argument("--design-system", "-ds", action="store_true", help="Generate complete design system recommendation")
|
|
65
|
+
parser.add_argument("--project-name", "-p", type=str, default=None, help="Project name for design system output")
|
|
66
|
+
parser.add_argument("--format", "-f", choices=["ascii", "markdown"], default="ascii", help="Output format for design system")
|
|
67
|
+
# Persistence (Master + Overrides pattern)
|
|
68
|
+
parser.add_argument("--persist", action="store_true", help="Save design system to design-system/MASTER.md (creates hierarchical structure)")
|
|
69
|
+
parser.add_argument("--page", type=str, default=None, help="Create page-specific override file in design-system/pages/")
|
|
70
|
+
parser.add_argument("--output-dir", "-o", type=str, default=None, help="Output directory for persisted files (default: current directory)")
|
|
71
|
+
|
|
72
|
+
args = parser.parse_args()
|
|
73
|
+
|
|
74
|
+
# Design system takes priority
|
|
75
|
+
if args.design_system:
|
|
76
|
+
result = generate_design_system(
|
|
77
|
+
args.query,
|
|
78
|
+
args.project_name,
|
|
79
|
+
args.format,
|
|
80
|
+
persist=args.persist,
|
|
81
|
+
page=args.page,
|
|
82
|
+
output_dir=args.output_dir
|
|
83
|
+
)
|
|
84
|
+
print(result)
|
|
85
|
+
|
|
86
|
+
# Print persistence confirmation
|
|
87
|
+
if args.persist:
|
|
88
|
+
project_slug = args.project_name.lower().replace(' ', '-') if args.project_name else "default"
|
|
89
|
+
print("\n" + "=" * 60)
|
|
90
|
+
print(f"✅ Design system persisted to design-system/{project_slug}/")
|
|
91
|
+
print(f" 📄 design-system/{project_slug}/MASTER.md (Global Source of Truth)")
|
|
92
|
+
if args.page:
|
|
93
|
+
page_filename = args.page.lower().replace(' ', '-')
|
|
94
|
+
print(f" 📄 design-system/{project_slug}/pages/{page_filename}.md (Page Overrides)")
|
|
95
|
+
print("")
|
|
96
|
+
print(f"📖 Usage: When building a page, check design-system/{project_slug}/pages/[page].md first.")
|
|
97
|
+
print(f" If exists, its rules override MASTER.md. Otherwise, use MASTER.md.")
|
|
98
|
+
print("=" * 60)
|
|
99
|
+
# Stack search
|
|
100
|
+
elif args.stack:
|
|
101
|
+
result = search_stack(args.query, args.stack, args.max_results)
|
|
102
|
+
if args.json:
|
|
103
|
+
import json
|
|
104
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
105
|
+
else:
|
|
106
|
+
print(format_output(result))
|
|
107
|
+
# Domain search
|
|
108
|
+
else:
|
|
109
|
+
result = search(args.query, args.domain, args.max_results)
|
|
110
|
+
if args.json:
|
|
111
|
+
import json
|
|
112
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
113
|
+
else:
|
|
114
|
+
print(format_output(result))
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Implement tasks incrementally using TDD and vertical slices"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /build — Incremental Implementation
|
|
6
|
+
|
|
7
|
+
> "The simplest thing that could work."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Implement tasks one at a time using Test-Driven Development. Each increment leaves the system in a working, testable state.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- A plan exists (`tasks/todo.md`)
|
|
16
|
+
- Understanding of task acceptance criteria
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### For Each Task
|
|
21
|
+
|
|
22
|
+
#### Step 1: Load Context
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. Read `.agent/SESSION.md` if present (or run `/resume` at session start)
|
|
26
|
+
2. Read the task's acceptance criteria from `tasks/todo.md`
|
|
27
|
+
3. Identify relevant existing code and patterns
|
|
28
|
+
4. Understand types and interfaces involved
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
#### Step 2: RED — Write Failing Test
|
|
32
|
+
|
|
33
|
+
```javascript
|
|
34
|
+
// Write a test that describes expected behavior
|
|
35
|
+
// This test MUST fail initially
|
|
36
|
+
|
|
37
|
+
describe('createTask', () => {
|
|
38
|
+
it('should create a task with title and return id', async () => {
|
|
39
|
+
const result = await createTask({ title: 'Test' });
|
|
40
|
+
expect(result.id).toBeDefined();
|
|
41
|
+
expect(result.title).toBe('Test');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Run test — confirm it **fails**.
|
|
47
|
+
|
|
48
|
+
#### Step 3: GREEN — Minimal Implementation
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
// Write the MINIMUM code to pass the test
|
|
52
|
+
// No extra features, no premature optimization
|
|
53
|
+
|
|
54
|
+
async function createTask({ title }) {
|
|
55
|
+
const task = await db.task.create({ data: { title } });
|
|
56
|
+
return task;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Run test — confirm it **passes**.
|
|
61
|
+
|
|
62
|
+
#### Step 4: REFACTOR — Improve Code Quality
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
// Clean up while keeping tests green
|
|
66
|
+
// - Improve naming
|
|
67
|
+
// - Extract helpers if needed
|
|
68
|
+
// - Remove duplication
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Run tests — confirm they **still pass**.
|
|
72
|
+
|
|
73
|
+
#### Step 5: Verify & Commit
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Run full test suite
|
|
77
|
+
npm test
|
|
78
|
+
|
|
79
|
+
# Run build
|
|
80
|
+
npm run build
|
|
81
|
+
|
|
82
|
+
# Commit with clear message
|
|
83
|
+
git add .
|
|
84
|
+
git commit -m "feat(tasks): add createTask function"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
#### Step 6: Mark Complete
|
|
88
|
+
|
|
89
|
+
Update `tasks/todo.md` and `.agent/SESSION.md` (**Done**, **In progress**, **Next**):
|
|
90
|
+
```markdown
|
|
91
|
+
- [x] Task 1.1: Create task endpoint
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Rules
|
|
95
|
+
|
|
96
|
+
| Rule | Why |
|
|
97
|
+
|------|-----|
|
|
98
|
+
| **100-line limit** | Test before writing more than ~100 lines |
|
|
99
|
+
| **Touch only what's needed** | Don't refactor adjacent code |
|
|
100
|
+
| **Keep it building** | Project must compile after each increment |
|
|
101
|
+
| **Feature flags** | Use flags for incomplete features that need merging |
|
|
102
|
+
| **Rollback-friendly** | Each increment should be independently revertable |
|
|
103
|
+
|
|
104
|
+
### When Stuck
|
|
105
|
+
|
|
106
|
+
If a step fails:
|
|
107
|
+
|
|
108
|
+
1. **Stop** — Don't push through broken code
|
|
109
|
+
2. **Diagnose** — Use `/debug` to find root cause
|
|
110
|
+
3. **Fix** — Address the actual problem
|
|
111
|
+
4. **Guard** — Add test to prevent recurrence
|
|
112
|
+
5. **Resume** — Continue from where you stopped
|
|
113
|
+
|
|
114
|
+
## Red Flags
|
|
115
|
+
|
|
116
|
+
Stop and reassess if you find yourself:
|
|
117
|
+
|
|
118
|
+
- Writing > 100 lines without testing
|
|
119
|
+
- Mixing unrelated changes in one commit
|
|
120
|
+
- Expanding scope mid-task
|
|
121
|
+
- Breaking the build between increments
|
|
122
|
+
- Creating abstractions "for later"
|
|
123
|
+
|
|
124
|
+
## Output
|
|
125
|
+
|
|
126
|
+
- Working, tested code
|
|
127
|
+
- Updated `tasks/todo.md` with completed items
|
|
128
|
+
- Clean git history with atomic commits
|
|
129
|
+
|
|
130
|
+
## Next Step
|
|
131
|
+
|
|
132
|
+
After all tasks complete, run `/review` for final quality check.
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Systematic debugging and error recovery — find root cause, not symptoms"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /debug — Debugging & Error Recovery
|
|
6
|
+
|
|
7
|
+
> "Fix root causes, not symptoms."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Systematically diagnose and fix errors. Stop feature work, preserve evidence, find root cause, add guards, then resume.
|
|
12
|
+
|
|
13
|
+
## The Stop-the-Line Rule
|
|
14
|
+
|
|
15
|
+
When unexpected failures occur:
|
|
16
|
+
|
|
17
|
+
1. **STOP** — Halt feature work immediately
|
|
18
|
+
2. **PRESERVE** — Save error messages, logs, stack traces
|
|
19
|
+
3. **DIAGNOSE** — Follow the 6-step triage process
|
|
20
|
+
4. **FIX** — Address root cause, not symptoms
|
|
21
|
+
5. **GUARD** — Add tests to prevent recurrence
|
|
22
|
+
6. **RESUME** — Only continue after verification; update `.agent/SESSION.md` with root cause, guard tests, and **Next**
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 6-Step Triage Process
|
|
27
|
+
|
|
28
|
+
### Step 1: Reproduce
|
|
29
|
+
|
|
30
|
+
Make the failure happen reliably.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Run the failing test
|
|
34
|
+
npm test -- --grep "failing test name"
|
|
35
|
+
|
|
36
|
+
# Or reproduce manually with specific steps
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**If not reproducible**, investigate:
|
|
40
|
+
- Timing/race conditions
|
|
41
|
+
- Environment differences (dev vs CI)
|
|
42
|
+
- State leakage between tests
|
|
43
|
+
- Random/flaky behavior
|
|
44
|
+
|
|
45
|
+
### Step 2: Localize
|
|
46
|
+
|
|
47
|
+
Identify which layer fails:
|
|
48
|
+
|
|
49
|
+
| Layer | Symptoms |
|
|
50
|
+
|-------|----------|
|
|
51
|
+
| **UI/Frontend** | Render errors, missing elements, wrong display |
|
|
52
|
+
| **API/Backend** | HTTP errors, wrong responses, timeout |
|
|
53
|
+
| **Database** | Query errors, constraint violations, missing data |
|
|
54
|
+
| **Build** | Compilation errors, missing dependencies |
|
|
55
|
+
| **External** | Third-party API failures, network issues |
|
|
56
|
+
| **Test itself** | Flaky assertion, wrong expectations |
|
|
57
|
+
|
|
58
|
+
**Use `git bisect` for regressions:**
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git bisect start
|
|
62
|
+
git bisect bad HEAD
|
|
63
|
+
git bisect good <last-known-good-commit>
|
|
64
|
+
# Git will guide you to the breaking commit
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Step 3: Reduce
|
|
68
|
+
|
|
69
|
+
Strip away unrelated elements:
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
// Original complex failing code
|
|
73
|
+
const result = await complexFunction(
|
|
74
|
+
await getConfig(),
|
|
75
|
+
await fetchData(),
|
|
76
|
+
processOptions(opts)
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// Reduced to find the problem
|
|
80
|
+
const config = await getConfig();
|
|
81
|
+
console.log('config:', config); // Check each step
|
|
82
|
+
|
|
83
|
+
const data = await fetchData();
|
|
84
|
+
console.log('data:', data);
|
|
85
|
+
|
|
86
|
+
const result = await complexFunction(config, data, opts);
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 4: Fix Root Cause
|
|
90
|
+
|
|
91
|
+
**Fix the actual problem, not the symptom:**
|
|
92
|
+
|
|
93
|
+
| Symptom | Bad Fix | Good Fix |
|
|
94
|
+
|---------|---------|----------|
|
|
95
|
+
| Duplicate list items | Dedupe in UI | Fix query returning duplicates |
|
|
96
|
+
| Null reference error | Add `?.` everywhere | Ensure data is loaded before access |
|
|
97
|
+
| Slow API response | Increase timeout | Optimize the query |
|
|
98
|
+
| Flaky test | Add retry logic | Fix the race condition |
|
|
99
|
+
|
|
100
|
+
### Step 5: Guard Against Recurrence
|
|
101
|
+
|
|
102
|
+
Write a test that catches this specific failure:
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
it('should not return duplicate items (regression #123)', async () => {
|
|
106
|
+
// Setup that caused the original bug
|
|
107
|
+
await createOrder({ items: [item, item] });
|
|
108
|
+
|
|
109
|
+
// The query that was returning duplicates
|
|
110
|
+
const result = await getOrderItems();
|
|
111
|
+
|
|
112
|
+
// Guard: ensure no duplicates
|
|
113
|
+
const ids = result.map(r => r.id);
|
|
114
|
+
expect(ids).toEqual([...new Set(ids)]);
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Step 6: Verify End-to-End
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Run the specific test
|
|
122
|
+
npm test -- --grep "regression"
|
|
123
|
+
|
|
124
|
+
# Run full test suite
|
|
125
|
+
npm test
|
|
126
|
+
|
|
127
|
+
# Run build
|
|
128
|
+
npm run build
|
|
129
|
+
|
|
130
|
+
# Manual verification if needed
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Error-Specific Triage Trees
|
|
136
|
+
|
|
137
|
+
### Test Failure
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Test fails
|
|
141
|
+
├── Assertion error
|
|
142
|
+
│ ├── Expected value wrong → Check test expectation
|
|
143
|
+
│ └── Actual value wrong → Debug implementation
|
|
144
|
+
├── Runtime error
|
|
145
|
+
│ ├── ReferenceError → Check imports, variable names
|
|
146
|
+
│ ├── TypeError → Check types, null checks
|
|
147
|
+
│ └── NetworkError → Check test setup, mocks
|
|
148
|
+
└── Timeout
|
|
149
|
+
├── Async not awaited → Add missing await
|
|
150
|
+
└── Infinite loop → Check loop conditions
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Build Error
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
Build fails
|
|
157
|
+
├── TypeScript error
|
|
158
|
+
│ ├── Type mismatch → Fix types or add assertion
|
|
159
|
+
│ └── Missing import → Add import statement
|
|
160
|
+
├── Module not found
|
|
161
|
+
│ ├── Package missing → npm install
|
|
162
|
+
│ └── Path wrong → Fix import path
|
|
163
|
+
└── Syntax error
|
|
164
|
+
└── Check recent changes → git diff
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Runtime Error
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
Runtime error
|
|
171
|
+
├── API returns error
|
|
172
|
+
│ ├── 4xx → Client issue, check request
|
|
173
|
+
│ └── 5xx → Server issue, check logs
|
|
174
|
+
├── CORS error
|
|
175
|
+
│ └── Check server CORS config
|
|
176
|
+
├── Undefined/null
|
|
177
|
+
│ └── Add loading state or null check
|
|
178
|
+
└── Network timeout
|
|
179
|
+
└── Check connectivity, increase timeout
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Debugging Tools
|
|
185
|
+
|
|
186
|
+
### Console Logging (Temporary)
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
// Add strategic logs
|
|
190
|
+
console.log('[DEBUG] Input:', input);
|
|
191
|
+
console.log('[DEBUG] After transform:', result);
|
|
192
|
+
|
|
193
|
+
// Remove all debug logs before commit
|
|
194
|
+
git diff | grep console.log
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Node Inspector
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Debug Node.js
|
|
201
|
+
node --inspect-brk src/index.js
|
|
202
|
+
|
|
203
|
+
# Debug tests
|
|
204
|
+
node --inspect-brk node_modules/.bin/vitest
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Git Bisect
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
git bisect start
|
|
211
|
+
git bisect bad # Current commit is broken
|
|
212
|
+
git bisect good abc123 # This commit was working
|
|
213
|
+
# Test each commit git suggests
|
|
214
|
+
git bisect good # or git bisect bad
|
|
215
|
+
git bisect reset # When done
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Common Rationalizations (Avoid These)
|
|
221
|
+
|
|
222
|
+
| Excuse | Reality |
|
|
223
|
+
|--------|---------|
|
|
224
|
+
| "It works on my machine" | Environment differences are bugs |
|
|
225
|
+
| "It's just flaky" | Flaky tests have root causes |
|
|
226
|
+
| "Let's just retry" | Retries hide real problems |
|
|
227
|
+
| "It's a third-party issue" | Still need to handle gracefully |
|
|
228
|
+
| "We'll fix it later" | Tech debt compounds |
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Output
|
|
233
|
+
|
|
234
|
+
- Root cause identified and fixed
|
|
235
|
+
- Regression test added
|
|
236
|
+
- All tests passing
|
|
237
|
+
- Clear commit message explaining the fix
|
|
238
|
+
- **`.agent/SESSION.md`** updated (Gotchas, Decisions, **Next**)
|
|
239
|
+
|
|
240
|
+
## Next Step
|
|
241
|
+
|
|
242
|
+
After fixing, continue with `/build` or run `/review` for verification.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "deploy"
|
|
3
|
+
---
|
|
4
|
+
# Deploy Command
|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
Deploy the application to the target environment.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
Tell Claude: "Run the deploy command" or "Deploy to [environment]"
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
### 1. Pre-deploy Checklist
|
|
15
|
+
- [ ] All tests pass (`npm test`)
|
|
16
|
+
- [ ] No linting errors (`npm run lint`)
|
|
17
|
+
- [ ] Environment variables are configured
|
|
18
|
+
- [ ] Database migrations are ready
|
|
19
|
+
|
|
20
|
+
### 2. Build
|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 3. Deploy
|
|
26
|
+
```bash
|
|
27
|
+
# Development
|
|
28
|
+
npm run deploy:dev
|
|
29
|
+
|
|
30
|
+
# Production
|
|
31
|
+
npm run deploy:prod
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 4. Post-deploy Verification
|
|
35
|
+
- Check application health endpoint
|
|
36
|
+
- Verify logs for errors
|
|
37
|
+
- Run smoke tests
|
|
38
|
+
|
|
39
|
+
## Rollback
|
|
40
|
+
If deployment fails:
|
|
41
|
+
```bash
|
|
42
|
+
npm run rollback
|
|
43
|
+
```
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "fix-issue"
|
|
3
|
+
---
|
|
4
|
+
# Fix Issue Command
|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
Analyze and fix a reported bug or issue systematically.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
Tell Claude: "Fix issue: [describe the issue]" or "Fix bug in [file/module]"
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
### 1. Understand the Issue
|
|
15
|
+
- Read the error message or bug description carefully
|
|
16
|
+
- Identify the affected component(s)
|
|
17
|
+
- Reproduce the issue locally if possible
|
|
18
|
+
|
|
19
|
+
### 2. Root Cause Analysis
|
|
20
|
+
- Check recent git changes: `git log --oneline -20`
|
|
21
|
+
- Review affected files
|
|
22
|
+
- Look for related tests that may reveal expected behavior
|
|
23
|
+
|
|
24
|
+
### 3. Plan the Fix
|
|
25
|
+
- Identify the minimal change needed
|
|
26
|
+
- Consider side effects on other components
|
|
27
|
+
- Update or add tests to cover the fix
|
|
28
|
+
|
|
29
|
+
### 4. Implement
|
|
30
|
+
- Make the targeted fix
|
|
31
|
+
- Ensure code follows `.agent/rules/code-style.md`
|
|
32
|
+
- Handle errors per `.agent/rules/error-handling.md`
|
|
33
|
+
|
|
34
|
+
### 5. Verify
|
|
35
|
+
- Run relevant tests: `npm test -- --testPathPattern=[affected]`
|
|
36
|
+
- Run full test suite: `npm test`
|
|
37
|
+
- Check linting: `npm run lint`
|
|
38
|
+
|
|
39
|
+
### 6. Commit
|
|
40
|
+
Follow `.agent/rules/git-workflow.md`:
|
|
41
|
+
```
|
|
42
|
+
fix: [short description of the fix]
|
|
43
|
+
|
|
44
|
+
Closes #[issue-number]
|
|
45
|
+
```
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "End-of-session — update .agent/SESSION.md for the next agent or tool"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /handoff — Session handoff
|
|
6
|
+
|
|
7
|
+
> "Leave the next agent a map, not a maze."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Capture current work in **`.agent/SESSION.md`** so another chat, persona, or tool (Cursor, Claude Code, Kiro) can continue without re-discovering context.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
- End of a work session (before closing chat)
|
|
16
|
+
- Switching tools (Cursor → Claude Code → Kiro)
|
|
17
|
+
- Switching persona (e.g. architect → backend)
|
|
18
|
+
- After completing a workflow phase (spec, plan, build, test, review)
|
|
19
|
+
- Before opening a PR (document what reviewers should know)
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- `.agent/SESSION.md` exists (created by `npx class-ai-agent` or copy from `.agent/SESSION.template.md`)
|
|
24
|
+
- You have context on what was done this session
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
### Phase 1: Gather state
|
|
29
|
+
|
|
30
|
+
1. **Review git** — branch name, uncommitted files, last commits
|
|
31
|
+
2. **Review tasks** — open `tasks/todo.md`; sync checkboxes with reality
|
|
32
|
+
3. **Review spec** — note linked `SPEC.md` or `docs/specs/...` path
|
|
33
|
+
4. **Scan decisions** — what did we choose that is not obvious from code alone?
|
|
34
|
+
5. **Scan gotchas** — what failed, env quirks, commands that matter
|
|
35
|
+
|
|
36
|
+
### Phase 2: Update `.agent/SESSION.md`
|
|
37
|
+
|
|
38
|
+
Refresh every section (use `.agent/SESSION.template.md` as schema):
|
|
39
|
+
|
|
40
|
+
| Section | Content |
|
|
41
|
+
|---------|---------|
|
|
42
|
+
| **Meta** | `Updated` (today), `Phase`, `Tool` (cursor/claude/kiro), optional `Persona` |
|
|
43
|
+
| **Goal** | One paragraph — still accurate? |
|
|
44
|
+
| **Done** | Bullets with file paths or commit refs |
|
|
45
|
+
| **In progress** | Current task; **Blockers** (none or describe) |
|
|
46
|
+
| **Next** | Numbered steps for the *next* agent |
|
|
47
|
+
| **Decisions** | Non-obvious choices made this session |
|
|
48
|
+
| **Gotchas** | Failed attempts, test commands, env notes |
|
|
49
|
+
| **Pointers** | Spec path, `tasks/todo.md`, branch, key files |
|
|
50
|
+
|
|
51
|
+
### Phase 3: Sync `tasks/todo.md`
|
|
52
|
+
|
|
53
|
+
- Mark completed items `[x]`
|
|
54
|
+
- Add new tasks discovered during work
|
|
55
|
+
- Remove or defer items that are out of scope
|
|
56
|
+
|
|
57
|
+
### Phase 4: Risk note (if applicable)
|
|
58
|
+
|
|
59
|
+
If work is **not** safe to pick up blindly, add under **Gotchas** or **In progress**:
|
|
60
|
+
|
|
61
|
+
- Uncommitted changes and why
|
|
62
|
+
- Failing tests or broken build
|
|
63
|
+
- External blockers (API, review, dependency)
|
|
64
|
+
|
|
65
|
+
### Phase 5: Optional milestone archive
|
|
66
|
+
|
|
67
|
+
For major milestones, copy `SESSION.md` to:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
.agent/history/YYYY-MM-DD-short-slug.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Commit both `SESSION.md` and the history file when ready.
|
|
74
|
+
|
|
75
|
+
## Security
|
|
76
|
+
|
|
77
|
+
**Never** write to `SESSION.md`:
|
|
78
|
+
|
|
79
|
+
- API keys, passwords, tokens, credentials
|
|
80
|
+
- PII or customer data
|
|
81
|
+
- Full stack traces with secrets
|
|
82
|
+
|
|
83
|
+
Use issue links or commit SHAs instead.
|
|
84
|
+
|
|
85
|
+
## Output
|
|
86
|
+
|
|
87
|
+
- Updated **`.agent/SESSION.md`**
|
|
88
|
+
- Updated **`tasks/todo.md`** (if it exists)
|
|
89
|
+
- Short summary for the user: phase, next steps, blockers
|
|
90
|
+
|
|
91
|
+
## Next step
|
|
92
|
+
|
|
93
|
+
Tell the user to run **`/resume`** in the next session or tool, or commit and share the branch.
|