hatch3r 1.9.0 → 2.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/README.md +52 -143
- package/dist/cli/index.js +28453 -15831
- package/dist/content/agents/hatch3r-architect.md +39 -9
- package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
- package/dist/content/agents/hatch3r-ci-watcher.md +8 -1
- package/dist/content/agents/hatch3r-context-rules.md +19 -1
- package/dist/content/agents/hatch3r-creator.md +65 -26
- package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
- package/dist/content/agents/hatch3r-devops.md +11 -1
- package/dist/content/agents/hatch3r-docs-writer.md +11 -1
- package/dist/content/agents/hatch3r-edge-case-analyst.md +134 -0
- package/dist/content/agents/hatch3r-enhancability.md +192 -0
- package/dist/content/agents/hatch3r-fixer.md +59 -8
- package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
- package/dist/content/agents/hatch3r-handoff-loader.md +29 -3
- package/dist/content/agents/hatch3r-handoff-preparer.md +10 -1
- package/dist/content/agents/hatch3r-implementer.md +139 -8
- package/dist/content/agents/hatch3r-incident-responder.md +96 -0
- package/dist/content/agents/hatch3r-learnings-loader.md +122 -88
- package/dist/content/agents/hatch3r-lint-fixer.md +15 -3
- package/dist/content/agents/hatch3r-maintainability.md +183 -0
- package/dist/content/agents/hatch3r-pack-installer.md +113 -0
- package/dist/content/agents/hatch3r-performance.md +179 -0
- package/dist/content/agents/hatch3r-reliability.md +193 -0
- package/dist/content/agents/hatch3r-researcher.md +27 -4
- package/dist/content/agents/hatch3r-reviewer.md +153 -103
- package/dist/content/agents/hatch3r-scalability.md +162 -0
- package/dist/content/agents/hatch3r-security.md +197 -0
- package/dist/content/agents/hatch3r-testability.md +204 -0
- package/dist/content/agents/hatch3r-ui.md +175 -0
- package/dist/content/agents/hatch3r-ux.md +160 -0
- package/dist/content/agents/modes/requirements-elicitation.md +1 -1
- package/dist/content/agents/modes/user-flows.md +2 -2
- package/dist/content/agents/shared/clarification-default-block.md +44 -0
- package/dist/content/agents/shared/confidence-gate.md +42 -0
- package/dist/content/agents/shared/cq-specialist-roster.md +26 -0
- package/dist/content/agents/shared/efficiency-patterns.md +32 -1
- package/dist/content/agents/shared/injection-patterns.md +18 -7
- package/dist/content/agents/shared/principles.md +60 -0
- package/dist/content/agents/shared/prompt-structure.md +7 -1
- package/dist/content/agents/shared/quality-charter.md +48 -12
- package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
- package/dist/content/agents/shared/rigor-contract.md +151 -0
- package/dist/content/agents/shared/severity-mapping.md +92 -0
- package/dist/content/agents/shared/triage-vocabulary.md +46 -0
- package/dist/content/agents/shared/user-content-templates.md +34 -8
- package/dist/content/agents/shared/user-question-protocol.md +45 -3
- package/dist/content/checks/README.md +5 -0
- package/dist/content/checks/accessibility.md +14 -7
- package/dist/content/checks/code-quality.md +1 -1
- package/dist/content/checks/performance.md +7 -4
- package/dist/content/checks/security.md +6 -6
- package/dist/content/checks/testing.md +1 -1
- package/dist/content/commands/board/pickup-delegation-multi.md +37 -10
- package/dist/content/commands/board/pickup-delegation.md +7 -5
- package/dist/content/commands/board/pickup-modes.md +1 -0
- package/dist/content/commands/board/pickup-post-impl.md +1 -1
- package/dist/content/commands/hatch3r-api-spec.md +79 -2
- package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
- package/dist/content/commands/hatch3r-benchmark.md +90 -7
- package/dist/content/commands/hatch3r-board-fill.md +97 -11
- package/dist/content/commands/hatch3r-board-pickup.md +93 -9
- package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
- package/dist/content/commands/hatch3r-bug-plan.md +79 -3
- package/dist/content/commands/hatch3r-codebase-map.md +80 -4
- package/dist/content/commands/hatch3r-create.md +105 -7
- package/dist/content/commands/hatch3r-debug.md +102 -14
- package/dist/content/commands/hatch3r-diagnose.md +238 -0
- package/dist/content/commands/hatch3r-feature-plan.md +125 -5
- package/dist/content/commands/hatch3r-handoff.md +83 -3
- package/dist/content/commands/hatch3r-healthcheck.md +105 -5
- package/dist/content/commands/hatch3r-incident-response.md +228 -0
- package/dist/content/commands/hatch3r-migration-plan.md +79 -3
- package/dist/content/commands/hatch3r-onboard.md +94 -3
- package/dist/content/commands/hatch3r-pack-install.md +243 -0
- package/dist/content/commands/hatch3r-pr-resolve.md +106 -23
- package/dist/content/commands/hatch3r-project-spec.md +82 -6
- package/dist/content/commands/hatch3r-quick-change.md +108 -13
- package/dist/content/commands/hatch3r-refactor-plan.md +78 -2
- package/dist/content/commands/hatch3r-release.md +401 -0
- package/dist/content/commands/hatch3r-revision.md +98 -12
- package/dist/content/commands/hatch3r-roadmap.md +92 -10
- package/dist/content/commands/hatch3r-security-audit.md +105 -5
- package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
- package/dist/content/commands/hatch3r-spec.md +216 -0
- package/dist/content/commands/hatch3r-test-plan.md +85 -9
- package/dist/content/commands/hatch3r-workflow.md +165 -41
- package/dist/content/commands/revision/revision-delegation.md +6 -5
- package/dist/content/commands/revision/revision-modes.md +49 -4
- package/dist/content/commands/revision/revision-quality.md +10 -7
- package/dist/content/commands/shared/orchestration-frame.md +119 -0
- package/dist/content/github-agents/hatch3r-docs-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-lint-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-security-agent.md +21 -1
- package/dist/content/github-agents/hatch3r-test-agent.md +21 -1
- package/dist/content/hooks/hatch3r-file-save.md +1 -1
- package/dist/content/hooks/hatch3r-pre-push.md +4 -4
- package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
- package/dist/content/mcp/mcp.json +7 -5
- package/dist/content/rules/hatch3r-accessibility-standards.md +14 -2
- package/dist/content/rules/hatch3r-accessibility-standards.mdc +12 -1
- package/dist/content/rules/hatch3r-agent-orchestration-detail.md +58 -19
- package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +58 -19
- package/dist/content/rules/hatch3r-agent-orchestration.md +87 -213
- package/dist/content/rules/hatch3r-agent-orchestration.mdc +87 -213
- package/dist/content/rules/hatch3r-ai-evals.md +5 -4
- package/dist/content/rules/hatch3r-ai-evals.mdc +3 -3
- package/dist/content/rules/hatch3r-ai-ux-patterns.md +6 -2
- package/dist/content/rules/hatch3r-ai-ux-patterns.mdc +4 -1
- package/dist/content/rules/hatch3r-android-patterns.md +107 -0
- package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
- package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
- package/dist/content/rules/hatch3r-api-design.md +5 -1
- package/dist/content/rules/hatch3r-api-design.mdc +3 -0
- package/dist/content/rules/hatch3r-api-versioning.md +2 -1
- package/dist/content/rules/hatch3r-auth-patterns.md +3 -1
- package/dist/content/rules/hatch3r-auth-patterns.mdc +1 -0
- package/dist/content/rules/hatch3r-browser-verification.md +2 -0
- package/dist/content/rules/hatch3r-browser-verification.mdc +2 -0
- package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
- package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
- package/dist/content/rules/hatch3r-ci-cd.md +8 -1
- package/dist/content/rules/hatch3r-ci-cd.mdc +6 -0
- package/dist/content/rules/hatch3r-clarification-default.md +73 -0
- package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
- package/dist/content/rules/hatch3r-code-standards.md +23 -47
- package/dist/content/rules/hatch3r-code-standards.mdc +22 -46
- package/dist/content/rules/hatch3r-component-conventions.md +3 -0
- package/dist/content/rules/hatch3r-component-conventions.mdc +3 -0
- package/dist/content/rules/hatch3r-container-hardening.md +11 -2
- package/dist/content/rules/hatch3r-container-hardening.mdc +9 -1
- package/dist/content/rules/hatch3r-contract-testing.md +2 -1
- package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
- package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
- package/dist/content/rules/hatch3r-data-classification.md +3 -1
- package/dist/content/rules/hatch3r-data-classification.mdc +2 -1
- package/dist/content/rules/hatch3r-deep-context.md +13 -13
- package/dist/content/rules/hatch3r-deep-context.mdc +13 -13
- package/dist/content/rules/hatch3r-dependency-management.md +16 -3
- package/dist/content/rules/hatch3r-dependency-management.mdc +15 -3
- package/dist/content/rules/hatch3r-design-system-detection.md +2 -1
- package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
- package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
- package/dist/content/rules/hatch3r-enhancability.md +147 -0
- package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
- package/dist/content/rules/hatch3r-event-schema-evolution.md +2 -1
- package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
- package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
- package/dist/content/rules/hatch3r-feature-flags.md +2 -0
- package/dist/content/rules/hatch3r-feature-flags.mdc +2 -0
- package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
- package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
- package/dist/content/rules/hatch3r-git-conventions.md +4 -1
- package/dist/content/rules/hatch3r-git-conventions.mdc +2 -0
- package/dist/content/rules/hatch3r-go-patterns.md +98 -0
- package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
- package/dist/content/rules/hatch3r-handoff-readiness.md +10 -0
- package/dist/content/rules/hatch3r-handoff-readiness.mdc +10 -0
- package/dist/content/rules/hatch3r-i18n.md +2 -0
- package/dist/content/rules/hatch3r-i18n.mdc +2 -0
- package/dist/content/rules/hatch3r-iteration-summary.md +75 -57
- package/dist/content/rules/hatch3r-iteration-summary.mdc +77 -54
- package/dist/content/rules/hatch3r-learning-system.md +202 -0
- package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
- package/dist/content/rules/hatch3r-maintainability.md +157 -0
- package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
- package/dist/content/rules/hatch3r-migrations.md +2 -1
- package/dist/content/rules/hatch3r-observability-logging.md +1 -1
- package/dist/content/rules/hatch3r-observability-metrics.md +1 -1
- package/dist/content/rules/hatch3r-observability-tracing.md +45 -36
- package/dist/content/rules/hatch3r-observability-tracing.mdc +44 -35
- package/dist/content/rules/hatch3r-operability.md +2 -1
- package/dist/content/rules/hatch3r-passkey-server.md +2 -1
- package/dist/content/rules/hatch3r-performance-budgets.md +2 -0
- package/dist/content/rules/hatch3r-performance-budgets.mdc +2 -0
- package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
- package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
- package/dist/content/rules/hatch3r-progressive-delivery.md +5 -1
- package/dist/content/rules/hatch3r-progressive-delivery.mdc +3 -0
- package/dist/content/rules/hatch3r-proof-model.md +131 -0
- package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
- package/dist/content/rules/hatch3r-python-patterns.md +70 -0
- package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
- package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
- package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
- package/dist/content/rules/hatch3r-resilience-patterns.md +2 -1
- package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
- package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
- package/dist/content/rules/hatch3r-right-sizing.md +68 -0
- package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
- package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
- package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-scalability.md +137 -0
- package/dist/content/rules/hatch3r-scalability.mdc +132 -0
- package/dist/content/rules/hatch3r-secrets-management.md +10 -1
- package/dist/content/rules/hatch3r-secrets-management.mdc +8 -0
- package/dist/content/rules/hatch3r-security-patterns.md +36 -34
- package/dist/content/rules/hatch3r-security-patterns.mdc +35 -34
- package/dist/content/rules/hatch3r-security.md +97 -0
- package/dist/content/rules/hatch3r-security.mdc +92 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
- package/dist/content/rules/hatch3r-testability.md +115 -0
- package/dist/content/rules/hatch3r-testability.mdc +110 -0
- package/dist/content/rules/hatch3r-testing.md +4 -1
- package/dist/content/rules/hatch3r-testing.mdc +2 -0
- package/dist/content/rules/hatch3r-theming.md +2 -0
- package/dist/content/rules/hatch3r-theming.mdc +2 -0
- package/dist/content/rules/hatch3r-tool-currency.md +91 -0
- package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
- package/dist/content/rules/hatch3r-tooling-hierarchy.md +29 -31
- package/dist/content/rules/hatch3r-tooling-hierarchy.mdc +27 -30
- package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
- package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
- package/dist/content/rules/hatch3r-ux-states-and-flows.md +11 -4
- package/dist/content/rules/hatch3r-ux-states-and-flows.mdc +9 -3
- package/dist/content/skills/hatch3r-a11y-audit/SKILL.md +10 -8
- package/dist/content/skills/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
- package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
- package/dist/content/skills/hatch3r-ai-feature/SKILL.md +4 -6
- package/dist/content/skills/hatch3r-api-spec/SKILL.md +27 -2
- package/dist/content/skills/hatch3r-architecture-review/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-board-groom/SKILL.md +11 -0
- package/dist/content/skills/hatch3r-board-init/SKILL.md +17 -1
- package/dist/content/skills/hatch3r-board-refresh/SKILL.md +12 -1
- package/dist/content/skills/hatch3r-board-shared/SKILL.md +38 -1
- package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
- package/dist/content/skills/hatch3r-bug-fix/SKILL.md +15 -2
- package/dist/content/skills/hatch3r-ci-pipeline/SKILL.md +17 -7
- package/dist/content/skills/hatch3r-cli-fd/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-fzf/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-gh/SKILL.md +50 -1
- package/dist/content/skills/hatch3r-cli-jq/SKILL.md +40 -6
- package/dist/content/skills/hatch3r-cli-ripgrep/SKILL.md +33 -1
- package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +130 -23
- package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
- package/dist/content/skills/hatch3r-context-health/SKILL.md +9 -7
- package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +37 -17
- package/dist/content/skills/hatch3r-customize/SKILL.md +5 -8
- package/dist/content/skills/hatch3r-dep-audit/SKILL.md +23 -7
- package/dist/content/skills/hatch3r-design-system-detect/SKILL.md +3 -7
- package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
- package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
- package/dist/content/skills/hatch3r-feature/SKILL.md +53 -3
- package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
- package/dist/content/skills/hatch3r-gh-agentic-workflows/SKILL.md +10 -8
- package/dist/content/skills/hatch3r-handoff-prepare/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-handoff-resume/SKILL.md +4 -7
- package/dist/content/{commands/hatch3r-hooks.md → skills/hatch3r-hooks/SKILL.md} +48 -137
- package/dist/content/skills/hatch3r-incident-response/SKILL.md +66 -7
- package/dist/content/skills/hatch3r-issue-workflow/SKILL.md +11 -0
- package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
- package/dist/content/skills/hatch3r-logical-refactor/SKILL.md +6 -7
- package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
- package/dist/content/skills/hatch3r-migration/SKILL.md +8 -7
- package/dist/content/skills/hatch3r-observability-verify/SKILL.md +17 -12
- package/dist/content/skills/hatch3r-perf-audit/SKILL.md +13 -9
- package/dist/content/skills/hatch3r-pr-creation/SKILL.md +4 -7
- package/dist/content/skills/hatch3r-qa-validation/SKILL.md +6 -5
- package/dist/content/skills/hatch3r-recipe/SKILL.md +63 -60
- package/dist/content/skills/hatch3r-refactor/SKILL.md +6 -7
- package/dist/content/skills/hatch3r-release/SKILL.md +123 -11
- package/dist/content/skills/hatch3r-reliability-verify/SKILL.md +9 -5
- package/dist/content/{commands/hatch3r-report.md → skills/hatch3r-report/SKILL.md} +20 -17
- package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
- package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
- package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
- package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
- package/dist/content/skills/hatch3r-ui-ux-verify/SKILL.md +19 -11
- package/dist/content/skills/hatch3r-visual-refactor/SKILL.md +11 -7
- package/package.json +50 -31
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js.map +0 -1
- package/dist/content/agents/hatch3r-a11y-auditor.md +0 -159
- package/dist/content/agents/hatch3r-dependency-auditor.md +0 -219
- package/dist/content/agents/hatch3r-perf-profiler.md +0 -166
- package/dist/content/agents/hatch3r-security-auditor.md +0 -180
- package/dist/content/agents/hatch3r-test-writer.md +0 -171
- package/dist/content/commands/hatch3r-learn.md +0 -312
- package/dist/content/rules/hatch3r-learning-consult.md +0 -42
- package/dist/content/rules/hatch3r-learning-consult.mdc +0 -38
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
id: hatch3r-tooling-hierarchy
|
|
3
3
|
type: rule
|
|
4
4
|
description: Platform MCP-first priority, documentation MCP for library APIs, web research for CVEs, and browser MCP for UI verification with fallback guidance
|
|
5
|
-
scope:
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "**/.hatch3r/**,**/mcp/**,**/mcp.json,**/.cursor/**,**/.github/copilot*,**/hatch.json,**/.claude/**"
|
|
6
7
|
tags: [orchestration]
|
|
7
8
|
quality_charter: agents/shared/quality-charter.md
|
|
8
9
|
cache_friendly: true
|
|
9
10
|
---
|
|
10
11
|
# Tooling Hierarchy
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
**Pillars:** P3 (Adapter & External Tool Currency), P7 (Speed & Token Efficiency)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
## A. Platform MCP-First (when available)
|
|
15
16
|
|
|
16
|
-
Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to use.
|
|
17
|
+
**Prefer platform MCP tools over the platform CLI** when the MCP server provides typed tools with structured input/output. Use them as the primary interface for issue tracker and repository operations. Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to use.
|
|
17
18
|
|
|
18
19
|
### Prerequisites
|
|
19
20
|
|
|
@@ -25,11 +26,7 @@ Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to
|
|
|
25
26
|
|
|
26
27
|
### Platform CLI Fallback Reference
|
|
27
28
|
|
|
28
|
-
**Fallback to the platform CLI only when
|
|
29
|
-
- The MCP tool catalog lacks the specific capability.
|
|
30
|
-
- An MCP call fails repeatedly and the CLI provides a viable alternative.
|
|
31
|
-
|
|
32
|
-
**Never** use the platform CLI for operations that have a direct MCP equivalent (issue CRUD, PR/MR CRUD, search, labels).
|
|
29
|
+
**Fallback to the platform CLI only when** the MCP tool catalog lacks the capability, or an MCP call fails repeatedly and the CLI provides a viable alternative. **Never** use the CLI for operations that have a direct MCP equivalent (issue CRUD, PR/MR CRUD, search, labels).
|
|
33
30
|
|
|
34
31
|
| Action | GitHub | Azure DevOps | GitLab |
|
|
35
32
|
|--------|--------|--------------|--------|
|
|
@@ -54,17 +51,21 @@ Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to
|
|
|
54
51
|
Use documentation MCP (e.g., Context7) to retrieve up-to-date, version-specific documentation for external libraries and frameworks. This prevents hallucinated APIs and outdated patterns.
|
|
55
52
|
|
|
56
53
|
**When to use:**
|
|
57
|
-
- Working with any external dependency.
|
|
54
|
+
- Working with any external dependency, or reviewing code that uses third-party libraries.
|
|
58
55
|
- Verifying API signatures, configuration options, or migration paths.
|
|
59
|
-
-
|
|
60
|
-
- Writing tests with external test frameworks.
|
|
61
|
-
- Debugging errors from external libraries.
|
|
56
|
+
- Writing tests with external test frameworks, or debugging errors from external libraries.
|
|
62
57
|
|
|
63
58
|
**When NOT to use:**
|
|
64
59
|
- Internal project specs — use project docs.
|
|
65
60
|
- Internal codebase patterns — use Grep, SemanticSearch, or exploration tools.
|
|
66
61
|
- General programming concepts not tied to a specific library.
|
|
67
62
|
|
|
63
|
+
**Fallback when documentation MCP is unavailable:**
|
|
64
|
+
If no documentation MCP server (e.g., Context7) is in `mcp.servers` in `.hatch3r/hatch.json`:
|
|
65
|
+
- Fall back to web research (§C) for the library's official docs, then read the installed version's type definitions in `node_modules` (or the language equivalent).
|
|
66
|
+
- Note in your output when a version-specific lookup would have been valuable (e.g., "Context7 lookup recommended for the express@5 migration but not available").
|
|
67
|
+
- Do NOT assert API signatures from memory — flag any unverified third-party API as needing confirmation.
|
|
68
|
+
|
|
68
69
|
## C. Web Research for External Context
|
|
69
70
|
|
|
70
71
|
Use web search to retrieve current, real-world information not available in project docs or library documentation.
|
|
@@ -72,20 +73,17 @@ Use web search to retrieve current, real-world information not available in proj
|
|
|
72
73
|
**When to use:**
|
|
73
74
|
- Latest security advisories, CVEs, or vulnerability disclosures for dependencies.
|
|
74
75
|
- Breaking changes or deprecations in upcoming dependency versions.
|
|
75
|
-
- Current best practices for architecture
|
|
76
|
+
- Current best practices for architecture, deployment, or tooling, including comparing alternatives against current community consensus.
|
|
76
77
|
- Novel problems with no match in docs (e.g., obscure error messages, platform-specific quirks).
|
|
77
|
-
- Comparing alternative approaches or tools with current community consensus.
|
|
78
78
|
|
|
79
79
|
**When NOT to use:**
|
|
80
80
|
- Questions answerable from project specs or codebase exploration.
|
|
81
|
-
- Standard library API questions (use documentation MCP instead).
|
|
82
|
-
- Internal project decisions (use project ADRs).
|
|
81
|
+
- Standard library API questions (use documentation MCP instead), or internal project decisions (use project ADRs).
|
|
83
82
|
|
|
84
83
|
**Fallback when web search is unavailable:**
|
|
85
|
-
If no web search MCP server
|
|
86
|
-
- Note in your output when web research would have been valuable (e.g., "Web research recommended for CVE verification but not available").
|
|
84
|
+
If no web search MCP server (e.g., `brave-search`) is in `mcp.servers` in `.hatch3r/hatch.json`:
|
|
85
|
+
- Note in your output when web research would have been valuable (e.g., "Web research recommended for CVE verification but not available"), and flag security-sensitive decisions that would benefit from current advisory data.
|
|
87
86
|
- Rely more heavily on Context7 documentation MCP and codebase exploration.
|
|
88
|
-
- Flag security-sensitive decisions that would benefit from current advisory data.
|
|
89
87
|
- Do NOT silently skip web research — surface the limitation so the user can decide whether to enable it.
|
|
90
88
|
|
|
91
89
|
## D. Browser Verification for UI Changes
|
|
@@ -96,26 +94,26 @@ Use browser automation MCP tools to visually verify UI changes after automated t
|
|
|
96
94
|
- Verifying UI component changes render as specified in the design or acceptance criteria.
|
|
97
95
|
- Reproducing and confirming fixes for visually observable bugs.
|
|
98
96
|
- Accessibility auditing (keyboard nav, contrast, focus indicators).
|
|
99
|
-
- Frontend performance profiling (CPU, frame rate, memory).
|
|
100
|
-
- Capturing screenshot evidence for PRs.
|
|
97
|
+
- Frontend performance profiling (CPU, frame rate, memory), and capturing screenshot evidence for PRs.
|
|
101
98
|
|
|
102
99
|
**When NOT to use:**
|
|
103
100
|
- Pure backend or API changes with no visual impact.
|
|
104
101
|
- Configuration or infrastructure changes.
|
|
105
102
|
- Code refactors that do not alter rendered output.
|
|
106
103
|
|
|
107
|
-
**
|
|
108
|
-
|
|
109
|
-
-
|
|
104
|
+
**Fallback when browser MCP is unavailable:**
|
|
105
|
+
If no browser automation MCP server is configured, defer interactive verification:
|
|
106
|
+
- For accessibility, run an in-process axe-core check (`@axe-core/playwright`, `jest-axe`, or `axe-core` in a jsdom test) in the test suite to catch violations without a live browser.
|
|
107
|
+
- Note in your output that visual/UI confirmation was skipped and recommend manual review before merge — do NOT silently skip it.
|
|
108
|
+
|
|
109
|
+
**Available tools:** IDE-native browser MCP (e.g., `cursor-ide-browser` in Cursor); Playwright MCP (`@anthropic/mcp-playwright`) for cross-editor browser automation.
|
|
110
110
|
|
|
111
111
|
## E. Knowledge Augmentation Priority
|
|
112
112
|
|
|
113
|
-
When seeking information, follow this priority order:
|
|
113
|
+
When seeking information, follow this priority order, combining sources when valuable (e.g., read the spec, then verify external API usage with docs MCP, then check for recent advisories via web research):
|
|
114
114
|
|
|
115
115
|
1. **Project specs and ADRs** — authoritative for project-specific behavior, constraints, and decisions.
|
|
116
|
-
2. **Codebase exploration** (code search
|
|
117
|
-
3. **Documentation MCP** — authoritative for external library/framework APIs and patterns.
|
|
116
|
+
2. **Codebase exploration** (code search, semantic code search) — ground truth for current implementation.
|
|
117
|
+
3. **Documentation MCP** — authoritative for external library/framework APIs and patterns. Falls back to web research + installed type definitions when unavailable (§B).
|
|
118
118
|
4. **Web research** — current events, best practices, security advisories, novel problems.
|
|
119
|
-
5. **Browser verification** — visual confirmation of UI changes after automated tests pass.
|
|
120
|
-
|
|
121
|
-
Combine sources when valuable: read the spec first, then verify external API usage with docs MCP, then check for recent advisories via web research.
|
|
119
|
+
5. **Browser verification** — visual confirmation of UI changes after automated tests pass; falls back to in-process axe-core for a11y when unavailable (§D).
|
|
@@ -5,11 +5,11 @@ alwaysApply: false
|
|
|
5
5
|
---
|
|
6
6
|
# Tooling Hierarchy
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**Pillars:** P3 (Adapter & External Tool Currency), P7 (Speed & Token Efficiency)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## A. Platform MCP-First (when available)
|
|
11
11
|
|
|
12
|
-
Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to use.
|
|
12
|
+
**Prefer platform MCP tools over the platform CLI** when the MCP server provides typed tools with structured input/output. Use them as the primary interface for issue tracker and repository operations. Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to use.
|
|
13
13
|
|
|
14
14
|
### Prerequisites
|
|
15
15
|
|
|
@@ -21,11 +21,7 @@ Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to
|
|
|
21
21
|
|
|
22
22
|
### Platform CLI Fallback Reference
|
|
23
23
|
|
|
24
|
-
**Fallback to the platform CLI only when
|
|
25
|
-
- The MCP tool catalog lacks the specific capability.
|
|
26
|
-
- An MCP call fails repeatedly and the CLI provides a viable alternative.
|
|
27
|
-
|
|
28
|
-
**Never** use the platform CLI for operations that have a direct MCP equivalent (issue CRUD, PR/MR CRUD, search, labels).
|
|
24
|
+
**Fallback to the platform CLI only when** the MCP tool catalog lacks the capability, or an MCP call fails repeatedly and the CLI provides a viable alternative. **Never** use the CLI for operations that have a direct MCP equivalent (issue CRUD, PR/MR CRUD, search, labels).
|
|
29
25
|
|
|
30
26
|
| Action | GitHub | Azure DevOps | GitLab |
|
|
31
27
|
|--------|--------|--------------|--------|
|
|
@@ -50,17 +46,21 @@ Read `platform` from `.hatch3r/hatch.json` to determine which platform tools to
|
|
|
50
46
|
Use documentation MCP (e.g., Context7) to retrieve up-to-date, version-specific documentation for external libraries and frameworks. This prevents hallucinated APIs and outdated patterns.
|
|
51
47
|
|
|
52
48
|
**When to use:**
|
|
53
|
-
- Working with any external dependency.
|
|
49
|
+
- Working with any external dependency, or reviewing code that uses third-party libraries.
|
|
54
50
|
- Verifying API signatures, configuration options, or migration paths.
|
|
55
|
-
-
|
|
56
|
-
- Writing tests with external test frameworks.
|
|
57
|
-
- Debugging errors from external libraries.
|
|
51
|
+
- Writing tests with external test frameworks, or debugging errors from external libraries.
|
|
58
52
|
|
|
59
53
|
**When NOT to use:**
|
|
60
54
|
- Internal project specs — use project docs.
|
|
61
55
|
- Internal codebase patterns — use Grep, SemanticSearch, or exploration tools.
|
|
62
56
|
- General programming concepts not tied to a specific library.
|
|
63
57
|
|
|
58
|
+
**Fallback when documentation MCP is unavailable:**
|
|
59
|
+
If no documentation MCP server (e.g., Context7) is in `mcp.servers` in `.hatch3r/hatch.json`:
|
|
60
|
+
- Fall back to web research (§C) for the library's official docs, then read the installed version's type definitions in `node_modules` (or the language equivalent).
|
|
61
|
+
- Note in your output when a version-specific lookup would have been valuable (e.g., "Context7 lookup recommended for the express@5 migration but not available").
|
|
62
|
+
- Do NOT assert API signatures from memory — flag any unverified third-party API as needing confirmation.
|
|
63
|
+
|
|
64
64
|
## C. Web Research for External Context
|
|
65
65
|
|
|
66
66
|
Use web search to retrieve current, real-world information not available in project docs or library documentation.
|
|
@@ -68,20 +68,17 @@ Use web search to retrieve current, real-world information not available in proj
|
|
|
68
68
|
**When to use:**
|
|
69
69
|
- Latest security advisories, CVEs, or vulnerability disclosures for dependencies.
|
|
70
70
|
- Breaking changes or deprecations in upcoming dependency versions.
|
|
71
|
-
- Current best practices for architecture
|
|
71
|
+
- Current best practices for architecture, deployment, or tooling, including comparing alternatives against current community consensus.
|
|
72
72
|
- Novel problems with no match in docs (e.g., obscure error messages, platform-specific quirks).
|
|
73
|
-
- Comparing alternative approaches or tools with current community consensus.
|
|
74
73
|
|
|
75
74
|
**When NOT to use:**
|
|
76
75
|
- Questions answerable from project specs or codebase exploration.
|
|
77
|
-
- Standard library API questions (use documentation MCP instead).
|
|
78
|
-
- Internal project decisions (use project ADRs).
|
|
76
|
+
- Standard library API questions (use documentation MCP instead), or internal project decisions (use project ADRs).
|
|
79
77
|
|
|
80
78
|
**Fallback when web search is unavailable:**
|
|
81
|
-
If no web search MCP server
|
|
82
|
-
- Note in your output when web research would have been valuable (e.g., "Web research recommended for CVE verification but not available").
|
|
79
|
+
If no web search MCP server (e.g., `brave-search`) is in `mcp.servers` in `.hatch3r/hatch.json`:
|
|
80
|
+
- Note in your output when web research would have been valuable (e.g., "Web research recommended for CVE verification but not available"), and flag security-sensitive decisions that would benefit from current advisory data.
|
|
83
81
|
- Rely more heavily on Context7 documentation MCP and codebase exploration.
|
|
84
|
-
- Flag security-sensitive decisions that would benefit from current advisory data.
|
|
85
82
|
- Do NOT silently skip web research — surface the limitation so the user can decide whether to enable it.
|
|
86
83
|
|
|
87
84
|
## D. Browser Verification for UI Changes
|
|
@@ -92,26 +89,26 @@ Use browser automation MCP tools to visually verify UI changes after automated t
|
|
|
92
89
|
- Verifying UI component changes render as specified in the design or acceptance criteria.
|
|
93
90
|
- Reproducing and confirming fixes for visually observable bugs.
|
|
94
91
|
- Accessibility auditing (keyboard nav, contrast, focus indicators).
|
|
95
|
-
- Frontend performance profiling (CPU, frame rate, memory).
|
|
96
|
-
- Capturing screenshot evidence for PRs.
|
|
92
|
+
- Frontend performance profiling (CPU, frame rate, memory), and capturing screenshot evidence for PRs.
|
|
97
93
|
|
|
98
94
|
**When NOT to use:**
|
|
99
95
|
- Pure backend or API changes with no visual impact.
|
|
100
96
|
- Configuration or infrastructure changes.
|
|
101
97
|
- Code refactors that do not alter rendered output.
|
|
102
98
|
|
|
103
|
-
**
|
|
104
|
-
|
|
105
|
-
-
|
|
99
|
+
**Fallback when browser MCP is unavailable:**
|
|
100
|
+
If no browser automation MCP server is configured, defer interactive verification:
|
|
101
|
+
- For accessibility, run an in-process axe-core check (`@axe-core/playwright`, `jest-axe`, or `axe-core` in a jsdom test) in the test suite to catch violations without a live browser.
|
|
102
|
+
- Note in your output that visual/UI confirmation was skipped and recommend manual review before merge — do NOT silently skip it.
|
|
103
|
+
|
|
104
|
+
**Available tools:** IDE-native browser MCP (e.g., `cursor-ide-browser` in Cursor); Playwright MCP (`@anthropic/mcp-playwright`) for cross-editor browser automation.
|
|
106
105
|
|
|
107
106
|
## E. Knowledge Augmentation Priority
|
|
108
107
|
|
|
109
|
-
When seeking information, follow this priority order:
|
|
108
|
+
When seeking information, follow this priority order, combining sources when valuable (e.g., read the spec, then verify external API usage with docs MCP, then check for recent advisories via web research):
|
|
110
109
|
|
|
111
110
|
1. **Project specs and ADRs** — authoritative for project-specific behavior, constraints, and decisions.
|
|
112
|
-
2. **Codebase exploration** (code search
|
|
113
|
-
3. **Documentation MCP** — authoritative for external library/framework APIs and patterns.
|
|
111
|
+
2. **Codebase exploration** (code search, semantic code search) — ground truth for current implementation.
|
|
112
|
+
3. **Documentation MCP** — authoritative for external library/framework APIs and patterns. Falls back to web research + installed type definitions when unavailable (§B).
|
|
114
113
|
4. **Web research** — current events, best practices, security advisories, novel problems.
|
|
115
|
-
5. **Browser verification** — visual confirmation of UI changes after automated tests pass.
|
|
116
|
-
|
|
117
|
-
Combine sources when valuable: read the spec first, then verify external API usage with docs MCP, then check for recent advisories via web research.
|
|
114
|
+
5. **Browser verification** — visual confirmation of UI changes after automated tests pass; falls back to in-process axe-core for a11y when unavailable (§D).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-typescript-patterns
|
|
3
|
+
type: rule
|
|
4
|
+
description: TypeScript and JavaScript typing mechanics — satisfies over as, discriminated unions, branded types, strict utility types, barrel exports, and import ordering
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "**/*.ts,**/*.tsx,**/*.mts,**/*.cts,**/*.js,**/*.jsx,**/*.mjs,**/*.cjs,**/tsconfig*.json,**/.eslintrc*,**/eslint.config.*"
|
|
7
|
+
tags: [implementation, lang:typescript]
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
9
|
+
cache_friendly: true
|
|
10
|
+
---
|
|
11
|
+
# TypeScript Patterns
|
|
12
|
+
|
|
13
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
|
|
14
|
+
|
|
15
|
+
> Applies when the project ships TypeScript or JavaScript. Detection signals: `tsconfig.json` at repo root, `*.ts`/`*.tsx` source files, or an ESLint config. This rule carries the TypeScript/JavaScript-specific typing, barrel, and import mechanics that were split out of `rules/hatch3r-code-standards.md` (the language-agnostic code floor) under D14-14 / SA14.1-F3, so these idioms bind only on TS/JS repos and not as a floor on Go, Rust, Python, Ruby, or Java repos where they are nonsensical.
|
|
16
|
+
|
|
17
|
+
## TypeScript-Specific Patterns
|
|
18
|
+
|
|
19
|
+
### `satisfies` Over `as`
|
|
20
|
+
|
|
21
|
+
- Use `satisfies` to validate a value conforms to a type while preserving its narrower inferred type. Prefer `satisfies Config` over `as Config` because `as` silences type errors and loses narrowing.
|
|
22
|
+
- Use `as const` for literal types in configuration objects, action types, and discriminant values. Combine with `satisfies` when both literal inference and shape validation are needed: `const config = { ... } as const satisfies Config`.
|
|
23
|
+
|
|
24
|
+
### Discriminated Unions
|
|
25
|
+
|
|
26
|
+
- Model domain variants with discriminated unions over polymorphic classes or `type` string checks. Every variant must share a common literal discriminant field (e.g., `kind`, `type`, `status`).
|
|
27
|
+
- Use a `switch` that handles every variant, with a `never` default case so the compiler errors when a new variant is added but not handled.
|
|
28
|
+
|
|
29
|
+
### Branded Types
|
|
30
|
+
|
|
31
|
+
- Use branded types for domain identifiers that must not be accidentally interchanged (e.g., `UserId`, `OrderId`, `Currency`). Implement via intersection with a unique symbol: `type UserId = string & { readonly __brand: unique symbol }`.
|
|
32
|
+
- Provide factory functions (`createUserId(raw: string): UserId`) that validate the input before branding. Never brand raw values without validation.
|
|
33
|
+
|
|
34
|
+
### Strict Utility Types
|
|
35
|
+
|
|
36
|
+
- Prefer `Readonly<T>` for function parameters and return types that should not be mutated by the caller.
|
|
37
|
+
- Use `Record<string, never>` instead of `{}` to represent an empty object type. `{}` matches any non-nullish value.
|
|
38
|
+
- Avoid `Omit` with string literals that do not exist on the source type — use `satisfies` or a helper type that enforces key existence.
|
|
39
|
+
|
|
40
|
+
## Barrel Exports
|
|
41
|
+
|
|
42
|
+
- Use barrel files (`index.ts`) at module boundaries to define the public API of a module. Re-export only the types and functions intended for external consumption.
|
|
43
|
+
- Never import from a module's internal files directly — import from the barrel. Enforce with ESLint `no-restricted-imports` or equivalent.
|
|
44
|
+
- Keep barrel files thin — only re-exports, no logic. A barrel with logic is a code smell.
|
|
45
|
+
|
|
46
|
+
## Import Ordering
|
|
47
|
+
|
|
48
|
+
Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import`). The canonical order:
|
|
49
|
+
|
|
50
|
+
1. **Built-in modules** — `node:fs`, `node:path`, etc.
|
|
51
|
+
2. **External packages** — `zod`, `express`, etc.
|
|
52
|
+
3. **Internal aliases** — `@/utils`, `@/types`, etc.
|
|
53
|
+
4. **Relative imports** — `./sibling`, `../parent`, etc.
|
|
54
|
+
5. **Type-only imports** — `import type { ... }` (grouped separately where the linter supports it)
|
|
55
|
+
|
|
56
|
+
Separate each group with a blank line. Sort alphabetically within each group.
|
|
57
|
+
|
|
58
|
+
Reference: `rules/hatch3r-code-standards.md` (language-agnostic code floor — naming, size caps, Result-type error handling, module boundaries, dead-code, untrusted-content hygiene), `rules/hatch3r-edge-case-discipline.md` (every-variant-matching and silent-catch rules that build on the discriminated-union mechanics above).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: TypeScript and JavaScript typing mechanics — satisfies over as, discriminated unions, branded types, strict utility types, barrel exports, and import ordering
|
|
3
|
+
globs: ["**/*.ts", "**/*.tsx", "**/*.mts", "**/*.cts", "**/*.js", "**/*.jsx", "**/*.mjs", "**/*.cjs", "**/tsconfig*.json", "**/.eslintrc*", "**/eslint.config.*"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# TypeScript Patterns
|
|
7
|
+
|
|
8
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
|
|
9
|
+
|
|
10
|
+
> Applies when the project ships TypeScript or JavaScript. Detection signals: `tsconfig.json` at repo root, `*.ts`/`*.tsx` source files, or an ESLint config. This rule carries the TypeScript/JavaScript-specific typing, barrel, and import mechanics that were split out of `rules/hatch3r-code-standards.md` (the language-agnostic code floor) under D14-14 / SA14.1-F3, so these idioms bind only on TS/JS repos and not as a floor on Go, Rust, Python, Ruby, or Java repos where they are nonsensical.
|
|
11
|
+
|
|
12
|
+
## TypeScript-Specific Patterns
|
|
13
|
+
|
|
14
|
+
### `satisfies` Over `as`
|
|
15
|
+
|
|
16
|
+
- Use `satisfies` to validate a value conforms to a type while preserving its narrower inferred type. Prefer `satisfies Config` over `as Config` because `as` silences type errors and loses narrowing.
|
|
17
|
+
- Use `as const` for literal types in configuration objects, action types, and discriminant values. Combine with `satisfies` when both literal inference and shape validation are needed: `const config = { ... } as const satisfies Config`.
|
|
18
|
+
|
|
19
|
+
### Discriminated Unions
|
|
20
|
+
|
|
21
|
+
- Model domain variants with discriminated unions over polymorphic classes or `type` string checks. Every variant must share a common literal discriminant field (e.g., `kind`, `type`, `status`).
|
|
22
|
+
- Use a `switch` that handles every variant, with a `never` default case so the compiler errors when a new variant is added but not handled.
|
|
23
|
+
|
|
24
|
+
### Branded Types
|
|
25
|
+
|
|
26
|
+
- Use branded types for domain identifiers that must not be accidentally interchanged (e.g., `UserId`, `OrderId`, `Currency`). Implement via intersection with a unique symbol: `type UserId = string & { readonly __brand: unique symbol }`.
|
|
27
|
+
- Provide factory functions (`createUserId(raw: string): UserId`) that validate the input before branding. Never brand raw values without validation.
|
|
28
|
+
|
|
29
|
+
### Strict Utility Types
|
|
30
|
+
|
|
31
|
+
- Prefer `Readonly<T>` for function parameters and return types that should not be mutated by the caller.
|
|
32
|
+
- Use `Record<string, never>` instead of `{}` to represent an empty object type. `{}` matches any non-nullish value.
|
|
33
|
+
- Avoid `Omit` with string literals that do not exist on the source type — use `satisfies` or a helper type that enforces key existence.
|
|
34
|
+
|
|
35
|
+
## Barrel Exports
|
|
36
|
+
|
|
37
|
+
- Use barrel files (`index.ts`) at module boundaries to define the public API of a module. Re-export only the types and functions intended for external consumption.
|
|
38
|
+
- Never import from a module's internal files directly — import from the barrel. Enforce with ESLint `no-restricted-imports` or equivalent.
|
|
39
|
+
- Keep barrel files thin — only re-exports, no logic. A barrel with logic is a code smell.
|
|
40
|
+
|
|
41
|
+
## Import Ordering
|
|
42
|
+
|
|
43
|
+
Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import`). The canonical order:
|
|
44
|
+
|
|
45
|
+
1. **Built-in modules** — `node:fs`, `node:path`, etc.
|
|
46
|
+
2. **External packages** — `zod`, `express`, etc.
|
|
47
|
+
3. **Internal aliases** — `@/utils`, `@/types`, etc.
|
|
48
|
+
4. **Relative imports** — `./sibling`, `../parent`, etc.
|
|
49
|
+
5. **Type-only imports** — `import type { ... }` (grouped separately where the linter supports it)
|
|
50
|
+
|
|
51
|
+
Separate each group with a blank line. Sort alphabetically within each group.
|
|
52
|
+
|
|
53
|
+
Reference: `rules/hatch3r-code-standards.md` (language-agnostic code floor — naming, size caps, Result-type error handling, module boundaries, dead-code, untrusted-content hygiene), `rules/hatch3r-edge-case-discipline.md` (every-variant-matching and silent-catch rules that build on the discriminated-union mechanics above).
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
id: hatch3r-ux-states-and-flows
|
|
3
3
|
type: rule
|
|
4
4
|
description: Four-state surface contract (loading/empty/error/partial), user-flow decomposition before implementation, and microcopy + tone discipline for end-user UIs
|
|
5
|
-
scope:
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "**/*.vue,**/*.jsx,**/*.tsx,**/*.svelte,**/components/**,**/*.html,**/messages/**,**/locales/**,**/copy/**"
|
|
6
7
|
tags: [implementation, floor:ui-ux, ux, ui, frontend]
|
|
7
8
|
precedence: high
|
|
8
9
|
quality_charter: agents/shared/quality-charter.md
|
|
@@ -24,7 +25,7 @@ Flow decomposition is also the contract between the feature designer and the rev
|
|
|
24
25
|
|
|
25
26
|
## Four-State Surface Contract
|
|
26
27
|
|
|
27
|
-
Every async view renders all four states. Missing any state on an async view is a blocker
|
|
28
|
+
Every async view renders all four states. Missing any state on an async view is a blocker: the empty, error, and partial states are each a distinct cause-and-recovery path, and dropping one strands the user with no diagnosis or next action when that path fires (an empty result reads as a broken load, a failed request reads as a hang, a partial result silently hides the failed subset). The blocker is justified by recovery-path completeness, not by an omission-frequency statistic. NN/g empty-state and error-message guidance ([empty states](https://www.nngroup.com/articles/empty-state-interface-design/), [error messages](https://www.nngroup.com/articles/error-message-guidelines/), both accessed 2026-06-05, NN/g, official-docs) anchors the per-state rendering rules below.
|
|
28
29
|
|
|
29
30
|
| State | Trigger | Rendering rules |
|
|
30
31
|
|-------|---------|-----------------|
|
|
@@ -37,6 +38,10 @@ State machines drive these transitions — model the view as `idle | loading | s
|
|
|
37
38
|
|
|
38
39
|
Transitions between states have their own rules. Loading -> success swaps the skeleton for content without layout shift (the skeleton was already the final dimensions). Loading -> error replaces the skeleton with the error surface and announces it via `role="alert"`. Loading -> empty replaces the skeleton with the sub-typed empty surface (cold / filter / permission). Success -> partial overlays the banner without re-rendering the succeeded subset. Every transition has a measurable duration and an announcement strategy — never silent.
|
|
39
40
|
|
|
41
|
+
### Partial-state fixture recipe
|
|
42
|
+
|
|
43
|
+
Loading, empty, and error each fixture from one mocked response (delay it, return `[]`, return a 5xx). Partial is the hard case the snapshot blocker most often strands on: it requires two concurrent requests resolving to opposite outcomes in a single render. Build it one of two ways. (1) **MSW per-endpoint**: register two handlers in the same worker — `http.get('/api/widgets', () => HttpResponse.json(widgets))` and `http.get('/api/sidebar', () => HttpResponse.json(null, { status: 500 }))` — so the view mounts its 200 subset and its 500 subset together and the partial banner renders against real degraded data. (2) **`Promise.allSettled` with a forced rejection**: have the fixture's data layer resolve the succeeded fetch and reject the failed one (`Promise.allSettled([ok(widgets), Promise.reject(new Error('sidebar 500'))])`), then assert the component reads `status === 'rejected'` on the failed entry and renders the banner + retry for that subset only. Either path produces the snapshot Gate 4 (`skills/hatch3r-ui-ux-verify/SKILL.md` -> Gate 4) requires; do not stub the partial state by hand-editing the success snapshot, which never exercises the failed-subset render path.
|
|
44
|
+
|
|
40
45
|
## First-Run vs Filter vs Network — Content Structure
|
|
41
46
|
|
|
42
47
|
| State type | Heading level | Visual cue | CTA | Example |
|
|
@@ -109,7 +114,7 @@ Anchored to GOV.UK Design System (error pattern, plain English) and IBM Carbon (
|
|
|
109
114
|
## Mobile and Touch
|
|
110
115
|
|
|
111
116
|
- Touch target minimum: 44pt on iOS HIG, 48dp on Material 3. The platform minimum supersedes WCAG SC 2.5.8 (24x24 CSS px) on touch surfaces — use the stricter bound.
|
|
112
|
-
- Spacing between adjacent interactive elements: >=8px to avoid mis-taps. Measure on the rendered DOM, not on the design comp — padding and margins count toward hit area only when they belong to the same interactive element.
|
|
117
|
+
- Spacing between adjacent interactive elements: >=8px to avoid mis-taps. Measure on the rendered DOM (web) or the rendered native view tree (RN/Flutter/SwiftUI/Compose), not on the design comp — padding and margins count toward hit area only when they belong to the same interactive element.
|
|
113
118
|
- Avoid tap-to-reveal (hover-only tooltip) on touch surfaces. Use permanent labels or long-press with a visible affordance. Hover-only tooltips fail WCAG SC 1.4.13 Content on Hover or Focus on touch.
|
|
114
119
|
- Apply `env(safe-area-inset-*)` on full-bleed surfaces so primary CTAs do not sit under the iOS home indicator, notch, or Android gesture nav. Native equivalents: `safeAreaInsets` on iOS, `WindowInsets` on Android.
|
|
115
120
|
- Dynamic Type on iOS (`UIFont.preferredFont(forTextStyle:)` or SwiftUI `Font.body`) and rem-based font scaling on Android/web. Never use hard-coded `px` for text — fails text-resize verification at 200% zoom (WCAG SC 1.4.4) and 400% reflow (SC 1.4.10).
|
|
@@ -117,6 +122,7 @@ Anchored to GOV.UK Design System (error pattern, plain English) and IBM Carbon (
|
|
|
117
122
|
- Pointer-event vs touch-event: prefer pointer events (`pointerdown`, `pointermove`, `pointerup`) so the same handler covers mouse, touch, pen. Synthesize click events on tap with a 300ms tolerance only on legacy mobile browsers — modern engines emit click immediately.
|
|
118
123
|
- Pinch-zoom: never disable user zoom on the viewport meta tag. WCAG SC 1.4.4 fails on disabled zoom. Use `maximum-scale=5` to allow up to 5x zoom while suppressing zoom-on-focus jitter.
|
|
119
124
|
- Orientation lock: respect WCAG SC 1.3.4 — content adapts to portrait and landscape unless an essential exception applies (e.g., piano keyboard, blueprint editor). Document the exception in the spec.
|
|
125
|
+
- Native verification: the touch obligations above hold for React Native, Flutter, SwiftUI/UIKit, and Android Compose/View targets, which have no DOM for axe-core to scan. Verify them with the framework-native a11y check (`eslint-plugin-react-native-a11y`; Flutter `meets_guideline` matchers; Espresso `AccessibilityChecks`; XCUITest `performAccessibilityAudit()`) per `rules/hatch3r-accessibility-standards.md` -> Mobile-native verification path; a native obligation with no such check is `BLOCKED_MISSING_TOOL`, not satisfied.
|
|
120
126
|
|
|
121
127
|
## Heuristic Verification Gate
|
|
122
128
|
|
|
@@ -134,7 +140,8 @@ Run every check below before declaring a feature done. A "done" claim without th
|
|
|
134
140
|
## References
|
|
135
141
|
|
|
136
142
|
- WCAG 2.2 AA — new success criteria SC 2.5.8 (Target Size), SC 2.4.11 (Focus Not Obscured), SC 2.5.7 (Dragging Movements), SC 1.4.13 (Content on Hover or Focus)
|
|
137
|
-
-
|
|
143
|
+
- Nielsen Norman Group, "Designing Empty States in Complex Applications: 3 Guidelines" — https://www.nngroup.com/articles/empty-state-interface-design/ (accessed 2026-06-05, NN/g, official-docs)
|
|
144
|
+
- Nielsen Norman Group, "Error-Message Guidelines" — https://www.nngroup.com/articles/error-message-guidelines/ (accessed 2026-06-05, NN/g, official-docs)
|
|
138
145
|
- GOV.UK Design System — error message and error summary components, plain English readability guidance
|
|
139
146
|
- IBM Carbon Design System — voice and tone content guidelines, error message patterns
|
|
140
147
|
- Baymard Institute — inline form validation research and disabled-submit findings (top-10 form-abandonment driver)
|
|
@@ -20,7 +20,7 @@ Flow decomposition is also the contract between the feature designer and the rev
|
|
|
20
20
|
|
|
21
21
|
## Four-State Surface Contract
|
|
22
22
|
|
|
23
|
-
Every async view renders all four states. Missing any state on an async view is a blocker
|
|
23
|
+
Every async view renders all four states. Missing any state on an async view is a blocker: the empty, error, and partial states are each a distinct cause-and-recovery path, and dropping one strands the user with no diagnosis or next action when that path fires (an empty result reads as a broken load, a failed request reads as a hang, a partial result silently hides the failed subset). The blocker is justified by recovery-path completeness, not by an omission-frequency statistic. NN/g empty-state and error-message guidance ([empty states](https://www.nngroup.com/articles/empty-state-interface-design/), [error messages](https://www.nngroup.com/articles/error-message-guidelines/), both accessed 2026-06-05, NN/g, official-docs) anchors the per-state rendering rules below.
|
|
24
24
|
|
|
25
25
|
| State | Trigger | Rendering rules |
|
|
26
26
|
|-------|---------|-----------------|
|
|
@@ -33,6 +33,10 @@ State machines drive these transitions — model the view as `idle | loading | s
|
|
|
33
33
|
|
|
34
34
|
Transitions between states have their own rules. Loading -> success swaps the skeleton for content without layout shift (the skeleton was already the final dimensions). Loading -> error replaces the skeleton with the error surface and announces it via `role="alert"`. Loading -> empty replaces the skeleton with the sub-typed empty surface (cold / filter / permission). Success -> partial overlays the banner without re-rendering the succeeded subset. Every transition has a measurable duration and an announcement strategy — never silent.
|
|
35
35
|
|
|
36
|
+
### Partial-state fixture recipe
|
|
37
|
+
|
|
38
|
+
Loading, empty, and error each fixture from one mocked response (delay it, return `[]`, return a 5xx). Partial is the hard case the snapshot blocker most often strands on: it requires two concurrent requests resolving to opposite outcomes in a single render. Build it one of two ways. (1) **MSW per-endpoint**: register two handlers in the same worker — `http.get('/api/widgets', () => HttpResponse.json(widgets))` and `http.get('/api/sidebar', () => HttpResponse.json(null, { status: 500 }))` — so the view mounts its 200 subset and its 500 subset together and the partial banner renders against real degraded data. (2) **`Promise.allSettled` with a forced rejection**: have the fixture's data layer resolve the succeeded fetch and reject the failed one (`Promise.allSettled([ok(widgets), Promise.reject(new Error('sidebar 500'))])`), then assert the component reads `status === 'rejected'` on the failed entry and renders the banner + retry for that subset only. Either path produces the snapshot Gate 4 (`skills/hatch3r-ui-ux-verify/SKILL.md` -> Gate 4) requires; do not stub the partial state by hand-editing the success snapshot, which never exercises the failed-subset render path.
|
|
39
|
+
|
|
36
40
|
## First-Run vs Filter vs Network — Content Structure
|
|
37
41
|
|
|
38
42
|
| State type | Heading level | Visual cue | CTA | Example |
|
|
@@ -105,7 +109,7 @@ Anchored to GOV.UK Design System (error pattern, plain English) and IBM Carbon (
|
|
|
105
109
|
## Mobile and Touch
|
|
106
110
|
|
|
107
111
|
- Touch target minimum: 44pt on iOS HIG, 48dp on Material 3. The platform minimum supersedes WCAG SC 2.5.8 (24x24 CSS px) on touch surfaces — use the stricter bound.
|
|
108
|
-
- Spacing between adjacent interactive elements: >=8px to avoid mis-taps. Measure on the rendered DOM, not on the design comp — padding and margins count toward hit area only when they belong to the same interactive element.
|
|
112
|
+
- Spacing between adjacent interactive elements: >=8px to avoid mis-taps. Measure on the rendered DOM (web) or the rendered native view tree (RN/Flutter/SwiftUI/Compose), not on the design comp — padding and margins count toward hit area only when they belong to the same interactive element.
|
|
109
113
|
- Avoid tap-to-reveal (hover-only tooltip) on touch surfaces. Use permanent labels or long-press with a visible affordance. Hover-only tooltips fail WCAG SC 1.4.13 Content on Hover or Focus on touch.
|
|
110
114
|
- Apply `env(safe-area-inset-*)` on full-bleed surfaces so primary CTAs do not sit under the iOS home indicator, notch, or Android gesture nav. Native equivalents: `safeAreaInsets` on iOS, `WindowInsets` on Android.
|
|
111
115
|
- Dynamic Type on iOS (`UIFont.preferredFont(forTextStyle:)` or SwiftUI `Font.body`) and rem-based font scaling on Android/web. Never use hard-coded `px` for text — fails text-resize verification at 200% zoom (WCAG SC 1.4.4) and 400% reflow (SC 1.4.10).
|
|
@@ -113,6 +117,7 @@ Anchored to GOV.UK Design System (error pattern, plain English) and IBM Carbon (
|
|
|
113
117
|
- Pointer-event vs touch-event: prefer pointer events (`pointerdown`, `pointermove`, `pointerup`) so the same handler covers mouse, touch, pen. Synthesize click events on tap with a 300ms tolerance only on legacy mobile browsers — modern engines emit click immediately.
|
|
114
118
|
- Pinch-zoom: never disable user zoom on the viewport meta tag. WCAG SC 1.4.4 fails on disabled zoom. Use `maximum-scale=5` to allow up to 5x zoom while suppressing zoom-on-focus jitter.
|
|
115
119
|
- Orientation lock: respect WCAG SC 1.3.4 — content adapts to portrait and landscape unless an essential exception applies (e.g., piano keyboard, blueprint editor). Document the exception in the spec.
|
|
120
|
+
- Native verification: the touch obligations above hold for React Native, Flutter, SwiftUI/UIKit, and Android Compose/View targets, which have no DOM for axe-core to scan. Verify them with the framework-native a11y check (`eslint-plugin-react-native-a11y`; Flutter `meets_guideline` matchers; Espresso `AccessibilityChecks`; XCUITest `performAccessibilityAudit()`) per `rules/hatch3r-accessibility-standards.md` -> Mobile-native verification path; a native obligation with no such check is `BLOCKED_MISSING_TOOL`, not satisfied.
|
|
116
121
|
|
|
117
122
|
## Heuristic Verification Gate
|
|
118
123
|
|
|
@@ -130,7 +135,8 @@ Run every check below before declaring a feature done. A "done" claim without th
|
|
|
130
135
|
## References
|
|
131
136
|
|
|
132
137
|
- WCAG 2.2 AA — new success criteria SC 2.5.8 (Target Size), SC 2.4.11 (Focus Not Obscured), SC 2.5.7 (Dragging Movements), SC 1.4.13 (Content on Hover or Focus)
|
|
133
|
-
-
|
|
138
|
+
- Nielsen Norman Group, "Designing Empty States in Complex Applications: 3 Guidelines" — https://www.nngroup.com/articles/empty-state-interface-design/ (accessed 2026-06-05, NN/g, official-docs)
|
|
139
|
+
- Nielsen Norman Group, "Error-Message Guidelines" — https://www.nngroup.com/articles/error-message-guidelines/ (accessed 2026-06-05, NN/g, official-docs)
|
|
134
140
|
- GOV.UK Design System — error message and error summary components, plain English readability guidance
|
|
135
141
|
- IBM Carbon Design System — voice and tone content guidelines, error message patterns
|
|
136
142
|
- Baymard Institute — inline form validation research and disabled-submit findings (top-10 form-abandonment driver)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: hatch3r-a11y-audit
|
|
3
|
-
|
|
3
|
+
name: hatch3r-a11y-audit
|
|
4
|
+
type: skill
|
|
5
|
+
description: Runs a WCAG AA accessibility audit with findings and fixes across 7 scan categories (keyboard, contrast, ARIA, reduced motion, screen reader, high contrast, automated axe). Use when auditing accessibility or verifying WCAG compliance.
|
|
4
6
|
tags: [review, floor:ui-ux, a11y]
|
|
5
7
|
quality_charter: agents/shared/quality-charter.md
|
|
6
8
|
efficiency_patterns: agents/shared/efficiency-patterns.md
|
|
@@ -27,12 +29,7 @@ Before any work, scan the invocation for unresolved questions in scope, intent,
|
|
|
27
29
|
|
|
28
30
|
## Fan-out Discipline (P8 B2)
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
- Tier 1 (trivial single-file): inline execution acceptable.
|
|
32
|
-
- Tier 2 (multi-file or multi-concern): spawn parallel sub-agents per concern via the Task tool.
|
|
33
|
-
- Tier 3 (multi-module / high-risk): one fresh sub-agent per independent module or gate; orchestrator integrates only.
|
|
34
|
-
|
|
35
|
-
Never under-fan-out to save tokens. Token cost is dominated by quality and completeness gains. Emit `sub_agents_spawned: { count, rationale }` in your output.
|
|
32
|
+
Fan-out scales with task size; token cost never justifies serializing independent work (`rules/hatch3r-fan-out-discipline.md` P8 B2; `agents/shared/efficiency-patterns.md`). Emit `sub_agents_spawned: { count, rationale }` in your output.
|
|
36
33
|
|
|
37
34
|
## Progressive Disclosure
|
|
38
35
|
|
|
@@ -97,7 +94,7 @@ Use the severity rubric in `references/manual-audit-checklist.md` to assign seve
|
|
|
97
94
|
|
|
98
95
|
You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`) at the appropriate points:
|
|
99
96
|
|
|
100
|
-
- **`hatch3r-
|
|
97
|
+
- **`hatch3r-ui`** (CQ1) — MUST spawn to perform the full WCAG AA compliance audit autonomously (axe-core + design-token + four-state + deep ARIA / reduced-motion). Provide the list of surfaces/components to audit and the current violation list.
|
|
101
98
|
|
|
102
99
|
## Related Rules
|
|
103
100
|
|
|
@@ -119,3 +116,8 @@ You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`
|
|
|
119
116
|
- [ ] ARIA live regions for dynamic content
|
|
120
117
|
- [ ] Automated scan clean for critical/major
|
|
121
118
|
- [ ] Manual verification completed
|
|
119
|
+
|
|
120
|
+
## References
|
|
121
|
+
|
|
122
|
+
- [WCAG 2.2 — W3C Recommendation](https://www.w3.org/TR/WCAG22/) — accessed 2026-05-31, official-docs (W3C). Source for the success criteria (1.1.1, 1.4.3, 2.1.1, 4.1.2) and the 4.5:1 AA text-contrast ratio cited above.
|
|
123
|
+
- [axe-core rules and WCAG mapping](https://github.com/dequelabs/axe-core/blob/develop/doc/rule-descriptions.md) — accessed 2026-05-31, independent-analysis (Deque Systems). Source for the automated-scan rule IDs and impact levels mapped to WCAG criteria in Step 2.
|
|
@@ -49,10 +49,12 @@ Loaded on demand during Step 3 of the accessibility audit workflow when a detail
|
|
|
49
49
|
|
|
50
50
|
## Severity Cataloging
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
|
|
|
56
|
-
|
|
|
52
|
+
WCAG conformance levels map to the canonical audit severity 5-tier via `agents/shared/severity-mapping.md` — `Critical → Critical`, `Major → Medium` (escalate to High when blocking a critical user journey per the table's A11y-Auditor row), `Minor → Low`. Findings reported to consumers (`hatch3r-fixer`, audit registry) MUST use the canonical 5-tier or carry the mapping reference; this file documents the local WCAG vocabulary alongside the canonical pointer.
|
|
53
|
+
|
|
54
|
+
| Severity (local WCAG) | Canonical map | Definition | Examples |
|
|
55
|
+
| --------------------- | --------------------- | --------------------------------------- | ------------------------------------------------------------- |
|
|
56
|
+
| Critical | Critical | Blocks core functionality, fails WCAG A | Missing form labels, no keyboard access to primary actions |
|
|
57
|
+
| Major | Medium (High if blocking critical journey) | Significant barrier, fails WCAG AA | Contrast < 4.5:1, missing focus indicators, no reduced motion |
|
|
58
|
+
| Minor | Low | Improves experience, best practice | Redundant labels, suboptimal heading order |
|
|
57
59
|
|
|
58
60
|
Produce a findings table: ID, severity, WCAG criterion, description, location, fix suggestion. Prioritize critical first, then major. Minor can be batched.
|