@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.
Files changed (33) hide show
  1. package/.github/agents/architect.agent.md +102 -0
  2. package/.github/agents/build-error-resolver.agent.md +119 -0
  3. package/.github/agents/code-reviewer.agent.md +92 -0
  4. package/.github/agents/doc-updater.agent.md +121 -0
  5. package/.github/agents/e2e-runner.agent.md +150 -0
  6. package/.github/agents/planner.agent.md +95 -0
  7. package/.github/agents/refactor-cleaner.agent.md +122 -0
  8. package/.github/agents/security-reviewer.agent.md +129 -0
  9. package/.github/agents/tdd-guide.agent.md +127 -0
  10. package/.github/copilot-instructions.md +68 -0
  11. package/.github/hooks/project-hooks.json +48 -0
  12. package/.github/instructions/coding-style.instructions.md +67 -0
  13. package/.github/instructions/git-workflow.instructions.md +60 -0
  14. package/.github/instructions/performance.instructions.md +52 -0
  15. package/.github/instructions/security.instructions.md +63 -0
  16. package/.github/instructions/testing.instructions.md +55 -0
  17. package/.github/skills/backend-patterns/SKILL.md +582 -0
  18. package/.github/skills/clickhouse-io/SKILL.md +429 -0
  19. package/.github/skills/coding-standards/SKILL.md +520 -0
  20. package/.github/skills/frontend-patterns/SKILL.md +631 -0
  21. package/.github/skills/project-guidelines-example/SKILL.md +350 -0
  22. package/.github/skills/security-review/SKILL.md +494 -0
  23. package/.github/skills/tdd-workflow/SKILL.md +409 -0
  24. package/.github/skills/verification-loop/SKILL.md +125 -0
  25. package/AGENTS.md +81 -0
  26. package/LICENSE +21 -0
  27. package/README.md +185 -0
  28. package/copilot/config.json +5 -0
  29. package/copilot/mcp-config.json +42 -0
  30. package/package.json +47 -0
  31. package/src/cli.js +79 -0
  32. package/src/commands/init.js +212 -0
  33. package/src/index.js +9 -0
@@ -0,0 +1,409 @@
1
+ ---
2
+ name: tdd-workflow
3
+ description: Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
4
+ ---
5
+
6
+ # Test-Driven Development Workflow
7
+
8
+ This skill ensures all code development follows TDD principles with comprehensive test coverage.
9
+
10
+ ## When to Activate
11
+
12
+ - Writing new features or functionality
13
+ - Fixing bugs or issues
14
+ - Refactoring existing code
15
+ - Adding API endpoints
16
+ - Creating new components
17
+
18
+ ## Core Principles
19
+
20
+ ### 1. Tests BEFORE Code
21
+ ALWAYS write tests first, then implement code to make tests pass.
22
+
23
+ ### 2. Coverage Requirements
24
+ - Minimum 80% coverage (unit + integration + E2E)
25
+ - All edge cases covered
26
+ - Error scenarios tested
27
+ - Boundary conditions verified
28
+
29
+ ### 3. Test Types
30
+
31
+ #### Unit Tests
32
+ - Individual functions and utilities
33
+ - Component logic
34
+ - Pure functions
35
+ - Helpers and utilities
36
+
37
+ #### Integration Tests
38
+ - API endpoints
39
+ - Database operations
40
+ - Service interactions
41
+ - External API calls
42
+
43
+ #### E2E Tests (Playwright)
44
+ - Critical user flows
45
+ - Complete workflows
46
+ - Browser automation
47
+ - UI interactions
48
+
49
+ ## TDD Workflow Steps
50
+
51
+ ### Step 1: Write User Journeys
52
+ ```
53
+ As a [role], I want to [action], so that [benefit]
54
+
55
+ Example:
56
+ As a user, I want to search for markets semantically,
57
+ so that I can find relevant markets even without exact keywords.
58
+ ```
59
+
60
+ ### Step 2: Generate Test Cases
61
+ For each user journey, create comprehensive test cases:
62
+
63
+ ```typescript
64
+ describe('Semantic Search', () => {
65
+ it('returns relevant markets for query', async () => {
66
+ // Test implementation
67
+ })
68
+
69
+ it('handles empty query gracefully', async () => {
70
+ // Test edge case
71
+ })
72
+
73
+ it('falls back to substring search when Redis unavailable', async () => {
74
+ // Test fallback behavior
75
+ })
76
+
77
+ it('sorts results by similarity score', async () => {
78
+ // Test sorting logic
79
+ })
80
+ })
81
+ ```
82
+
83
+ ### Step 3: Run Tests (They Should Fail)
84
+ ```bash
85
+ npm test
86
+ # Tests should fail - we haven't implemented yet
87
+ ```
88
+
89
+ ### Step 4: Implement Code
90
+ Write minimal code to make tests pass:
91
+
92
+ ```typescript
93
+ // Implementation guided by tests
94
+ export async function searchMarkets(query: string) {
95
+ // Implementation here
96
+ }
97
+ ```
98
+
99
+ ### Step 5: Run Tests Again
100
+ ```bash
101
+ npm test
102
+ # Tests should now pass
103
+ ```
104
+
105
+ ### Step 6: Refactor
106
+ Improve code quality while keeping tests green:
107
+ - Remove duplication
108
+ - Improve naming
109
+ - Optimize performance
110
+ - Enhance readability
111
+
112
+ ### Step 7: Verify Coverage
113
+ ```bash
114
+ npm run test:coverage
115
+ # Verify 80%+ coverage achieved
116
+ ```
117
+
118
+ ## Testing Patterns
119
+
120
+ ### Unit Test Pattern (Jest/Vitest)
121
+ ```typescript
122
+ import { render, screen, fireEvent } from '@testing-library/react'
123
+ import { Button } from './Button'
124
+
125
+ describe('Button Component', () => {
126
+ it('renders with correct text', () => {
127
+ render(<Button>Click me</Button>)
128
+ expect(screen.getByText('Click me')).toBeInTheDocument()
129
+ })
130
+
131
+ it('calls onClick when clicked', () => {
132
+ const handleClick = jest.fn()
133
+ render(<Button onClick={handleClick}>Click</Button>)
134
+
135
+ fireEvent.click(screen.getByRole('button'))
136
+
137
+ expect(handleClick).toHaveBeenCalledTimes(1)
138
+ })
139
+
140
+ it('is disabled when disabled prop is true', () => {
141
+ render(<Button disabled>Click</Button>)
142
+ expect(screen.getByRole('button')).toBeDisabled()
143
+ })
144
+ })
145
+ ```
146
+
147
+ ### API Integration Test Pattern
148
+ ```typescript
149
+ import { NextRequest } from 'next/server'
150
+ import { GET } from './route'
151
+
152
+ describe('GET /api/markets', () => {
153
+ it('returns markets successfully', async () => {
154
+ const request = new NextRequest('http://localhost/api/markets')
155
+ const response = await GET(request)
156
+ const data = await response.json()
157
+
158
+ expect(response.status).toBe(200)
159
+ expect(data.success).toBe(true)
160
+ expect(Array.isArray(data.data)).toBe(true)
161
+ })
162
+
163
+ it('validates query parameters', async () => {
164
+ const request = new NextRequest('http://localhost/api/markets?limit=invalid')
165
+ const response = await GET(request)
166
+
167
+ expect(response.status).toBe(400)
168
+ })
169
+
170
+ it('handles database errors gracefully', async () => {
171
+ // Mock database failure
172
+ const request = new NextRequest('http://localhost/api/markets')
173
+ // Test error handling
174
+ })
175
+ })
176
+ ```
177
+
178
+ ### E2E Test Pattern (Playwright)
179
+ ```typescript
180
+ import { test, expect } from '@playwright/test'
181
+
182
+ test('user can search and filter markets', async ({ page }) => {
183
+ // Navigate to markets page
184
+ await page.goto('/')
185
+ await page.click('a[href="/markets"]')
186
+
187
+ // Verify page loaded
188
+ await expect(page.locator('h1')).toContainText('Markets')
189
+
190
+ // Search for markets
191
+ await page.fill('input[placeholder="Search markets"]', 'election')
192
+
193
+ // Wait for debounce and results
194
+ await page.waitForTimeout(600)
195
+
196
+ // Verify search results displayed
197
+ const results = page.locator('[data-testid="market-card"]')
198
+ await expect(results).toHaveCount(5, { timeout: 5000 })
199
+
200
+ // Verify results contain search term
201
+ const firstResult = results.first()
202
+ await expect(firstResult).toContainText('election', { ignoreCase: true })
203
+
204
+ // Filter by status
205
+ await page.click('button:has-text("Active")')
206
+
207
+ // Verify filtered results
208
+ await expect(results).toHaveCount(3)
209
+ })
210
+
211
+ test('user can create a new market', async ({ page }) => {
212
+ // Login first
213
+ await page.goto('/creator-dashboard')
214
+
215
+ // Fill market creation form
216
+ await page.fill('input[name="name"]', 'Test Market')
217
+ await page.fill('textarea[name="description"]', 'Test description')
218
+ await page.fill('input[name="endDate"]', '2025-12-31')
219
+
220
+ // Submit form
221
+ await page.click('button[type="submit"]')
222
+
223
+ // Verify success message
224
+ await expect(page.locator('text=Market created successfully')).toBeVisible()
225
+
226
+ // Verify redirect to market page
227
+ await expect(page).toHaveURL(/\/markets\/test-market/)
228
+ })
229
+ ```
230
+
231
+ ## Test File Organization
232
+
233
+ ```
234
+ src/
235
+ ├── components/
236
+ │ ├── Button/
237
+ │ │ ├── Button.tsx
238
+ │ │ ├── Button.test.tsx # Unit tests
239
+ │ │ └── Button.stories.tsx # Storybook
240
+ │ └── MarketCard/
241
+ │ ├── MarketCard.tsx
242
+ │ └── MarketCard.test.tsx
243
+ ├── app/
244
+ │ └── api/
245
+ │ └── markets/
246
+ │ ├── route.ts
247
+ │ └── route.test.ts # Integration tests
248
+ └── e2e/
249
+ ├── markets.spec.ts # E2E tests
250
+ ├── trading.spec.ts
251
+ └── auth.spec.ts
252
+ ```
253
+
254
+ ## Mocking External Services
255
+
256
+ ### Supabase Mock
257
+ ```typescript
258
+ jest.mock('@/lib/supabase', () => ({
259
+ supabase: {
260
+ from: jest.fn(() => ({
261
+ select: jest.fn(() => ({
262
+ eq: jest.fn(() => Promise.resolve({
263
+ data: [{ id: 1, name: 'Test Market' }],
264
+ error: null
265
+ }))
266
+ }))
267
+ }))
268
+ }
269
+ }))
270
+ ```
271
+
272
+ ### Redis Mock
273
+ ```typescript
274
+ jest.mock('@/lib/redis', () => ({
275
+ searchMarketsByVector: jest.fn(() => Promise.resolve([
276
+ { slug: 'test-market', similarity_score: 0.95 }
277
+ ])),
278
+ checkRedisHealth: jest.fn(() => Promise.resolve({ connected: true }))
279
+ }))
280
+ ```
281
+
282
+ ### OpenAI Mock
283
+ ```typescript
284
+ jest.mock('@/lib/openai', () => ({
285
+ generateEmbedding: jest.fn(() => Promise.resolve(
286
+ new Array(1536).fill(0.1) // Mock 1536-dim embedding
287
+ ))
288
+ }))
289
+ ```
290
+
291
+ ## Test Coverage Verification
292
+
293
+ ### Run Coverage Report
294
+ ```bash
295
+ npm run test:coverage
296
+ ```
297
+
298
+ ### Coverage Thresholds
299
+ ```json
300
+ {
301
+ "jest": {
302
+ "coverageThresholds": {
303
+ "global": {
304
+ "branches": 80,
305
+ "functions": 80,
306
+ "lines": 80,
307
+ "statements": 80
308
+ }
309
+ }
310
+ }
311
+ }
312
+ ```
313
+
314
+ ## Common Testing Mistakes to Avoid
315
+
316
+ ### ❌ WRONG: Testing Implementation Details
317
+ ```typescript
318
+ // Don't test internal state
319
+ expect(component.state.count).toBe(5)
320
+ ```
321
+
322
+ ### ✅ CORRECT: Test User-Visible Behavior
323
+ ```typescript
324
+ // Test what users see
325
+ expect(screen.getByText('Count: 5')).toBeInTheDocument()
326
+ ```
327
+
328
+ ### ❌ WRONG: Brittle Selectors
329
+ ```typescript
330
+ // Breaks easily
331
+ await page.click('.css-class-xyz')
332
+ ```
333
+
334
+ ### ✅ CORRECT: Semantic Selectors
335
+ ```typescript
336
+ // Resilient to changes
337
+ await page.click('button:has-text("Submit")')
338
+ await page.click('[data-testid="submit-button"]')
339
+ ```
340
+
341
+ ### ❌ WRONG: No Test Isolation
342
+ ```typescript
343
+ // Tests depend on each other
344
+ test('creates user', () => { /* ... */ })
345
+ test('updates same user', () => { /* depends on previous test */ })
346
+ ```
347
+
348
+ ### ✅ CORRECT: Independent Tests
349
+ ```typescript
350
+ // Each test sets up its own data
351
+ test('creates user', () => {
352
+ const user = createTestUser()
353
+ // Test logic
354
+ })
355
+
356
+ test('updates user', () => {
357
+ const user = createTestUser()
358
+ // Update logic
359
+ })
360
+ ```
361
+
362
+ ## Continuous Testing
363
+
364
+ ### Watch Mode During Development
365
+ ```bash
366
+ npm test -- --watch
367
+ # Tests run automatically on file changes
368
+ ```
369
+
370
+ ### Pre-Commit Hook
371
+ ```bash
372
+ # Runs before every commit
373
+ npm test && npm run lint
374
+ ```
375
+
376
+ ### CI/CD Integration
377
+ ```yaml
378
+ # GitHub Actions
379
+ - name: Run Tests
380
+ run: npm test -- --coverage
381
+ - name: Upload Coverage
382
+ uses: codecov/codecov-action@v3
383
+ ```
384
+
385
+ ## Best Practices
386
+
387
+ 1. **Write Tests First** - Always TDD
388
+ 2. **One Assert Per Test** - Focus on single behavior
389
+ 3. **Descriptive Test Names** - Explain what's tested
390
+ 4. **Arrange-Act-Assert** - Clear test structure
391
+ 5. **Mock External Dependencies** - Isolate unit tests
392
+ 6. **Test Edge Cases** - Null, undefined, empty, large
393
+ 7. **Test Error Paths** - Not just happy paths
394
+ 8. **Keep Tests Fast** - Unit tests < 50ms each
395
+ 9. **Clean Up After Tests** - No side effects
396
+ 10. **Review Coverage Reports** - Identify gaps
397
+
398
+ ## Success Metrics
399
+
400
+ - 80%+ code coverage achieved
401
+ - All tests passing (green)
402
+ - No skipped or disabled tests
403
+ - Fast test execution (< 30s for unit tests)
404
+ - E2E tests cover critical user flows
405
+ - Tests catch bugs before production
406
+
407
+ ---
408
+
409
+ **Remember**: Tests are not optional. They are the safety net that enables confident refactoring, rapid development, and production reliability.
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: verification-loop
3
+ description: A comprehensive verification system for coding sessions. Use this after completing features, before creating PRs, or when ensuring quality gates pass.
4
+ ---
5
+
6
+ # Verification Loop Skill
7
+
8
+ A comprehensive verification system for coding sessions.
9
+
10
+ ## When to Use
11
+
12
+ Invoke this skill:
13
+ - After completing a feature or significant code change
14
+ - Before creating a PR
15
+ - When you want to ensure quality gates pass
16
+ - After refactoring
17
+
18
+ ## Verification Phases
19
+
20
+ ### Phase 1: Build Verification
21
+ ```bash
22
+ # Check if project builds
23
+ npm run build 2>&1 | tail -20
24
+ # OR
25
+ pnpm build 2>&1 | tail -20
26
+ ```
27
+
28
+ If build fails, STOP and fix before continuing.
29
+
30
+ ### Phase 2: Type Check
31
+ ```bash
32
+ # TypeScript projects
33
+ npx tsc --noEmit 2>&1 | head -30
34
+
35
+ # Python projects
36
+ pyright . 2>&1 | head -30
37
+ ```
38
+
39
+ Report all type errors. Fix critical ones before continuing.
40
+
41
+ ### Phase 3: Lint Check
42
+ ```bash
43
+ # JavaScript/TypeScript
44
+ npm run lint 2>&1 | head -30
45
+
46
+ # Python
47
+ ruff check . 2>&1 | head -30
48
+ ```
49
+
50
+ ### Phase 4: Test Suite
51
+ ```bash
52
+ # Run tests with coverage
53
+ npm run test -- --coverage 2>&1 | tail -50
54
+
55
+ # Check coverage threshold
56
+ # Target: 80% minimum
57
+ ```
58
+
59
+ Report:
60
+ - Total tests: X
61
+ - Passed: X
62
+ - Failed: X
63
+ - Coverage: X%
64
+
65
+ ### Phase 5: Security Scan
66
+ ```bash
67
+ # Check for secrets
68
+ grep -rn "sk-" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
69
+ grep -rn "api_key" --include="*.ts" --include="*.js" . 2>/dev/null | head -10
70
+
71
+ # Check for console.log
72
+ grep -rn "console.log" --include="*.ts" --include="*.tsx" src/ 2>/dev/null | head -10
73
+ ```
74
+
75
+ ### Phase 6: Diff Review
76
+ ```bash
77
+ # Show what changed
78
+ git diff --stat
79
+ git diff HEAD~1 --name-only
80
+ ```
81
+
82
+ Review each changed file for:
83
+ - Unintended changes
84
+ - Missing error handling
85
+ - Potential edge cases
86
+
87
+ ## Output Format
88
+
89
+ After running all phases, produce a verification report:
90
+
91
+ ```
92
+ VERIFICATION REPORT
93
+ ==================
94
+
95
+ Build: [PASS/FAIL]
96
+ Types: [PASS/FAIL] (X errors)
97
+ Lint: [PASS/FAIL] (X warnings)
98
+ Tests: [PASS/FAIL] (X/Y passed, Z% coverage)
99
+ Security: [PASS/FAIL] (X issues)
100
+ Diff: [X files changed]
101
+
102
+ Overall: [READY/NOT READY] for PR
103
+
104
+ Issues to Fix:
105
+ 1. ...
106
+ 2. ...
107
+ ```
108
+
109
+ ## Continuous Mode
110
+
111
+ For long sessions, run verification every 15 minutes or after major changes:
112
+
113
+ ```markdown
114
+ Set a mental checkpoint:
115
+ - After completing each function
116
+ - After finishing a component
117
+ - Before moving to next task
118
+
119
+ Run: /verify
120
+ ```
121
+
122
+ ## Integration with Hooks
123
+
124
+ This skill complements PostToolUse hooks but provides deeper verification.
125
+ Hooks catch issues immediately; this skill provides comprehensive review.
package/AGENTS.md ADDED
@@ -0,0 +1,81 @@
1
+ # Everything Copilot Code
2
+
3
+ A comprehensive collection of GitHub Copilot CLI configurations including custom agents, skills, hooks, and MCP server setups.
4
+
5
+ ## Dev Environment
6
+
7
+ - Use `node scripts/setup-package-manager.js --detect` to detect or set package manager
8
+ - Supported: npm, pnpm, yarn, bun (auto-detected from lock files)
9
+ - Cross-platform support: Linux, macOS, Windows (WSL/PowerShell)
10
+
11
+ ## Project Structure
12
+
13
+ ```
14
+ .github/
15
+ ├── copilot-instructions.md # Repository-wide instructions
16
+ ├── agents/ # Custom agents (.agent.md files)
17
+ ├── skills/ # Agent skills (SKILL.md files)
18
+ ├── instructions/ # Path-specific instructions
19
+ └── hooks/ # Hook configurations
20
+ ```
21
+
22
+ ## Available Custom Agents
23
+
24
+ | Agent | Purpose | Invoke With |
25
+ |-------|---------|-------------|
26
+ | planner | Implementation planning | `/agent planner` |
27
+ | architect | System design decisions | `/agent architect` |
28
+ | tdd-guide | Test-driven development | `/agent tdd-guide` |
29
+ | code-reviewer | Code quality review | `/agent code-reviewer` |
30
+ | security-reviewer | Security analysis | `/agent security-reviewer` |
31
+ | build-error-resolver | Fix build/type errors | `/agent build-error-resolver` |
32
+ | e2e-runner | Playwright E2E testing | `/agent e2e-runner` |
33
+ | refactor-cleaner | Dead code cleanup | `/agent refactor-cleaner` |
34
+ | doc-updater | Documentation sync | `/agent doc-updater` |
35
+
36
+ ## Testing Instructions
37
+
38
+ ```bash
39
+ # Run all tests
40
+ node tests/run-all.js
41
+
42
+ # Run specific test
43
+ node tests/lib/utils.test.js
44
+ ```
45
+
46
+ ## Build & Validation
47
+
48
+ ```bash
49
+ # Type check (if TypeScript)
50
+ npx tsc --noEmit
51
+
52
+ # Lint
53
+ npm run lint
54
+
55
+ # Format
56
+ npx prettier --write .
57
+ ```
58
+
59
+ ## Key Guidelines
60
+
61
+ 1. **TDD First**: Write tests before implementation
62
+ 2. **Security**: Never hardcode secrets, validate all inputs
63
+ 3. **Immutability**: Use spread operators, never mutate
64
+ 4. **Small Files**: 200-400 lines typical, 800 max
65
+ 5. **Error Handling**: Always handle errors comprehensively
66
+
67
+ ## MCP Server Configuration
68
+
69
+ MCP servers are configured in `~/.copilot/mcp-config.json`. Use `/mcp add` to add new servers.
70
+
71
+ ## Skills
72
+
73
+ Skills are stored in `.github/skills/` with `SKILL.md` files. Copilot automatically loads relevant skills based on context.
74
+
75
+ ## Hooks
76
+
77
+ Hooks in `.github/hooks/*.json` execute at key points:
78
+ - `sessionStart` / `sessionEnd`
79
+ - `preToolUse` / `postToolUse`
80
+ - `userPromptSubmitted`
81
+ - `errorOccurred`
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 fyow
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.