cortexhawk 3.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.
Files changed (136) hide show
  1. package/.cortexhawk-team.yml +65 -0
  2. package/CHANGELOG.md +268 -0
  3. package/CLAUDE.md +96 -0
  4. package/LICENSE +21 -0
  5. package/PACKS.md +14 -0
  6. package/README.md +418 -0
  7. package/REGISTRY.md +23 -0
  8. package/agents/architect.md +46 -0
  9. package/agents/brainstormer.md +57 -0
  10. package/agents/code-simplifier.md +56 -0
  11. package/agents/codebase-mapper.md +63 -0
  12. package/agents/copywriter.md +48 -0
  13. package/agents/debugger.md +44 -0
  14. package/agents/designer.md +53 -0
  15. package/agents/devops.md +49 -0
  16. package/agents/docs-manager.md +50 -0
  17. package/agents/fullstack-developer.md +55 -0
  18. package/agents/git-manager.md +63 -0
  19. package/agents/implementer.md +30 -0
  20. package/agents/journal-writer.md +53 -0
  21. package/agents/planner.md +52 -0
  22. package/agents/project-manager.md +50 -0
  23. package/agents/researcher.md +46 -0
  24. package/agents/reviewer.md +63 -0
  25. package/agents/security-auditor.md +92 -0
  26. package/agents/teacher.md +71 -0
  27. package/agents/tester.md +41 -0
  28. package/commands/api-gen.md +17 -0
  29. package/commands/backlog.md +26 -0
  30. package/commands/bootstrap.md +32 -0
  31. package/commands/brainstorm.md +18 -0
  32. package/commands/build.md +16 -0
  33. package/commands/chain.md +46 -0
  34. package/commands/changelog.md +16 -0
  35. package/commands/check.md +40 -0
  36. package/commands/ci.md +32 -0
  37. package/commands/context.md +35 -0
  38. package/commands/debug.md +16 -0
  39. package/commands/deploy.md +16 -0
  40. package/commands/doc.md +15 -0
  41. package/commands/export.md +17 -0
  42. package/commands/journal.md +18 -0
  43. package/commands/learn.md +16 -0
  44. package/commands/map.md +16 -0
  45. package/commands/migrate.md +17 -0
  46. package/commands/monitor.md +16 -0
  47. package/commands/optimize.md +17 -0
  48. package/commands/plan.md +17 -0
  49. package/commands/pulse.md +46 -0
  50. package/commands/refactor.md +16 -0
  51. package/commands/research.md +18 -0
  52. package/commands/review.md +16 -0
  53. package/commands/scan.md +19 -0
  54. package/commands/ship.md +17 -0
  55. package/commands/simplify.md +16 -0
  56. package/commands/task.md +32 -0
  57. package/commands/tdd.md +17 -0
  58. package/commands/test.md +16 -0
  59. package/commands/upgrade.md +27 -0
  60. package/cortexhawk +450 -0
  61. package/hooks/agent-analytics.sh +67 -0
  62. package/hooks/branch-guard.sh +56 -0
  63. package/hooks/codex-dispatcher.sh +84 -0
  64. package/hooks/commit-guard.sh +71 -0
  65. package/hooks/compose.yml +47 -0
  66. package/hooks/dependency-check.sh +56 -0
  67. package/hooks/file-guard.sh +69 -0
  68. package/hooks/hooks.json +46 -0
  69. package/hooks/self-review.sh +71 -0
  70. package/hooks/session-start.sh +132 -0
  71. package/hooks/session-telemetry.sh +60 -0
  72. package/hooks/test-reminder.sh +75 -0
  73. package/install.sh +3805 -0
  74. package/mcp/README.md +37 -0
  75. package/mcp/context7.json +8 -0
  76. package/mcp/puppeteer.json +8 -0
  77. package/mcp/sequential-thinking.json +8 -0
  78. package/modes/default.md +5 -0
  79. package/modes/fast.md +5 -0
  80. package/modes/learn.md +9 -0
  81. package/modes/orchestration.md +5 -0
  82. package/modes/pair.md +10 -0
  83. package/modes/research.md +5 -0
  84. package/modes/review.md +5 -0
  85. package/package.json +32 -0
  86. package/profiles/api.json +27 -0
  87. package/profiles/data.json +23 -0
  88. package/profiles/fullstack.json +27 -0
  89. package/scripts/autodetect-profile.sh +68 -0
  90. package/scripts/benchmark.sh +106 -0
  91. package/scripts/chain-post-save.sh +23 -0
  92. package/scripts/generate-plans-index.sh +50 -0
  93. package/scripts/git-workflow-init.sh +115 -0
  94. package/scripts/install-codex.sh +128 -0
  95. package/scripts/interactive-init.sh +264 -0
  96. package/scripts/post-install-audit.sh +130 -0
  97. package/scripts/validate.sh +214 -0
  98. package/settings.json +90 -0
  99. package/setup.sh +67 -0
  100. package/skills/databases/schema-designer/SKILL.md +54 -0
  101. package/skills/databases/sql-optimizer/SKILL.md +37 -0
  102. package/skills/devops/ci-cd/SKILL.md +59 -0
  103. package/skills/devops/deployment/SKILL.md +49 -0
  104. package/skills/devops/docker/SKILL.md +57 -0
  105. package/skills/frameworks/api-design/SKILL.md +103 -0
  106. package/skills/frameworks/fastapi/SKILL.md +68 -0
  107. package/skills/frameworks/nextjs/SKILL.md +74 -0
  108. package/skills/frameworks/python/SKILL.md +89 -0
  109. package/skills/frameworks/react/SKILL.md +83 -0
  110. package/skills/frameworks/sveltekit/SKILL.md +69 -0
  111. package/skills/frameworks/tailwindcss/SKILL.md +75 -0
  112. package/skills/frameworks/typescript/SKILL.md +94 -0
  113. package/skills/meta/mcp-builder/SKILL.md +54 -0
  114. package/skills/meta/skill-creator/SKILL.md +43 -0
  115. package/skills/optimization/performance/SKILL.md +70 -0
  116. package/skills/quality/complexity-analyzer/SKILL.md +52 -0
  117. package/skills/quality/error-handling/SKILL.md +123 -0
  118. package/skills/quality/log-analyzer/SKILL.md +31 -0
  119. package/skills/quality/pattern-detector/SKILL.md +50 -0
  120. package/skills/security/auth-analyzer/SKILL.md +96 -0
  121. package/skills/security/compliance-checker/SKILL.md +92 -0
  122. package/skills/security/container-security/SKILL.md +128 -0
  123. package/skills/security/dependency-auditor/SKILL.md +100 -0
  124. package/skills/security/encryption/SKILL.md +94 -0
  125. package/skills/security/incident-response/SKILL.md +127 -0
  126. package/skills/security/secrets/SKILL.md +93 -0
  127. package/skills/security/security-headers/SKILL.md +83 -0
  128. package/skills/security/security-logging/SKILL.md +107 -0
  129. package/skills/security/vulnerability-scanner/SKILL.md +114 -0
  130. package/skills/testing/e2e-testing/SKILL.md +119 -0
  131. package/skills/testing/tdd/SKILL.md +40 -0
  132. package/skills/testing/test-generator/SKILL.md +39 -0
  133. package/skills/workflow/commit/SKILL.md +61 -0
  134. package/skills/workflow/confidence-check/SKILL.md +90 -0
  135. package/skills/workflow/pr-review-comments/SKILL.md +81 -0
  136. package/skills/workflow/pr-review-comments/scripts/fetch_comments.py +237 -0
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: security-logging
3
+ description: Security event logging — what to log, log format, log protection, intrusion detection, alerting, and SIEM integration.
4
+ requires: quality/log-analyzer
5
+ ---
6
+
7
+ # Security Logging
8
+
9
+ ## What to Log
10
+ ```
11
+ Authentication: login success/failure (IP, user-agent), logout, MFA, password changes, lockouts
12
+ Authorization: access denied, privilege escalation, role changes, permission modifications
13
+ Data access: sensitive data reads, bulk exports, admin operations, API key creation/revocation
14
+ System: startup/shutdown, config changes, deployments, cert expiry, rate limit triggers
15
+ ```
16
+
17
+ ## Never Log
18
+ ```
19
+ Passwords or hashes, session tokens or JWTs, API keys or secrets,
20
+ full credit card numbers, SSNs, encryption keys, health info, raw request bodies with sensitive data
21
+
22
+ Use masking: last 4 digits, hashed identifiers, or event type only
23
+ ```
24
+
25
+ ## Log Format (JSON)
26
+ ```json
27
+ {
28
+ "timestamp": "ISO-8601 UTC",
29
+ "level": "INFO|WARN|ERROR|CRITICAL",
30
+ "event_type": "auth.login.success",
31
+ "actor": {
32
+ "user_id": "hashed or internal ID",
33
+ "ip": "x.x.x.x",
34
+ "user_agent": "..."
35
+ },
36
+ "resource": {
37
+ "type": "endpoint|record|file",
38
+ "id": "...",
39
+ "action": "read|write|delete"
40
+ },
41
+ "outcome": "success|failure",
42
+ "metadata": {
43
+ "request_id": "correlation-id",
44
+ "service": "service-name",
45
+ "environment": "production"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Log Protection
51
+ 1. Append-only storage (no modification/deletion)
52
+ 2. Ship to centralized system immediately (ELK, Splunk, CloudWatch, Datadog)
53
+ 3. Encrypt at rest and in transit
54
+ 4. Restrict access (security team + on-call only)
55
+ 5. Retention: min 90 days hot, 1 year cold
56
+ 6. Integrity checks (checksums, signing)
57
+ 7. Never expose logs via public endpoints
58
+
59
+ ## Intrusion Detection
60
+
61
+ ### Host-Based (HIDS)
62
+ ```
63
+ Monitor: file integrity, unexpected processes, network connections, user changes, privilege escalation
64
+ Tools: OSSEC, Wazuh, Falco (containers)
65
+ ```
66
+
67
+ ### Network-Based (NIDS)
68
+ ```
69
+ Monitor: traffic spikes, known attack signatures, DNS anomalies, lateral movement
70
+ Tools: Suricata, Zeek, AWS GuardDuty, GCP SCC
71
+ ```
72
+
73
+ ### Application-Level
74
+ ```
75
+ Alert on: failed login spikes (brute force), repeated access denied, unusual data access,
76
+ SQL error spikes (injection), rapid requests (scanning), unexpected geolocations, rate limit violations
77
+ ```
78
+
79
+ ## Alerting Rules
80
+ | Event | Severity | Response | Action |
81
+ |---|---|---|---|
82
+ | Brute force (>10 fails/min) | HIGH | 5 min | Auto-block IP, alert team |
83
+ | Privilege escalation attempt | CRITICAL | Immediate | Alert + investigate |
84
+ | Unusual data export (>10x normal) | HIGH | 15 min | Alert, pause export |
85
+ | New admin off-hours | HIGH | 15 min | Alert + verify |
86
+ | SQL error spike (>5x baseline) | MEDIUM | 30 min | Alert dev team |
87
+ | Cert expiry < 14 days | MEDIUM | 24h | Auto-renew or alert ops |
88
+
89
+ ## SIEM Integration
90
+ ```
91
+ Pipeline: App logs -> Shipper (Fluentd/Filebeat) -> Queue (Kafka) -> SIEM (Splunk/ELK/Datadog)
92
+
93
+ Correlation rules:
94
+ 1. Same user + failed auth from multiple IPs = credential stuffing
95
+ 2. Same IP + failed auth for multiple users = brute force
96
+ 3. Auth success + immediate sensitive access + large download = compromised account
97
+ ```
98
+
99
+ ## Checklist
100
+ - [ ] All security events logged (see What to Log)
101
+ - [ ] No sensitive data in logs
102
+ - [ ] Logs shipped to centralized platform
103
+ - [ ] Retention meets compliance (min 90 days)
104
+ - [ ] Alerting configured for critical events
105
+ - [ ] IDS active (host + network + application)
106
+ - [ ] Log access restricted
107
+ - [ ] Log integrity verification in place
@@ -0,0 +1,114 @@
1
+ ---
2
+ name: vulnerability-scanner
3
+ description: Scan code for vulnerabilities — injection, XSS, SSRF, path traversal, plus SAST/DAST tool guidance and security test cases.
4
+ ---
5
+
6
+ # Vulnerability Scanner
7
+
8
+ ## SAST Tools by Stack
9
+ | Language | Tools |
10
+ |---|---|
11
+ | JavaScript/TS | ESLint security plugin, Semgrep, CodeQL |
12
+ | Python | Bandit, Semgrep, CodeQL |
13
+ | Java/Kotlin | SpotBugs + FindSecBugs, Semgrep |
14
+ | Go | gosec, Semgrep, CodeQL |
15
+ | Ruby | Brakeman, Semgrep |
16
+ | Rust | cargo-audit, clippy security lints |
17
+ | Multi-language | Semgrep, CodeQL, SonarQube |
18
+
19
+ ## DAST Tools
20
+ | Tool | Type | Best For |
21
+ |---|---|---|
22
+ | OWASP ZAP | Open source | General web app scanning |
23
+ | Nuclei | Open source | Template-based scanning |
24
+ | Burp Suite | Commercial | Deep manual + automated |
25
+ | sqlmap | Open source | SQL injection testing |
26
+
27
+ ## Vulnerability Patterns
28
+
29
+ ### SQL Injection
30
+ ```python
31
+ # VULNERABLE: string interpolation in queries
32
+ query = f"SELECT * FROM users WHERE id = {user_input}"
33
+
34
+ # SAFE: parameterized queries
35
+ cursor.execute("SELECT * FROM users WHERE id = %s", (user_input,))
36
+ ```
37
+
38
+ ### XSS (Cross-Site Scripting)
39
+ ```
40
+ VULNERABLE patterns to flag:
41
+ - Raw HTML insertion from user data
42
+ - DOM write APIs with unsanitized input
43
+ - React unsafe HTML prop with unescaped content
44
+
45
+ SAFE alternatives:
46
+ - Use element.textContent for plain text
47
+ - Use framework auto-escaping (React JSX, Vue templates)
48
+ - Use DOMPurify if HTML rendering is required
49
+ ```
50
+
51
+ ### Command Injection
52
+ ```python
53
+ # VULNERABLE: shell=True with user input
54
+ subprocess.call(f"convert {filename}", shell=True)
55
+
56
+ # SAFE: argument list, no shell
57
+ subprocess.run(["ping", "-c", "1", validated_host], shell=False)
58
+ ```
59
+
60
+ ### Path Traversal
61
+ ```python
62
+ # SAFE pattern — always validate resolved path
63
+ safe_path = os.path.realpath(os.path.join(base_dir, user_input))
64
+ if not safe_path.startswith(os.path.realpath(base_dir)):
65
+ raise ValueError("Path traversal detected")
66
+ ```
67
+
68
+ ### SSRF
69
+ ```python
70
+ # SAFE — validate scheme + block internal IPs
71
+ parsed = urlparse(user_url)
72
+ if parsed.scheme not in ('http', 'https'):
73
+ raise ValueError("Invalid scheme")
74
+ # Block 127.0.0.1, 10.x, 172.16-31.x, 192.168.x, 169.254.x
75
+ ```
76
+
77
+ ### Insecure Deserialization
78
+ ```
79
+ VULNERABLE: Language-native serialization with untrusted data
80
+ (Python: native deserializer, Ruby: Marshal, Java: ObjectInputStream)
81
+
82
+ SAFE: Use JSON or schema-validated formats
83
+ json.loads(user_data)
84
+ yaml.safe_load(data)
85
+ ```
86
+
87
+ ## Security Test Cases
88
+
89
+ ### Authentication
90
+ - SQL injection in login fields
91
+ - Brute force protection verification
92
+ - Token replay after logout
93
+ - Access with expired tokens
94
+ - Privilege escalation (user to admin endpoints)
95
+
96
+ ### Input Validation
97
+ - XSS payloads in all text inputs
98
+ - Path traversal (../../etc/passwd)
99
+ - Command injection in file names
100
+ - Oversized payloads (DoS)
101
+ - Unicode/encoding bypass
102
+
103
+ ### Business Logic
104
+ - Race conditions on financial operations
105
+ - Negative quantity/amount manipulation
106
+ - Skip steps in multi-step workflows
107
+ - IDOR — access other users' resources
108
+
109
+ ## Scan Process
110
+ 1. Search for vulnerable patterns (regex + AST)
111
+ 2. Check exploitability — is user input reaching the sink?
112
+ 3. Rate severity: Critical (remote), High (requires auth), Medium (limited)
113
+ 4. Provide specific fix with code for each finding
114
+ 5. Flag false positives as INFO
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: e2e-testing
3
+ description: End-to-end testing with Playwright — page objects, fixtures, selectors, CI integration, and common patterns.
4
+ detect: dir:tests dir:__tests__ dir:test
5
+ ---
6
+
7
+ # E2E Testing (Playwright)
8
+
9
+ ## Setup
10
+ ```bash
11
+ npm init playwright@latest
12
+ # Creates: playwright.config.ts, tests/, .github/workflows/playwright.yml
13
+ ```
14
+
15
+ ## Page Object Pattern
16
+ ```typescript
17
+ // pages/login.page.ts
18
+ export class LoginPage {
19
+ constructor(private page: Page) {}
20
+
21
+ async goto() {
22
+ await this.page.goto('/login');
23
+ }
24
+
25
+ async login(email: string, password: string) {
26
+ await this.page.getByLabel('Email').fill(email);
27
+ await this.page.getByLabel('Password').fill(password);
28
+ await this.page.getByRole('button', { name: 'Sign in' }).click();
29
+ }
30
+
31
+ async expectError(message: string) {
32
+ await expect(this.page.getByRole('alert')).toContainText(message);
33
+ }
34
+ }
35
+
36
+ // tests/login.spec.ts
37
+ test('successful login redirects to dashboard', async ({ page }) => {
38
+ const login = new LoginPage(page);
39
+ await login.goto();
40
+ await login.login('user@test.com', 'password123');
41
+ await expect(page).toHaveURL('/dashboard');
42
+ });
43
+
44
+ test('invalid password shows error', async ({ page }) => {
45
+ const login = new LoginPage(page);
46
+ await login.goto();
47
+ await login.login('user@test.com', 'wrong');
48
+ await login.expectError('Invalid credentials');
49
+ });
50
+ ```
51
+
52
+ ## Selectors (priority order)
53
+ ```typescript
54
+ // 1. Role-based (best — accessible, resilient)
55
+ page.getByRole('button', { name: 'Submit' })
56
+ page.getByRole('heading', { name: 'Dashboard' })
57
+
58
+ // 2. Label-based (forms)
59
+ page.getByLabel('Email')
60
+ page.getByPlaceholder('Search...')
61
+
62
+ // 3. Text-based
63
+ page.getByText('Welcome back')
64
+
65
+ // 4. Test ID (last resort)
66
+ page.getByTestId('checkout-button')
67
+
68
+ // AVOID: CSS selectors, XPath — brittle, break on refactors
69
+ ```
70
+
71
+ ## Fixtures
72
+ ```typescript
73
+ // fixtures.ts
74
+ import { test as base } from '@playwright/test';
75
+
76
+ type Fixtures = {
77
+ authenticatedPage: Page;
78
+ };
79
+
80
+ export const test = base.extend<Fixtures>({
81
+ authenticatedPage: async ({ page }, use) => {
82
+ await page.goto('/login');
83
+ await page.getByLabel('Email').fill('test@test.com');
84
+ await page.getByLabel('Password').fill('password');
85
+ await page.getByRole('button', { name: 'Sign in' }).click();
86
+ await page.waitForURL('/dashboard');
87
+ await use(page);
88
+ },
89
+ });
90
+ ```
91
+
92
+ ## Config
93
+ ```typescript
94
+ // playwright.config.ts
95
+ export default defineConfig({
96
+ testDir: './tests',
97
+ retries: process.env.CI ? 2 : 0,
98
+ use: {
99
+ baseURL: 'http://localhost:3000',
100
+ screenshot: 'only-on-failure',
101
+ trace: 'on-first-retry',
102
+ },
103
+ webServer: {
104
+ command: 'npm run dev',
105
+ port: 3000,
106
+ reuseExistingServer: !process.env.CI,
107
+ },
108
+ });
109
+ ```
110
+
111
+ ## Checklist
112
+ - Page Objects for every page/component — isolate selectors from tests
113
+ - Role-based selectors first — they test accessibility for free
114
+ - Test user flows, not implementation — "user can checkout" not "button has class"
115
+ - Each test must be independent — no shared state between tests
116
+ - Use fixtures for auth, seeded data, and common setup
117
+ - Screenshots on failure + traces on retry for debugging CI flakes
118
+ - Run against a real server (webServer config), not mocks
119
+ - Parallelize tests — Playwright runs in parallel by default
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: tdd
3
+ description: Test-Driven Development workflow — red, green, refactor cycle.
4
+ detect: base
5
+ ---
6
+
7
+ # TDD
8
+
9
+ ## Cycle
10
+ 1. 🔴 **Red** — Write a failing test for the next piece of behavior
11
+ 2. 🟢 **Green** — Write the minimum code to make it pass
12
+ 3. 🔵 **Refactor** — Clean up while keeping tests green
13
+
14
+ ## Rules
15
+ - Never write production code without a failing test first
16
+ - Each cycle should take 2-5 minutes
17
+ - One behavior per test, one test at a time
18
+ - Refactor only when tests are green
19
+ - Commit after each green phase
20
+
21
+ ## Example
22
+ ```python
23
+ # 1. RED — write failing test
24
+ def test_add_returns_sum():
25
+ assert add(2, 3) == 5 # NameError: add not defined
26
+
27
+ # 2. GREEN — minimum code to pass
28
+ def add(a, b):
29
+ return a + b
30
+
31
+ # 3. REFACTOR — nothing to clean here, next test
32
+ def test_add_negative_numbers():
33
+ assert add(-1, -2) == -3
34
+ ```
35
+
36
+ ## Process
37
+ 1. Start with the simplest case
38
+ 2. Add complexity one test at a time
39
+ 3. Let the tests drive the design — don't plan ahead
40
+ 4. When stuck, write a smaller test
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: test-generator
3
+ description: Generate comprehensive tests — unit, integration, e2e. Auto-detect framework.
4
+ detect: base
5
+ ---
6
+
7
+ # Test Generator
8
+
9
+ ## Framework Detection
10
+ - `pytest` / `unittest` → Python tests
11
+ - `jest` / `vitest` → JavaScript/TypeScript tests
12
+ - `go test` → Go tests
13
+ - `cargo test` → Rust tests
14
+
15
+ ## Test Priority
16
+ 1. Happy path (expected inputs → expected outputs)
17
+ 2. Error paths (invalid inputs, exceptions, network failures)
18
+ 3. Edge cases (null, empty, 0, -1, MAX_INT, unicode, special chars)
19
+ 4. Boundary values (off-by-one, limits, overflow)
20
+ 5. Integration (component interactions, API calls, DB queries)
21
+
22
+ ## Structure
23
+ ```
24
+ Arrange → Act → Assert (one assertion per test)
25
+ ```
26
+
27
+ ## Naming
28
+ ```
29
+ test_[unit]_[condition]_[expected]
30
+ test_create_user_with_valid_data_returns_201
31
+ test_create_user_with_duplicate_email_returns_409
32
+ test_create_user_with_missing_name_returns_422
33
+ ```
34
+
35
+ ## Mocking Rules
36
+ - Mock external dependencies (APIs, DB, filesystem, time)
37
+ - Never mock the thing you're testing
38
+ - Prefer fakes over mocks when possible
39
+ - Reset mocks between tests
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: commit
3
+ description: Conventional commit messages, atomic commits, and git staging best practices.
4
+ detect: base
5
+ ---
6
+
7
+ # Commit
8
+
9
+ ## Conventional Commits Format
10
+ ```
11
+ type(scope): subject
12
+
13
+ body (optional)
14
+
15
+ footer (optional)
16
+ ```
17
+
18
+ ## Types
19
+ | Type | When |
20
+ |---|---|
21
+ | `feat` | New feature |
22
+ | `fix` | Bug fix |
23
+ | `docs` | Documentation only |
24
+ | `style` | Formatting, no code change |
25
+ | `refactor` | Code restructure, no behavior change |
26
+ | `test` | Adding or fixing tests |
27
+ | `chore` | Build, CI, tooling, dependencies |
28
+ | `perf` | Performance improvement |
29
+ | `security` | Security fix or hardening |
30
+
31
+ ## Rules
32
+ - Subject line: imperative mood, lowercase, no period, ≤72 chars
33
+ - Scope: the module/component affected (e.g., `feat(auth): add JWT refresh`)
34
+ - One logical change per commit — don't mix features with refactors
35
+ - Stage specific files — avoid `git add -A` (catches .env, binaries)
36
+ - Breaking changes: add `BREAKING CHANGE:` in footer or `!` after type
37
+ - Body explains WHY, not WHAT — the diff shows the what
38
+
39
+ ## Atomic Commit Checklist
40
+ - [ ] Single purpose — would the message need "and"? Split it
41
+ - [ ] Tests pass after this commit
42
+ - [ ] No unrelated changes mixed in
43
+ - [ ] No debug artifacts (console.log, print, breakpoints)
44
+ - [ ] No secrets or .env files staged
45
+
46
+ ## Examples
47
+ ```
48
+ feat(api): add user registration endpoint
49
+
50
+ fix(auth): prevent token reuse after password change
51
+
52
+ docs: update README with new commands
53
+
54
+ refactor(db): extract connection pooling into shared module
55
+
56
+ chore: upgrade dependencies to latest patch versions
57
+
58
+ feat(ui)!: redesign navigation layout
59
+
60
+ BREAKING CHANGE: navigation component props changed
61
+ ```
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: confidence-check
3
+ description: Assess confidence BEFORE implementation. Prevents wrong-direction execution by verifying duplicates, architecture, docs, references, and root cause. Requires ≥90% to proceed.
4
+ detect: base
5
+ ---
6
+
7
+ # Confidence Check
8
+
9
+ Run this BEFORE implementing any task. Spend 100-200 tokens here to save 5,000-50,000 on wrong-direction work.
10
+
11
+ ## 5 Checks
12
+
13
+ ### 1. No Duplicate Implementations? (25%)
14
+ Search the codebase for existing functionality before writing new code.
15
+ ```
16
+ Grep for: function names, class names, similar logic
17
+ Glob for: related modules, utils, helpers
18
+ ```
19
+ - Pass: no duplicates found
20
+ - Fail: similar implementation already exists — extend it instead
21
+
22
+ ### 2. Architecture Compliance? (25%)
23
+ Verify the approach fits the existing tech stack and patterns.
24
+ ```
25
+ Read: CLAUDE.md, PLANNING.md, existing code patterns
26
+ Check: does this use the project's established tools?
27
+ Avoid: introducing new dependencies unnecessarily
28
+ ```
29
+ - Pass: uses existing stack (e.g., project already uses Supabase, pytest, UV)
30
+ - Fail: introduces new tools when existing ones suffice
31
+
32
+ ### 3. Official Documentation Verified? (20%)
33
+ Review official docs before implementing — don't rely on assumptions.
34
+ ```
35
+ Use: Context7 MCP, WebFetch, WebSearch
36
+ Verify: API signatures, version compatibility, deprecations
37
+ ```
38
+ - Pass: official docs reviewed and confirmed
39
+ - Fail: relying on memory or assumptions about API behavior
40
+
41
+ ### 4. Working OSS Reference Found? (15%)
42
+ Find proven implementations to validate the approach.
43
+ ```
44
+ Search: GitHub, Stack Overflow, framework examples
45
+ Verify: code actually works, not just theoretically correct
46
+ ```
47
+ - Pass: working reference found and reviewed
48
+ - Fail: no proven examples exist — higher risk
49
+
50
+ ### 5. Root Cause Identified? (15%)
51
+ Understand the actual problem before solving it.
52
+ ```
53
+ Analyze: error messages, stack traces, logs
54
+ Trace: data flow from input to failure point
55
+ Distinguish: symptom vs root cause
56
+ ```
57
+ - Pass: root cause is clear and specific
58
+ - Fail: only symptoms identified — dig deeper first
59
+
60
+ ## Score Calculation
61
+
62
+ ```
63
+ Total = Check1 (0.25) + Check2 (0.25) + Check3 (0.20) + Check4 (0.15) + Check5 (0.15)
64
+
65
+ ≥ 0.90 → Proceed with implementation
66
+ ≥ 0.70 → Present alternatives, ask clarifying questions
67
+ < 0.70 → STOP — request more context before proceeding
68
+ ```
69
+
70
+ ## Output Format
71
+
72
+ ```
73
+ Confidence Checks:
74
+ [pass/fail] No duplicate implementations — [detail]
75
+ [pass/fail] Architecture compliance — [detail]
76
+ [pass/fail] Official docs verified — [detail]
77
+ [pass/fail] Working OSS reference — [detail]
78
+ [pass/fail] Root cause identified — [detail]
79
+
80
+ Confidence: [score] ([percentage]%)
81
+ [Proceed / Alternatives / STOP] — [reasoning]
82
+ ```
83
+
84
+ ## Rules
85
+ - Run BEFORE writing any code — never after
86
+ - Be honest about failed checks — don't inflate the score
87
+ - A failed check is not a blocker if acknowledged with a mitigation plan
88
+ - For bug fixes: checks 1, 2, 5 are critical. For new features: checks 1, 2, 3 are critical
89
+ - If score is borderline (0.85-0.89), present the gaps and let the user decide
90
+ - Skip check 4 (OSS reference) for project-specific business logic — score out of 0.85 instead
@@ -0,0 +1,81 @@
1
+ ---
2
+ name: pr-review-comments
3
+ description: Fetch, triage, and address PR review comments from GitHub (Copilot, reviewers, bots). Uses MCP GitHub tools with gh CLI fallback.
4
+ detect: base
5
+ ---
6
+
7
+ # PR Review Comments
8
+
9
+ Fetch all review comments on the current branch's PR, triage them, and apply fixes.
10
+
11
+ ## Process
12
+
13
+ 1. **Auth** — Verify MCP GitHub or `gh` CLI is authenticated
14
+ 2. **Fetch** — Get all PR comments, reviews, and inline threads
15
+ 3. **Triage** — Group by author (Copilot, human reviewers, bots), summarize each
16
+ 4. **Present** — Number all threads, show file:line + summary
17
+ 5. **Fix** — Apply selected fixes, respond on the PR thread
18
+
19
+ ## Fetch Methods (priority order)
20
+
21
+ ### MCP GitHub (preferred)
22
+ ```
23
+ mcp__github__list_pull_requests → find PR for current branch
24
+ mcp__github__get_pull_request_comments → conversation comments
25
+ mcp__github__get_pull_request_reviews → review submissions
26
+ ```
27
+
28
+ ### gh CLI fallback
29
+ ```bash
30
+ # Quick: get PR comments as JSON
31
+ gh pr view --json comments,reviews,reviewRequests
32
+
33
+ # Full: use the bundled GraphQL script for inline threads
34
+ python skills/workflow/pr-review-comments/scripts/fetch_comments.py
35
+ ```
36
+
37
+ ## Output Format
38
+
39
+ ```
40
+ PR #[number]: [title]
41
+
42
+ ## Review Threads
43
+
44
+ ### [1] [author] — [file:line]
45
+ > [comment summary]
46
+ Status: [open/resolved/outdated]
47
+ Fix: [proposed action]
48
+
49
+ ### [2] [author] — [file:line]
50
+ > [comment summary]
51
+ Status: [open/resolved/outdated]
52
+ Fix: [proposed action]
53
+
54
+ ## Summary
55
+ - Open threads: [count]
56
+ - Resolved: [count]
57
+ - By Copilot: [count]
58
+ - By reviewers: [count]
59
+
60
+ Which comments should I address? (e.g., 1, 3, 5 or "all")
61
+ ```
62
+
63
+ ## Responding
64
+
65
+ After applying fixes:
66
+ ```
67
+ mcp__github__create_pull_request_review → batch response
68
+ mcp__github__add_issue_comment → single reply
69
+ ```
70
+
71
+ Or via CLI:
72
+ ```bash
73
+ gh pr comment [number] --body "Fixed in [commit]"
74
+ ```
75
+
76
+ ## Rules
77
+ - Always present comments before fixing — let the user choose
78
+ - Group Copilot comments separately from human review
79
+ - Skip resolved and outdated threads unless explicitly asked
80
+ - If auth fails mid-run, prompt user to `gh auth login` and retry
81
+ - After fixing, respond on the PR thread to close the loop