class-ai-agent 1.4.0 → 1.5.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/.agent/README.md +10 -5
- package/.agent/SESSION.md +18 -13
- 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/.claude/CLAUDE.md +23 -0
- package/.claude/agents/business-analyst.md +380 -0
- package/.claude/references/codegraph.md +26 -14
- package/.claude/rules/agent-continuity.md +3 -2
- package/.claude/rules/api-conventions.md +1 -0
- package/.claude/rules/clean-code.md +1 -0
- package/.claude/rules/code-style.md +1 -0
- package/.claude/rules/codegraph.md +43 -0
- package/.claude/rules/database.md +2 -1
- package/.claude/rules/error-handling.md +1 -0
- package/.claude/rules/git-workflow.md +1 -0
- package/.claude/rules/monitoring.md +1 -0
- package/.claude/rules/naming-conventions.md +1 -0
- package/.claude/rules/project-structure.md +1 -0
- package/.claude/rules/security.md +1 -0
- package/.claude/rules/system-design.md +1 -0
- package/.claude/rules/tech-stack.md +1 -0
- package/.claude/rules/testing.md +1 -0
- package/.claude/settings.json +3 -1
- package/.claude/skills/ui-ux-pro-max/SKILL.md +1 -90
- package/.cursor/CURSOR.md +1 -1
- package/.cursor/agents/business-analyst.md +380 -0
- package/.cursor/rules/cursor-overview.mdc +4 -3
- package/.cursor/rules/database.mdc +2 -2
- package/.kiro/KIRO.md +3 -3
- package/.kiro/agents/business-analyst.md +380 -0
- package/.kiro/steering/database.md +2 -2
- package/.kiro/steering/kiro-overview.md +2 -2
- package/AGENTS.md +23 -1
- package/GEMINI.md +152 -0
- package/README.md +65 -19
- package/bin/class-ai-agent.cjs +85 -9
- package/package.json +11 -4
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Decompose specs into small, verifiable tasks with dependency ordering"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /plan — Planning & Task Breakdown
|
|
6
|
+
|
|
7
|
+
> "Vertical slices, not horizontal layers."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Transform a specification into an ordered list of small, verifiable tasks. Each task delivers end-to-end functionality.
|
|
12
|
+
|
|
13
|
+
## Prerequisites
|
|
14
|
+
|
|
15
|
+
- A specification exists (`SPEC.md` or described requirements)
|
|
16
|
+
- Understanding of the codebase structure
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
### Phase 1: Analysis (Read-Only)
|
|
21
|
+
|
|
22
|
+
1. **Read the spec** — Understand objectives and acceptance criteria
|
|
23
|
+
2. **Survey the codebase** — Identify relevant files, patterns, and integration points
|
|
24
|
+
3. **Map dependencies** — Which components depend on which?
|
|
25
|
+
|
|
26
|
+
> **Do NOT modify code during planning.**
|
|
27
|
+
|
|
28
|
+
### Phase 2: Vertical Slicing
|
|
29
|
+
|
|
30
|
+
Break work into **vertical slices** — each slice delivers complete functionality through all layers:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
❌ Horizontal (anti-pattern):
|
|
34
|
+
Task 1: Create all DB models
|
|
35
|
+
Task 2: Create all API routes
|
|
36
|
+
Task 3: Create all UI components
|
|
37
|
+
|
|
38
|
+
✅ Vertical (correct):
|
|
39
|
+
Task 1: User can create a task (DB + API + UI)
|
|
40
|
+
Task 2: User can view task list (DB + API + UI)
|
|
41
|
+
Task 3: User can mark task complete (DB + API + UI)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Phase 3: Task Definition
|
|
45
|
+
|
|
46
|
+
Each task must include:
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Task: [Short description]
|
|
50
|
+
|
|
51
|
+
**Objective**: [What this achieves]
|
|
52
|
+
|
|
53
|
+
**Files to modify**:
|
|
54
|
+
- `src/models/task.ts`
|
|
55
|
+
- `src/routes/tasks.ts`
|
|
56
|
+
- `src/components/TaskList.tsx`
|
|
57
|
+
|
|
58
|
+
**Acceptance Criteria**:
|
|
59
|
+
- [ ] User can [action]
|
|
60
|
+
- [ ] [Validation] is enforced
|
|
61
|
+
- [ ] Test covers [scenario]
|
|
62
|
+
|
|
63
|
+
**Dependencies**: [Task IDs this depends on]
|
|
64
|
+
|
|
65
|
+
**Verification**:
|
|
66
|
+
- [ ] Unit tests pass
|
|
67
|
+
- [ ] Integration test added
|
|
68
|
+
- [ ] Manual verification: [steps]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Phase 4: Ordering
|
|
72
|
+
|
|
73
|
+
Order tasks by:
|
|
74
|
+
1. **Foundation first** — DB models, types, shared utilities
|
|
75
|
+
2. **Risk-first** — Tackle uncertain/complex items early
|
|
76
|
+
3. **Dependencies** — Respect the dependency graph
|
|
77
|
+
4. **Quick wins** — Early momentum with smaller tasks
|
|
78
|
+
|
|
79
|
+
### Phase 5: Checkpoints
|
|
80
|
+
|
|
81
|
+
Insert checkpoints between major phases:
|
|
82
|
+
|
|
83
|
+
```markdown
|
|
84
|
+
---
|
|
85
|
+
## Checkpoint: Core CRUD Complete
|
|
86
|
+
|
|
87
|
+
**Verify before proceeding**:
|
|
88
|
+
- [ ] All CRUD operations work
|
|
89
|
+
- [ ] Test coverage > 80%
|
|
90
|
+
- [ ] No console errors
|
|
91
|
+
- [ ] Performance acceptable
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Output
|
|
97
|
+
|
|
98
|
+
Save to `tasks/` directory:
|
|
99
|
+
|
|
100
|
+
- `tasks/plan.md` — Full planning document with context
|
|
101
|
+
- `tasks/todo.md` — Actionable task checklist
|
|
102
|
+
- **`.agent/SESSION.md`** — Update Meta `phase` to `build`, **Pointers** → `tasks/todo.md` and spec path, **Next** → first `/build` task
|
|
103
|
+
|
|
104
|
+
```markdown
|
|
105
|
+
# TODO: [Feature Name]
|
|
106
|
+
|
|
107
|
+
## Phase 1: Foundation
|
|
108
|
+
- [ ] Task 1.1: [Description]
|
|
109
|
+
- [ ] Task 1.2: [Description]
|
|
110
|
+
|
|
111
|
+
## Checkpoint: Foundation Complete
|
|
112
|
+
|
|
113
|
+
## Phase 2: Core Features
|
|
114
|
+
- [ ] Task 2.1: [Description]
|
|
115
|
+
- [ ] Task 2.2: [Description]
|
|
116
|
+
|
|
117
|
+
## Checkpoint: Core Complete
|
|
118
|
+
|
|
119
|
+
## Phase 3: Polish
|
|
120
|
+
- [ ] Task 3.1: [Description]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Next Step
|
|
124
|
+
|
|
125
|
+
After plan is approved, run `/build` to implement tasks incrementally.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "publish-npm"
|
|
3
|
+
---
|
|
4
|
+
# Publish to npm (maintainers)
|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
|
|
8
|
+
Publish **`class-ai-agent`** to the npm registry: draft release notes from git, get maintainer approval, update README, bump version, verify CLI, publish.
|
|
9
|
+
|
|
10
|
+
## Triggers
|
|
11
|
+
|
|
12
|
+
Use when the maintainer says any of:
|
|
13
|
+
|
|
14
|
+
- **push to npm repo**
|
|
15
|
+
- **publish to npm**
|
|
16
|
+
- **publish class-ai-agent**
|
|
17
|
+
|
|
18
|
+
Or **@ mention this file** in Chat/Composer (`.agents/workflows/publish-npm.md` in Cursor; `.agents/workflows/publish-npm.md` in Kiro).
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- Changes are ready to ship; working tree reflects what you are publishing.
|
|
23
|
+
- **`npm login`** completed for the `class-ai-agent` package scope.
|
|
24
|
+
- Two-factor auth enabled for npm **writes** if the account requires it (see README *Publishing to npm*).
|
|
25
|
+
|
|
26
|
+
## Workflow
|
|
27
|
+
|
|
28
|
+
### 1. Resolve baseline version
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git tag -l 'v*' --sort=-v:refname | head -1
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If no `v*` tags exist, use the latest `### x.y.z` heading under **## Release notes** in README, or `package.json` version as the last shipped baseline.
|
|
35
|
+
|
|
36
|
+
Strip a leading `v` from tags when comparing to semver (e.g. `v1.2.4` → `1.2.4`).
|
|
37
|
+
|
|
38
|
+
### 2. Draft release notes (do not publish yet)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git log <lastTagOrBaseline>..HEAD --pretty=format:'- %s (%h)'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- Group related commits; rewrite subjects for user-facing clarity.
|
|
45
|
+
- Drop noise (merge commits, duplicate WIP messages) unless relevant.
|
|
46
|
+
- Present the bullet list to the maintainer and **wait for explicit approval or edits**.
|
|
47
|
+
|
|
48
|
+
### 3. Confirm version bump
|
|
49
|
+
|
|
50
|
+
Default: **`patch`** (`npm version patch --no-git-tag-version`).
|
|
51
|
+
|
|
52
|
+
Use **`minor`** or **`major`** only if the maintainer requests it.
|
|
53
|
+
|
|
54
|
+
### 4. Bump version
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm version patch --no-git-tag-version # or minor | major
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Read the new version from `package.json`.
|
|
61
|
+
|
|
62
|
+
### 5. Update README
|
|
63
|
+
|
|
64
|
+
Prefer the helper script after approval (write bullets to a temp file):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm run release:readme -- --version NEW_VERSION --date YYYY-MM-DD --notes-file /path/to/notes.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`notes.md` should contain one bullet per line (with or without leading `- `).
|
|
71
|
+
|
|
72
|
+
If **## Release notes** is missing, add it before **## Contributing** first, then run the script.
|
|
73
|
+
|
|
74
|
+
Fallback: manually insert at the top of **## Release notes**:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
### NEW_VERSION — YYYY-MM-DD
|
|
78
|
+
|
|
79
|
+
- …
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
And sync the version badge: `version-NEW_VERSION` in the shields.io img (line ~21).
|
|
83
|
+
|
|
84
|
+
### 6. Verify CLI
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm run test:cli
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Stop on failure; do not publish.
|
|
91
|
+
|
|
92
|
+
### 7. Publish
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm publish --access public
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If npm prompts for **OTP**, the maintainer enters it in the terminal.
|
|
99
|
+
|
|
100
|
+
On **403 / cannot publish over previously published versions**: bump with `npm version patch --no-git-tag-version` and retry (each semver can only be published once).
|
|
101
|
+
|
|
102
|
+
### 8. Report
|
|
103
|
+
|
|
104
|
+
Tell the maintainer:
|
|
105
|
+
|
|
106
|
+
- Published version (from `package.json`)
|
|
107
|
+
- https://www.npmjs.com/package/class-ai-agent
|
|
108
|
+
|
|
109
|
+
**Do not** `git commit`, tag, or push unless the maintainer separately asks.
|
|
110
|
+
|
|
111
|
+
## Maintainer quick reference
|
|
112
|
+
|
|
113
|
+
| Step | Command / action |
|
|
114
|
+
|------|------------------|
|
|
115
|
+
| Draft | `git log <tag>..HEAD --pretty=format:'- %s (%h)'` |
|
|
116
|
+
| Approve | Maintainer edits bullets in chat |
|
|
117
|
+
| Bump | `npm version patch --no-git-tag-version` |
|
|
118
|
+
| README | `npm run release:readme -- --version … --notes-file …` |
|
|
119
|
+
| Test | `npm run test:cli` |
|
|
120
|
+
| Publish | `npm publish --access public` |
|
|
121
|
+
|
|
122
|
+
See also [README — Publishing to npm](../../README.md#publishing-to-npm-maintainers) and [README — Release notes](../../README.md#release-notes).
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Start-of-session — load .agent/SESSION.md and continue prior work"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /resume — Continue prior work
|
|
6
|
+
|
|
7
|
+
> "Read the map before you move."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Load cross-tool handoff state and continue work from a previous agent session without re-discovering context.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
- Starting a new chat on the same feature
|
|
16
|
+
- Switching tools (Cursor ↔ Claude Code ↔ Kiro)
|
|
17
|
+
- User says "continue", "pick up where we left off", or "resume"
|
|
18
|
+
- After pulling a branch that includes an updated `.agent/SESSION.md`
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- **`.agent/SESSION.md`** exists in the project root
|
|
23
|
+
- If missing: run `npx class-ai-agent` or copy `.agent/SESSION.template.md` → `.agent/SESSION.md`
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
### Phase 1: Load handoff (read-only first)
|
|
28
|
+
|
|
29
|
+
Read in this order:
|
|
30
|
+
|
|
31
|
+
1. **`.agent/SESSION.md`** — goal, done, in progress, next, decisions, gotchas, pointers
|
|
32
|
+
2. **`tasks/todo.md`** — if referenced in Pointers
|
|
33
|
+
3. **`SPEC.md`** or path from Pointers — if in spec/plan/build phase
|
|
34
|
+
|
|
35
|
+
> Do **not** edit code until Phase 3 plan is stated to the user.
|
|
36
|
+
|
|
37
|
+
### Phase 2: Sanity check
|
|
38
|
+
|
|
39
|
+
From SESSION **Gotchas** and **Pointers**, run quick checks when noted:
|
|
40
|
+
|
|
41
|
+
- `git status` — uncommitted work matches SESSION?
|
|
42
|
+
- Build/test commands listed in Gotchas — run if stale or uncertain
|
|
43
|
+
- Branch matches Pointers
|
|
44
|
+
|
|
45
|
+
If SESSION reports **blockers** or broken build, surface them before implementing.
|
|
46
|
+
|
|
47
|
+
### Phase 3: State plan to user
|
|
48
|
+
|
|
49
|
+
Reply with a short structured summary:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
## Resuming
|
|
53
|
+
|
|
54
|
+
**Goal:** [from SESSION]
|
|
55
|
+
**Phase:** [spec | plan | build | test | review | debug]
|
|
56
|
+
**Last updated:** [Meta date] via [tool/persona]
|
|
57
|
+
|
|
58
|
+
### Already done
|
|
59
|
+
- ...
|
|
60
|
+
|
|
61
|
+
### In progress
|
|
62
|
+
- ...
|
|
63
|
+
|
|
64
|
+
### Next (this session)
|
|
65
|
+
1. ...
|
|
66
|
+
|
|
67
|
+
### Risks / blockers
|
|
68
|
+
- ...
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Ask for confirmation only if SESSION is ambiguous or blockers need a decision.
|
|
72
|
+
|
|
73
|
+
### Phase 4: Continue workflow
|
|
74
|
+
|
|
75
|
+
| Phase in SESSION | Command to follow |
|
|
76
|
+
|------------------|-------------------|
|
|
77
|
+
| spec | `/spec` (refine) or `/plan` if spec is done |
|
|
78
|
+
| plan | `/plan` or `/build` if plan exists |
|
|
79
|
+
| build | `/build` |
|
|
80
|
+
| test | `/test` |
|
|
81
|
+
| review | `/review` |
|
|
82
|
+
| debug | `/debug` |
|
|
83
|
+
|
|
84
|
+
Update **Meta** in `.agent/SESSION.md` when you change phase or tool.
|
|
85
|
+
|
|
86
|
+
### Phase 5: During work
|
|
87
|
+
|
|
88
|
+
- After meaningful progress, update SESSION **Done** / **In progress** / **Next**
|
|
89
|
+
- End session with **`/handoff`**
|
|
90
|
+
|
|
91
|
+
## If SESSION is empty or stale
|
|
92
|
+
|
|
93
|
+
1. Survey repo: `git log`, `tasks/todo.md`, open PRs
|
|
94
|
+
2. Rebuild SESSION from evidence
|
|
95
|
+
3. Ask user to confirm goal and next steps
|
|
96
|
+
4. Run `/handoff` when aligned
|
|
97
|
+
|
|
98
|
+
## Output
|
|
99
|
+
|
|
100
|
+
- Resumption summary (Phase 3)
|
|
101
|
+
- Explicit next action (first item from **Next**)
|
|
102
|
+
- No code changes until plan is stated (unless user asked for a specific fix)
|
|
103
|
+
|
|
104
|
+
## Next step
|
|
105
|
+
|
|
106
|
+
Execute the first **Next** item using the appropriate workflow command (`/build`, etc.).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "review"
|
|
3
|
+
---
|
|
4
|
+
# Review Command
|
|
5
|
+
|
|
6
|
+
## Description
|
|
7
|
+
Perform a thorough code review of specified files or a pull request.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
Tell Claude: "Review [file/PR/feature]" or "Do a code review of [changes]"
|
|
11
|
+
|
|
12
|
+
## Review Checklist
|
|
13
|
+
|
|
14
|
+
### Code Quality
|
|
15
|
+
- [ ] Code follows style guide (`.agent/rules/code-style.md`)
|
|
16
|
+
- [ ] No unnecessary complexity or duplication
|
|
17
|
+
- [ ] Functions are small and focused (single responsibility)
|
|
18
|
+
- [ ] Variable and function names are descriptive
|
|
19
|
+
|
|
20
|
+
### Security
|
|
21
|
+
- [ ] No hardcoded secrets or credentials
|
|
22
|
+
- [ ] Input validation is present
|
|
23
|
+
- [ ] Authentication/authorization checks in place
|
|
24
|
+
- [ ] See `.agent/rules/security.md` for full checklist
|
|
25
|
+
|
|
26
|
+
### Error Handling
|
|
27
|
+
- [ ] Errors are properly caught and handled
|
|
28
|
+
- [ ] Meaningful error messages
|
|
29
|
+
- [ ] No swallowed exceptions
|
|
30
|
+
- [ ] See `.agent/rules/error-handling.md`
|
|
31
|
+
|
|
32
|
+
### Testing
|
|
33
|
+
- [ ] Unit tests cover new logic
|
|
34
|
+
- [ ] Edge cases are tested
|
|
35
|
+
- [ ] Tests are readable and maintainable
|
|
36
|
+
- [ ] See `.agent/rules/testing.md`
|
|
37
|
+
|
|
38
|
+
### Database
|
|
39
|
+
- [ ] Queries are optimized (no N+1)
|
|
40
|
+
- [ ] Transactions used where appropriate
|
|
41
|
+
- [ ] See `.agent/rules/database.md`
|
|
42
|
+
|
|
43
|
+
### API
|
|
44
|
+
- [ ] Endpoints follow REST conventions
|
|
45
|
+
- [ ] Request/response schemas are documented
|
|
46
|
+
- [ ] See `.agent/rules/api-conventions.md`
|
|
47
|
+
|
|
48
|
+
## Output Format
|
|
49
|
+
Provide feedback as:
|
|
50
|
+
- 🔴 **Critical** — Must fix before merge
|
|
51
|
+
- 🟡 **Warning** — Should fix, potential issue
|
|
52
|
+
- 🟢 **Suggestion** — Nice to have improvement
|
|
53
|
+
- ✅ **Good** — Highlight what's done well
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Reduce complexity without changing behavior — code simplification"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /simplify — Code Simplification
|
|
6
|
+
|
|
7
|
+
> "Complexity is the enemy of execution."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Simplify code for clarity and maintainability. Reduce complexity **without changing behavior**.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- After `/review` identifies complexity issues
|
|
16
|
+
- When code is hard to understand
|
|
17
|
+
- Before adding new features to tangled code
|
|
18
|
+
- During tech debt cleanup sprints
|
|
19
|
+
|
|
20
|
+
## Principles
|
|
21
|
+
|
|
22
|
+
### Chesterton's Fence
|
|
23
|
+
|
|
24
|
+
> Before removing something, understand why it exists.
|
|
25
|
+
|
|
26
|
+
Don't delete code just because it looks unnecessary. Investigate:
|
|
27
|
+
- Git history: `git log -p -- path/to/file`
|
|
28
|
+
- Related tests
|
|
29
|
+
- Comments or documentation
|
|
30
|
+
- Ask team members if unsure
|
|
31
|
+
|
|
32
|
+
### Rule of 500
|
|
33
|
+
|
|
34
|
+
If a function, file, or class exceeds ~500 lines, it likely needs splitting.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
### Step 1: Identify Target
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Recently modified complex code
|
|
44
|
+
git diff --stat HEAD~10
|
|
45
|
+
|
|
46
|
+
# Or specify scope
|
|
47
|
+
# "Simplify the OrderService class"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Step 2: Understand Before Changing
|
|
51
|
+
|
|
52
|
+
1. **Read the code** — What does it do?
|
|
53
|
+
2. **Check tests** — What behaviors are verified?
|
|
54
|
+
3. **Trace callers** — Who uses this code?
|
|
55
|
+
4. **Note edge cases** — Any special handling?
|
|
56
|
+
|
|
57
|
+
### Step 3: Identify Opportunities
|
|
58
|
+
|
|
59
|
+
| Pattern | Simplification |
|
|
60
|
+
|---------|---------------|
|
|
61
|
+
| Deep nesting (> 3 levels) | Guard clauses, extract helpers |
|
|
62
|
+
| Long functions (> 30 lines) | Split by responsibility |
|
|
63
|
+
| Nested ternaries | `if/else` or `switch` |
|
|
64
|
+
| Unclear names | Rename for clarity |
|
|
65
|
+
| Duplicated code | Extract shared function |
|
|
66
|
+
| Dead code | Remove entirely |
|
|
67
|
+
| Complex conditionals | Extract to named function |
|
|
68
|
+
| Magic numbers | Named constants |
|
|
69
|
+
|
|
70
|
+
### Step 4: Apply Incrementally
|
|
71
|
+
|
|
72
|
+
**One change at a time:**
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
// Before: Deep nesting
|
|
76
|
+
function processOrder(order) {
|
|
77
|
+
if (order) {
|
|
78
|
+
if (order.items.length > 0) {
|
|
79
|
+
if (order.status === 'pending') {
|
|
80
|
+
// ... actual logic buried here
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// After: Guard clauses
|
|
87
|
+
function processOrder(order) {
|
|
88
|
+
if (!order) return;
|
|
89
|
+
if (order.items.length === 0) return;
|
|
90
|
+
if (order.status !== 'pending') return;
|
|
91
|
+
|
|
92
|
+
// ... actual logic at top level
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Run tests after each change.**
|
|
97
|
+
|
|
98
|
+
### Step 5: Validate
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# All tests pass
|
|
102
|
+
npm test
|
|
103
|
+
|
|
104
|
+
# Build succeeds
|
|
105
|
+
npm run build
|
|
106
|
+
|
|
107
|
+
# Behavior unchanged (manual check if needed)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Step 6: If Tests Fail
|
|
111
|
+
|
|
112
|
+
**Revert immediately.** Don't debug while mid-simplification.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git checkout -- .
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Then:
|
|
119
|
+
1. Reassess the change
|
|
120
|
+
2. Make a smaller change
|
|
121
|
+
3. Or add missing tests first
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Common Simplifications
|
|
126
|
+
|
|
127
|
+
### Extract Guard Clauses
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
// Before
|
|
131
|
+
function getDiscount(user) {
|
|
132
|
+
if (user) {
|
|
133
|
+
if (user.membership === 'premium') {
|
|
134
|
+
return 0.2;
|
|
135
|
+
} else {
|
|
136
|
+
return 0.1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// After
|
|
143
|
+
function getDiscount(user) {
|
|
144
|
+
if (!user) return 0;
|
|
145
|
+
if (user.membership === 'premium') return 0.2;
|
|
146
|
+
return 0.1;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Extract Named Functions
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// Before
|
|
154
|
+
const eligibleUsers = users.filter(u =>
|
|
155
|
+
u.age >= 18 && u.verified && !u.banned && u.subscription !== 'free'
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
// After
|
|
159
|
+
const isEligible = (user) =>
|
|
160
|
+
user.age >= 18 &&
|
|
161
|
+
user.verified &&
|
|
162
|
+
!user.banned &&
|
|
163
|
+
user.subscription !== 'free';
|
|
164
|
+
|
|
165
|
+
const eligibleUsers = users.filter(isEligible);
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Replace Nested Ternary
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
// Before
|
|
172
|
+
const status = isPaid ? (isShipped ? 'complete' : 'processing') : 'pending';
|
|
173
|
+
|
|
174
|
+
// After
|
|
175
|
+
function getOrderStatus(isPaid, isShipped) {
|
|
176
|
+
if (!isPaid) return 'pending';
|
|
177
|
+
if (!isShipped) return 'processing';
|
|
178
|
+
return 'complete';
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Remove Dead Code
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
// Before
|
|
186
|
+
function calculate(a, b) {
|
|
187
|
+
// const oldResult = legacyCalculate(a, b); // Commented out
|
|
188
|
+
const result = a + b;
|
|
189
|
+
// console.log('Debug:', result); // Debug log
|
|
190
|
+
return result;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// After
|
|
194
|
+
function calculate(a, b) {
|
|
195
|
+
return a + b;
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Red Flags
|
|
202
|
+
|
|
203
|
+
Stop if you find yourself:
|
|
204
|
+
|
|
205
|
+
- Changing behavior while "simplifying"
|
|
206
|
+
- Unable to explain why code exists
|
|
207
|
+
- Simplifying without tests
|
|
208
|
+
- Making changes across unrelated files
|
|
209
|
+
- Creating new abstractions
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Output
|
|
214
|
+
|
|
215
|
+
- Simpler, clearer code
|
|
216
|
+
- All tests still passing
|
|
217
|
+
- Atomic commits with clear messages
|
|
218
|
+
|
|
219
|
+
## Next Step
|
|
220
|
+
|
|
221
|
+
Run `/review` to verify improvements.
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Spec before code — structured PRD creation for new features"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# /spec — Specification-Driven Development
|
|
6
|
+
|
|
7
|
+
> "Plan the work, then work the plan."
|
|
8
|
+
|
|
9
|
+
## Purpose
|
|
10
|
+
|
|
11
|
+
Create a comprehensive specification document **before** writing any code. This ensures alignment on requirements, constraints, and acceptance criteria.
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
### Phase 1: Discovery (Ask Questions)
|
|
16
|
+
|
|
17
|
+
Before generating a spec, gather requirements by asking:
|
|
18
|
+
|
|
19
|
+
**Scope**
|
|
20
|
+
- What is the objective of this feature?
|
|
21
|
+
- Who are the target users?
|
|
22
|
+
- What problem does this solve?
|
|
23
|
+
|
|
24
|
+
**Features**
|
|
25
|
+
- What are the core features (MVP)?
|
|
26
|
+
- What are the acceptance criteria for each?
|
|
27
|
+
- What is explicitly out of scope?
|
|
28
|
+
|
|
29
|
+
**Technical**
|
|
30
|
+
- Any tech stack preferences or constraints?
|
|
31
|
+
- Integration points with existing systems?
|
|
32
|
+
- Performance requirements?
|
|
33
|
+
|
|
34
|
+
### Phase 2: Generate Specification
|
|
35
|
+
|
|
36
|
+
After discovery, produce `SPEC.md` with these sections:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
# Feature: [Name]
|
|
40
|
+
|
|
41
|
+
## Objective
|
|
42
|
+
[1-2 sentences describing the goal]
|
|
43
|
+
|
|
44
|
+
## Target Users
|
|
45
|
+
[Who will use this and why]
|
|
46
|
+
|
|
47
|
+
## Core Features
|
|
48
|
+
1. [Feature A] — [Acceptance criteria]
|
|
49
|
+
2. [Feature B] — [Acceptance criteria]
|
|
50
|
+
3. [Feature C] — [Acceptance criteria]
|
|
51
|
+
|
|
52
|
+
## Out of Scope
|
|
53
|
+
- [What we're NOT building in this iteration]
|
|
54
|
+
|
|
55
|
+
## Technical Approach
|
|
56
|
+
- Tech stack decisions
|
|
57
|
+
- Data models
|
|
58
|
+
- API contracts (if applicable)
|
|
59
|
+
- Integration points
|
|
60
|
+
|
|
61
|
+
## Code Style
|
|
62
|
+
- Follow rules in `.agent/rules/`
|
|
63
|
+
- [Any feature-specific conventions]
|
|
64
|
+
|
|
65
|
+
## Testing Strategy
|
|
66
|
+
- Unit tests for: [areas]
|
|
67
|
+
- Integration tests for: [areas]
|
|
68
|
+
- E2E tests for: [critical paths]
|
|
69
|
+
|
|
70
|
+
## Boundaries
|
|
71
|
+
### Always Do
|
|
72
|
+
- [Non-negotiables]
|
|
73
|
+
|
|
74
|
+
### Ask First
|
|
75
|
+
- [Decisions requiring approval]
|
|
76
|
+
|
|
77
|
+
### Never Do
|
|
78
|
+
- [Hard constraints]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Phase 3: Review & Confirm
|
|
82
|
+
|
|
83
|
+
- Present the spec to the user
|
|
84
|
+
- Confirm before proceeding to `/plan`
|
|
85
|
+
- Save as `SPEC.md` in project root or `docs/specs/[feature].md`
|
|
86
|
+
|
|
87
|
+
## Output
|
|
88
|
+
|
|
89
|
+
- `SPEC.md` — The specification document
|
|
90
|
+
- Clear alignment on what to build
|
|
91
|
+
- **`.agent/SESSION.md`** — Initialize or update: set Meta `phase` to `plan`, **Goal**, **Pointers** → spec path, **Next** → run `/plan`
|
|
92
|
+
|
|
93
|
+
## Next Step
|
|
94
|
+
|
|
95
|
+
After spec is approved, run `/plan` to decompose into tasks. Run `/handoff` if ending the session before planning.
|