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.
Files changed (157) hide show
  1. package/.agent/README.md +10 -5
  2. package/.agent/SESSION.md +18 -13
  3. package/.agent/rules/agent-continuity.md +44 -0
  4. package/.agent/rules/antigravity-overview.md +38 -0
  5. package/.agent/rules/api-conventions.md +85 -0
  6. package/.agent/rules/clean-code.md +211 -0
  7. package/.agent/rules/code-style.md +92 -0
  8. package/.agent/rules/codegraph.md +47 -0
  9. package/.agent/rules/database.md +66 -0
  10. package/.agent/rules/error-handling.md +98 -0
  11. package/.agent/rules/git-workflow.md +83 -0
  12. package/.agent/rules/monitoring.md +317 -0
  13. package/.agent/rules/naming-conventions.md +266 -0
  14. package/.agent/rules/project-structure.md +71 -0
  15. package/.agent/rules/security.md +95 -0
  16. package/.agent/rules/system-design.md +168 -0
  17. package/.agent/rules/tech-stack.md +463 -0
  18. package/.agent/rules/testing.md +110 -0
  19. package/.agents/agents/backend.md +395 -0
  20. package/.agents/agents/business-analyst.md +380 -0
  21. package/.agents/agents/code-reviewer.md +110 -0
  22. package/.agents/agents/copywriter-seo.md +236 -0
  23. package/.agents/agents/frontend.md +384 -0
  24. package/.agents/agents/project-manager.md +201 -0
  25. package/.agents/agents/qa.md +221 -0
  26. package/.agents/agents/security-auditor.md +143 -0
  27. package/.agents/agents/systems-architect.md +211 -0
  28. package/.agents/agents/test-engineer.md +123 -0
  29. package/.agents/agents/ui-ux-designer.md +210 -0
  30. package/.agents/references/accessibility-checklist.md +174 -0
  31. package/.agents/references/agent-continuity.md +42 -0
  32. package/.agents/references/codegraph.md +90 -0
  33. package/.agents/references/mcp-antigravity.md +71 -0
  34. package/.agents/references/performance-checklist.md +150 -0
  35. package/.agents/references/security-checklist.md +94 -0
  36. package/.agents/references/supabase.md +55 -0
  37. package/.agents/references/testing-patterns.md +183 -0
  38. package/.agents/skills/agent-continuity/SKILL.md +70 -0
  39. package/.agents/skills/code-review/SKILL.md +208 -0
  40. package/.agents/skills/deploy/SKILL.md +68 -0
  41. package/.agents/skills/deploy/deploy.md +735 -0
  42. package/.agents/skills/incremental-implementation/SKILL.md +210 -0
  43. package/.agents/skills/security-review/SKILL.md +71 -0
  44. package/.agents/skills/supabase/SKILL.md +135 -0
  45. package/.agents/skills/supabase/UPSTREAM.md +16 -0
  46. package/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
  47. package/.agents/skills/supabase/references/skill-feedback.md +17 -0
  48. package/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
  49. package/.agents/skills/supabase-postgres-best-practices/UPSTREAM.md +16 -0
  50. package/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
  51. package/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
  52. package/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
  53. package/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
  54. package/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
  55. package/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
  56. package/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
  57. package/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
  58. package/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
  59. package/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
  60. package/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
  61. package/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
  62. package/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
  63. package/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
  64. package/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
  65. package/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
  66. package/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
  67. package/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
  68. package/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
  69. package/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
  70. package/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
  71. package/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
  72. package/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
  73. package/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
  74. package/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
  75. package/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
  76. package/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
  77. package/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
  78. package/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
  79. package/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
  80. package/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
  81. package/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
  82. package/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
  83. package/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
  84. package/.agents/skills/tdd/SKILL.md +217 -0
  85. package/.agents/skills/ui-ux-pro-max/SKILL.md +288 -0
  86. package/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -0
  87. package/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -0
  88. package/.agents/skills/ui-ux-pro-max/data/icons.csv +101 -0
  89. package/.agents/skills/ui-ux-pro-max/data/landing.csv +31 -0
  90. package/.agents/skills/ui-ux-pro-max/data/products.csv +97 -0
  91. package/.agents/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  92. package/.agents/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  93. package/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  94. package/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  95. package/.agents/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  96. package/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  97. package/.agents/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  98. package/.agents/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  99. package/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  100. package/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  101. package/.agents/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  102. package/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  103. package/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  104. package/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  105. package/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -0
  106. package/.agents/skills/ui-ux-pro-max/data/typography.csv +58 -0
  107. package/.agents/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  108. package/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  109. package/.agents/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  110. package/.agents/skills/ui-ux-pro-max/scripts/core.py +253 -0
  111. package/.agents/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
  112. package/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -0
  113. package/.agents/workflows/build.md +132 -0
  114. package/.agents/workflows/debug.md +242 -0
  115. package/.agents/workflows/deploy.md +43 -0
  116. package/.agents/workflows/fix-issue.md +45 -0
  117. package/.agents/workflows/handoff.md +93 -0
  118. package/.agents/workflows/plan.md +125 -0
  119. package/.agents/workflows/publish-npm.md +122 -0
  120. package/.agents/workflows/resume.md +106 -0
  121. package/.agents/workflows/review.md +53 -0
  122. package/.agents/workflows/simplify.md +221 -0
  123. package/.agents/workflows/spec.md +95 -0
  124. package/.agents/workflows/test.md +213 -0
  125. package/.claude/CLAUDE.md +23 -0
  126. package/.claude/agents/business-analyst.md +380 -0
  127. package/.claude/references/codegraph.md +26 -14
  128. package/.claude/rules/agent-continuity.md +3 -2
  129. package/.claude/rules/api-conventions.md +1 -0
  130. package/.claude/rules/clean-code.md +1 -0
  131. package/.claude/rules/code-style.md +1 -0
  132. package/.claude/rules/codegraph.md +43 -0
  133. package/.claude/rules/database.md +2 -1
  134. package/.claude/rules/error-handling.md +1 -0
  135. package/.claude/rules/git-workflow.md +1 -0
  136. package/.claude/rules/monitoring.md +1 -0
  137. package/.claude/rules/naming-conventions.md +1 -0
  138. package/.claude/rules/project-structure.md +1 -0
  139. package/.claude/rules/security.md +1 -0
  140. package/.claude/rules/system-design.md +1 -0
  141. package/.claude/rules/tech-stack.md +1 -0
  142. package/.claude/rules/testing.md +1 -0
  143. package/.claude/settings.json +3 -1
  144. package/.claude/skills/ui-ux-pro-max/SKILL.md +1 -90
  145. package/.cursor/CURSOR.md +1 -1
  146. package/.cursor/agents/business-analyst.md +380 -0
  147. package/.cursor/rules/cursor-overview.mdc +4 -3
  148. package/.cursor/rules/database.mdc +2 -2
  149. package/.kiro/KIRO.md +3 -3
  150. package/.kiro/agents/business-analyst.md +380 -0
  151. package/.kiro/steering/database.md +2 -2
  152. package/.kiro/steering/kiro-overview.md +2 -2
  153. package/AGENTS.md +23 -1
  154. package/GEMINI.md +152 -0
  155. package/README.md +65 -19
  156. package/bin/class-ai-agent.cjs +85 -9
  157. package/package.json +11 -4
@@ -0,0 +1,150 @@
1
+ # Performance Checklist
2
+
3
+ > Quick reference for performance optimization.
4
+
5
+ ## Core Web Vitals Targets
6
+
7
+ | Metric | Good | Needs Work | Poor |
8
+ |--------|------|------------|------|
9
+ | **LCP** (Largest Contentful Paint) | < 2.5s | 2.5-4s | > 4s |
10
+ | **INP** (Interaction to Next Paint) | < 200ms | 200-500ms | > 500ms |
11
+ | **CLS** (Cumulative Layout Shift) | < 0.1 | 0.1-0.25 | > 0.25 |
12
+
13
+ ## Frontend Performance
14
+
15
+ ### Critical Render Path
16
+ - [ ] Minimize critical CSS (inline above-fold styles)
17
+ - [ ] Defer non-critical JavaScript
18
+ - [ ] Preload critical resources
19
+ - [ ] Optimize font loading (font-display: swap)
20
+
21
+ ### Images
22
+ - [ ] Use modern formats (WebP, AVIF)
23
+ - [ ] Implement lazy loading
24
+ - [ ] Serve responsive sizes (srcset)
25
+ - [ ] Use CDN for static assets
26
+ - [ ] Set explicit width/height (prevent CLS)
27
+
28
+ ### JavaScript
29
+ - [ ] Code splitting (dynamic imports)
30
+ - [ ] Tree shaking enabled
31
+ - [ ] Bundle size monitored (< 200KB initial)
32
+ - [ ] No unused dependencies
33
+
34
+ ### React Specific
35
+ - [ ] Memoize expensive computations (useMemo)
36
+ - [ ] Prevent unnecessary re-renders (React.memo)
37
+ - [ ] Virtualize long lists (react-window)
38
+ - [ ] Use Suspense for code splitting
39
+
40
+ ```javascript
41
+ // ✅ Good: Memoized component
42
+ const ExpensiveList = React.memo(({ items }) => {
43
+ return items.map(item => <Item key={item.id} {...item} />);
44
+ });
45
+
46
+ // ✅ Good: Memoized computation
47
+ const sortedItems = useMemo(
48
+ () => items.sort((a, b) => a.name.localeCompare(b.name)),
49
+ [items]
50
+ );
51
+ ```
52
+
53
+ ## Backend Performance
54
+
55
+ ### Database
56
+ - [ ] Indexes on queried columns
57
+ - [ ] No N+1 queries
58
+ - [ ] Pagination implemented
59
+ - [ ] Connection pooling configured
60
+ - [ ] Query timeouts set
61
+
62
+ ```javascript
63
+ // ❌ N+1 Problem
64
+ const users = await db.user.findMany();
65
+ for (const user of users) {
66
+ user.orders = await db.order.findMany({ where: { userId: user.id } });
67
+ }
68
+
69
+ // ✅ Fixed: Include relation
70
+ const users = await db.user.findMany({
71
+ include: { orders: true }
72
+ });
73
+ ```
74
+
75
+ ### Caching
76
+ - [ ] Cache frequently accessed data
77
+ - [ ] Appropriate TTLs set
78
+ - [ ] Cache invalidation strategy
79
+ - [ ] CDN for static content
80
+
81
+ ```javascript
82
+ // Cache pattern
83
+ async function getUser(id) {
84
+ const cached = await redis.get(`user:${id}`);
85
+ if (cached) return JSON.parse(cached);
86
+
87
+ const user = await db.user.findUnique({ where: { id } });
88
+ await redis.setex(`user:${id}`, 3600, JSON.stringify(user));
89
+ return user;
90
+ }
91
+ ```
92
+
93
+ ### API
94
+ - [ ] Response compression (gzip/brotli)
95
+ - [ ] Pagination for lists
96
+ - [ ] Field selection (select only needed)
97
+ - [ ] Async operations for slow tasks
98
+
99
+ ```javascript
100
+ // ✅ Good: Paginated API
101
+ GET /api/users?page=1&limit=20&fields=id,name,email
102
+ ```
103
+
104
+ ## Measurement Commands
105
+
106
+ ```bash
107
+ # Lighthouse (Chrome)
108
+ npx lighthouse https://example.com --output=json
109
+
110
+ # Bundle analysis
111
+ npx webpack-bundle-analyzer stats.json
112
+
113
+ # Check bundle size
114
+ npx bundlephobia <package-name>
115
+
116
+ # Database query analysis
117
+ EXPLAIN ANALYZE SELECT * FROM users WHERE email = '...';
118
+
119
+ # Redis latency
120
+ redis-cli --latency
121
+
122
+ # API response time
123
+ curl -o /dev/null -s -w '%{time_total}\n' https://api.example.com/users
124
+ ```
125
+
126
+ ## Performance Budget
127
+
128
+ | Resource | Budget |
129
+ |----------|--------|
130
+ | Initial JS | < 200KB |
131
+ | Initial CSS | < 50KB |
132
+ | Total page weight | < 1MB |
133
+ | Time to Interactive | < 3s |
134
+ | API response (p95) | < 200ms |
135
+
136
+ ## Monitoring
137
+
138
+ - [ ] Real User Monitoring (RUM) enabled
139
+ - [ ] Synthetic monitoring configured
140
+ - [ ] Alerting on degradation
141
+ - [ ] Performance tracked in CI
142
+
143
+ ```javascript
144
+ // Example: Track Core Web Vitals
145
+ import { onLCP, onINP, onCLS } from 'web-vitals';
146
+
147
+ onLCP(metric => sendToAnalytics('LCP', metric.value));
148
+ onINP(metric => sendToAnalytics('INP', metric.value));
149
+ onCLS(metric => sendToAnalytics('CLS', metric.value));
150
+ ```
@@ -0,0 +1,94 @@
1
+ # Security Checklist
2
+
3
+ > Quick reference for security review. See `.claude/rules/security.md` for full rules.
4
+
5
+ ## Pre-Commit Checks
6
+
7
+ - [ ] No secrets in code (API keys, passwords, tokens)
8
+ - [ ] `.gitignore` excludes sensitive files (`.env`, credentials)
9
+ - [ ] `.env.example` contains only placeholder values
10
+ - [ ] No hardcoded URLs with credentials
11
+
12
+ ## Authentication
13
+
14
+ - [ ] Passwords hashed with bcrypt (rounds >= 12) or argon2
15
+ - [ ] Session cookies: `httpOnly`, `secure`, `sameSite: 'lax'`
16
+ - [ ] JWT tokens have reasonable expiry (15min access, 7d refresh)
17
+ - [ ] Rate limiting on auth endpoints (max 10 attempts/15min)
18
+ - [ ] Logout invalidates session/token
19
+
20
+ ## Authorization
21
+
22
+ - [ ] Every endpoint checks authentication
23
+ - [ ] Resource ownership verified (no IDOR)
24
+ - [ ] API keys are scoped appropriately
25
+ - [ ] JWT signature, expiration, and issuer validated
26
+ - [ ] Admin functions protected
27
+
28
+ ## Input Validation
29
+
30
+ - [ ] All user input validated at system boundary
31
+ - [ ] Allowlist validation preferred over blocklist
32
+ - [ ] String lengths constrained
33
+ - [ ] Numeric ranges validated
34
+ - [ ] File uploads restricted by type and size
35
+ - [ ] SQL queries parameterized (never string concat)
36
+
37
+ ## Security Headers
38
+
39
+ ```javascript
40
+ // Required headers
41
+ Content-Security-Policy: default-src 'self'
42
+ Strict-Transport-Security: max-age=31536000; includeSubDomains
43
+ X-Content-Type-Options: nosniff
44
+ X-Frame-Options: DENY
45
+ Permissions-Policy: geolocation=(), camera=()
46
+ ```
47
+
48
+ ## CORS
49
+
50
+ - [ ] Restrictive origin allowlist (no `*` in production)
51
+ - [ ] Credentials mode appropriate
52
+ - [ ] Methods and headers restricted
53
+
54
+ ## Data Protection
55
+
56
+ - [ ] Sensitive fields excluded from API responses
57
+ - [ ] No secrets in logs
58
+ - [ ] PII encrypted when required
59
+ - [ ] HTTPS enforced
60
+ - [ ] Database backups encrypted
61
+
62
+ ## Dependencies
63
+
64
+ ```bash
65
+ # Run regularly
66
+ npm audit
67
+ npm audit fix
68
+ ```
69
+
70
+ - [ ] No critical vulnerabilities
71
+ - [ ] Dependencies up to date
72
+ - [ ] Lock file committed
73
+
74
+ ## Error Handling
75
+
76
+ - [ ] Generic error messages in production
77
+ - [ ] No stack traces exposed
78
+ - [ ] No database details in errors
79
+ - [ ] No internal paths revealed
80
+
81
+ ## OWASP Top 10 Quick Check
82
+
83
+ | # | Vulnerability | Check |
84
+ |---|--------------|-------|
85
+ | 1 | Broken Access Control | Auth on all endpoints? |
86
+ | 2 | Cryptographic Failures | Secrets encrypted? HTTPS? |
87
+ | 3 | Injection | Inputs sanitized? Queries parameterized? |
88
+ | 4 | Insecure Design | Threat modeling done? |
89
+ | 5 | Security Misconfiguration | Headers set? Defaults changed? |
90
+ | 6 | Vulnerable Components | `npm audit` clean? |
91
+ | 7 | Auth Failures | Rate limiting? Strong passwords? |
92
+ | 8 | Data Integrity | Signatures verified? |
93
+ | 9 | Logging Failures | Security events logged? |
94
+ | 10 | SSRF | External URLs validated? |
@@ -0,0 +1,55 @@
1
+ # Supabase reference
2
+
3
+ [class-ai-agent](https://github.com/khoantd/class-ai-agent) bundles official [Supabase Agent Skills](https://github.com/supabase/agent-skills) and wires the **Supabase MCP** server for Cursor and Kiro.
4
+
5
+ ## Skills
6
+
7
+ | Skill | Use when |
8
+ |-------|----------|
9
+ | `supabase` | Any Supabase product work: Database, Auth, Edge Functions, Realtime, Storage, CLI, MCP, migrations, RLS, `supabase-js`, `@supabase/ssr` |
10
+ | `supabase-postgres-best-practices` | SQL, schema design, indexes, pooling, RLS performance, query review |
11
+
12
+ Paths: `.cursor/skills/supabase/`, `.cursor/skills/supabase-postgres-best-practices/` (and `.claude/skills/`, `.kiro/skills/` after install).
13
+
14
+ Invoke with **`@`** mention or let the agent load them when the task matches. See each skill’s `SKILL.md` for security checklists and workflow.
15
+
16
+ **Maintainers:** refresh vendored copies with `npm run sync:supabase-skills` (pin in `scripts/supabase-skills.lock.json`).
17
+
18
+ ## MCP (Cursor & Kiro)
19
+
20
+ | Tool | MCP config |
21
+ |------|------------|
22
+ | Cursor | `.cursor/mcp.json` → `mcpServers.supabase` |
23
+ | Kiro | `.kiro/settings/mcp.json` → `mcpServers.supabase` |
24
+
25
+ Server URL: `https://mcp.supabase.com/mcp?features=docs` (HTTP, OAuth 2.1).
26
+
27
+ ### After install
28
+
29
+ 1. **Reload** Cursor or **restart** Kiro so MCP servers connect.
30
+ 2. On first use, complete **OAuth** in the browser when prompted (Supabase account).
31
+ 3. Health check (expect `401` without a token — server is up):
32
+ ```bash
33
+ curl -so /dev/null -w "%{http_code}" "https://mcp.supabase.com/mcp"
34
+ ```
35
+
36
+ Useful MCP tools include `search_docs`, `list_projects`, `list_tables`, `execute_sql`, `get_advisors`, `get_logs`, and migration helpers. Prefer `search_docs` over guessing API behavior.
37
+
38
+ **Note:** Upstream skill text may refer to a project-root `.mcp.json`. In this scaffold, Supabase MCP lives only under `.cursor/mcp.json` and `.kiro/settings/mcp.json` — do not add a duplicate root `.mcp.json`.
39
+
40
+ ## Claude Code
41
+
42
+ Skills install to `.claude/skills/`. Claude Code does not get MCP from this package by default. Options:
43
+
44
+ - [Supabase MCP setup](https://supabase.com/docs/guides/getting-started/mcp)
45
+ - [Supabase plugin for Claude Code](https://github.com/supabase/agent-skills)
46
+
47
+ ## Secrets
48
+
49
+ Never commit service role keys, secret keys, or project tokens. Use environment variables per `.cursor/rules/security.mdc` (and `.claude/rules/security.md`, `.kiro/steering/security.md`).
50
+
51
+ ## Learn more
52
+
53
+ - [Supabase AI skills docs](https://supabase.com/docs/guides/ai-tools/ai-skills)
54
+ - [Upstream repository](https://github.com/supabase/agent-skills)
55
+ - [THIRD_PARTY_NOTICES.md](../../THIRD_PARTY_NOTICES.md) — license and pinned version
@@ -0,0 +1,183 @@
1
+ # Testing Patterns Reference
2
+
3
+ > Quick reference for test patterns. See `.claude/rules/testing.md` for full rules.
4
+
5
+ ## Test Pyramid
6
+
7
+ ```
8
+ ┌─────────┐
9
+ │ E2E │ 5% Critical user flows
10
+ ├─────────┤
11
+ │ Integ │ 15% API + DB interactions
12
+ ├─────────┤
13
+ │ Unit │ 80% Pure logic, fast
14
+ └─────────┘
15
+ ```
16
+
17
+ ## Test Structure (AAA)
18
+
19
+ ```javascript
20
+ it('should [expected behavior] when [condition]', () => {
21
+ // Arrange — Setup
22
+ const user = createTestUser({ role: 'admin' });
23
+
24
+ // Act — Execute
25
+ const result = checkPermission(user, 'delete');
26
+
27
+ // Assert — Verify
28
+ expect(result).toBe(true);
29
+ });
30
+ ```
31
+
32
+ ## Unit Test Example
33
+
34
+ ```javascript
35
+ describe('calculateDiscount', () => {
36
+ it('should return 10% for orders over $100', () => {
37
+ expect(calculateDiscount(150)).toBe(15);
38
+ });
39
+
40
+ it('should return 0 for orders under $100', () => {
41
+ expect(calculateDiscount(50)).toBe(0);
42
+ });
43
+
44
+ it('should handle edge case at exactly $100', () => {
45
+ expect(calculateDiscount(100)).toBe(0);
46
+ });
47
+ });
48
+ ```
49
+
50
+ ## Integration Test Example
51
+
52
+ ```javascript
53
+ describe('POST /api/users', () => {
54
+ it('should create user and return 201', async () => {
55
+ const response = await request(app)
56
+ .post('/api/users')
57
+ .send({ email: 'test@example.com', name: 'Test' })
58
+ .set('Authorization', `Bearer ${token}`);
59
+
60
+ expect(response.status).toBe(201);
61
+ expect(response.body.data.email).toBe('test@example.com');
62
+
63
+ // Verify in database
64
+ const user = await db.user.findUnique({
65
+ where: { email: 'test@example.com' }
66
+ });
67
+ expect(user).toBeDefined();
68
+ });
69
+ });
70
+ ```
71
+
72
+ ## E2E Test Example (Playwright)
73
+
74
+ ```javascript
75
+ test('user can complete checkout flow', async ({ page }) => {
76
+ // Login
77
+ await page.goto('/login');
78
+ await page.fill('[name="email"]', 'user@example.com');
79
+ await page.fill('[name="password"]', 'password');
80
+ await page.click('button[type="submit"]');
81
+
82
+ // Add to cart
83
+ await page.goto('/products/1');
84
+ await page.click('button:has-text("Add to Cart")');
85
+
86
+ // Checkout
87
+ await page.goto('/checkout');
88
+ await page.fill('[name="card"]', '4242424242424242');
89
+ await page.click('button:has-text("Pay")');
90
+
91
+ // Verify
92
+ await expect(page.locator('.success-message')).toBeVisible();
93
+ });
94
+ ```
95
+
96
+ ## React Component Test
97
+
98
+ ```javascript
99
+ import { render, screen, fireEvent } from '@testing-library/react';
100
+
101
+ describe('Counter', () => {
102
+ it('should increment count when button clicked', () => {
103
+ render(<Counter initialCount={0} />);
104
+
105
+ const button = screen.getByRole('button', { name: /increment/i });
106
+ fireEvent.click(button);
107
+
108
+ expect(screen.getByText('Count: 1')).toBeInTheDocument();
109
+ });
110
+ });
111
+ ```
112
+
113
+ ## Test Doubles
114
+
115
+ ```javascript
116
+ // 1. Real (preferred)
117
+ const db = createTestDatabase();
118
+
119
+ // 2. Fake (in-memory)
120
+ const fakeUserRepo = {
121
+ users: [],
122
+ create(user) { this.users.push(user); return user; },
123
+ findById(id) { return this.users.find(u => u.id === id); }
124
+ };
125
+
126
+ // 3. Stub (canned response)
127
+ const stubbedApi = {
128
+ getUser: () => Promise.resolve({ id: '1', name: 'Test' })
129
+ };
130
+
131
+ // 4. Mock (verify interactions — use sparingly)
132
+ const mockLogger = vi.fn();
133
+ ```
134
+
135
+ ## Naming Convention
136
+
137
+ ```javascript
138
+ // Pattern: should [expected] when [condition]
139
+
140
+ // ✅ Good
141
+ 'should return null when user not found'
142
+ 'should throw ValidationError when email invalid'
143
+ 'should emit event when order placed'
144
+
145
+ // ❌ Bad
146
+ 'works'
147
+ 'test user'
148
+ 'error handling'
149
+ ```
150
+
151
+ ## Anti-Patterns
152
+
153
+ | Pattern | Problem | Fix |
154
+ |---------|---------|-----|
155
+ | Testing internals | Breaks on refactor | Test behavior |
156
+ | Shared state | Tests affect each other | Reset in beforeEach |
157
+ | Flaky tests | Random failures | Deterministic data |
158
+ | Over-mocking | False confidence | Real implementations |
159
+ | No assertions | Test always passes | Assert outcomes |
160
+ | Magic numbers | Hard to understand | Named constants |
161
+
162
+ ## Coverage Thresholds
163
+
164
+ ```javascript
165
+ // vitest.config.js
166
+ coverage: {
167
+ thresholds: {
168
+ lines: 80,
169
+ branches: 80,
170
+ functions: 80,
171
+ statements: 80
172
+ }
173
+ }
174
+ ```
175
+
176
+ ## Commands
177
+
178
+ ```bash
179
+ npm test # Run all tests
180
+ npm test -- --watch # Watch mode
181
+ npm test -- --coverage # Coverage report
182
+ npm run test:e2e # E2E tests
183
+ ```
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: Agent Continuity
3
+ description: Cross-tool session handoff and resume via .agent/SESSION.md
4
+ ---
5
+
6
+ # Agent Continuity Skill
7
+
8
+ ## Purpose
9
+
10
+ Keep **Cursor**, **Claude Code**, and **Kiro** aligned on the same in-flight work using committed **`.agent/SESSION.md`**.
11
+
12
+ ---
13
+
14
+ ## When to apply
15
+
16
+ | Situation | Action |
17
+ |-----------|--------|
18
+ | New chat, same feature | **Resume** — read SESSION first |
19
+ | End of session | **Handoff** — update SESSION |
20
+ | Switch IDE/tool | **Handoff** then **Resume** in new tool |
21
+ | Switch persona | Update Meta `persona`; handoff notes for next role |
22
+ | Phase change (plan → build) | Update Meta `phase` |
23
+
24
+ ---
25
+
26
+ ## Handoff checklist
27
+
28
+ - [ ] Meta: date, phase, tool, persona
29
+ - [ ] Goal still accurate (one paragraph)
30
+ - [ ] Done: bullets with paths/commits
31
+ - [ ] In progress + blockers
32
+ - [ ] Next: numbered for next agent
33
+ - [ ] Decisions: non-obvious choices
34
+ - [ ] Gotchas: failures, test commands, env
35
+ - [ ] Pointers: spec, tasks, branch, key files
36
+ - [ ] `tasks/todo.md` synced
37
+ - [ ] No secrets or PII in SESSION
38
+
39
+ ---
40
+
41
+ ## Resume checklist
42
+
43
+ - [ ] Read `.agent/SESSION.md`
44
+ - [ ] Read `tasks/todo.md` if linked
45
+ - [ ] Read SPEC if linked
46
+ - [ ] `git status` vs SESSION expectations
47
+ - [ ] Run sanity build/test if Gotchas say so
48
+ - [ ] Post resumption summary to user
49
+ - [ ] Execute first **Next** step via workflow command
50
+
51
+ ---
52
+
53
+ ## SESSION schema
54
+
55
+ See **`.agent/SESSION.template.md`** for the canonical sections.
56
+
57
+ ---
58
+
59
+ ## Commands
60
+
61
+ | Command | File |
62
+ |---------|------|
63
+ | `/handoff` | `.agents/workflows/handoff.md` (`.agents/`, `.agents/`) |
64
+ | `/resume` | `.agents/workflows/resume.md` |
65
+
66
+ ---
67
+
68
+ ## Optional history
69
+
70
+ Copy SESSION to `.agent/history/YYYY-MM-DD-slug.md` at milestones; commit for audit trail.