hatch3r 1.0.0 → 1.2.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 (144) hide show
  1. package/README.md +93 -322
  2. package/agents/hatch3r-a11y-auditor.md +24 -6
  3. package/agents/hatch3r-architect.md +20 -1
  4. package/agents/hatch3r-ci-watcher.md +31 -8
  5. package/agents/hatch3r-context-rules.md +14 -2
  6. package/agents/hatch3r-dependency-auditor.md +21 -5
  7. package/agents/hatch3r-devops.md +37 -6
  8. package/agents/hatch3r-docs-writer.md +19 -3
  9. package/agents/hatch3r-fixer.md +171 -0
  10. package/agents/hatch3r-implementer.md +84 -11
  11. package/agents/hatch3r-learnings-loader.md +69 -13
  12. package/agents/hatch3r-lint-fixer.md +19 -14
  13. package/agents/hatch3r-perf-profiler.md +18 -1
  14. package/agents/hatch3r-researcher.md +440 -5
  15. package/agents/hatch3r-reviewer.md +97 -5
  16. package/agents/hatch3r-security-auditor.md +23 -5
  17. package/agents/hatch3r-test-writer.md +21 -10
  18. package/checks/README.md +49 -0
  19. package/checks/code-quality.md +49 -0
  20. package/checks/performance.md +58 -0
  21. package/checks/security.md +58 -0
  22. package/checks/testing.md +53 -0
  23. package/commands/board/pickup-azure-devops.md +81 -0
  24. package/commands/board/pickup-delegation-multi.md +197 -0
  25. package/commands/board/pickup-delegation.md +100 -0
  26. package/commands/board/pickup-github.md +82 -0
  27. package/commands/board/pickup-gitlab.md +81 -0
  28. package/commands/board/pickup-modes.md +143 -0
  29. package/commands/board/pickup-post-impl.md +120 -0
  30. package/commands/board/shared-azure-devops.md +149 -0
  31. package/commands/board/shared-board-overview.md +215 -0
  32. package/commands/board/shared-github.md +169 -0
  33. package/commands/board/shared-gitlab.md +142 -0
  34. package/commands/hatch3r-agent-customize.md +40 -2
  35. package/commands/hatch3r-api-spec.md +294 -32
  36. package/commands/hatch3r-benchmark.md +386 -32
  37. package/commands/hatch3r-board-fill.md +161 -25
  38. package/commands/hatch3r-board-groom.md +595 -0
  39. package/commands/hatch3r-board-init.md +203 -46
  40. package/commands/hatch3r-board-pickup.md +79 -457
  41. package/commands/hatch3r-board-refresh.md +98 -27
  42. package/commands/hatch3r-board-shared.md +87 -238
  43. package/commands/hatch3r-bug-plan.md +16 -3
  44. package/commands/hatch3r-codebase-map.md +43 -10
  45. package/commands/hatch3r-command-customize.md +6 -0
  46. package/commands/hatch3r-context-health.md +5 -0
  47. package/commands/hatch3r-cost-tracking.md +5 -0
  48. package/commands/hatch3r-debug.md +426 -0
  49. package/commands/hatch3r-dep-audit.md +7 -1
  50. package/commands/hatch3r-feature-plan.md +74 -12
  51. package/commands/hatch3r-healthcheck.md +17 -1
  52. package/commands/hatch3r-hooks.md +16 -10
  53. package/commands/hatch3r-learn.md +15 -9
  54. package/commands/hatch3r-migration-plan.md +333 -33
  55. package/commands/hatch3r-onboard.md +327 -38
  56. package/commands/hatch3r-project-spec.md +46 -10
  57. package/commands/hatch3r-quick-change.md +336 -0
  58. package/commands/hatch3r-recipe.md +6 -0
  59. package/commands/hatch3r-refactor-plan.md +29 -13
  60. package/commands/hatch3r-release.md +13 -3
  61. package/commands/hatch3r-revision.md +395 -0
  62. package/commands/hatch3r-roadmap.md +18 -3
  63. package/commands/hatch3r-rule-customize.md +6 -0
  64. package/commands/hatch3r-security-audit.md +17 -1
  65. package/commands/hatch3r-skill-customize.md +6 -0
  66. package/commands/hatch3r-test-plan.md +532 -0
  67. package/commands/hatch3r-workflow.md +113 -38
  68. package/dist/cli/index.js +5184 -2593
  69. package/dist/cli/index.js.map +1 -0
  70. package/github-agents/hatch3r-docs-agent.md +1 -0
  71. package/github-agents/hatch3r-lint-agent.md +1 -0
  72. package/github-agents/hatch3r-security-agent.md +1 -0
  73. package/github-agents/hatch3r-test-agent.md +1 -0
  74. package/hooks/hatch3r-ci-failure.md +30 -0
  75. package/hooks/hatch3r-file-save.md +22 -0
  76. package/hooks/hatch3r-post-merge.md +23 -0
  77. package/hooks/hatch3r-pre-commit.md +23 -0
  78. package/hooks/hatch3r-pre-push.md +22 -0
  79. package/hooks/hatch3r-session-start.md +22 -0
  80. package/mcp/mcp.json +22 -3
  81. package/package.json +4 -7
  82. package/prompts/hatch3r-bug-triage.md +1 -0
  83. package/prompts/hatch3r-code-review.md +1 -0
  84. package/prompts/hatch3r-pr-description.md +1 -0
  85. package/rules/hatch3r-accessibility-standards.md +1 -0
  86. package/rules/hatch3r-agent-orchestration.md +326 -53
  87. package/rules/hatch3r-agent-orchestration.mdc +225 -0
  88. package/rules/hatch3r-api-design.md +4 -1
  89. package/rules/hatch3r-browser-verification.md +33 -1
  90. package/rules/hatch3r-browser-verification.mdc +29 -0
  91. package/rules/hatch3r-ci-cd.md +5 -1
  92. package/rules/hatch3r-ci-cd.mdc +4 -1
  93. package/rules/hatch3r-code-standards.md +18 -0
  94. package/rules/hatch3r-code-standards.mdc +10 -1
  95. package/rules/hatch3r-component-conventions.md +4 -1
  96. package/rules/hatch3r-data-classification.md +1 -0
  97. package/rules/hatch3r-deep-context.md +94 -0
  98. package/rules/hatch3r-deep-context.mdc +69 -0
  99. package/rules/hatch3r-dependency-management.md +13 -0
  100. package/rules/hatch3r-feature-flags.md +4 -1
  101. package/rules/hatch3r-git-conventions.md +1 -0
  102. package/rules/hatch3r-i18n.md +4 -1
  103. package/rules/hatch3r-learning-consult.md +4 -2
  104. package/rules/hatch3r-learning-consult.mdc +3 -2
  105. package/rules/hatch3r-migrations.md +12 -0
  106. package/rules/hatch3r-observability.md +293 -1
  107. package/rules/hatch3r-performance-budgets.md +5 -2
  108. package/rules/hatch3r-performance-budgets.mdc +1 -1
  109. package/rules/hatch3r-secrets-management.md +11 -3
  110. package/rules/hatch3r-secrets-management.mdc +10 -3
  111. package/rules/hatch3r-security-patterns.md +23 -3
  112. package/rules/hatch3r-security-patterns.mdc +8 -2
  113. package/rules/hatch3r-testing.md +1 -0
  114. package/rules/hatch3r-theming.md +4 -1
  115. package/rules/hatch3r-tooling-hierarchy.md +42 -15
  116. package/rules/hatch3r-tooling-hierarchy.mdc +27 -4
  117. package/skills/hatch3r-a11y-audit/SKILL.md +1 -0
  118. package/skills/hatch3r-agent-customize/SKILL.md +3 -0
  119. package/skills/hatch3r-api-spec/SKILL.md +1 -0
  120. package/skills/hatch3r-architecture-review/SKILL.md +6 -2
  121. package/skills/hatch3r-bug-fix/SKILL.md +4 -1
  122. package/skills/hatch3r-ci-pipeline/SKILL.md +1 -0
  123. package/skills/hatch3r-command-customize/SKILL.md +1 -0
  124. package/skills/hatch3r-context-health/SKILL.md +2 -1
  125. package/skills/hatch3r-cost-tracking/SKILL.md +1 -0
  126. package/skills/hatch3r-dep-audit/SKILL.md +6 -2
  127. package/skills/hatch3r-feature/SKILL.md +9 -2
  128. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +130 -21
  129. package/skills/hatch3r-incident-response/SKILL.md +11 -5
  130. package/skills/hatch3r-issue-workflow/SKILL.md +12 -7
  131. package/skills/hatch3r-logical-refactor/SKILL.md +1 -0
  132. package/skills/hatch3r-migration/SKILL.md +1 -0
  133. package/skills/hatch3r-perf-audit/SKILL.md +2 -1
  134. package/skills/hatch3r-pr-creation/SKILL.md +20 -10
  135. package/skills/hatch3r-qa-validation/SKILL.md +2 -1
  136. package/skills/hatch3r-recipe/SKILL.md +1 -0
  137. package/skills/hatch3r-refactor/SKILL.md +7 -1
  138. package/skills/hatch3r-release/SKILL.md +15 -11
  139. package/skills/hatch3r-rule-customize/SKILL.md +1 -0
  140. package/skills/hatch3r-skill-customize/SKILL.md +1 -0
  141. package/skills/hatch3r-visual-refactor/SKILL.md +1 -0
  142. package/dist/cli/hooks-ZOTFDEA3.js +0 -59
  143. package/rules/hatch3r-error-handling.md +0 -17
  144. package/rules/hatch3r-error-handling.mdc +0 -15
@@ -1,6 +1,9 @@
1
1
  ---
2
2
  id: hatch3r-security-auditor
3
3
  description: Security analyst who audits database rules, cloud functions, event metadata, and data flows. Use when reviewing security, auditing privacy invariants, or validating access control.
4
+ protected: true
5
+ model: standard
6
+ tags: [review, security]
4
7
  ---
5
8
  You are an expert security analyst for the project.
6
9
 
@@ -13,13 +16,12 @@ You are an expert security analyst for the project.
13
16
 
14
17
  ## Critical Invariants to Enforce
15
18
 
19
+ Follow the security patterns defined in `.agents/rules/hatch3r-security-patterns.md` (input validation, auth enforcement, fail-closed defaults, CSRF, OWASP Top 10, AI/agentic security). In addition, enforce these project-specific invariants:
20
+
16
21
  - **Data pipeline:** No sensitive content anywhere in the data pipeline
17
22
  - **Metadata:** Event metadata validated against allowlist (client AND server)
18
23
  - **Sensitive collections:** Deny-all client rules for billing/subscription data
19
24
  - **Membership:** Protected data access requires verified membership
20
- - **API auth:** All API/function endpoints validate auth token
21
- - **Webhooks:** All payment/webhook endpoints verify signature
22
- - **Secrets:** No secrets in client-side code, logs, or error messages
23
25
  - **Entitlements:** Entitlements written only by backend/cloud functions
24
26
 
25
27
  ## Key Files
@@ -44,7 +46,23 @@ You are an expert security analyst for the project.
44
46
 
45
47
  ## External Knowledge
46
48
 
47
- Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). Prefer `gh` CLI over GitHub MCP tools.
49
+ Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). Use the project's configured platform CLI (check `platform` in `.agents/hatch.json`):
50
+ - **GitHub:** `gh` CLI
51
+ - **Azure DevOps:** `az devops` / `az boards` / `az repos` CLI
52
+ - **GitLab:** `glab` CLI
53
+
54
+ ## Context7 MCP Usage
55
+
56
+ - Use `resolve-library-id` then `query-docs` to look up current API patterns for security libraries (JWT verification, bcrypt, helmet, CSRF middleware, OAuth libraries).
57
+ - Verify correct usage of auth/crypto APIs in audited code — training data may reflect deprecated or insecure defaults.
58
+ - Look up framework-specific security middleware docs (e.g., Express helmet options, Next.js CSP config, Django security middleware).
59
+
60
+ ## Web Research Usage
61
+
62
+ - Use web search for latest CVEs and security advisories affecting dependencies found in the project (NVD, GitHub Security Advisories, platform-specific databases).
63
+ - Use web search for current OWASP Top 10, CWE references, and NIST guidelines when classifying findings.
64
+ - Use web search for known exploit techniques and attack patterns relevant to the application's technology stack.
65
+ - Use web search for security hardening best practices when the codebase uses patterns not covered by local docs or Context7.
48
66
 
49
67
  ## Sub-Agent Delegation
50
68
 
@@ -91,7 +109,7 @@ When auditing a large application with multiple modules:
91
109
 
92
110
  ## Boundaries
93
111
 
94
- - **Always:** Test both allow and deny cases, verify invariants, check for secret leakage, validate input sanitization, use `gh` CLI for issue/code reads
112
+ - **Always:** Test both allow and deny cases, verify invariants, check for secret leakage, validate input sanitization, use the platform CLI for issue/code reads
95
113
  - **Ask first:** Before modifying function logic or changing the entitlement model
96
114
  - **Never:** Weaken security rules without explicit approval, skip signature verification, expose billing data to clients, commit secrets
97
115
 
@@ -1,7 +1,9 @@
1
1
  ---
2
2
  id: hatch3r-test-writer
3
3
  description: QA engineer who writes deterministic, isolated tests. Covers unit, integration, E2E, security rules, and contract tests.
4
- model: sonnet
4
+ model: standard
5
+ protected: true
6
+ tags: [core, review]
5
7
  ---
6
8
  You are an expert QA engineer for the project.
7
9
 
@@ -25,13 +27,7 @@ You are an expert QA engineer for the project.
25
27
 
26
28
  ## Test Standards
27
29
 
28
- - **Deterministic:** Use fake timers where applicable no wall clock dependency
29
- - **Isolated:** Each test creates and tears down its own state
30
- - **Fast:** Unit < 50ms, integration < 2s
31
- - **Named clearly:** Descriptive test names that explain expected behavior
32
- - **Regression:** Every bug fix gets a test that fails before the fix and passes after
33
- - **No network:** Unit tests never make network calls (use mocks)
34
- - **No `any`:** Use proper types in tests. No `.skip` without a linked issue.
30
+ Follow the full testing standards defined in `.agents/rules/hatch3r-testing.md` (coverage thresholds, mocking strategy, property-based testing, flaky test handling, test data management). Key principles enforced by this agent: deterministic (fake timers), isolated (own state), fast (unit < 50ms, integration < 2s), clearly named, regression tests for every bug fix, no network calls in unit tests, no `any` or `.skip` without a linked issue.
35
31
 
36
32
  ## Commands
37
33
 
@@ -56,7 +52,22 @@ This interactive verification complements automated E2E test suites — use it t
56
52
 
57
53
  ## External Knowledge
58
54
 
59
- Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). Prefer `gh` CLI over GitHub MCP tools.
55
+ Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). Use the project's configured platform CLI (check `platform` in `.agents/hatch.json`):
56
+ - **GitHub:** `gh` CLI
57
+ - **Azure DevOps:** `az devops` / `az boards` / `az repos` CLI
58
+ - **GitLab:** `glab` CLI
59
+
60
+ ## Context7 MCP Usage
61
+
62
+ - Use `resolve-library-id` then `query-docs` to look up current APIs for testing frameworks (Vitest, Jest, Playwright, Cypress, Testing Library) before writing tests.
63
+ - Look up assertion library APIs, mocking utilities, and test runner configuration to use correct patterns rather than relying on potentially outdated training data.
64
+ - When testing code that uses external libraries, query Context7 for the library's recommended testing patterns (e.g., React Testing Library queries, Playwright locators, Supertest assertion chains).
65
+
66
+ ## Web Research Usage
67
+
68
+ - Use web search for testing best practices for specific scenarios (e.g., testing race conditions, WebSocket handlers, file uploads, streaming responses).
69
+ - Use web search for known testing pitfalls and flaky test patterns in the project's testing framework.
70
+ - Use web search for security testing techniques (e.g., injection test patterns, auth bypass test cases) when writing security-related tests.
60
71
 
61
72
  ## Output Format
62
73
 
@@ -96,7 +107,7 @@ Follow the tooling hierarchy (specs > codebase > Context7 MCP > web research). P
96
107
 
97
108
  ## Boundaries
98
109
 
99
- - **Always:** Write tests to `tests/`, run tests before submitting, verify edge cases, check invariants from specs, use `gh` CLI for issue reads
110
+ - **Always:** Write tests to `tests/`, run tests before submitting, verify edge cases, check invariants from specs, use the platform CLI for issue reads
100
111
  - **Ask first:** Before modifying existing test infrastructure or adding test dependencies
101
112
  - **Never:** Modify source code in `src/`, remove failing tests to make the suite pass, skip tests without a linked issue
102
113
 
@@ -0,0 +1,49 @@
1
+ # Checks
2
+
3
+ Review criteria definitions for automated and agent-assisted code review. Each check file defines a set of criteria that agents reference when reviewing code changes.
4
+
5
+ ## How Checks Work
6
+
7
+ - Agents load check files during code review to evaluate changes against defined criteria.
8
+ - Each check file focuses on one concern (code quality, security, testing, etc.).
9
+ - Criteria are pass/fail — a change either meets the criterion or doesn't.
10
+ - Agents report findings per-criterion, noting which passed and which need attention.
11
+
12
+ ## File Format
13
+
14
+ Each check file uses frontmatter with:
15
+
16
+ ```yaml
17
+ ---
18
+ id: check-name
19
+ type: check
20
+ description: What this check evaluates
21
+ ---
22
+ ```
23
+
24
+ The body contains sections of review criteria organized by category.
25
+
26
+ ## Usage
27
+
28
+ Agents (particularly `hatch3r-reviewer`) reference checks during code review:
29
+
30
+ 1. Load the relevant check files based on the type of change.
31
+ 2. Evaluate each criterion against the diff.
32
+ 3. Report pass/fail per criterion with specific findings.
33
+ 4. Block merging if any critical criterion fails.
34
+
35
+ ## Available Checks
36
+
37
+ | Check | Focus Area |
38
+ |-------|------------|
39
+ | `code-quality` | Code standards, complexity, maintainability |
40
+ | `security` | Vulnerability patterns, input validation, secrets |
41
+ | `testing` | Test coverage, test quality, regression tests |
42
+ | `performance` | Bundle size, render performance, memory usage, network optimization, database queries |
43
+
44
+ ## Adding New Checks
45
+
46
+ 1. Create a new `.md` file in this directory with the frontmatter format above.
47
+ 2. Define criteria grouped by category — each criterion should be specific and actionable.
48
+ 3. Mark criteria as `[CRITICAL]` if failure should block the PR, or `[RECOMMENDED]` for advisory.
49
+ 4. Update this README with the new check in the Available Checks table.
@@ -0,0 +1,49 @@
1
+ ---
2
+ id: code-quality
3
+ type: check
4
+ description: Code quality review criteria covering standards compliance, complexity, maintainability, and architectural patterns
5
+ ---
6
+ # Code Quality Check
7
+
8
+ Review criteria for evaluating code quality in pull requests.
9
+
10
+ ## Standards Compliance
11
+
12
+ - `[CRITICAL]` No type escape hatches (`any`, `@ts-ignore`, `// @ts-expect-error`) without a linked issue justification.
13
+ - `[CRITICAL]` All new functions and variables follow the project naming conventions (camelCase functions, PascalCase types, SCREAMING_SNAKE constants).
14
+ - `[CRITICAL]` No linter warnings introduced. The diff must not increase the warning count.
15
+ - `[RECOMMENDED]` Import ordering follows the canonical order: built-in, external, internal aliases, relative, type-only.
16
+
17
+ ## Complexity
18
+
19
+ - `[CRITICAL]` No function exceeds 50 lines. If it does, it must be decomposed.
20
+ - `[CRITICAL]` Cyclomatic complexity does not exceed 10 per function.
21
+ - `[RECOMMENDED]` No file exceeds 400 lines. Large files should be split by responsibility.
22
+ - `[RECOMMENDED]` Nesting depth does not exceed 3 levels. Use early returns or extract helpers.
23
+
24
+ ## Maintainability
25
+
26
+ - `[CRITICAL]` No dead code: unused imports, variables, functions, or commented-out code blocks.
27
+ - `[CRITICAL]` No placeholder code (`// TODO`, `// FIXME`, `// HACK`) without a linked tracking issue.
28
+ - `[RECOMMENDED]` Complex logic has inline comments explaining the *why*, not the *what*.
29
+ - `[RECOMMENDED]` Public API functions have JSDoc/docstring with parameter and return descriptions.
30
+
31
+ ## Error Handling
32
+
33
+ - `[CRITICAL]` No swallowed errors (empty `catch` blocks or `catch` that only logs without re-throwing or returning an error result).
34
+ - `[CRITICAL]` Error messages are descriptive and include context (what failed, with what input, suggested action).
35
+ - `[RECOMMENDED]` Domain errors use custom error classes, not raw `Error("message")`.
36
+ - `[RECOMMENDED]` External call failures (HTTP, DB, file I/O) have retry or graceful degradation logic.
37
+
38
+ ## Architecture
39
+
40
+ - `[CRITICAL]` No circular imports between modules. Check with dependency graph tools.
41
+ - `[CRITICAL]` New dependencies are justified — include a comment or PR description explaining why the existing stack doesn't suffice.
42
+ - `[RECOMMENDED]` Cross-module imports go through barrel exports (`index.ts`), not internal file paths.
43
+ - `[RECOMMENDED]` Side effects are isolated at the edges (API handlers, CLI entry points), not embedded in domain logic.
44
+
45
+ ## Performance
46
+
47
+ - `[RECOMMENDED]` No N+1 query patterns in data fetching code.
48
+ - `[RECOMMENDED]` Large collections use pagination or streaming, not full in-memory loading.
49
+ - `[RECOMMENDED]` Expensive operations (crypto, compression, network) are not performed synchronously in request handlers.
@@ -0,0 +1,58 @@
1
+ ---
2
+ id: performance
3
+ type: check
4
+ description: Performance review criteria covering bundle size, render performance, memory usage, network optimization, database queries, and runtime efficiency
5
+ ---
6
+ # Performance Check
7
+
8
+ Review criteria for evaluating performance in pull requests.
9
+
10
+ ## Bundle Size and Asset Optimization
11
+
12
+ - `[CRITICAL]` New dependencies do not increase the total bundle size (gzipped) beyond the defined budget. Measure before and after.
13
+ - `[CRITICAL]` No unintentional import of full libraries when a subpath import or tree-shakable alternative exists (e.g., `import _ from "lodash"` vs `import groupBy from "lodash/groupBy"`).
14
+ - `[RECOMMENDED]` Images and static assets are optimized (compressed, appropriately sized, modern formats like WebP/AVIF).
15
+ - `[RECOMMENDED]` CSS and JavaScript are minified and dead-code-eliminated in production builds.
16
+
17
+ ## Render and Paint Performance
18
+
19
+ - `[CRITICAL]` Changes to critical rendering path do not regress Largest Contentful Paint (LCP) beyond the defined budget.
20
+ - `[CRITICAL]` Layout shifts are not introduced — Cumulative Layout Shift (CLS) must remain below the defined threshold.
21
+ - `[RECOMMENDED]` First Contentful Paint (FCP) is not regressed. Above-the-fold content renders without blocking on non-critical resources.
22
+ - `[RECOMMENDED]` Animations and transitions use `transform`/`opacity` (compositor-only properties) rather than properties that trigger layout or paint.
23
+
24
+ ## Memory Usage and Leak Detection
25
+
26
+ - `[CRITICAL]` Event listeners, subscriptions, timers, and observers are cleaned up on component unmount or scope exit.
27
+ - `[CRITICAL]` No unbounded data structures (arrays, maps, caches) that grow without eviction or size limits.
28
+ - `[RECOMMENDED]` Large objects and buffers are released when no longer needed — avoid holding references beyond their useful lifetime.
29
+ - `[RECOMMENDED]` Closures in hot paths do not capture unnecessary outer scope variables that prevent garbage collection.
30
+
31
+ ## Network Request Optimization
32
+
33
+ - `[CRITICAL]` No N+1 request patterns — batch or aggregate related requests instead of issuing one per item.
34
+ - `[CRITICAL]` API response payloads return only required fields. No over-fetching of large objects when a subset is needed.
35
+ - `[RECOMMENDED]` Cacheable responses include appropriate cache headers (`Cache-Control`, `ETag`). Client-side caching (query cache, service worker) is used where applicable.
36
+ - `[RECOMMENDED]` Request waterfalls are minimized — parallelize independent requests and preload critical resources.
37
+
38
+ ## Database Query Performance
39
+
40
+ - `[CRITICAL]` New queries that filter or sort on a column have a supporting index. Queries against large tables must not perform full table scans.
41
+ - `[CRITICAL]` No N+1 query patterns in data access layers — use joins, batch loading, or dataloader patterns.
42
+ - `[RECOMMENDED]` Queries select only required columns, not `SELECT *`.
43
+ - `[RECOMMENDED]` Connection pooling is used for database access. No per-request connection creation in request handlers.
44
+ - `[RECOMMENDED]` Long-running queries and transactions are identified and bounded with timeouts.
45
+
46
+ ## Runtime Performance
47
+
48
+ - `[CRITICAL]` No synchronous blocking operations (heavy computation, synchronous I/O) on the main thread or event loop.
49
+ - `[CRITICAL]` Hot-path code (called per-request, per-frame, or per-event) does not perform redundant computation — memoize or cache where appropriate.
50
+ - `[RECOMMENDED]` CPU-intensive work is offloaded to workers, background jobs, or streaming pipelines.
51
+ - `[RECOMMENDED]` Object allocation in tight loops is minimized — reuse buffers and avoid creating short-lived objects per iteration.
52
+
53
+ ## Lazy Loading and Code Splitting
54
+
55
+ - `[CRITICAL]` Routes and large feature modules use dynamic imports or lazy loading — not bundled into the initial payload.
56
+ - `[RECOMMENDED]` Below-the-fold content, modals, and infrequently accessed features are lazy-loaded on demand.
57
+ - `[RECOMMENDED]` Third-party scripts (analytics, chat widgets, ads) are loaded asynchronously and deferred.
58
+ - `[RECOMMENDED]` Code splitting boundaries align with route or feature boundaries, not arbitrary file splits.
@@ -0,0 +1,58 @@
1
+ ---
2
+ id: security
3
+ type: check
4
+ description: Security review criteria covering vulnerability patterns, input validation, authentication, secrets handling, and dependency safety
5
+ ---
6
+ # Security Check
7
+
8
+ Review criteria for evaluating security posture in pull requests.
9
+
10
+ ## Input Validation
11
+
12
+ - `[CRITICAL]` All external input (HTTP params, form data, file uploads, CLI args) is validated and sanitized before use.
13
+ - `[CRITICAL]` SQL queries use parameterized statements or an ORM — no string concatenation of user input into queries.
14
+ - `[CRITICAL]` HTML output is escaped to prevent XSS. No use of `dangerouslySetInnerHTML`, `v-html`, or equivalent without sanitization.
15
+ - `[CRITICAL]` File paths constructed from user input are validated against directory traversal (`../`).
16
+ - `[RECOMMENDED]` Input validation uses schema validation (Zod, Joi, JSON Schema) rather than manual checks.
17
+
18
+ ## Authentication and Authorization
19
+
20
+ - `[CRITICAL]` New endpoints have appropriate authentication guards. No accidental public exposure of protected resources.
21
+ - `[CRITICAL]` Authorization checks verify the authenticated user has access to the specific resource, not just that they're logged in.
22
+ - `[CRITICAL]` Authentication tokens are not logged, included in URLs, or exposed in error messages.
23
+ - `[RECOMMENDED]` Session tokens use secure attributes: `HttpOnly`, `Secure`, `SameSite=Strict`, appropriate `Max-Age`.
24
+ - `[RECOMMENDED]` Rate limiting is applied to authentication endpoints (login, password reset, OTP verification).
25
+
26
+ ## Secrets and Credentials
27
+
28
+ - `[CRITICAL]` No hardcoded secrets, API keys, passwords, or tokens in source code.
29
+ - `[CRITICAL]` No secrets in committed configuration files, test fixtures, or comments.
30
+ - `[CRITICAL]` `.env` files are gitignored. Only `.env.example` (with placeholder values) is committed.
31
+ - `[RECOMMENDED]` Secrets are loaded from environment variables or a secrets manager, not from config files.
32
+ - `[RECOMMENDED]` New secrets are documented in `.env.example` with a description of their purpose.
33
+
34
+ ## Dependency Safety
35
+
36
+ - `[CRITICAL]` New dependencies are from trusted sources with active maintenance (recent commits, multiple maintainers).
37
+ - `[CRITICAL]` No known critical or high vulnerabilities in new or updated dependencies (`npm audit`, `pip audit`, etc.).
38
+ - `[RECOMMENDED]` Dependency count increase is justified — prefer standard library solutions when adequate.
39
+ - `[RECOMMENDED]` New dependencies have appropriate licenses compatible with the project.
40
+
41
+ ## Data Exposure
42
+
43
+ - `[CRITICAL]` API responses do not leak internal implementation details (stack traces, database errors, internal paths).
44
+ - `[CRITICAL]` PII fields are not included in logs, error messages, or analytics events.
45
+ - `[CRITICAL]` Sensitive data in database queries is not selected unnecessarily (select only needed columns).
46
+ - `[RECOMMENDED]` API responses use DTOs or serializers that explicitly whitelist fields, rather than returning raw database objects.
47
+
48
+ ## Cryptography
49
+
50
+ - `[CRITICAL]` No use of deprecated or weak algorithms (MD5 for security, SHA1 for signatures, DES, RC4).
51
+ - `[CRITICAL]` Random values for security purposes (tokens, nonces) use cryptographically secure generators (`crypto.randomBytes`, `secrets.token_hex`).
52
+ - `[RECOMMENDED]` Passwords are hashed with bcrypt, scrypt, or Argon2 — not SHA-256 or PBKDF2 with low iterations.
53
+ - `[RECOMMENDED]` TLS certificate validation is not disabled, even in test environments.
54
+
55
+ ## Error Handling
56
+
57
+ - `[CRITICAL]` Error responses to clients do not include stack traces, internal paths, or database details.
58
+ - `[RECOMMENDED]` Security-relevant errors (auth failures, permission denials) are logged with sufficient context for incident investigation.
@@ -0,0 +1,53 @@
1
+ ---
2
+ id: testing
3
+ type: check
4
+ description: Test coverage review criteria covering test quality, regression testing, test isolation, and coverage requirements
5
+ ---
6
+ # Testing Check
7
+
8
+ Review criteria for evaluating test coverage and quality in pull requests.
9
+
10
+ ## Coverage Requirements
11
+
12
+ - `[CRITICAL]` Every new public function or method has at least one unit test.
13
+ - `[CRITICAL]` Code coverage does not decrease from the base branch. New code must be tested.
14
+ - `[CRITICAL]` Bug fix PRs include a regression test that fails without the fix and passes with it.
15
+ - `[RECOMMENDED]` Critical path functions (auth, payments, data mutations) have > 90% branch coverage.
16
+ - `[RECOMMENDED]` Edge cases are explicitly tested: empty inputs, boundary values, error conditions, null/undefined.
17
+
18
+ ## Test Quality
19
+
20
+ - `[CRITICAL]` Tests are deterministic — no flaky tests. Tests must not depend on timing, network, or external services.
21
+ - `[CRITICAL]` Each test has a single clear assertion focus. Test names describe the expected behavior, not the implementation.
22
+ - `[CRITICAL]` Tests do not depend on execution order. Each test sets up and tears down its own state.
23
+ - `[RECOMMENDED]` Test names follow "should [expected behavior] when [condition]" or equivalent descriptive pattern.
24
+ - `[RECOMMENDED]` No logic duplication between test and implementation — tests should verify behavior, not re-implement it.
25
+
26
+ ## Test Isolation
27
+
28
+ - `[CRITICAL]` Unit tests do not make real network calls, database queries, or file system writes.
29
+ - `[CRITICAL]` External dependencies are mocked, stubbed, or faked at module boundaries.
30
+ - `[CRITICAL]` Tests clean up after themselves — no leaked state, open handles, or modified globals.
31
+ - `[RECOMMENDED]` Test fixtures and factories are used for complex test data setup, not inline object literals.
32
+ - `[RECOMMENDED]` Shared test helpers live in a dedicated test utilities directory, not duplicated across test files.
33
+
34
+ ## Integration Tests
35
+
36
+ - `[CRITICAL]` API endpoints have integration tests covering the happy path and primary error paths.
37
+ - `[CRITICAL]` Database operations are tested against a real (test) database, not mocks, for integration-level tests.
38
+ - `[RECOMMENDED]` Integration tests verify the complete request-response cycle including middleware (auth, validation, error handling).
39
+ - `[RECOMMENDED]` Integration tests use transactional rollback or isolated test databases to avoid cross-test contamination.
40
+
41
+ ## Test Organization
42
+
43
+ - `[RECOMMENDED]` Test files are co-located with source files (`foo.ts` → `foo.test.ts`) or in a mirrored `__tests__/` directory.
44
+ - `[RECOMMENDED]` Test suites are grouped by feature or module, not by test type.
45
+ - `[RECOMMENDED]` Slow tests (integration, e2e) are tagged or separated so unit tests can run independently and fast.
46
+ - `[RECOMMENDED]` Test utility functions (factories, builders, custom matchers) are documented with usage examples.
47
+
48
+ ## Regression Prevention
49
+
50
+ - `[CRITICAL]` Deleted tests must be justified — removing a test without replacing it requires explanation in the PR description.
51
+ - `[CRITICAL]` Modified tests still test the original intended behavior, not just the new implementation.
52
+ - `[RECOMMENDED]` Snapshot tests are reviewed for meaningful changes — auto-updated snapshots must be inspected.
53
+ - `[RECOMMENDED]` Performance-sensitive code has benchmark tests or assertions to catch regressions.
@@ -0,0 +1,81 @@
1
+ ---
2
+ id: hatch3r-board-pickup-azure-devops
3
+ type: command
4
+ description: Azure DevOps-specific platform procedures for board-pickup. Covers az CLI commands for work item listing, status updates, collision detection, PR creation, and state transitions.
5
+ tags: [board, team, azure-devops]
6
+ ---
7
+ # Board Pickup — Azure DevOps Platform Details
8
+
9
+ Platform-specific procedures for Azure DevOps. Referenced from `hatch3r-board-pickup`.
10
+
11
+ ---
12
+
13
+ ## Step 1a: Fetch and Parse Board State — Azure DevOps
14
+
15
+ **Fetch all open work items:**
16
+ 1. `az boards query --org https://dev.azure.com/{namespace} --project {project} --wiql "SELECT [System.Id], [System.Title], [System.State], [System.Tags] FROM WorkItems WHERE [System.State] <> 'Closed' AND [System.State] <> 'Removed'"` (fall back to `list_work_items` MCP).
17
+
18
+ **Check sub-issues per work item:**
19
+ - `az boards work-item relation list --id N`.
20
+
21
+ **Fetch tags:**
22
+ - Extract from `System.Tags` field.
23
+
24
+ ---
25
+
26
+ ## Step 3: Collision Detection — Azure DevOps
27
+
28
+ **In-progress work items:**
29
+ - `az boards query --wiql "SELECT ... WHERE [System.State] = 'Active' AND [System.Tags] CONTAINS 'status:in-progress'"`.
30
+
31
+ **Open PRs:**
32
+ - `az repos pr list --org https://dev.azure.com/{namespace} --project {project} --status active`.
33
+
34
+ ---
35
+
36
+ ## Step 4: Update Issue Status — Azure DevOps
37
+
38
+ **Update work item state and tags:**
39
+ - `az boards work-item update --id N --state "Active"` and update tags to include `status:in-progress`.
40
+
41
+ **Sync board status:**
42
+ Follow the **Azure Boards Work Item State Sync** from `commands/board/shared-azure-devops.md` for each work item marked `status:in-progress` (including parent epic). Set state to "Active".
43
+
44
+ ---
45
+
46
+ ## Step 8: Create Pull Request — Azure DevOps
47
+
48
+ **PR template:** Check `.azuredevops/pull_request_template.md`.
49
+
50
+ **Create PR:**
51
+ `az repos pr create --org https://dev.azure.com/{namespace} --project {project} --source-branch {branch} --target-branch {base} --title "..." --description "..."` (fall back to `create_pull_request` MCP).
52
+
53
+ `{base}` = `board.defaultBranch` from `.agents/hatch.json` (fallback: `"main"`).
54
+
55
+ **Link PR to epic:**
56
+ `az boards work-item relation add --id {epic_id} --relation-type "ArtifactLink" --target-id {pr_id}` or link via PR description.
57
+
58
+ **Verify PR body linkage:**
59
+ Read back the created PR description and verify it contains `Closes #N` for every work item addressed. If any reference is missing:
60
+ `az repos pr update --id {pr_number} --description "..."`.
61
+
62
+ ---
63
+
64
+ ## Step 8a: Post-PR Label Transition — Azure DevOps
65
+
66
+ **Transition to `status:in-review`:**
67
+ `az boards work-item update --id N --state "Resolved"` and update tags to include `status:in-review`.
68
+
69
+ **Sync Board:**
70
+ Follow the full **Azure Boards Work Item State Sync** from `commands/board/shared-azure-devops.md` for:
71
+ - Each `Closes #N` work item: Set state to "Resolved".
72
+ - Parent epic (all sub-issues addressed): Set state to "Resolved".
73
+ - Parent epic (partial): Verify state is "Active"; set it if not.
74
+
75
+ ---
76
+
77
+ ## Error Handling — Azure DevOps
78
+
79
+ - **Work item listing failure** (`az boards query`): retry once, then ask user for work item ID.
80
+ - **Work item update failure** (`az boards work-item update`): warn and continue (tags not blocking).
81
+ - **PR creation failure** (`az repos pr create`): present error and manual instructions.