agent-configs 1.0.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/README.md +223 -0
- package/agents/architect.md +211 -0
- package/agents/code-reviewer.md +104 -0
- package/agents/planner.md +119 -0
- package/agents/refactor-cleaner.md +306 -0
- package/agents/security-reviewer.md +545 -0
- package/agents/tdd-guide.md +280 -0
- package/bundles/bk-chat-bundle/README.md +48 -0
- package/bundles/bk-chat-bundle/manifest.json +10 -0
- package/bundles/continuous-learning/.claude/commands/evolve.md +190 -0
- package/bundles/continuous-learning/.claude/commands/instinct-status.md +64 -0
- package/bundles/continuous-learning/.claude/commands/learn.md +83 -0
- package/bundles/continuous-learning/.claude/hooks/learning-end.js +85 -0
- package/bundles/continuous-learning/.claude/hooks/observe.js +131 -0
- package/bundles/continuous-learning/.claude/lib/learning.js +559 -0
- package/bundles/continuous-learning/.claude/lib/utils.js +312 -0
- package/bundles/continuous-learning/.claude/skills/continuous-learning/SKILL.md +200 -0
- package/bundles/continuous-learning/.cursor/hooks/learning-end.js +102 -0
- package/bundles/continuous-learning/.cursor/rules/continuous-learning.mdc +34 -0
- package/bundles/continuous-learning/.cursor/skills/continuous-learning/SKILL.md +77 -0
- package/bundles/continuous-learning/README.md +159 -0
- package/bundles/continuous-learning/manifest.json +51 -0
- package/bundles/planning-bundle/README.md +34 -0
- package/bundles/planning-bundle/manifest.json +10 -0
- package/bundles/review-bundle/README.md +43 -0
- package/bundles/review-bundle/manifest.json +11 -0
- package/bundles/shared-memory/.claude/commands/list-sessions.md +124 -0
- package/bundles/shared-memory/.claude/commands/load-session.md +169 -0
- package/bundles/shared-memory/.claude/commands/save-session.md +137 -0
- package/bundles/shared-memory/.claude/hooks/memory-compact.js +43 -0
- package/bundles/shared-memory/.claude/hooks/memory-end.js +42 -0
- package/bundles/shared-memory/.claude/hooks/memory-start.js +59 -0
- package/bundles/shared-memory/.claude/lib/memory.js +416 -0
- package/bundles/shared-memory/.claude/lib/utils.js +209 -0
- package/bundles/shared-memory/.claude/skills/shared-memory/SKILL.md +183 -0
- package/bundles/shared-memory/.cursor/hooks/memory-start.js +42 -0
- package/bundles/shared-memory/.cursor/rules/shared-memory.mdc +37 -0
- package/bundles/shared-memory/.cursor/skills/shared-memory/SKILL.md +183 -0
- package/bundles/tdd-bundle/README.md +33 -0
- package/bundles/tdd-bundle/manifest.json +10 -0
- package/cli.js +978 -0
- package/commands/build-fix.md +29 -0
- package/commands/code-review.md +40 -0
- package/commands/e2e.md +363 -0
- package/commands/learn.md +114 -0
- package/commands/plan.md +113 -0
- package/commands/refactor-clean.md +28 -0
- package/commands/tdd.md +326 -0
- package/commands/test-coverage.md +27 -0
- package/commands/update-codemaps.md +17 -0
- package/commands/update-docs.md +31 -0
- package/configs.json +158 -0
- package/hooks/hooks.json +101 -0
- package/package.json +58 -0
- package/rules/agents.md +49 -0
- package/rules/coding-style.md +70 -0
- package/rules/git-workflow.md +45 -0
- package/rules/hooks.md +46 -0
- package/rules/patterns.md +55 -0
- package/rules/performance.md +47 -0
- package/rules/security.md +36 -0
- package/rules/testing.md +30 -0
- package/skills/ai-config-architect/SKILL.md +59 -0
- package/skills/ai-config-architect/references/agents.md +77 -0
- package/skills/ai-config-architect/references/commands.md +66 -0
- package/skills/ai-config-architect/references/hooks.md +70 -0
- package/skills/ai-config-architect/references/patterns.md +66 -0
- package/skills/ai-config-architect/references/platforms.md +82 -0
- package/skills/ai-config-architect/references/rules.md +66 -0
- package/skills/ai-config-architect/references/skills.md +67 -0
- package/skills/bk-chat-helper/SKILL.md +398 -0
- package/skills/bk-chat-helper/references/api-reference.md +606 -0
- package/skills/bk-chat-helper/references/examples.md +789 -0
- package/skills/bk-chat-helper/references/integration-guide.md +583 -0
- package/skills/bk-chat-x/SKILL.md +400 -0
- package/skills/bk-chat-x/references/components-api.md +340 -0
- package/skills/bk-chat-x/references/examples.md +386 -0
- package/skills/bk-chat-x/references/shortcuts-guide.md +375 -0
- package/skills/coding-standards/SKILL.md +523 -0
- package/skills/security-review/SKILL.md +497 -0
- package/skills/security-review/references/cloud-infrastructure-security.md +361 -0
- package/skills/strategic-compact/SKILL.md +66 -0
- package/skills/strategic-compact/scripts/suggest-compact.sh +52 -0
- package/skills/tdd-workflow/SKILL.md +412 -0
- package/skills/verification-loop/SKILL.md +128 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Build and Fix
|
|
2
|
+
|
|
3
|
+
Incrementally fix TypeScript and build errors:
|
|
4
|
+
|
|
5
|
+
1. Run build: npm run build or pnpm build
|
|
6
|
+
|
|
7
|
+
2. Parse error output:
|
|
8
|
+
- Group by file
|
|
9
|
+
- Sort by severity
|
|
10
|
+
|
|
11
|
+
3. For each error:
|
|
12
|
+
- Show error context (5 lines before/after)
|
|
13
|
+
- Explain the issue
|
|
14
|
+
- Propose fix
|
|
15
|
+
- Apply fix
|
|
16
|
+
- Re-run build
|
|
17
|
+
- Verify error resolved
|
|
18
|
+
|
|
19
|
+
4. Stop if:
|
|
20
|
+
- Fix introduces new errors
|
|
21
|
+
- Same error persists after 3 attempts
|
|
22
|
+
- User requests pause
|
|
23
|
+
|
|
24
|
+
5. Show summary:
|
|
25
|
+
- Errors fixed
|
|
26
|
+
- Errors remaining
|
|
27
|
+
- New errors introduced
|
|
28
|
+
|
|
29
|
+
Fix one error at a time for safety!
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Code Review
|
|
2
|
+
|
|
3
|
+
Comprehensive security and quality review of uncommitted changes:
|
|
4
|
+
|
|
5
|
+
1. Get changed files: git diff --name-only HEAD
|
|
6
|
+
|
|
7
|
+
2. For each changed file, check for:
|
|
8
|
+
|
|
9
|
+
**Security Issues (CRITICAL):**
|
|
10
|
+
- Hardcoded credentials, API keys, tokens
|
|
11
|
+
- SQL injection vulnerabilities
|
|
12
|
+
- XSS vulnerabilities
|
|
13
|
+
- Missing input validation
|
|
14
|
+
- Insecure dependencies
|
|
15
|
+
- Path traversal risks
|
|
16
|
+
|
|
17
|
+
**Code Quality (HIGH):**
|
|
18
|
+
- Functions > 50 lines
|
|
19
|
+
- Files > 800 lines
|
|
20
|
+
- Nesting depth > 4 levels
|
|
21
|
+
- Missing error handling
|
|
22
|
+
- console.log statements
|
|
23
|
+
- TODO/FIXME comments
|
|
24
|
+
- Missing JSDoc for public APIs
|
|
25
|
+
|
|
26
|
+
**Best Practices (MEDIUM):**
|
|
27
|
+
- Mutation patterns (use immutable instead)
|
|
28
|
+
- Emoji usage in code/comments
|
|
29
|
+
- Missing tests for new code
|
|
30
|
+
- Accessibility issues (a11y)
|
|
31
|
+
|
|
32
|
+
3. Generate report with:
|
|
33
|
+
- Severity: CRITICAL, HIGH, MEDIUM, LOW
|
|
34
|
+
- File location and line numbers
|
|
35
|
+
- Issue description
|
|
36
|
+
- Suggested fix
|
|
37
|
+
|
|
38
|
+
4. Block commit if CRITICAL or HIGH issues found
|
|
39
|
+
|
|
40
|
+
Never approve code with security vulnerabilities!
|
package/commands/e2e.md
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Generate and run end-to-end tests with Playwright. Creates test journeys, runs tests, captures screenshots/videos/traces, and uploads artifacts.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# E2E Command
|
|
6
|
+
|
|
7
|
+
This command invokes the **e2e-runner** agent to generate, maintain, and execute end-to-end tests using Playwright.
|
|
8
|
+
|
|
9
|
+
## What This Command Does
|
|
10
|
+
|
|
11
|
+
1. **Generate Test Journeys** - Create Playwright tests for user flows
|
|
12
|
+
2. **Run E2E Tests** - Execute tests across browsers
|
|
13
|
+
3. **Capture Artifacts** - Screenshots, videos, traces on failures
|
|
14
|
+
4. **Upload Results** - HTML reports and JUnit XML
|
|
15
|
+
5. **Identify Flaky Tests** - Quarantine unstable tests
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
Use `/e2e` when:
|
|
20
|
+
- Testing critical user journeys (login, trading, payments)
|
|
21
|
+
- Verifying multi-step flows work end-to-end
|
|
22
|
+
- Testing UI interactions and navigation
|
|
23
|
+
- Validating integration between frontend and backend
|
|
24
|
+
- Preparing for production deployment
|
|
25
|
+
|
|
26
|
+
## How It Works
|
|
27
|
+
|
|
28
|
+
The e2e-runner agent will:
|
|
29
|
+
|
|
30
|
+
1. **Analyze user flow** and identify test scenarios
|
|
31
|
+
2. **Generate Playwright test** using Page Object Model pattern
|
|
32
|
+
3. **Run tests** across multiple browsers (Chrome, Firefox, Safari)
|
|
33
|
+
4. **Capture failures** with screenshots, videos, and traces
|
|
34
|
+
5. **Generate report** with results and artifacts
|
|
35
|
+
6. **Identify flaky tests** and recommend fixes
|
|
36
|
+
|
|
37
|
+
## Example Usage
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
User: /e2e Test the market search and view flow
|
|
41
|
+
|
|
42
|
+
Agent (e2e-runner):
|
|
43
|
+
# E2E Test Generation: Market Search and View Flow
|
|
44
|
+
|
|
45
|
+
## Test Scenario Identified
|
|
46
|
+
|
|
47
|
+
**User Journey:** Market Search → View Results → Click Market → View Details
|
|
48
|
+
|
|
49
|
+
**Test Coverage:**
|
|
50
|
+
1. Navigate to markets page
|
|
51
|
+
2. Perform semantic search
|
|
52
|
+
3. Verify search results
|
|
53
|
+
4. Click on first result
|
|
54
|
+
5. Verify market details page loads
|
|
55
|
+
6. Verify chart renders
|
|
56
|
+
|
|
57
|
+
## Generated Test Code
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// tests/e2e/markets/search-and-view.spec.ts
|
|
61
|
+
import { test, expect } from '@playwright/test'
|
|
62
|
+
import { MarketsPage } from '../../pages/MarketsPage'
|
|
63
|
+
import { MarketDetailsPage } from '../../pages/MarketDetailsPage'
|
|
64
|
+
|
|
65
|
+
test.describe('Market Search and View Flow', () => {
|
|
66
|
+
test('user can search markets and view details', async ({ page }) => {
|
|
67
|
+
// 1. Navigate to markets page
|
|
68
|
+
const marketsPage = new MarketsPage(page)
|
|
69
|
+
await marketsPage.goto()
|
|
70
|
+
|
|
71
|
+
// Verify page loaded
|
|
72
|
+
await expect(page).toHaveTitle(/Markets/)
|
|
73
|
+
await expect(page.locator('h1')).toContainText('Markets')
|
|
74
|
+
|
|
75
|
+
// 2. Perform semantic search
|
|
76
|
+
await marketsPage.searchMarkets('election')
|
|
77
|
+
|
|
78
|
+
// Wait for API response
|
|
79
|
+
await page.waitForResponse(resp =>
|
|
80
|
+
resp.url().includes('/api/markets/search') && resp.status() === 200
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
// 3. Verify search results
|
|
84
|
+
const marketCards = marketsPage.marketCards
|
|
85
|
+
await expect(marketCards.first()).toBeVisible()
|
|
86
|
+
const resultCount = await marketCards.count()
|
|
87
|
+
expect(resultCount).toBeGreaterThan(0)
|
|
88
|
+
|
|
89
|
+
// Take screenshot of search results
|
|
90
|
+
await page.screenshot({ path: 'artifacts/search-results.png' })
|
|
91
|
+
|
|
92
|
+
// 4. Click on first result
|
|
93
|
+
const firstMarketTitle = await marketCards.first().textContent()
|
|
94
|
+
await marketCards.first().click()
|
|
95
|
+
|
|
96
|
+
// 5. Verify market details page loads
|
|
97
|
+
await expect(page).toHaveURL(/\/markets\/[a-z0-9-]+/)
|
|
98
|
+
|
|
99
|
+
const detailsPage = new MarketDetailsPage(page)
|
|
100
|
+
await expect(detailsPage.marketName).toBeVisible()
|
|
101
|
+
await expect(detailsPage.marketDescription).toBeVisible()
|
|
102
|
+
|
|
103
|
+
// 6. Verify chart renders
|
|
104
|
+
await expect(detailsPage.priceChart).toBeVisible()
|
|
105
|
+
|
|
106
|
+
// Verify market name matches
|
|
107
|
+
const detailsTitle = await detailsPage.marketName.textContent()
|
|
108
|
+
expect(detailsTitle?.toLowerCase()).toContain(
|
|
109
|
+
firstMarketTitle?.toLowerCase().substring(0, 20) || ''
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
// Take screenshot of market details
|
|
113
|
+
await page.screenshot({ path: 'artifacts/market-details.png' })
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
test('search with no results shows empty state', async ({ page }) => {
|
|
117
|
+
const marketsPage = new MarketsPage(page)
|
|
118
|
+
await marketsPage.goto()
|
|
119
|
+
|
|
120
|
+
// Search for non-existent market
|
|
121
|
+
await marketsPage.searchMarkets('xyznonexistentmarket123456')
|
|
122
|
+
|
|
123
|
+
// Verify empty state
|
|
124
|
+
await expect(page.locator('[data-testid="no-results"]')).toBeVisible()
|
|
125
|
+
await expect(page.locator('[data-testid="no-results"]')).toContainText(
|
|
126
|
+
/no.*results|no.*markets/i
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
const marketCount = await marketsPage.marketCards.count()
|
|
130
|
+
expect(marketCount).toBe(0)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
test('can clear search and see all markets again', async ({ page }) => {
|
|
134
|
+
const marketsPage = new MarketsPage(page)
|
|
135
|
+
await marketsPage.goto()
|
|
136
|
+
|
|
137
|
+
// Initial market count
|
|
138
|
+
const initialCount = await marketsPage.marketCards.count()
|
|
139
|
+
|
|
140
|
+
// Perform search
|
|
141
|
+
await marketsPage.searchMarkets('trump')
|
|
142
|
+
await page.waitForLoadState('networkidle')
|
|
143
|
+
|
|
144
|
+
// Verify filtered results
|
|
145
|
+
const filteredCount = await marketsPage.marketCards.count()
|
|
146
|
+
expect(filteredCount).toBeLessThan(initialCount)
|
|
147
|
+
|
|
148
|
+
// Clear search
|
|
149
|
+
await marketsPage.searchInput.clear()
|
|
150
|
+
await page.waitForLoadState('networkidle')
|
|
151
|
+
|
|
152
|
+
// Verify all markets shown again
|
|
153
|
+
const finalCount = await marketsPage.marketCards.count()
|
|
154
|
+
expect(finalCount).toBe(initialCount)
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Running Tests
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Run the generated test
|
|
163
|
+
npx playwright test tests/e2e/markets/search-and-view.spec.ts
|
|
164
|
+
|
|
165
|
+
Running 3 tests using 3 workers
|
|
166
|
+
|
|
167
|
+
✓ [chromium] › search-and-view.spec.ts:5:3 › user can search markets and view details (4.2s)
|
|
168
|
+
✓ [chromium] › search-and-view.spec.ts:52:3 › search with no results shows empty state (1.8s)
|
|
169
|
+
✓ [chromium] › search-and-view.spec.ts:67:3 › can clear search and see all markets again (2.9s)
|
|
170
|
+
|
|
171
|
+
3 passed (9.1s)
|
|
172
|
+
|
|
173
|
+
Artifacts generated:
|
|
174
|
+
- artifacts/search-results.png
|
|
175
|
+
- artifacts/market-details.png
|
|
176
|
+
- playwright-report/index.html
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Test Report
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
183
|
+
║ E2E Test Results ║
|
|
184
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
185
|
+
║ Status: ✅ ALL TESTS PASSED ║
|
|
186
|
+
║ Total: 3 tests ║
|
|
187
|
+
║ Passed: 3 (100%) ║
|
|
188
|
+
║ Failed: 0 ║
|
|
189
|
+
║ Flaky: 0 ║
|
|
190
|
+
║ Duration: 9.1s ║
|
|
191
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
192
|
+
|
|
193
|
+
Artifacts:
|
|
194
|
+
📸 Screenshots: 2 files
|
|
195
|
+
📹 Videos: 0 files (only on failure)
|
|
196
|
+
🔍 Traces: 0 files (only on failure)
|
|
197
|
+
📊 HTML Report: playwright-report/index.html
|
|
198
|
+
|
|
199
|
+
View report: npx playwright show-report
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
✅ E2E test suite ready for CI/CD integration!
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Test Artifacts
|
|
206
|
+
|
|
207
|
+
When tests run, the following artifacts are captured:
|
|
208
|
+
|
|
209
|
+
**On All Tests:**
|
|
210
|
+
- HTML Report with timeline and results
|
|
211
|
+
- JUnit XML for CI integration
|
|
212
|
+
|
|
213
|
+
**On Failure Only:**
|
|
214
|
+
- Screenshot of the failing state
|
|
215
|
+
- Video recording of the test
|
|
216
|
+
- Trace file for debugging (step-by-step replay)
|
|
217
|
+
- Network logs
|
|
218
|
+
- Console logs
|
|
219
|
+
|
|
220
|
+
## Viewing Artifacts
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# View HTML report in browser
|
|
224
|
+
npx playwright show-report
|
|
225
|
+
|
|
226
|
+
# View specific trace file
|
|
227
|
+
npx playwright show-trace artifacts/trace-abc123.zip
|
|
228
|
+
|
|
229
|
+
# Screenshots are saved in artifacts/ directory
|
|
230
|
+
open artifacts/search-results.png
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Flaky Test Detection
|
|
234
|
+
|
|
235
|
+
If a test fails intermittently:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
⚠️ FLAKY TEST DETECTED: tests/e2e/markets/trade.spec.ts
|
|
239
|
+
|
|
240
|
+
Test passed 7/10 runs (70% pass rate)
|
|
241
|
+
|
|
242
|
+
Common failure:
|
|
243
|
+
"Timeout waiting for element '[data-testid="confirm-btn"]'"
|
|
244
|
+
|
|
245
|
+
Recommended fixes:
|
|
246
|
+
1. Add explicit wait: await page.waitForSelector('[data-testid="confirm-btn"]')
|
|
247
|
+
2. Increase timeout: { timeout: 10000 }
|
|
248
|
+
3. Check for race conditions in component
|
|
249
|
+
4. Verify element is not hidden by animation
|
|
250
|
+
|
|
251
|
+
Quarantine recommendation: Mark as test.fixme() until fixed
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Browser Configuration
|
|
255
|
+
|
|
256
|
+
Tests run on multiple browsers by default:
|
|
257
|
+
- ✅ Chromium (Desktop Chrome)
|
|
258
|
+
- ✅ Firefox (Desktop)
|
|
259
|
+
- ✅ WebKit (Desktop Safari)
|
|
260
|
+
- ✅ Mobile Chrome (optional)
|
|
261
|
+
|
|
262
|
+
Configure in `playwright.config.ts` to adjust browsers.
|
|
263
|
+
|
|
264
|
+
## CI/CD Integration
|
|
265
|
+
|
|
266
|
+
Add to your CI pipeline:
|
|
267
|
+
|
|
268
|
+
```yaml
|
|
269
|
+
# .github/workflows/e2e.yml
|
|
270
|
+
- name: Install Playwright
|
|
271
|
+
run: npx playwright install --with-deps
|
|
272
|
+
|
|
273
|
+
- name: Run E2E tests
|
|
274
|
+
run: npx playwright test
|
|
275
|
+
|
|
276
|
+
- name: Upload artifacts
|
|
277
|
+
if: always()
|
|
278
|
+
uses: actions/upload-artifact@v3
|
|
279
|
+
with:
|
|
280
|
+
name: playwright-report
|
|
281
|
+
path: playwright-report/
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## PMX-Specific Critical Flows
|
|
285
|
+
|
|
286
|
+
For PMX, prioritize these E2E tests:
|
|
287
|
+
|
|
288
|
+
**🔴 CRITICAL (Must Always Pass):**
|
|
289
|
+
1. User can connect wallet
|
|
290
|
+
2. User can browse markets
|
|
291
|
+
3. User can search markets (semantic search)
|
|
292
|
+
4. User can view market details
|
|
293
|
+
5. User can place trade (with test funds)
|
|
294
|
+
6. Market resolves correctly
|
|
295
|
+
7. User can withdraw funds
|
|
296
|
+
|
|
297
|
+
**🟡 IMPORTANT:**
|
|
298
|
+
1. Market creation flow
|
|
299
|
+
2. User profile updates
|
|
300
|
+
3. Real-time price updates
|
|
301
|
+
4. Chart rendering
|
|
302
|
+
5. Filter and sort markets
|
|
303
|
+
6. Mobile responsive layout
|
|
304
|
+
|
|
305
|
+
## Best Practices
|
|
306
|
+
|
|
307
|
+
**DO:**
|
|
308
|
+
- ✅ Use Page Object Model for maintainability
|
|
309
|
+
- ✅ Use data-testid attributes for selectors
|
|
310
|
+
- ✅ Wait for API responses, not arbitrary timeouts
|
|
311
|
+
- ✅ Test critical user journeys end-to-end
|
|
312
|
+
- ✅ Run tests before merging to main
|
|
313
|
+
- ✅ Review artifacts when tests fail
|
|
314
|
+
|
|
315
|
+
**DON'T:**
|
|
316
|
+
- ❌ Use brittle selectors (CSS classes can change)
|
|
317
|
+
- ❌ Test implementation details
|
|
318
|
+
- ❌ Run tests against production
|
|
319
|
+
- ❌ Ignore flaky tests
|
|
320
|
+
- ❌ Skip artifact review on failures
|
|
321
|
+
- ❌ Test every edge case with E2E (use unit tests)
|
|
322
|
+
|
|
323
|
+
## Important Notes
|
|
324
|
+
|
|
325
|
+
**CRITICAL for PMX:**
|
|
326
|
+
- E2E tests involving real money MUST run on testnet/staging only
|
|
327
|
+
- Never run trading tests against production
|
|
328
|
+
- Set `test.skip(process.env.NODE_ENV === 'production')` for financial tests
|
|
329
|
+
- Use test wallets with small test funds only
|
|
330
|
+
|
|
331
|
+
## Integration with Other Commands
|
|
332
|
+
|
|
333
|
+
- Use `/plan` to identify critical journeys to test
|
|
334
|
+
- Use `/tdd` for unit tests (faster, more granular)
|
|
335
|
+
- Use `/e2e` for integration and user journey tests
|
|
336
|
+
- Use `/code-review` to verify test quality
|
|
337
|
+
|
|
338
|
+
## Related Agents
|
|
339
|
+
|
|
340
|
+
This command invokes the `e2e-runner` agent located at:
|
|
341
|
+
`~/.claude/agents/e2e-runner.md`
|
|
342
|
+
|
|
343
|
+
## Quick Commands
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
# Run all E2E tests
|
|
347
|
+
npx playwright test
|
|
348
|
+
|
|
349
|
+
# Run specific test file
|
|
350
|
+
npx playwright test tests/e2e/markets/search.spec.ts
|
|
351
|
+
|
|
352
|
+
# Run in headed mode (see browser)
|
|
353
|
+
npx playwright test --headed
|
|
354
|
+
|
|
355
|
+
# Debug test
|
|
356
|
+
npx playwright test --debug
|
|
357
|
+
|
|
358
|
+
# Generate test code
|
|
359
|
+
npx playwright codegen http://localhost:3000
|
|
360
|
+
|
|
361
|
+
# View report
|
|
362
|
+
npx playwright show-report
|
|
363
|
+
```
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# /learn - 提取可复用的 Patterns
|
|
2
|
+
|
|
3
|
+
分析当前会话,提取值得保存为 skills 或 instincts 的 patterns。
|
|
4
|
+
|
|
5
|
+
## 触发
|
|
6
|
+
|
|
7
|
+
在会话中任意时刻运行 `/learn`,当你解决了一个非平凡的问题时。
|
|
8
|
+
|
|
9
|
+
## 要提取的内容
|
|
10
|
+
|
|
11
|
+
寻找以下类型的 patterns:
|
|
12
|
+
|
|
13
|
+
### 1. 错误解决模式
|
|
14
|
+
- 遇到了什么错误?
|
|
15
|
+
- 根本原因是什么?
|
|
16
|
+
- 如何修复的?
|
|
17
|
+
- 这个方案是否可复用于类似错误?
|
|
18
|
+
|
|
19
|
+
### 2. 调试技巧
|
|
20
|
+
- 非显而易见的调试步骤
|
|
21
|
+
- 有效的工具组合
|
|
22
|
+
- 诊断模式
|
|
23
|
+
|
|
24
|
+
### 3. 变通方案
|
|
25
|
+
- 库的特殊行为
|
|
26
|
+
- API 限制
|
|
27
|
+
- 版本特定的修复
|
|
28
|
+
|
|
29
|
+
### 4. 项目特定模式
|
|
30
|
+
- 发现的代码库约定
|
|
31
|
+
- 做出的架构决策
|
|
32
|
+
- 集成模式
|
|
33
|
+
|
|
34
|
+
## 输出格式
|
|
35
|
+
|
|
36
|
+
### v1: Learned Skill
|
|
37
|
+
|
|
38
|
+
创建 skill 文件到 `~/.claude/skills/learned/[pattern-name].md`:
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
# [描述性的 Pattern 名称]
|
|
42
|
+
|
|
43
|
+
**Extracted:** [日期]
|
|
44
|
+
**Context:** [适用场景简述]
|
|
45
|
+
|
|
46
|
+
## Problem
|
|
47
|
+
[这个 pattern 解决什么问题 - 要具体]
|
|
48
|
+
|
|
49
|
+
## Solution
|
|
50
|
+
[pattern/技巧/变通方案]
|
|
51
|
+
|
|
52
|
+
## Example
|
|
53
|
+
[如果适用,代码示例]
|
|
54
|
+
|
|
55
|
+
## When to Use
|
|
56
|
+
[触发条件 - 什么情况应该激活这个 skill]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### v2: Instinct (高级)
|
|
60
|
+
|
|
61
|
+
创建 instinct 文件到 `~/.claude/homunculus/instincts/personal/[id].md`:
|
|
62
|
+
|
|
63
|
+
```markdown
|
|
64
|
+
---
|
|
65
|
+
id: [pattern-id]
|
|
66
|
+
trigger: "[触发条件]"
|
|
67
|
+
confidence: 0.5
|
|
68
|
+
domain: "[domain: code-style, testing, git, debugging, workflow]"
|
|
69
|
+
source: "session-observation"
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
# [Pattern 名称]
|
|
73
|
+
|
|
74
|
+
## Action
|
|
75
|
+
[应该采取的行动]
|
|
76
|
+
|
|
77
|
+
## Evidence
|
|
78
|
+
- [支持这个 pattern 的证据]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 处理流程
|
|
82
|
+
|
|
83
|
+
1. 回顾会话,寻找可提取的 patterns
|
|
84
|
+
2. 识别最有价值/可复用的洞见
|
|
85
|
+
3. 询问用户偏好(skill 或 instinct)
|
|
86
|
+
4. 起草对应文件
|
|
87
|
+
5. 询问用户确认后保存
|
|
88
|
+
|
|
89
|
+
## 注意事项
|
|
90
|
+
|
|
91
|
+
- **不要**提取简单问题(拼写错误、简单语法错误)
|
|
92
|
+
- **不要**提取一次性问题(特定 API 故障等)
|
|
93
|
+
- **聚焦**于能在未来会话中节省时间的 patterns
|
|
94
|
+
- **保持聚焦** - 每个 skill/instinct 只包含一个 pattern
|
|
95
|
+
|
|
96
|
+
## v1 vs v2 对比
|
|
97
|
+
|
|
98
|
+
| 特性 | Skill (v1) | Instinct (v2) |
|
|
99
|
+
|------|------------|---------------|
|
|
100
|
+
| 粒度 | 完整 pattern | 原子行为 |
|
|
101
|
+
| 置信度 | 无 | 0.3-0.9 |
|
|
102
|
+
| 进化 | 直接使用 | 可聚合为 skill/command/agent |
|
|
103
|
+
| 存储位置 | `~/.claude/skills/learned/` | `~/.claude/homunculus/instincts/` |
|
|
104
|
+
|
|
105
|
+
## 相关命令
|
|
106
|
+
|
|
107
|
+
| 命令 | 说明 |
|
|
108
|
+
|------|------|
|
|
109
|
+
| `/instinct-status` | 查看已学习的 instincts |
|
|
110
|
+
| `/evolve` | 将相关 instincts 进化为更高级结构 |
|
|
111
|
+
|
|
112
|
+
## 完整功能
|
|
113
|
+
|
|
114
|
+
如需使用完整的持续学习功能,请参考 `bundles/continuous-learning/` bundle。
|
package/commands/plan.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Restate requirements, assess risks, and create step-by-step implementation plan. WAIT for user CONFIRM before touching any code.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Plan Command
|
|
6
|
+
|
|
7
|
+
This command invokes the **planner** agent to create a comprehensive implementation plan before writing any code.
|
|
8
|
+
|
|
9
|
+
## What This Command Does
|
|
10
|
+
|
|
11
|
+
1. **Restate Requirements** - Clarify what needs to be built
|
|
12
|
+
2. **Identify Risks** - Surface potential issues and blockers
|
|
13
|
+
3. **Create Step Plan** - Break down implementation into phases
|
|
14
|
+
4. **Wait for Confirmation** - MUST receive user approval before proceeding
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
Use `/plan` when:
|
|
19
|
+
- Starting a new feature
|
|
20
|
+
- Making significant architectural changes
|
|
21
|
+
- Working on complex refactoring
|
|
22
|
+
- Multiple files/components will be affected
|
|
23
|
+
- Requirements are unclear or ambiguous
|
|
24
|
+
|
|
25
|
+
## How It Works
|
|
26
|
+
|
|
27
|
+
The planner agent will:
|
|
28
|
+
|
|
29
|
+
1. **Analyze the request** and restate requirements in clear terms
|
|
30
|
+
2. **Break down into phases** with specific, actionable steps
|
|
31
|
+
3. **Identify dependencies** between components
|
|
32
|
+
4. **Assess risks** and potential blockers
|
|
33
|
+
5. **Estimate complexity** (High/Medium/Low)
|
|
34
|
+
6. **Present the plan** and WAIT for your explicit confirmation
|
|
35
|
+
|
|
36
|
+
## Example Usage
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
User: /plan I need to add real-time notifications when markets resolve
|
|
40
|
+
|
|
41
|
+
Agent (planner):
|
|
42
|
+
# Implementation Plan: Real-Time Market Resolution Notifications
|
|
43
|
+
|
|
44
|
+
## Requirements Restatement
|
|
45
|
+
- Send notifications to users when markets they're watching resolve
|
|
46
|
+
- Support multiple notification channels (in-app, email, webhook)
|
|
47
|
+
- Ensure notifications are delivered reliably
|
|
48
|
+
- Include market outcome and user's position result
|
|
49
|
+
|
|
50
|
+
## Implementation Phases
|
|
51
|
+
|
|
52
|
+
### Phase 1: Database Schema
|
|
53
|
+
- Add notifications table with columns: id, user_id, market_id, type, status, created_at
|
|
54
|
+
- Add user_notification_preferences table for channel preferences
|
|
55
|
+
- Create indexes on user_id and market_id for performance
|
|
56
|
+
|
|
57
|
+
### Phase 2: Notification Service
|
|
58
|
+
- Create notification service in lib/notifications.ts
|
|
59
|
+
- Implement notification queue using BullMQ/Redis
|
|
60
|
+
- Add retry logic for failed deliveries
|
|
61
|
+
- Create notification templates
|
|
62
|
+
|
|
63
|
+
### Phase 3: Integration Points
|
|
64
|
+
- Hook into market resolution logic (when status changes to "resolved")
|
|
65
|
+
- Query all users with positions in market
|
|
66
|
+
- Enqueue notifications for each user
|
|
67
|
+
|
|
68
|
+
### Phase 4: Frontend Components
|
|
69
|
+
- Create NotificationBell component in header
|
|
70
|
+
- Add NotificationList modal
|
|
71
|
+
- Implement real-time updates via Supabase subscriptions
|
|
72
|
+
- Add notification preferences page
|
|
73
|
+
|
|
74
|
+
## Dependencies
|
|
75
|
+
- Redis (for queue)
|
|
76
|
+
- Email service (SendGrid/Resend)
|
|
77
|
+
- Supabase real-time subscriptions
|
|
78
|
+
|
|
79
|
+
## Risks
|
|
80
|
+
- HIGH: Email deliverability (SPF/DKIM required)
|
|
81
|
+
- MEDIUM: Performance with 1000+ users per market
|
|
82
|
+
- MEDIUM: Notification spam if markets resolve frequently
|
|
83
|
+
- LOW: Real-time subscription overhead
|
|
84
|
+
|
|
85
|
+
## Estimated Complexity: MEDIUM
|
|
86
|
+
- Backend: 4-6 hours
|
|
87
|
+
- Frontend: 3-4 hours
|
|
88
|
+
- Testing: 2-3 hours
|
|
89
|
+
- Total: 9-13 hours
|
|
90
|
+
|
|
91
|
+
**WAITING FOR CONFIRMATION**: Proceed with this plan? (yes/no/modify)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Important Notes
|
|
95
|
+
|
|
96
|
+
**CRITICAL**: The planner agent will **NOT** write any code until you explicitly confirm the plan with "yes" or "proceed" or similar affirmative response.
|
|
97
|
+
|
|
98
|
+
If you want changes, respond with:
|
|
99
|
+
- "modify: [your changes]"
|
|
100
|
+
- "different approach: [alternative]"
|
|
101
|
+
- "skip phase 2 and do phase 3 first"
|
|
102
|
+
|
|
103
|
+
## Integration with Other Commands
|
|
104
|
+
|
|
105
|
+
After planning:
|
|
106
|
+
- Use `/tdd` to implement with test-driven development
|
|
107
|
+
- Use `/build-and-fix` if build errors occur
|
|
108
|
+
- Use `/code-review` to review completed implementation
|
|
109
|
+
|
|
110
|
+
## Related Agents
|
|
111
|
+
|
|
112
|
+
This command invokes the `planner` agent located at:
|
|
113
|
+
`~/.claude/agents/planner.md`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Refactor Clean
|
|
2
|
+
|
|
3
|
+
Safely identify and remove dead code with test verification:
|
|
4
|
+
|
|
5
|
+
1. Run dead code analysis tools:
|
|
6
|
+
- knip: Find unused exports and files
|
|
7
|
+
- depcheck: Find unused dependencies
|
|
8
|
+
- ts-prune: Find unused TypeScript exports
|
|
9
|
+
|
|
10
|
+
2. Generate comprehensive report in .reports/dead-code-analysis.md
|
|
11
|
+
|
|
12
|
+
3. Categorize findings by severity:
|
|
13
|
+
- SAFE: Test files, unused utilities
|
|
14
|
+
- CAUTION: API routes, components
|
|
15
|
+
- DANGER: Config files, main entry points
|
|
16
|
+
|
|
17
|
+
4. Propose safe deletions only
|
|
18
|
+
|
|
19
|
+
5. Before each deletion:
|
|
20
|
+
- Run full test suite
|
|
21
|
+
- Verify tests pass
|
|
22
|
+
- Apply change
|
|
23
|
+
- Re-run tests
|
|
24
|
+
- Rollback if tests fail
|
|
25
|
+
|
|
26
|
+
6. Show summary of cleaned items
|
|
27
|
+
|
|
28
|
+
Never delete code without running tests first!
|