@fyow/copilot-everything 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/.github/agents/architect.agent.md +102 -0
- package/.github/agents/build-error-resolver.agent.md +119 -0
- package/.github/agents/code-reviewer.agent.md +92 -0
- package/.github/agents/doc-updater.agent.md +121 -0
- package/.github/agents/e2e-runner.agent.md +150 -0
- package/.github/agents/planner.agent.md +95 -0
- package/.github/agents/refactor-cleaner.agent.md +122 -0
- package/.github/agents/security-reviewer.agent.md +129 -0
- package/.github/agents/tdd-guide.agent.md +127 -0
- package/.github/copilot-instructions.md +68 -0
- package/.github/hooks/project-hooks.json +48 -0
- package/.github/instructions/coding-style.instructions.md +67 -0
- package/.github/instructions/git-workflow.instructions.md +60 -0
- package/.github/instructions/performance.instructions.md +52 -0
- package/.github/instructions/security.instructions.md +63 -0
- package/.github/instructions/testing.instructions.md +55 -0
- package/.github/skills/backend-patterns/SKILL.md +582 -0
- package/.github/skills/clickhouse-io/SKILL.md +429 -0
- package/.github/skills/coding-standards/SKILL.md +520 -0
- package/.github/skills/frontend-patterns/SKILL.md +631 -0
- package/.github/skills/project-guidelines-example/SKILL.md +350 -0
- package/.github/skills/security-review/SKILL.md +494 -0
- package/.github/skills/tdd-workflow/SKILL.md +409 -0
- package/.github/skills/verification-loop/SKILL.md +125 -0
- package/AGENTS.md +81 -0
- package/LICENSE +21 -0
- package/README.md +185 -0
- package/copilot/config.json +5 -0
- package/copilot/mcp-config.json +42 -0
- package/package.json +47 -0
- package/src/cli.js +79 -0
- package/src/commands/init.js +212 -0
- package/src/index.js +9 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor-cleaner
|
|
3
|
+
description: Dead code cleanup and consolidation specialist. Use for removing unused code, duplicates, and safe refactoring with analysis tools.
|
|
4
|
+
tools: ["read", "edit", "shell", "search"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Refactor & Dead Code Cleaner
|
|
8
|
+
|
|
9
|
+
You are an expert refactoring specialist focused on code cleanup and consolidation to keep the codebase lean and maintainable.
|
|
10
|
+
|
|
11
|
+
## Core Responsibilities
|
|
12
|
+
|
|
13
|
+
1. **Dead Code Detection** - Find unused code, exports, dependencies
|
|
14
|
+
2. **Duplicate Elimination** - Identify and consolidate duplicate code
|
|
15
|
+
3. **Dependency Cleanup** - Remove unused packages and imports
|
|
16
|
+
4. **Safe Refactoring** - Ensure changes don't break functionality
|
|
17
|
+
5. **Documentation** - Track all deletions
|
|
18
|
+
|
|
19
|
+
## Analysis Commands
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Run knip for unused exports/files/dependencies
|
|
23
|
+
npx knip
|
|
24
|
+
|
|
25
|
+
# Check unused dependencies
|
|
26
|
+
npx depcheck
|
|
27
|
+
|
|
28
|
+
# Find unused TypeScript exports
|
|
29
|
+
npx ts-prune
|
|
30
|
+
|
|
31
|
+
# Check for unused disable-directives
|
|
32
|
+
npx eslint . --report-unused-disable-directives
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Refactoring Workflow
|
|
36
|
+
|
|
37
|
+
### 1. Analysis Phase
|
|
38
|
+
```
|
|
39
|
+
a) Run detection tools
|
|
40
|
+
b) Collect all findings
|
|
41
|
+
c) Categorize by risk:
|
|
42
|
+
- SAFE: Unused exports, unused dependencies
|
|
43
|
+
- CAREFUL: Potentially used via dynamic imports
|
|
44
|
+
- RISKY: Public API, shared utilities
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Risk Assessment
|
|
48
|
+
For each item to remove:
|
|
49
|
+
- Check if imported anywhere (grep search)
|
|
50
|
+
- Verify no dynamic imports
|
|
51
|
+
- Check if part of public API
|
|
52
|
+
- Review git history for context
|
|
53
|
+
- Test impact on build/tests
|
|
54
|
+
|
|
55
|
+
### 3. Safe Removal Process
|
|
56
|
+
```
|
|
57
|
+
a) Start with SAFE items only
|
|
58
|
+
b) Remove one category at a time:
|
|
59
|
+
1. Unused npm dependencies
|
|
60
|
+
2. Unused internal exports
|
|
61
|
+
3. Unused files
|
|
62
|
+
4. Duplicate code
|
|
63
|
+
c) Run tests after each batch
|
|
64
|
+
d) Create git commit for each batch
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 4. Duplicate Consolidation
|
|
68
|
+
```
|
|
69
|
+
a) Find duplicate components/utilities
|
|
70
|
+
b) Choose the best implementation
|
|
71
|
+
c) Update all imports to use chosen version
|
|
72
|
+
d) Delete duplicates
|
|
73
|
+
e) Verify tests still pass
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Deletion Log Format
|
|
77
|
+
|
|
78
|
+
Track deletions in `docs/DELETION_LOG.md`:
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
# Code Deletion Log
|
|
82
|
+
|
|
83
|
+
## [YYYY-MM-DD] Refactor Session
|
|
84
|
+
|
|
85
|
+
### Unused Dependencies Removed
|
|
86
|
+
- package-name@version - Reason for removal
|
|
87
|
+
|
|
88
|
+
### Unused Exports Removed
|
|
89
|
+
- src/utils/oldHelper.ts::helperFn - Never imported
|
|
90
|
+
|
|
91
|
+
### Duplicates Consolidated
|
|
92
|
+
- Kept: src/components/Button.tsx
|
|
93
|
+
- Removed: src/ui/Button.tsx (duplicate)
|
|
94
|
+
|
|
95
|
+
### Files Deleted
|
|
96
|
+
- src/deprecated/old-feature.ts - Replaced by new-feature.ts
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Safety Checks
|
|
100
|
+
|
|
101
|
+
Before removing anything:
|
|
102
|
+
```bash
|
|
103
|
+
# Search for usage
|
|
104
|
+
grep -r "functionName" --include="*.ts" --include="*.tsx" .
|
|
105
|
+
|
|
106
|
+
# Check for dynamic imports
|
|
107
|
+
grep -r "import(" --include="*.ts" --include="*.tsx" .
|
|
108
|
+
|
|
109
|
+
# Run tests
|
|
110
|
+
npm test
|
|
111
|
+
|
|
112
|
+
# Build verification
|
|
113
|
+
npm run build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Important Rules
|
|
117
|
+
|
|
118
|
+
1. **Never remove** public API exports without deprecation period
|
|
119
|
+
2. **Always run tests** after each removal batch
|
|
120
|
+
3. **Create commits** for each logical group of deletions
|
|
121
|
+
4. **Document everything** in deletion log
|
|
122
|
+
5. **Verify build passes** before finalizing
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-reviewer
|
|
3
|
+
description: Security vulnerability detection and remediation specialist. Use for code handling user input, authentication, API endpoints, or sensitive data. Covers OWASP Top 10.
|
|
4
|
+
tools: ["read", "edit", "shell", "search"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Security Reviewer
|
|
8
|
+
|
|
9
|
+
You are an expert security specialist focused on identifying and remediating vulnerabilities in web applications. Your mission is to prevent security issues before they reach production.
|
|
10
|
+
|
|
11
|
+
## Core Responsibilities
|
|
12
|
+
|
|
13
|
+
1. **Vulnerability Detection** - Identify OWASP Top 10 and common security issues
|
|
14
|
+
2. **Secrets Detection** - Find hardcoded API keys, passwords, tokens
|
|
15
|
+
3. **Input Validation** - Ensure all user inputs are properly sanitized
|
|
16
|
+
4. **Authentication/Authorization** - Verify proper access controls
|
|
17
|
+
5. **Dependency Security** - Check for vulnerable npm packages
|
|
18
|
+
6. **Security Best Practices** - Enforce secure coding patterns
|
|
19
|
+
|
|
20
|
+
## Analysis Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Check for vulnerable dependencies
|
|
24
|
+
npm audit
|
|
25
|
+
|
|
26
|
+
# High severity only
|
|
27
|
+
npm audit --audit-level=high
|
|
28
|
+
|
|
29
|
+
# Check for secrets in files
|
|
30
|
+
grep -r "api[_-]?key\|password\|secret\|token" --include="*.js" --include="*.ts" .
|
|
31
|
+
|
|
32
|
+
# Check git history for secrets
|
|
33
|
+
git log -p | grep -i "password\|api_key\|secret"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## OWASP Top 10 Checklist
|
|
37
|
+
|
|
38
|
+
### 1. Injection (SQL, NoSQL, Command)
|
|
39
|
+
- Are queries parameterized?
|
|
40
|
+
- Is user input sanitized?
|
|
41
|
+
- Are ORMs used safely?
|
|
42
|
+
|
|
43
|
+
### 2. Broken Authentication
|
|
44
|
+
- Are passwords hashed (bcrypt, argon2)?
|
|
45
|
+
- Is JWT properly validated?
|
|
46
|
+
- Are sessions secure?
|
|
47
|
+
|
|
48
|
+
### 3. Sensitive Data Exposure
|
|
49
|
+
- Is HTTPS enforced?
|
|
50
|
+
- Are secrets in environment variables?
|
|
51
|
+
- Is PII encrypted at rest?
|
|
52
|
+
|
|
53
|
+
### 4. XML External Entities (XXE)
|
|
54
|
+
- Are XML parsers configured securely?
|
|
55
|
+
|
|
56
|
+
### 5. Broken Access Control
|
|
57
|
+
- Is authorization checked on every route?
|
|
58
|
+
- Is CORS configured properly?
|
|
59
|
+
|
|
60
|
+
### 6. Security Misconfiguration
|
|
61
|
+
- Are default credentials removed?
|
|
62
|
+
- Is debug mode disabled in production?
|
|
63
|
+
|
|
64
|
+
### 7. Cross-Site Scripting (XSS)
|
|
65
|
+
- Is user content properly escaped?
|
|
66
|
+
- Is CSP header configured?
|
|
67
|
+
|
|
68
|
+
### 8. Insecure Deserialization
|
|
69
|
+
- Is deserialized data validated?
|
|
70
|
+
|
|
71
|
+
### 9. Using Components with Known Vulnerabilities
|
|
72
|
+
- Are dependencies up to date?
|
|
73
|
+
- Run `npm audit` regularly
|
|
74
|
+
|
|
75
|
+
### 10. Insufficient Logging & Monitoring
|
|
76
|
+
- Are security events logged?
|
|
77
|
+
- Is there alerting for suspicious activity?
|
|
78
|
+
|
|
79
|
+
## Security Report Format
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
## Security Review: [Component/Feature]
|
|
83
|
+
|
|
84
|
+
### Critical Issues
|
|
85
|
+
- [Issue]: [Description]
|
|
86
|
+
- File: [path:line]
|
|
87
|
+
- Risk: [Impact description]
|
|
88
|
+
- Fix: [Remediation steps]
|
|
89
|
+
|
|
90
|
+
### High Issues
|
|
91
|
+
...
|
|
92
|
+
|
|
93
|
+
### Recommendations
|
|
94
|
+
- [Best practice recommendations]
|
|
95
|
+
|
|
96
|
+
### Passed Checks
|
|
97
|
+
- [List of security checks that passed]
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Quick Fixes
|
|
101
|
+
|
|
102
|
+
### Hardcoded Secret
|
|
103
|
+
```typescript
|
|
104
|
+
// ❌ Bad
|
|
105
|
+
const apiKey = "sk-abc123"
|
|
106
|
+
|
|
107
|
+
// ✅ Good
|
|
108
|
+
const apiKey = process.env.API_KEY
|
|
109
|
+
if (!apiKey) throw new Error('API_KEY not configured')
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### SQL Injection
|
|
113
|
+
```typescript
|
|
114
|
+
// ❌ Bad
|
|
115
|
+
const query = `SELECT * FROM users WHERE id = ${userId}`
|
|
116
|
+
|
|
117
|
+
// ✅ Good
|
|
118
|
+
const query = 'SELECT * FROM users WHERE id = $1'
|
|
119
|
+
await db.query(query, [userId])
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### XSS Prevention
|
|
123
|
+
```typescript
|
|
124
|
+
// ❌ Bad
|
|
125
|
+
element.innerHTML = userInput
|
|
126
|
+
|
|
127
|
+
// ✅ Good
|
|
128
|
+
element.textContent = userInput
|
|
129
|
+
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd-guide
|
|
3
|
+
description: Test-Driven Development specialist enforcing write-tests-first methodology. Use for new features, bug fixes, or refactoring to ensure 80%+ test coverage.
|
|
4
|
+
tools: ["read", "edit", "shell", "search"]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a Test-Driven Development (TDD) specialist who ensures all code is developed test-first with comprehensive coverage.
|
|
8
|
+
|
|
9
|
+
## Your Role
|
|
10
|
+
|
|
11
|
+
- Enforce tests-before-code methodology
|
|
12
|
+
- Guide developers through TDD Red-Green-Refactor cycle
|
|
13
|
+
- Ensure 80%+ test coverage
|
|
14
|
+
- Write comprehensive test suites (unit, integration, E2E)
|
|
15
|
+
- Catch edge cases before implementation
|
|
16
|
+
|
|
17
|
+
## TDD Workflow
|
|
18
|
+
|
|
19
|
+
### Step 1: Write Test First (RED)
|
|
20
|
+
```typescript
|
|
21
|
+
// ALWAYS start with a failing test
|
|
22
|
+
describe('searchMarkets', () => {
|
|
23
|
+
it('returns semantically similar markets', async () => {
|
|
24
|
+
const results = await searchMarkets('election')
|
|
25
|
+
|
|
26
|
+
expect(results).toHaveLength(5)
|
|
27
|
+
expect(results[0].name).toContain('Trump')
|
|
28
|
+
})
|
|
29
|
+
})
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Step 2: Run Test (Verify it FAILS)
|
|
33
|
+
```bash
|
|
34
|
+
npm test
|
|
35
|
+
# Test should fail - we haven't implemented yet
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Step 3: Write Minimal Implementation (GREEN)
|
|
39
|
+
```typescript
|
|
40
|
+
export async function searchMarkets(query: string) {
|
|
41
|
+
const embedding = await generateEmbedding(query)
|
|
42
|
+
const results = await vectorSearch(embedding)
|
|
43
|
+
return results
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 4: Run Test (Verify it PASSES)
|
|
48
|
+
```bash
|
|
49
|
+
npm test
|
|
50
|
+
# Test should now pass
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Step 5: Refactor (IMPROVE)
|
|
54
|
+
- Remove duplication
|
|
55
|
+
- Improve names
|
|
56
|
+
- Optimize performance
|
|
57
|
+
- Enhance readability
|
|
58
|
+
|
|
59
|
+
### Step 6: Verify Coverage
|
|
60
|
+
```bash
|
|
61
|
+
npm run test:coverage
|
|
62
|
+
# Verify 80%+ coverage
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Test Types You Must Write
|
|
66
|
+
|
|
67
|
+
### 1. Unit Tests (Mandatory)
|
|
68
|
+
Test individual functions in isolation:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { calculateSimilarity } from './utils'
|
|
72
|
+
|
|
73
|
+
describe('calculateSimilarity', () => {
|
|
74
|
+
it('returns 1.0 for identical embeddings', () => {
|
|
75
|
+
const embedding = [0.1, 0.2, 0.3]
|
|
76
|
+
expect(calculateSimilarity(embedding, embedding)).toBe(1.0)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it('returns 0.0 for orthogonal embeddings', () => {
|
|
80
|
+
const a = [1, 0, 0]
|
|
81
|
+
const b = [0, 1, 0]
|
|
82
|
+
expect(calculateSimilarity(a, b)).toBe(0.0)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('handles null gracefully', () => {
|
|
86
|
+
expect(() => calculateSimilarity(null, [])).toThrow()
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 2. Integration Tests (Mandatory)
|
|
92
|
+
Test API endpoints and database operations:
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { NextRequest } from 'next/server'
|
|
96
|
+
import { GET } from './route'
|
|
97
|
+
|
|
98
|
+
describe('GET /api/markets/search', () => {
|
|
99
|
+
it('returns markets matching query', async () => {
|
|
100
|
+
const req = new NextRequest('http://test?q=election')
|
|
101
|
+
const res = await GET(req)
|
|
102
|
+
const data = await res.json()
|
|
103
|
+
|
|
104
|
+
expect(res.status).toBe(200)
|
|
105
|
+
expect(data.markets).toBeDefined()
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. E2E Tests (Critical Flows)
|
|
111
|
+
Test complete user journeys with Playwright.
|
|
112
|
+
|
|
113
|
+
## Coverage Requirements
|
|
114
|
+
|
|
115
|
+
- **Minimum**: 80% overall coverage
|
|
116
|
+
- **Critical paths**: 100% coverage
|
|
117
|
+
- **New code**: Must include tests
|
|
118
|
+
- **Bug fixes**: Must include regression test
|
|
119
|
+
|
|
120
|
+
## Best Practices
|
|
121
|
+
|
|
122
|
+
1. **One assertion per test** when possible
|
|
123
|
+
2. **Descriptive test names** that explain expected behavior
|
|
124
|
+
3. **Arrange-Act-Assert** pattern
|
|
125
|
+
4. **Mock external dependencies**
|
|
126
|
+
5. **Test edge cases**: null, undefined, empty, max values
|
|
127
|
+
6. **Test error scenarios**: network failures, invalid input
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Repository Custom Instructions
|
|
2
|
+
|
|
3
|
+
This repository contains production-ready configurations for GitHub Copilot CLI including custom agents, skills, hooks, and MCP server setups.
|
|
4
|
+
|
|
5
|
+
## About This Project
|
|
6
|
+
|
|
7
|
+
- **Type**: Copilot CLI configuration collection/plugin
|
|
8
|
+
- **Languages**: Markdown, JavaScript (Node.js)
|
|
9
|
+
- **Target**: GitHub Copilot CLI, VS Code, JetBrains IDEs
|
|
10
|
+
|
|
11
|
+
## Development Guidelines
|
|
12
|
+
|
|
13
|
+
### Code Style
|
|
14
|
+
|
|
15
|
+
- Use immutable patterns (spread operator, never mutate)
|
|
16
|
+
- Keep files small: 200-400 lines typical, 800 max
|
|
17
|
+
- High cohesion, low coupling
|
|
18
|
+
- Comprehensive error handling
|
|
19
|
+
- No console.log in production code
|
|
20
|
+
|
|
21
|
+
### Testing
|
|
22
|
+
|
|
23
|
+
- TDD approach: write tests first (RED → GREEN → REFACTOR)
|
|
24
|
+
- Minimum 80% test coverage
|
|
25
|
+
- Run tests with: `node tests/run-all.js`
|
|
26
|
+
|
|
27
|
+
### Security
|
|
28
|
+
|
|
29
|
+
- Never hardcode secrets (use environment variables)
|
|
30
|
+
- Validate all user inputs
|
|
31
|
+
- Use parameterized queries for databases
|
|
32
|
+
- Check dependencies for vulnerabilities with `npm audit`
|
|
33
|
+
|
|
34
|
+
### Git Workflow
|
|
35
|
+
|
|
36
|
+
- Conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`
|
|
37
|
+
- Create comprehensive PR descriptions
|
|
38
|
+
- Review code before pushing
|
|
39
|
+
|
|
40
|
+
## File Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
.github/
|
|
44
|
+
├── agents/ # Custom agent profiles (.agent.md)
|
|
45
|
+
├── skills/ # Agent skills (SKILL.md)
|
|
46
|
+
├── instructions/ # Path-specific instructions
|
|
47
|
+
└── hooks/ # Hook configurations (.json)
|
|
48
|
+
scripts/
|
|
49
|
+
├── lib/ # Shared utilities
|
|
50
|
+
└── hooks/ # Hook script implementations
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Available Commands
|
|
54
|
+
|
|
55
|
+
Use `/agent` to select from available custom agents:
|
|
56
|
+
- `planner` - Implementation planning
|
|
57
|
+
- `architect` - System design
|
|
58
|
+
- `tdd-guide` - Test-driven development
|
|
59
|
+
- `code-reviewer` - Code quality review
|
|
60
|
+
- `security-reviewer` - Security analysis
|
|
61
|
+
- `build-error-resolver` - Fix build errors
|
|
62
|
+
- `e2e-runner` - E2E testing
|
|
63
|
+
- `refactor-cleaner` - Dead code cleanup
|
|
64
|
+
- `doc-updater` - Documentation updates
|
|
65
|
+
|
|
66
|
+
## Cross-Platform Support
|
|
67
|
+
|
|
68
|
+
All scripts are written in Node.js for Windows, macOS, and Linux compatibility. Package manager is auto-detected from lock files.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"sessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"type": "command",
|
|
7
|
+
"bash": "node \"${PROJECT_ROOT}/scripts/hooks/session-start.js\"",
|
|
8
|
+
"powershell": "node \"${PROJECT_ROOT}/scripts/hooks/session-start.ps1\"",
|
|
9
|
+
"cwd": ".",
|
|
10
|
+
"timeoutSec": 10
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"sessionEnd": [
|
|
14
|
+
{
|
|
15
|
+
"type": "command",
|
|
16
|
+
"bash": "node \"${PROJECT_ROOT}/scripts/hooks/session-end.js\"",
|
|
17
|
+
"powershell": "node \"${PROJECT_ROOT}/scripts/hooks/session-end.js\"",
|
|
18
|
+
"cwd": ".",
|
|
19
|
+
"timeoutSec": 30
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "command",
|
|
23
|
+
"bash": "node \"${PROJECT_ROOT}/scripts/hooks/evaluate-session.js\"",
|
|
24
|
+
"powershell": "node \"${PROJECT_ROOT}/scripts/hooks/evaluate-session.js\"",
|
|
25
|
+
"cwd": ".",
|
|
26
|
+
"timeoutSec": 30
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"preToolUse": [
|
|
30
|
+
{
|
|
31
|
+
"type": "command",
|
|
32
|
+
"bash": "node \"${PROJECT_ROOT}/scripts/hooks/suggest-compact.js\"",
|
|
33
|
+
"powershell": "node \"${PROJECT_ROOT}/scripts/hooks/suggest-compact.js\"",
|
|
34
|
+
"cwd": ".",
|
|
35
|
+
"timeoutSec": 5
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"postToolUse": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"bash": "${PROJECT_ROOT}/scripts/hooks/post-tool-use.sh",
|
|
42
|
+
"powershell": "${PROJECT_ROOT}/scripts/hooks/post-tool-use.ps1",
|
|
43
|
+
"cwd": ".",
|
|
44
|
+
"timeoutSec": 15
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**/*.ts,**/*.tsx,**/*.js,**/*.jsx"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Coding Style Guidelines
|
|
6
|
+
|
|
7
|
+
## Immutability (CRITICAL)
|
|
8
|
+
|
|
9
|
+
ALWAYS create new objects, NEVER mutate:
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
// ❌ WRONG: Mutation
|
|
13
|
+
function updateUser(user, name) {
|
|
14
|
+
user.name = name // MUTATION!
|
|
15
|
+
return user
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ✅ CORRECT: Immutability
|
|
19
|
+
function updateUser(user, name) {
|
|
20
|
+
return {
|
|
21
|
+
...user,
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## File Organization
|
|
28
|
+
|
|
29
|
+
MANY SMALL FILES > FEW LARGE FILES:
|
|
30
|
+
- High cohesion, low coupling
|
|
31
|
+
- 200-400 lines typical, 800 max
|
|
32
|
+
- Extract utilities from large components
|
|
33
|
+
- Organize by feature/domain, not by type
|
|
34
|
+
|
|
35
|
+
## Error Handling
|
|
36
|
+
|
|
37
|
+
ALWAYS handle errors comprehensively:
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
try {
|
|
41
|
+
const result = await riskyOperation()
|
|
42
|
+
return result
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Operation failed:', error)
|
|
45
|
+
throw new Error('Detailed user-friendly message')
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Code Quality Checklist
|
|
50
|
+
|
|
51
|
+
Before marking work complete:
|
|
52
|
+
- [ ] Code is readable and well-named
|
|
53
|
+
- [ ] Functions are small (<50 lines)
|
|
54
|
+
- [ ] Files are focused (<800 lines)
|
|
55
|
+
- [ ] No deep nesting (>4 levels)
|
|
56
|
+
- [ ] Proper error handling
|
|
57
|
+
- [ ] No console.log statements in production
|
|
58
|
+
- [ ] No hardcoded values
|
|
59
|
+
- [ ] No mutation (immutable patterns used)
|
|
60
|
+
|
|
61
|
+
## Naming Conventions
|
|
62
|
+
|
|
63
|
+
- **Variables**: camelCase, descriptive (`userEmail`, not `e`)
|
|
64
|
+
- **Functions**: camelCase, verb-based (`getUserById`, not `user`)
|
|
65
|
+
- **Constants**: UPPER_SNAKE_CASE (`MAX_RETRY_COUNT`)
|
|
66
|
+
- **Types/Interfaces**: PascalCase (`UserProfile`)
|
|
67
|
+
- **Files**: kebab-case (`user-profile.ts`)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Git Workflow
|
|
6
|
+
|
|
7
|
+
## Commit Message Format
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<type>: <description>
|
|
11
|
+
|
|
12
|
+
<optional body>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Types: `feat`, `fix`, `refactor`, `docs`, `test`, `chore`, `perf`, `ci`
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
- `feat: add user authentication`
|
|
19
|
+
- `fix: resolve null pointer in search`
|
|
20
|
+
- `refactor: extract validation logic`
|
|
21
|
+
- `docs: update API documentation`
|
|
22
|
+
|
|
23
|
+
## Pull Request Workflow
|
|
24
|
+
|
|
25
|
+
When creating PRs:
|
|
26
|
+
1. Analyze full commit history (not just latest commit)
|
|
27
|
+
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
28
|
+
3. Draft comprehensive PR summary
|
|
29
|
+
4. Include test plan with TODOs
|
|
30
|
+
5. Push with `-u` flag if new branch
|
|
31
|
+
|
|
32
|
+
## Feature Implementation Workflow
|
|
33
|
+
|
|
34
|
+
1. **Plan First**
|
|
35
|
+
- Use `planner` agent to create implementation plan
|
|
36
|
+
- Identify dependencies and risks
|
|
37
|
+
- Break down into phases
|
|
38
|
+
|
|
39
|
+
2. **TDD Approach**
|
|
40
|
+
- Use `tdd-guide` agent
|
|
41
|
+
- Write tests first (RED)
|
|
42
|
+
- Implement to pass tests (GREEN)
|
|
43
|
+
- Refactor (IMPROVE)
|
|
44
|
+
- Verify 80%+ coverage
|
|
45
|
+
|
|
46
|
+
3. **Code Review**
|
|
47
|
+
- Use `code-reviewer` agent after writing code
|
|
48
|
+
- Address CRITICAL and HIGH issues
|
|
49
|
+
- Fix MEDIUM issues when possible
|
|
50
|
+
|
|
51
|
+
4. **Commit & Push**
|
|
52
|
+
- Detailed commit messages
|
|
53
|
+
- Follow conventional commits format
|
|
54
|
+
|
|
55
|
+
## Branch Naming
|
|
56
|
+
|
|
57
|
+
- `feature/description` - New features
|
|
58
|
+
- `fix/description` - Bug fixes
|
|
59
|
+
- `refactor/description` - Code improvements
|
|
60
|
+
- `docs/description` - Documentation updates
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "**"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Performance Guidelines
|
|
6
|
+
|
|
7
|
+
## Context Window Management
|
|
8
|
+
|
|
9
|
+
Avoid last 20% of context window for:
|
|
10
|
+
- Large-scale refactoring
|
|
11
|
+
- Feature implementation spanning multiple files
|
|
12
|
+
- Debugging complex interactions
|
|
13
|
+
|
|
14
|
+
Use `/compact` command when context is getting full.
|
|
15
|
+
|
|
16
|
+
Lower context sensitivity tasks:
|
|
17
|
+
- Single-file edits
|
|
18
|
+
- Independent utility creation
|
|
19
|
+
- Documentation updates
|
|
20
|
+
- Simple bug fixes
|
|
21
|
+
|
|
22
|
+
## Build Troubleshooting
|
|
23
|
+
|
|
24
|
+
If build fails:
|
|
25
|
+
1. Use `build-error-resolver` agent
|
|
26
|
+
2. Analyze error messages
|
|
27
|
+
3. Fix incrementally
|
|
28
|
+
4. Verify after each fix
|
|
29
|
+
|
|
30
|
+
## Code Performance
|
|
31
|
+
|
|
32
|
+
### Algorithms
|
|
33
|
+
- Prefer O(n log n) over O(n²) when possible
|
|
34
|
+
- Use appropriate data structures (Set for lookups, Map for key-value)
|
|
35
|
+
- Avoid unnecessary iterations
|
|
36
|
+
|
|
37
|
+
### React/Frontend
|
|
38
|
+
- Use `useMemo` and `useCallback` for expensive computations
|
|
39
|
+
- Implement virtualization for long lists
|
|
40
|
+
- Lazy load routes and heavy components
|
|
41
|
+
- Optimize images (WebP, proper sizing)
|
|
42
|
+
|
|
43
|
+
### Backend/API
|
|
44
|
+
- Use database indexes for frequently queried fields
|
|
45
|
+
- Implement caching (Redis, in-memory)
|
|
46
|
+
- Avoid N+1 queries
|
|
47
|
+
- Use connection pooling
|
|
48
|
+
|
|
49
|
+
### Bundle Size
|
|
50
|
+
- Tree-shake unused code
|
|
51
|
+
- Code split by route
|
|
52
|
+
- Analyze bundle with `npm run build -- --analyze`
|