catalyst-os 0.1.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/.catalyst/main/project-config.yaml +11 -0
- package/.catalyst/spec-structure.yaml +241 -0
- package/.catalyst/specs/spec-config.yaml +109 -0
- package/.catalyst/standards/coding.md +187 -0
- package/.catalyst/standards/git-workflow.md +181 -0
- package/.catalyst/standards/testing.md +185 -0
- package/.catalyst/workflows/approve-spec.md +413 -0
- package/.catalyst/workflows/build-spec.md +527 -0
- package/.catalyst/workflows/build-task.md +434 -0
- package/.catalyst/workflows/catalyze-project.md +212 -0
- package/.catalyst/workflows/catalyze-spec.md +265 -0
- package/.catalyst/workflows/validate-spec.md +388 -0
- package/.claude/agents/alchemist.md +84 -0
- package/.claude/agents/arbiter.md +142 -0
- package/.claude/agents/catalyst.md +102 -0
- package/.claude/agents/enforcer.md +62 -0
- package/.claude/agents/forge-master.md +318 -0
- package/.claude/agents/forger.md +216 -0
- package/.claude/agents/inquisitor.md +70 -0
- package/.claude/agents/necromancer.md +84 -0
- package/.claude/agents/oracle.md +67 -0
- package/.claude/agents/scout.md +74 -0
- package/.claude/agents/scribe.md +163 -0
- package/.claude/agents/seer.md +108 -0
- package/.claude/agents/sentinel.md +58 -0
- package/.claude/agents/shaper.md +85 -0
- package/.claude/agents/smith.md +85 -0
- package/.claude/agents/surveyor.md +52 -0
- package/.claude/agents/watcher.md +69 -0
- package/.claude/commands/approve-spec.md +383 -0
- package/.claude/commands/build-spec.md +381 -0
- package/.claude/commands/build-task.md +210 -0
- package/.claude/commands/catalyze-project.md +112 -0
- package/.claude/commands/catalyze-spec.md +197 -0
- package/.claude/commands/mission.md +48 -0
- package/.claude/commands/reject-spec.md +125 -0
- package/.claude/commands/roadmap.md +62 -0
- package/.claude/commands/status-spec.md +289 -0
- package/.claude/commands/tech-stack.md +75 -0
- package/.claude/commands/update-spec.md +265 -0
- package/.claude/commands/validate-spec.md +265 -0
- package/.claude/settings.local.json +13 -0
- package/.claude/skills/catalysts/build-orchestration/SKILL.md +54 -0
- package/.claude/skills/catalysts/spec-orchestration/SKILL.md +52 -0
- package/.claude/skills/catalysts/validation-orchestration/SKILL.md +50 -0
- package/.claude/skills/guardians/browser-automation/SKILL.md +58 -0
- package/.claude/skills/guardians/code-review/SKILL.md +60 -0
- package/.claude/skills/guardians/dependency-audit/SKILL.md +63 -0
- package/.claude/skills/guardians/e2e-test-execution/SKILL.md +52 -0
- package/.claude/skills/guardians/lint-checking/SKILL.md +46 -0
- package/.claude/skills/guardians/secret-scanning/SKILL.md +69 -0
- package/.claude/skills/guardians/test-fixture-creation/SKILL.md +54 -0
- package/.claude/skills/guardians/unit-test-writing/SKILL.md +57 -0
- package/.claude/skills/seekers/codebase-analysis/SKILL.md +67 -0
- package/.claude/skills/seekers/context7-lookup/SKILL.md +59 -0
- package/.claude/skills/seekers/documentation-management/SKILL.md +190 -0
- package/.claude/skills/seekers/figma-analysis/SKILL.md +57 -0
- package/.claude/skills/seekers/github-research/SKILL.md +57 -0
- package/.claude/skills/seekers/reddit-research/SKILL.md +55 -0
- package/.claude/skills/seekers/requirement-elicitation/SKILL.md +53 -0
- package/.claude/skills/seekers/ui-pattern-hunting/SKILL.md +62 -0
- package/.claude/skills/seekers/web-research/SKILL.md +61 -0
- package/.claude/skills/technologists/ai-integration/SKILL.md +53 -0
- package/.claude/skills/technologists/api-development/SKILL.md +51 -0
- package/.claude/skills/technologists/migration-creation/SKILL.md +58 -0
- package/.claude/skills/technologists/ml-pipeline/SKILL.md +54 -0
- package/.claude/skills/technologists/react-development/SKILL.md +61 -0
- package/.claude/skills/technologists/schema-design/SKILL.md +54 -0
- package/.claude/skills/technologists/service-implementation/SKILL.md +49 -0
- package/.claude/skills/technologists/task-breakdown/SKILL.md +60 -0
- package/.claude/skills/technologists/ui-component-building/SKILL.md +58 -0
- package/.claude-plugin/plugin.json +43 -0
- package/README.md +440 -0
- package/bin/install.js +174 -0
- package/package.json +40 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: validation-orchestration
|
|
3
|
+
description: >
|
|
4
|
+
Orchestrate the validation workflow for completed implementations. TRIGGERS:
|
|
5
|
+
/validate-spec command, implementation complete, quality verification needed.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Validation Orchestration
|
|
9
|
+
|
|
10
|
+
Coordinate the validation workflow to ensure implementation quality.
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
1. **Verify prerequisites**
|
|
15
|
+
- All tasks marked complete
|
|
16
|
+
- Unit tests passing
|
|
17
|
+
- No blocking issues
|
|
18
|
+
|
|
19
|
+
2. **Run E2E tests** (use `e2e-test-execution`)
|
|
20
|
+
- Execute full test suite
|
|
21
|
+
- Capture failures
|
|
22
|
+
|
|
23
|
+
3. **Check code quality** (use `lint-checking`, `code-review`)
|
|
24
|
+
- Run linters
|
|
25
|
+
- Review patterns
|
|
26
|
+
|
|
27
|
+
4. **Security scan** (use `dependency-audit`, `secret-scanning`)
|
|
28
|
+
- Audit dependencies
|
|
29
|
+
- Scan for secrets
|
|
30
|
+
|
|
31
|
+
5. **Produce validation report**
|
|
32
|
+
- Compile results
|
|
33
|
+
- Create validation/sign-off.md
|
|
34
|
+
|
|
35
|
+
## Failure Handling
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
If any check fails:
|
|
39
|
+
1. Document in validation/
|
|
40
|
+
2. Route back to build phase
|
|
41
|
+
3. Re-run after fixes
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Output
|
|
45
|
+
|
|
46
|
+
`validation/sign-off.md` with:
|
|
47
|
+
- All check results
|
|
48
|
+
- Overall status
|
|
49
|
+
- Recommendations
|
|
50
|
+
- Next steps
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: browser-automation
|
|
3
|
+
description: >
|
|
4
|
+
Automate browser interactions for testing and validation. TRIGGERS: manual
|
|
5
|
+
testing validation, capturing screenshots, visual verification of UI.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Browser Automation
|
|
9
|
+
|
|
10
|
+
Automate browser interactions.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Manual testing validation
|
|
15
|
+
- Screenshot capture
|
|
16
|
+
- Visual verification
|
|
17
|
+
|
|
18
|
+
## Browser Tools
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
browser_navigate → Navigate to URL
|
|
22
|
+
browser_snapshot → Get page structure
|
|
23
|
+
browser_click → Click elements
|
|
24
|
+
browser_type → Type text
|
|
25
|
+
browser_take_screenshot → Capture page
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Testing Flow
|
|
29
|
+
|
|
30
|
+
1. Navigate to page
|
|
31
|
+
2. Snapshot for elements
|
|
32
|
+
3. Interact (click, type)
|
|
33
|
+
4. Verify state
|
|
34
|
+
5. Screenshot if needed
|
|
35
|
+
|
|
36
|
+
## Common Patterns
|
|
37
|
+
|
|
38
|
+
### Form Fill
|
|
39
|
+
```
|
|
40
|
+
1. snapshot - Get form refs
|
|
41
|
+
2. type - Fill fields
|
|
42
|
+
3. click - Submit
|
|
43
|
+
4. snapshot - Verify success
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Navigation Test
|
|
47
|
+
```
|
|
48
|
+
1. navigate - Go to page
|
|
49
|
+
2. click - Click link
|
|
50
|
+
3. snapshot - Verify new page
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Checklist
|
|
54
|
+
|
|
55
|
+
- [ ] Navigation works
|
|
56
|
+
- [ ] Elements interactable
|
|
57
|
+
- [ ] Screenshots captured
|
|
58
|
+
- [ ] Responsive tested
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: >
|
|
4
|
+
Review code for quality, patterns, and best practices. TRIGGERS: after
|
|
5
|
+
implementation, before merge/commit, /validate-spec command, quality gate check.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Code Review
|
|
9
|
+
|
|
10
|
+
Review code for quality and patterns.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- After implementation
|
|
15
|
+
- Before merge/commit
|
|
16
|
+
- Quality gate check
|
|
17
|
+
|
|
18
|
+
## Review Checklist
|
|
19
|
+
|
|
20
|
+
### Code Quality
|
|
21
|
+
- [ ] Clear naming
|
|
22
|
+
- [ ] DRY compliance
|
|
23
|
+
- [ ] Error handling
|
|
24
|
+
- [ ] Type safety
|
|
25
|
+
|
|
26
|
+
### Patterns
|
|
27
|
+
- [ ] Project conventions
|
|
28
|
+
- [ ] Proper abstraction
|
|
29
|
+
- [ ] No circular deps
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
- [ ] Input validation
|
|
33
|
+
- [ ] No hardcoded secrets
|
|
34
|
+
|
|
35
|
+
## Feedback Format
|
|
36
|
+
|
|
37
|
+
### 🔴 Critical (Must Fix)
|
|
38
|
+
```markdown
|
|
39
|
+
**File**: src/api/users.ts:45
|
|
40
|
+
**Issue**: SQL injection vulnerability
|
|
41
|
+
**Fix**: Use parameterized query
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 🟡 Important (Should Fix)
|
|
45
|
+
```markdown
|
|
46
|
+
**File**: src/services/stripe.ts:23
|
|
47
|
+
**Issue**: Missing error handling
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 🟢 Suggestion
|
|
51
|
+
```markdown
|
|
52
|
+
**File**: src/utils/pricing.ts:12
|
|
53
|
+
**Suggestion**: Extract constant
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Checklist
|
|
57
|
+
|
|
58
|
+
- [ ] Critical issues found
|
|
59
|
+
- [ ] Actionable feedback
|
|
60
|
+
- [ ] No bikeshedding
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dependency-audit
|
|
3
|
+
description: >
|
|
4
|
+
Audit dependencies for security vulnerabilities and license compliance.
|
|
5
|
+
TRIGGERS: security checks, before deployment, /validate-spec command, regular maintenance.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Dependency Audit
|
|
9
|
+
|
|
10
|
+
Audit dependencies for security.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Security checks
|
|
15
|
+
- Before deployment
|
|
16
|
+
- Regular maintenance
|
|
17
|
+
|
|
18
|
+
## Audit Commands
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# npm
|
|
22
|
+
npm audit
|
|
23
|
+
npm audit fix
|
|
24
|
+
|
|
25
|
+
# pip
|
|
26
|
+
pip-audit
|
|
27
|
+
safety check
|
|
28
|
+
|
|
29
|
+
# snyk
|
|
30
|
+
snyk test
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Severity Response
|
|
34
|
+
|
|
35
|
+
| Level | Action |
|
|
36
|
+
|-------|--------|
|
|
37
|
+
| Critical | Fix immediately |
|
|
38
|
+
| High | Fix within 24h |
|
|
39
|
+
| Medium | Fix within week |
|
|
40
|
+
| Low | Fix when convenient |
|
|
41
|
+
|
|
42
|
+
## Output Format
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
## Dependency Audit Report
|
|
46
|
+
|
|
47
|
+
### Vulnerabilities Found
|
|
48
|
+
|
|
49
|
+
#### 🔴 Critical (1)
|
|
50
|
+
**Package**: lodash@4.17.20
|
|
51
|
+
**Issue**: Prototype pollution
|
|
52
|
+
**Fix**: `npm update lodash`
|
|
53
|
+
|
|
54
|
+
### License Summary
|
|
55
|
+
- MIT: 180 packages
|
|
56
|
+
- Apache-2.0: 42 packages
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Checklist
|
|
60
|
+
|
|
61
|
+
- [ ] No critical vulnerabilities
|
|
62
|
+
- [ ] No high vulnerabilities
|
|
63
|
+
- [ ] Licenses compatible
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: e2e-test-execution
|
|
3
|
+
description: >
|
|
4
|
+
Execute end-to-end tests using browser automation. TRIGGERS: validating
|
|
5
|
+
complete user flows, running Playwright/Cypress tests, /validate-spec command.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# E2E Test Execution
|
|
9
|
+
|
|
10
|
+
Run end-to-end browser tests.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Validating user flows
|
|
15
|
+
- Testing integrations
|
|
16
|
+
- Pre-deployment checks
|
|
17
|
+
|
|
18
|
+
## Playwright Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
test('user can subscribe', async ({ page }) => {
|
|
22
|
+
await page.goto('/pricing')
|
|
23
|
+
await page.click('[data-testid="plan-pro"]')
|
|
24
|
+
await page.fill('[data-testid="card-number"]', '4242...')
|
|
25
|
+
await page.click('[data-testid="submit"]')
|
|
26
|
+
|
|
27
|
+
await expect(page.locator('[data-testid="success"]'))
|
|
28
|
+
.toBeVisible()
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Running Tests
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npx playwright test
|
|
36
|
+
npx playwright test --headed
|
|
37
|
+
npx playwright test subscription.spec.ts
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Best Practices
|
|
41
|
+
|
|
42
|
+
- Use data-testid for selectors
|
|
43
|
+
- Wait properly (no arbitrary sleeps)
|
|
44
|
+
- Screenshot on failure
|
|
45
|
+
- Clean state between tests
|
|
46
|
+
|
|
47
|
+
## Checklist
|
|
48
|
+
|
|
49
|
+
- [ ] Happy paths tested
|
|
50
|
+
- [ ] Error scenarios covered
|
|
51
|
+
- [ ] Screenshots on failure
|
|
52
|
+
- [ ] Reasonable timeouts
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lint-checking
|
|
3
|
+
description: >
|
|
4
|
+
Run linters and formatters to ensure code quality. TRIGGERS: pre-commit
|
|
5
|
+
checks, code style validation, /validate-spec command, quality gates.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Lint Checking
|
|
9
|
+
|
|
10
|
+
Run linters and formatters.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Pre-commit checks
|
|
15
|
+
- Code style validation
|
|
16
|
+
- Quality gates
|
|
17
|
+
|
|
18
|
+
## Common Commands
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# JavaScript/TypeScript
|
|
22
|
+
npx eslint . --ext .js,.jsx,.ts,.tsx
|
|
23
|
+
npx eslint . --fix
|
|
24
|
+
npx prettier --check .
|
|
25
|
+
npx prettier --write .
|
|
26
|
+
|
|
27
|
+
# Python
|
|
28
|
+
ruff check .
|
|
29
|
+
ruff check . --fix
|
|
30
|
+
black --check .
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Fix Process
|
|
34
|
+
|
|
35
|
+
1. Run linter
|
|
36
|
+
2. Review errors
|
|
37
|
+
3. Auto-fix where possible
|
|
38
|
+
4. Manual fix remaining
|
|
39
|
+
5. Verify clean
|
|
40
|
+
|
|
41
|
+
## Checklist
|
|
42
|
+
|
|
43
|
+
- [ ] Linter passes
|
|
44
|
+
- [ ] Formatter passes
|
|
45
|
+
- [ ] No warnings
|
|
46
|
+
- [ ] Pre-commit works
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: secret-scanning
|
|
3
|
+
description: >
|
|
4
|
+
Scan code for exposed secrets and credentials. TRIGGERS: pre-commit checks,
|
|
5
|
+
PR reviews, /validate-spec command, security audits.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Secret Scanning
|
|
9
|
+
|
|
10
|
+
Scan for exposed secrets.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Pre-commit checks
|
|
15
|
+
- PR reviews
|
|
16
|
+
- Security audits
|
|
17
|
+
|
|
18
|
+
## Scanning Tools
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# gitleaks
|
|
22
|
+
gitleaks detect
|
|
23
|
+
|
|
24
|
+
# truffleHog
|
|
25
|
+
trufflehog git file://.
|
|
26
|
+
|
|
27
|
+
# detect-secrets
|
|
28
|
+
detect-secrets scan
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Common Patterns
|
|
32
|
+
|
|
33
|
+
```regex
|
|
34
|
+
# AWS Access Key
|
|
35
|
+
AKIA[0-9A-Z]{16}
|
|
36
|
+
|
|
37
|
+
# GitHub Token
|
|
38
|
+
ghp_[A-Za-z0-9]{36}
|
|
39
|
+
|
|
40
|
+
# Generic API Key
|
|
41
|
+
[Aa]pi[_-]?[Kk]ey.*['"][A-Za-z0-9]{20,}['"]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Response Process
|
|
45
|
+
|
|
46
|
+
If secret found:
|
|
47
|
+
1. Revoke immediately
|
|
48
|
+
2. Remove from code
|
|
49
|
+
3. Use environment variables
|
|
50
|
+
4. Audit access
|
|
51
|
+
|
|
52
|
+
## Output Format
|
|
53
|
+
|
|
54
|
+
```markdown
|
|
55
|
+
## Secret Scan Report
|
|
56
|
+
|
|
57
|
+
### Findings
|
|
58
|
+
|
|
59
|
+
#### 🔴 Critical
|
|
60
|
+
**File**: src/config/stripe.ts:15
|
|
61
|
+
**Type**: Stripe API Key
|
|
62
|
+
**Action**: Revoke and rotate
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Checklist
|
|
66
|
+
|
|
67
|
+
- [ ] No secrets in code
|
|
68
|
+
- [ ] .gitignore updated
|
|
69
|
+
- [ ] Pre-commit hook active
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-fixture-creation
|
|
3
|
+
description: >
|
|
4
|
+
Create test fixtures, mocks, and test data. TRIGGERS: setting up test
|
|
5
|
+
environments, creating reusable test data, building mock services.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Fixture Creation
|
|
9
|
+
|
|
10
|
+
Create test fixtures and mock data.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Setting up test environments
|
|
15
|
+
- Creating reusable test data
|
|
16
|
+
- Building mock services
|
|
17
|
+
|
|
18
|
+
## Factory Pattern
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
export function createUser(overrides: Partial<User> = {}): User {
|
|
22
|
+
return {
|
|
23
|
+
id: faker.string.uuid(),
|
|
24
|
+
email: faker.internet.email(),
|
|
25
|
+
name: faker.person.fullName(),
|
|
26
|
+
...overrides,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Usage
|
|
31
|
+
const user = createUser({ email: 'test@example.com' })
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Mock Services
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
export const mockStripeService = {
|
|
38
|
+
createSubscription: vi.fn().mockResolvedValue({
|
|
39
|
+
id: 'sub_123',
|
|
40
|
+
status: 'active',
|
|
41
|
+
}),
|
|
42
|
+
|
|
43
|
+
reset() {
|
|
44
|
+
this.createSubscription.mockClear()
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Checklist
|
|
50
|
+
|
|
51
|
+
- [ ] Factories for entities
|
|
52
|
+
- [ ] Realistic fake data
|
|
53
|
+
- [ ] Service mocks
|
|
54
|
+
- [ ] Proper cleanup
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: unit-test-writing
|
|
3
|
+
description: >
|
|
4
|
+
Write unit tests following TDD principles. TRIGGERS: before any implementation,
|
|
5
|
+
TDD red phase, adding test coverage. Tests MUST be written BEFORE code.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Unit Test Writing
|
|
9
|
+
|
|
10
|
+
Write unit tests following TDD.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
- Before implementing features (TDD)
|
|
15
|
+
- Adding coverage to existing code
|
|
16
|
+
|
|
17
|
+
## TDD Process
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
1. Write test → ❌ FAIL (Red)
|
|
21
|
+
2. Write minimal code → ✅ PASS (Green)
|
|
22
|
+
3. Refactor → ✅ PASS
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Test Pattern
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
describe('createSubscription', () => {
|
|
29
|
+
it('should create with valid plan', async () => {
|
|
30
|
+
const result = await createSubscription({
|
|
31
|
+
userId: 'user-1',
|
|
32
|
+
planId: 'plan-pro',
|
|
33
|
+
})
|
|
34
|
+
expect(result.status).toBe('active')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('should throw on invalid plan', async () => {
|
|
38
|
+
await expect(
|
|
39
|
+
createSubscription({ userId: 'user-1', planId: 'invalid' })
|
|
40
|
+
).rejects.toThrow('Invalid plan')
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## What to Test
|
|
46
|
+
|
|
47
|
+
- Happy path
|
|
48
|
+
- Error cases
|
|
49
|
+
- Edge cases
|
|
50
|
+
- Boundary values
|
|
51
|
+
|
|
52
|
+
## Checklist
|
|
53
|
+
|
|
54
|
+
- [ ] Tests written BEFORE code
|
|
55
|
+
- [ ] Descriptive test names
|
|
56
|
+
- [ ] One assertion per test
|
|
57
|
+
- [ ] Edge cases covered
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-analysis
|
|
3
|
+
description: >
|
|
4
|
+
Analyze existing codebase for patterns, conventions, and integration points.
|
|
5
|
+
TRIGGERS: new feature implementation, understanding existing code, finding patterns,
|
|
6
|
+
identifying where new code should connect.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Codebase Analysis
|
|
10
|
+
|
|
11
|
+
Analyze existing code to inform new development.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Before implementing new features
|
|
16
|
+
- Finding existing patterns
|
|
17
|
+
- Identifying integration points
|
|
18
|
+
|
|
19
|
+
## Process
|
|
20
|
+
|
|
21
|
+
1. **Scan project structure**
|
|
22
|
+
- Directory organization
|
|
23
|
+
- File naming conventions
|
|
24
|
+
- Module boundaries
|
|
25
|
+
|
|
26
|
+
2. **Identify patterns**
|
|
27
|
+
- Component patterns
|
|
28
|
+
- API patterns
|
|
29
|
+
- Data patterns
|
|
30
|
+
- Testing patterns
|
|
31
|
+
|
|
32
|
+
3. **Find integration points**
|
|
33
|
+
- Related features
|
|
34
|
+
- Shared utilities
|
|
35
|
+
- Database connections
|
|
36
|
+
|
|
37
|
+
4. **Check for conflicts**
|
|
38
|
+
- Naming collisions
|
|
39
|
+
- Route conflicts
|
|
40
|
+
|
|
41
|
+
## Analysis Checklist
|
|
42
|
+
|
|
43
|
+
- [ ] Framework and version
|
|
44
|
+
- [ ] State management
|
|
45
|
+
- [ ] Routing strategy
|
|
46
|
+
- [ ] API patterns
|
|
47
|
+
- [ ] Naming conventions
|
|
48
|
+
- [ ] Test structure
|
|
49
|
+
|
|
50
|
+
## Output Format
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
## Codebase Analysis: {Feature}
|
|
54
|
+
|
|
55
|
+
### Project Structure
|
|
56
|
+
- Framework: [e.g., Next.js 14]
|
|
57
|
+
|
|
58
|
+
### Relevant Patterns
|
|
59
|
+
- Components: [pattern]
|
|
60
|
+
- API: [pattern]
|
|
61
|
+
|
|
62
|
+
### Integration Points
|
|
63
|
+
- [Where this connects]
|
|
64
|
+
|
|
65
|
+
### Recommendations
|
|
66
|
+
- Follow existing pattern for [X]
|
|
67
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: context7-lookup
|
|
3
|
+
description: >
|
|
4
|
+
Query Context7 for up-to-date library documentation and API references.
|
|
5
|
+
TRIGGERS: implementing features with external libraries, looking up API docs,
|
|
6
|
+
finding usage examples for packages.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Context7 Lookup
|
|
10
|
+
|
|
11
|
+
Query library documentation through Context7 MCP.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Looking up API documentation
|
|
16
|
+
- Finding usage examples
|
|
17
|
+
- Checking function signatures
|
|
18
|
+
|
|
19
|
+
## Process
|
|
20
|
+
|
|
21
|
+
1. **Resolve library ID**
|
|
22
|
+
```
|
|
23
|
+
Use mcp_context7_resolve-library-id
|
|
24
|
+
- Input: library name
|
|
25
|
+
- Output: Context7-compatible ID
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
2. **Fetch documentation**
|
|
29
|
+
```
|
|
30
|
+
Use mcp_context7_get-library-docs
|
|
31
|
+
- context7CompatibleLibraryID: from step 1
|
|
32
|
+
- topic: specific topic
|
|
33
|
+
- mode: "code" or "info"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. **Extract relevant info**
|
|
37
|
+
- API signatures
|
|
38
|
+
- Code examples
|
|
39
|
+
- Best practices
|
|
40
|
+
|
|
41
|
+
## Modes
|
|
42
|
+
|
|
43
|
+
- `code` - API references, code examples
|
|
44
|
+
- `info` - Conceptual guides, architecture
|
|
45
|
+
|
|
46
|
+
## Output Format
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
## Library: {package}
|
|
50
|
+
|
|
51
|
+
### API Reference
|
|
52
|
+
- `function(params)` - Description
|
|
53
|
+
|
|
54
|
+
### Code Examples
|
|
55
|
+
[snippets]
|
|
56
|
+
|
|
57
|
+
### Best Practices
|
|
58
|
+
- [practice]
|
|
59
|
+
```
|