hatch3r 1.3.0 → 1.5.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 (175) hide show
  1. package/README.md +12 -7
  2. package/agents/hatch3r-a11y-auditor.md +18 -11
  3. package/agents/hatch3r-architect.md +27 -12
  4. package/agents/hatch3r-ci-watcher.md +30 -9
  5. package/agents/hatch3r-context-rules.md +18 -8
  6. package/agents/hatch3r-dependency-auditor.md +30 -15
  7. package/agents/hatch3r-devops.md +18 -13
  8. package/agents/hatch3r-docs-writer.md +33 -12
  9. package/agents/hatch3r-fixer.md +46 -9
  10. package/agents/hatch3r-implementer.md +21 -9
  11. package/agents/hatch3r-learnings-loader.md +24 -7
  12. package/agents/hatch3r-lint-fixer.md +18 -9
  13. package/agents/hatch3r-perf-profiler.md +26 -10
  14. package/agents/hatch3r-researcher.md +57 -919
  15. package/agents/hatch3r-reviewer.md +29 -10
  16. package/agents/hatch3r-security-auditor.md +25 -10
  17. package/agents/hatch3r-test-writer.md +29 -9
  18. package/agents/modes/architecture.md +1 -0
  19. package/agents/modes/boundary-analysis.md +2 -1
  20. package/agents/modes/codebase-impact.md +1 -0
  21. package/agents/modes/complexity-risk.md +1 -0
  22. package/agents/modes/coverage-analysis.md +1 -0
  23. package/agents/modes/current-state.md +1 -0
  24. package/agents/modes/feature-design.md +1 -0
  25. package/agents/modes/impact-analysis.md +1 -0
  26. package/agents/modes/library-docs.md +2 -1
  27. package/agents/modes/migration-path.md +1 -0
  28. package/agents/modes/prior-art.md +1 -0
  29. package/agents/modes/refactoring-strategy.md +1 -0
  30. package/agents/modes/regression.md +1 -0
  31. package/agents/modes/requirements-elicitation.md +1 -0
  32. package/agents/modes/risk-assessment.md +1 -0
  33. package/agents/modes/risk-prioritization.md +1 -0
  34. package/agents/modes/root-cause.md +1 -0
  35. package/agents/modes/similar-implementation.md +2 -1
  36. package/agents/modes/symptom-trace.md +1 -0
  37. package/agents/modes/test-pattern.md +2 -1
  38. package/agents/shared/external-knowledge.md +31 -0
  39. package/agents/shared/quality-charter.md +96 -0
  40. package/checks/README.md +1 -0
  41. package/checks/accessibility.md +55 -0
  42. package/commands/board/pickup-azure-devops.md +5 -0
  43. package/commands/board/pickup-delegation-multi.md +9 -1
  44. package/commands/board/pickup-delegation.md +4 -0
  45. package/commands/board/pickup-github.md +5 -0
  46. package/commands/board/pickup-gitlab.md +5 -0
  47. package/commands/board/pickup-modes.md +1 -0
  48. package/commands/board/pickup-post-impl.md +9 -1
  49. package/commands/board/shared-azure-devops.md +14 -3
  50. package/commands/board/shared-board-overview.md +1 -0
  51. package/commands/board/shared-github.md +2 -0
  52. package/commands/board/shared-gitlab.md +10 -2
  53. package/commands/hatch3r-agent-customize.md +6 -1
  54. package/commands/hatch3r-api-spec.md +1 -0
  55. package/commands/hatch3r-benchmark.md +4 -3
  56. package/commands/hatch3r-board-fill.md +52 -9
  57. package/commands/hatch3r-board-groom.md +124 -7
  58. package/commands/hatch3r-board-init.md +7 -3
  59. package/commands/hatch3r-board-pickup.md +1 -0
  60. package/commands/hatch3r-board-refresh.md +1 -0
  61. package/commands/hatch3r-board-shared.md +71 -5
  62. package/commands/hatch3r-bug-plan.md +2 -1
  63. package/commands/hatch3r-codebase-map.md +4 -3
  64. package/commands/hatch3r-command-customize.md +6 -1
  65. package/commands/hatch3r-context-health.md +1 -0
  66. package/commands/hatch3r-cost-tracking.md +1 -0
  67. package/commands/hatch3r-debug.md +4 -3
  68. package/commands/hatch3r-dep-audit.md +3 -0
  69. package/commands/hatch3r-feature-plan.md +3 -2
  70. package/commands/hatch3r-healthcheck.md +1 -0
  71. package/commands/hatch3r-hooks.md +6 -1
  72. package/commands/hatch3r-learn.md +1 -0
  73. package/commands/hatch3r-migration-plan.md +3 -2
  74. package/commands/hatch3r-onboard.md +2 -1
  75. package/commands/hatch3r-project-spec.md +4 -3
  76. package/commands/hatch3r-quick-change.md +31 -3
  77. package/commands/hatch3r-recipe.md +1 -0
  78. package/commands/hatch3r-refactor-plan.md +2 -1
  79. package/commands/hatch3r-release.md +4 -1
  80. package/commands/hatch3r-revision.md +138 -17
  81. package/commands/hatch3r-roadmap.md +5 -4
  82. package/commands/hatch3r-rule-customize.md +5 -0
  83. package/commands/hatch3r-security-audit.md +1 -0
  84. package/commands/hatch3r-skill-customize.md +5 -0
  85. package/commands/hatch3r-test-plan.md +3 -2
  86. package/commands/hatch3r-workflow.md +15 -1
  87. package/dist/cli/index.js +7595 -4548
  88. package/dist/cli/index.js.map +1 -1
  89. package/hooks/hatch3r-ci-failure.md +1 -0
  90. package/hooks/hatch3r-file-save.md +1 -0
  91. package/hooks/hatch3r-post-merge.md +1 -0
  92. package/hooks/hatch3r-pre-commit.md +1 -0
  93. package/hooks/hatch3r-pre-push.md +1 -0
  94. package/hooks/hatch3r-session-start.md +1 -0
  95. package/package.json +30 -12
  96. package/rules/hatch3r-accessibility-standards.md +2 -1
  97. package/rules/hatch3r-accessibility-standards.mdc +1 -1
  98. package/rules/hatch3r-agent-orchestration-detail.md +207 -0
  99. package/rules/hatch3r-agent-orchestration-detail.mdc +202 -0
  100. package/rules/hatch3r-agent-orchestration.md +161 -318
  101. package/rules/hatch3r-agent-orchestration.mdc +212 -154
  102. package/rules/hatch3r-api-design.md +2 -1
  103. package/rules/hatch3r-api-design.mdc +1 -1
  104. package/rules/hatch3r-browser-verification.md +4 -2
  105. package/rules/hatch3r-browser-verification.mdc +1 -0
  106. package/rules/hatch3r-ci-cd.md +2 -1
  107. package/rules/hatch3r-ci-cd.mdc +1 -1
  108. package/rules/hatch3r-code-standards.md +15 -2
  109. package/rules/hatch3r-code-standards.mdc +22 -2
  110. package/rules/hatch3r-component-conventions.md +2 -1
  111. package/rules/hatch3r-component-conventions.mdc +1 -1
  112. package/rules/hatch3r-data-classification.md +2 -1
  113. package/rules/hatch3r-data-classification.mdc +1 -1
  114. package/rules/hatch3r-deep-context.md +26 -1
  115. package/rules/hatch3r-deep-context.mdc +54 -8
  116. package/rules/hatch3r-dependency-management.md +2 -1
  117. package/rules/hatch3r-dependency-management.mdc +17 -5
  118. package/rules/hatch3r-feature-flags.md +2 -0
  119. package/rules/hatch3r-feature-flags.mdc +1 -0
  120. package/rules/hatch3r-git-conventions.md +2 -1
  121. package/rules/hatch3r-git-conventions.mdc +2 -1
  122. package/rules/hatch3r-i18n.md +2 -1
  123. package/rules/hatch3r-i18n.mdc +1 -1
  124. package/rules/hatch3r-learning-consult.md +11 -1
  125. package/rules/hatch3r-learning-consult.mdc +11 -1
  126. package/rules/hatch3r-migrations.md +2 -1
  127. package/rules/hatch3r-migrations.mdc +12 -1
  128. package/rules/hatch3r-observability-logging.md +34 -0
  129. package/rules/hatch3r-observability-logging.mdc +30 -0
  130. package/rules/hatch3r-observability-metrics.md +74 -0
  131. package/rules/hatch3r-observability-metrics.mdc +70 -0
  132. package/rules/hatch3r-observability-tracing-detail.md +160 -0
  133. package/rules/hatch3r-observability-tracing-detail.mdc +63 -0
  134. package/rules/hatch3r-observability-tracing.md +86 -0
  135. package/rules/hatch3r-observability-tracing.mdc +77 -0
  136. package/rules/hatch3r-observability.md +9 -448
  137. package/rules/hatch3r-observability.mdc +7 -159
  138. package/rules/hatch3r-performance-budgets.md +2 -0
  139. package/rules/hatch3r-performance-budgets.mdc +1 -0
  140. package/rules/hatch3r-secrets-management.md +2 -1
  141. package/rules/hatch3r-secrets-management.mdc +1 -1
  142. package/rules/hatch3r-security-patterns.md +3 -2
  143. package/rules/hatch3r-security-patterns.mdc +12 -1
  144. package/rules/hatch3r-testing.md +12 -2
  145. package/rules/hatch3r-testing.mdc +11 -2
  146. package/rules/hatch3r-theming.md +3 -2
  147. package/rules/hatch3r-theming.mdc +1 -1
  148. package/rules/hatch3r-tooling-hierarchy.md +3 -2
  149. package/rules/hatch3r-tooling-hierarchy.mdc +19 -5
  150. package/skills/hatch3r-a11y-audit/SKILL.md +11 -4
  151. package/skills/hatch3r-agent-customize/SKILL.md +5 -72
  152. package/skills/hatch3r-api-spec/SKILL.md +9 -2
  153. package/skills/hatch3r-architecture-review/SKILL.md +7 -0
  154. package/skills/hatch3r-bug-fix/SKILL.md +16 -7
  155. package/skills/hatch3r-ci-pipeline/SKILL.md +8 -1
  156. package/skills/hatch3r-command-customize/SKILL.md +5 -62
  157. package/skills/hatch3r-context-health/SKILL.md +23 -2
  158. package/skills/hatch3r-cost-tracking/SKILL.md +16 -6
  159. package/skills/hatch3r-customize/SKILL.md +124 -0
  160. package/skills/hatch3r-dep-audit/SKILL.md +9 -2
  161. package/skills/hatch3r-feature/SKILL.md +12 -4
  162. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +7 -0
  163. package/skills/hatch3r-incident-response/SKILL.md +7 -0
  164. package/skills/hatch3r-issue-workflow/SKILL.md +8 -1
  165. package/skills/hatch3r-logical-refactor/SKILL.md +8 -1
  166. package/skills/hatch3r-migration/SKILL.md +7 -0
  167. package/skills/hatch3r-perf-audit/SKILL.md +9 -2
  168. package/skills/hatch3r-pr-creation/SKILL.md +8 -1
  169. package/skills/hatch3r-qa-validation/SKILL.md +8 -1
  170. package/skills/hatch3r-recipe/SKILL.md +8 -1
  171. package/skills/hatch3r-refactor/SKILL.md +10 -2
  172. package/skills/hatch3r-release/SKILL.md +8 -1
  173. package/skills/hatch3r-rule-customize/SKILL.md +5 -65
  174. package/skills/hatch3r-skill-customize/SKILL.md +5 -62
  175. package/skills/hatch3r-visual-refactor/SKILL.md +12 -5
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-context-health
3
3
  description: Monitor and maintain conversation context health during long sessions. Use when context may be degrading, after many turns, or when experiencing repeated errors.
4
4
  tags: [maintenance]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # Context Health Monitoring
7
8
 
@@ -64,14 +65,34 @@ After corrective action:
64
65
  - Confirm health is at Green or Yellow
65
66
  - Resume work on the original task
66
67
 
68
+ ## Context Poisoning Detection
69
+
70
+ During context health checks, also scan for signs of context poisoning -- stale or incorrect information that has accumulated in the conversation:
71
+
72
+ | Signal | Detection | Action |
73
+ |--------|-----------|--------|
74
+ | Outdated file content | You reference a file's content but the file has been modified since you last read it | Re-read the file before continuing |
75
+ | Stale assumptions | A decision was made based on information that has since changed (e.g., a function was refactored) | Re-verify assumptions against current state |
76
+ | Contradictory context | Two pieces of context in the conversation disagree (e.g., "the API uses REST" vs. code showing GraphQL) | Resolve by reading the actual source of truth |
77
+ | Accumulated errors | Multiple tool calls have failed, suggesting the mental model of the codebase is wrong | Reset context by re-reading key files from scratch |
78
+
79
+ Context poisoning is more dangerous than missing context because it leads to confident-but-wrong decisions.
80
+
81
+ ## Error Handling
82
+
83
+ - **Context degradation detected mid-task**: If health drops to Orange or Red during implementation, stop the current task, summarize progress so far, and recommend delegating the remainder to a fresh sub-agent with the summary as input.
84
+ - **Health checks produce conflicting signals**: If some checks indicate Green while others indicate Red, trust the worst signal and investigate the specific check that failed before proceeding.
85
+ - **Unable to estimate token usage**: If the platform does not expose token counts, use character-based estimation (1 token per 4 characters) and note the approximation in the report.
86
+
67
87
  ## Definition of Done
68
88
 
69
89
  - [ ] Context health assessed with all 5 checks
90
+ - [ ] Context poisoning scan completed (no stale assumptions)
70
91
  - [ ] Degradation level determined (Green/Yellow/Orange/Red)
71
92
  - [ ] Appropriate corrective action taken
72
93
  - [ ] Health verified at Green or Yellow after correction
73
94
 
74
95
  ## Related Skills & Agents
75
96
 
76
- - **Command**: `hatch3r-context-health` full monitoring protocol with integration points
77
- - **Command**: `hatch3r-board-pickup` auto-advance mode uses context health for session management
97
+ - **Command**: `hatch3r-context-health` -- full monitoring protocol with integration points
98
+ - **Command**: `hatch3r-board-pickup` -- auto-advance mode uses context health for session management
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-cost-tracking
3
3
  description: Track token usage and estimate costs for agent sessions. Use when monitoring spend, approaching budget limits, or generating cost reports.
4
4
  tags: [maintenance]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # Cost Tracking Workflow
7
8
 
@@ -26,12 +27,15 @@ Task Progress:
26
27
 
27
28
  Estimate tokens for the current session using these rules:
28
29
 
29
- | Content Type | Rule |
30
- |-------------|------|
31
- | Messages | ~4 characters per token |
32
- | Tool calls | JSON length / 4 (input), response length / 4 (output) |
33
- | File reads | Character count / 4 |
34
- | Web searches | ~500 tokens per search |
30
+ | Content Type | Rule | Accuracy |
31
+ |-------------|------|----------|
32
+ | Messages | ~4 characters per token | High -- stable ratio for English text |
33
+ | Tool calls | JSON length / 4 (input), response length / 4 (output) | Medium -- JSON has more overhead characters |
34
+ | File reads | Character count / 4 | High -- but large files may be truncated by the tool |
35
+ | Web searches | ~500 tokens per search | Low -- varies widely by result length |
36
+ | Subagent spawns | Estimate full context re-sent per spawn (~2000-5000 tokens base) | Medium -- depends on included rules/context |
37
+
38
+ **Subagent cost multiplier.** Each subagent spawn carries a base cost for the agent protocol, included rules, and context. A pipeline with 8 subagents (researcher + implementer + reviewer + fixer + 4 Phase 4 specialists) has significant overhead from context re-transmission. Factor this into budget estimates.
35
39
 
36
40
  Calculate estimated cost using the model tier rates from the `hatch3r-cost-tracking` command reference.
37
41
 
@@ -53,6 +57,12 @@ Produce a cost report using the output format from the `hatch3r-cost-tracking` c
53
57
  - Budget status (if configured)
54
58
  - Top optimization opportunities
55
59
 
60
+ ## Error Handling
61
+
62
+ - **Token usage data unavailable**: If the platform does not expose token metrics, use input/output character counts divided by 4 as an estimate. Note the approximation method in the report.
63
+ - **Budget limit exceeded mid-session**: Stop non-critical operations, produce a partial cost report, and recommend which remaining tasks to defer or delegate to a lower-cost model.
64
+ - **Cost configuration missing from hatch.json**: Operate in report-only mode and note that budget enforcement is inactive. Recommend adding cost configuration to enable guardrails.
65
+
56
66
  ## Definition of Done
57
67
 
58
68
  - [ ] Cost configuration reviewed (or report-only mode noted)
@@ -0,0 +1,124 @@
1
+ ---
2
+ id: hatch3r-customize
3
+ description: Create and manage customization files for any hatch3r artifact type (agents, commands, rules, skills). Supports model overrides, description changes, scope overrides, enable/disable control, and project-specific markdown instructions.
4
+ tags: [customize]
5
+ quality_charter: agents/shared/quality-charter.md
6
+ ---
7
+ # Artifact Customization Management
8
+
9
+ ## Quick Start
10
+
11
+ ```
12
+ Task Progress:
13
+ - [ ] Step 1: Identify what to customize (and why)
14
+ - [ ] Step 2: Determine customization needs
15
+ - [ ] Step 3: Multi-stakeholder review
16
+ - [ ] Step 4: Create the customization files
17
+ - [ ] Step 5: Sync to propagate changes
18
+ - [ ] Step 6: Verify the customized output
19
+ ```
20
+
21
+ ## Artifact Types
22
+
23
+ This skill handles customization for all artifact types. The `type` parameter determines file locations, available YAML fields, and verification steps.
24
+
25
+ | Type | Source Directory | Customization Directory | YAML Fields |
26
+ |------|-----------------|------------------------|-------------|
27
+ | `agent` | `.agents/agents/` | `.hatch3r/agents/` | `model`, `description`, `enabled` |
28
+ | `command` | `.agents/commands/` | `.hatch3r/commands/` | `description`, `enabled` |
29
+ | `rule` | `.agents/rules/` | `.hatch3r/rules/` | `scope`, `description`, `enabled` |
30
+ | `skill` | `.agents/skills/` | `.hatch3r/skills/` | `description`, `enabled` |
31
+
32
+ **Protected agents:** Some agents have `protected: true` in their canonical frontmatter. For these agents, `description` and `enabled` overrides are ignored — only `model` and markdown instructions can be customized.
33
+
34
+ ## Step 1: Identify and Root-Cause
35
+
36
+ Determine which artifact needs customization and **why**:
37
+
38
+ 1. Review the artifacts in the appropriate source directory and their default behaviors.
39
+ 2. Identify gaps between default behavior and project needs.
40
+ 3. Check for existing customization files in the appropriate `.hatch3r/{type}s/` directory.
41
+ 4. **Root-cause analysis:** Before proceeding, consider:
42
+ - Is this a genuine project-specific need, or a workaround for a bug in the default content?
43
+ - Would this customization be better addressed upstream (by modifying the canonical artifact)?
44
+ - Could a rule or learning achieve the same effect with less coupling?
45
+
46
+ If the customization is working around a default content issue, note it as a candidate for upstream contribution before proceeding.
47
+
48
+ ## Step 2: Determine Customization Needs
49
+
50
+ Decide which customization approach to use:
51
+
52
+ **YAML (`.customize.yaml`)** — for structured overrides:
53
+
54
+ | Field | Available For | Description |
55
+ |-------|--------------|-------------|
56
+ | `model` | agent only | Override the agent's preferred model |
57
+ | `scope` | rule only | Override when the rule applies (`always` or glob patterns) |
58
+ | `description` | all types | Change how the artifact is described in adapter outputs |
59
+ | `enabled` | all types | Set to `false` to exclude from adapter output generation |
60
+
61
+ **Markdown (`.customize.md`)** — for free-form instructions:
62
+ - Domain-specific checklists, constraints, or workflow additions
63
+ - Architecture context relevant to the artifact's function
64
+ - Project-specific requirements (compliance, testing, deployment)
65
+
66
+ Set only the fields/content you need — partial customization is valid.
67
+
68
+ ## Step 3: Multi-Stakeholder Review
69
+
70
+ Before creating customization files, consider the impact from multiple perspectives:
71
+
72
+ 1. **Developer experience:** Does this customization make the developer's workflow better or worse? Will it cause confusion for new team members?
73
+ 2. **Quality impact:** Does disabling or weakening an artifact (especially agents or rules) reduce quality safeguards? What compensating controls exist?
74
+ 3. **Maintenance burden:** Will this customization need updating when the upstream canonical artifact changes? Is the coupling acceptable?
75
+ 4. **Consistency:** Does this customization create inconsistency with other artifacts or team conventions?
76
+
77
+ **Confidence expression:** State your confidence in the customization decision:
78
+ - **High confidence:** Clear project-specific need with no quality trade-offs.
79
+ - **Medium confidence:** Reasonable need but with trade-offs worth noting.
80
+ - **Low confidence:** Workaround or uncertain benefit — recommend revisiting after more experience.
81
+
82
+ ## Step 4: Create Customization Files
83
+
84
+ Create files in `.hatch3r/{type}s/`:
85
+
86
+ **For YAML overrides:** Create `.hatch3r/{type}s/{artifact-id}.customize.yaml` with the applicable fields from the Step 2 table.
87
+
88
+ **For markdown instructions:** Create `.hatch3r/{type}s/{artifact-id}.customize.md` with project-specific content. This is injected into the managed block under `## Project Customizations`.
89
+
90
+ ## Step 5: Sync
91
+
92
+ Run `npx hatch3r sync` to propagate customizations to all adapter outputs. The sync reads `.customize.yaml` for structured overrides, reads `.customize.md` and appends it inside the managed block, and generates updated output for every configured adapter.
93
+
94
+ ## Step 6: Verify
95
+
96
+ Confirm customizations appear in adapter output files:
97
+ - Check YAML fields are reflected in adapter-specific frontmatter
98
+ - Check markdown instructions appear inside the managed block
99
+ - Verify disabled artifacts are absent from adapter outputs
100
+ - **For rules:** verify scope field in adapter-specific frontmatter matches the configured scope value
101
+
102
+ ### Quality Gate
103
+
104
+ Verification is not just "sync completes." Confirm:
105
+ - [ ] The adapter output for the customized artifact contains the expected changes
106
+ - [ ] No unrelated artifacts were affected by the sync
107
+ - [ ] If an artifact was disabled, verify no command or skill references it as a required dependency
108
+ - [ ] If a rule scope was narrowed, verify the excluded file patterns do not lose important coverage
109
+
110
+ ## Error Handling
111
+
112
+ - **`hatch3r sync` fails after customization**: Check the customization YAML for syntax errors (missing quotes, incorrect indentation). Validate the file against the schema documented in the corresponding customize command.
113
+ - **Customization has no visible effect in adapter output**: Verify the customization file is in the correct directory (`.hatch3r/{type}s/`) and that the `id` field matches the target artifact's `id` exactly.
114
+ - **Disabling an artifact breaks a command dependency**: Re-enable the artifact, then check which commands reference it. Either update the command to remove the dependency or keep the artifact enabled.
115
+
116
+ ## Definition of Done
117
+
118
+ - [ ] Root-cause considered (Step 1) — not working around an upstream issue
119
+ - [ ] Multi-stakeholder impact reviewed (Step 3)
120
+ - [ ] Customization files created in `.hatch3r/{type}s/`
121
+ - [ ] `npx hatch3r sync` completes without errors
122
+ - [ ] Adapter output files reflect the customizations
123
+ - [ ] Quality gate checks pass (Step 6)
124
+ - [ ] Customization files committed to the repository
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-dep-audit
3
3
  description: Audit and update npm dependencies for security, freshness, and bundle impact. Use when auditing dependencies, responding to CVEs, or upgrading packages.
4
4
  tags: [maintenance, security]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Dependency Audit Workflow
9
10
 
@@ -64,7 +65,7 @@ npm run build
64
65
 
65
66
  - Confirm bundle size within budget (if defined).
66
67
  - Run `npm audit` — no critical or high vulnerabilities remaining.
67
- - Ensure `package-lock.json` is committed.
68
+ - Verify `package-lock.json` is committed by checking `git status` for untracked or modified lockfile.
68
69
 
69
70
  ## Step 6: Open PR
70
71
 
@@ -76,6 +77,12 @@ Use the project's PR template. Include:
76
77
  - **Test evidence:** all tests pass, no regressions.
77
78
  - **Rollback plan:** if risky (e.g., major version bump).
78
79
 
80
+ ## Error Handling
81
+
82
+ - **`npm audit` reports vulnerabilities with no fix available**: Document the vulnerability, assess exploitability in the project context, and create a tracking issue. If the risk is high, evaluate alternative packages.
83
+ - **Major version upgrade breaks tests**: Roll back the upgrade, document the breaking changes encountered, and create a dedicated migration issue with the specific test failures and required code changes.
84
+ - **Lockfile conflicts after upgrade**: Regenerate the lockfile from scratch (`rm package-lock.json && npm install`), verify all tests pass, and commit the clean lockfile.
85
+
79
86
  ## Definition of Done
80
87
 
81
88
  - [ ] No critical or high CVEs remaining
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-feature
3
3
  description: End-to-end feature implementation workflow. Covers data model, domain logic, API, and UI as a vertical slice. Use when implementing new features or working on feature request issues.
4
4
  tags: [core, implementation]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Feature Implementation Workflow
9
10
 
@@ -66,11 +67,12 @@ Use standard flow (implement → test) when:
66
67
  ## Step 3: Implement
67
68
 
68
69
  - Deliver a complete vertical slice (data -> logic -> UI).
69
- - Follow the convention lock from Step 1 / the implementer's Step 1b match the reference implementation's patterns for file structure, state management, error handling, data fetching, and testing. Do not invent new patterns when established ones exist in the codebase.
70
+ - Follow the convention lock from Step 1 / the implementer's Step 1b -- match the reference implementation's patterns for file structure, state management, error handling, data fetching, and testing. Do not invent new patterns when established ones exist in the codebase.
70
71
  - Use stable IDs from the project glossary.
71
72
  - If database/backend data is needed, include security rules updates.
72
73
  - If feature is gated, enforce entitlements client-side AND server-side.
73
74
  - If new events, follow the project's event schema.
75
+ - **Error handling for new code paths.** Every new function that can fail must use the project's error handling patterns (Result types for expected failures, custom error classes for domain errors, error boundaries at architectural boundaries). Do not defer error handling to "a future PR" -- incomplete error handling is a Critical review finding.
74
76
 
75
77
  ## Step 4: Tests
76
78
 
@@ -90,9 +92,9 @@ npm run lint && npm run typecheck && npm run test
90
92
 
91
93
  Skip this step if the feature has no user-facing UI changes.
92
94
 
93
- - Ensure the dev server is running. If not, start it in the background.
95
+ - Confirm the dev server is running by checking the expected port. If not running, start it in the background.
94
96
  - Navigate to the page or surface affected by the new feature.
95
- - Walk through the acceptance criteria visually — confirm the feature renders and behaves correctly.
97
+ - Walk through the acceptance criteria visually — confirm the feature renders and behaves as specified in the issue.
96
98
  - Interact with new UI elements: click, type, trigger state transitions.
97
99
  - Check the browser console for errors or warnings.
98
100
  - If the feature is responsive, test at different viewport sizes.
@@ -122,6 +124,12 @@ You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`
122
124
 
123
125
  - **Skill**: `hatch3r-qa-validation` — use this skill for end-to-end verification of the implemented feature
124
126
 
127
+ ## Error Handling
128
+
129
+ - **Acceptance criteria are ambiguous or incomplete**: Stop implementation, document the specific ambiguities, and ask the user for clarification before proceeding. Do not guess at requirements.
130
+ - **Feature touches a module with no existing tests**: Write foundational tests for the existing behavior first, then implement the feature. This prevents regressions in untested code.
131
+ - **Database migration fails or is irreversible**: Test the migration against a local database or emulator before applying. If rollback is needed, verify the down-migration restores the original schema.
132
+
125
133
  ## Definition of Done
126
134
 
127
135
  - [ ] All acceptance criteria met
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-gh-agentic-workflows
3
3
  description: Set up CI/CD agentic workflows for continuous AI-powered repository automation (GitHub Actions, Azure Pipelines, GitLab CI)
4
4
  tags: [devops, team]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # CI/CD Agentic Workflows Integration
7
8
 
@@ -220,6 +221,12 @@ Trigger on merge to the default branch. Check if documentation needs updating an
220
221
  - **Cost awareness**: Monitor AI token usage per workflow run. Set spending limits in org settings.
221
222
  - **Quality metrics**: Track: success rate, output acceptance rate (merged PRs/MRs / total), mean time per run.
222
223
 
224
+ ## Error Handling
225
+
226
+ - **Workflow file has YAML syntax errors**: Validate the workflow file locally before pushing (e.g., `actionlint` for GitHub Actions, Azure Pipelines schema validation, or `glab ci lint` for GitLab). Fix all reported errors before committing.
227
+ - **AI engine produces low-quality or empty output**: Add explicit context to the workflow prompt (file references, examples, constraints). If the output is still poor after enrichment, switch to a more capable model.
228
+ - **Workflow runs exceed cost or time limits**: Add `timeout-minutes` to the workflow, scope file references to reduce context size, and add concurrency groups to prevent parallel runs.
229
+
223
230
  ## Troubleshooting
224
231
 
225
232
  | Symptom | Likely Cause | Fix |
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-incident-response
3
3
  description: Handle production incidents with structured triage, mitigation, and post-mortem. Use when responding to production issues, outages, or security incidents.
4
4
  tags: [devops]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # Incident Response Workflow
7
8
 
@@ -77,6 +78,12 @@ Store in project incident docs or as an issue/wiki page on the platform. Follow
77
78
  - Link issues/work items to the post-mortem and to each other.
78
79
  - Assign owners and due dates for critical fixes.
79
80
 
81
+ ## Error Handling
82
+
83
+ - **Cannot reproduce the incident locally**: Use production logs and traces to build the timeline. If local reproduction is blocked by environment differences, document the gap and recommend a staging environment test.
84
+ - **Mitigation introduces new issues**: Roll back the mitigation immediately, reassess the approach, and apply a more targeted fix. Document both the original incident and the mitigation regression in the post-mortem.
85
+ - **Root cause spans multiple services or teams**: Document the cross-service dependency chain, assign follow-up items to the responsible teams, and coordinate a joint post-mortem.
86
+
80
87
  ## Definition of Done
81
88
 
82
89
  - [ ] Incident mitigated and verified
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-issue-workflow
3
3
  description: Guides the 8-step agentic development workflow for issues/work items. Covers parsing issues, loading skills, reading specs, planning, implementing, testing, opening PRs/MRs, and addressing review. Use when working on any issue/work item or when the user mentions an issue number.
4
4
  tags: [core, implementation]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # Issue Workflow
7
8
 
@@ -108,7 +109,7 @@ The implementer sub-agent protocol is defined in the hatch3r-implementer agent.
108
109
 
109
110
  Skip this step if the issue has no user-facing UI changes.
110
111
 
111
- - Ensure the dev server is running. If not, start it in the background.
112
+ - Confirm the dev server is running by checking the expected port. If not running, start it in the background.
112
113
  - Navigate to the page or surface affected by the change.
113
114
  - Visually confirm the implementation matches acceptance criteria from the issue.
114
115
  - Interact with changed elements to verify functional correctness.
@@ -132,6 +133,12 @@ Skip this step if the issue has no user-facing UI changes.
132
133
  - Push fixes as new commits (don't force-push during review).
133
134
  - Re-request review after addressing all comments.
134
135
 
136
+ ## Error Handling
137
+
138
+ - **Issue description is too vague to implement**: Do not guess. Ask the user for clarification on acceptance criteria, scope boundaries, and expected behavior before starting Step 3 (planning).
139
+ - **Tests fail after implementation and the cause is unclear**: Run tests in isolation to identify whether the failure is in new code or existing code. If existing tests broke, check whether they relied on behavior that was intentionally changed.
140
+ - **PR/MR creation fails due to branch conflicts**: Rebase onto the target branch, resolve conflicts, re-run all tests, and verify the merge result before re-creating the PR/MR.
141
+
135
142
  ## Escalation
136
143
 
137
144
  Stop and ask when:
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-logical-refactor
3
3
  description: Workflow for changing behavior or logic flow without adding new features or overhauling UI. Use when modifying business logic, data flows, behavioral rules, or working on logical refactor issues.
4
4
  tags: [implementation]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Logical Refactor Workflow
9
10
 
@@ -63,6 +64,12 @@ Use the project's PR template. Include:
63
64
  - Test evidence for both new behavior and preserved behavior
64
65
  - Spec docs updated (if any)
65
66
 
67
+ ## Error Handling
68
+
69
+ - **Behavioral invariant violated during refactor**: If a test that should pass now fails, check whether the invariant was incorrectly preserved or whether the refactor inadvertently changed behavior. Fix the refactor, not the test, unless the test was wrong.
70
+ - **Refactor scope grows beyond the original task**: If additional modules need changes to complete the refactor, stop, document the expanded scope, and get confirmation before continuing.
71
+ - **Cannot verify behavioral equivalence due to missing tests**: Write characterization tests for the current behavior before applying the refactor. This provides a safety net for the transformation.
72
+
66
73
  ## Definition of Done
67
74
 
68
75
  - [ ] New behavior matches the "after" description
@@ -3,6 +3,7 @@ id: hatch3r-migration
3
3
  type: skill
4
4
  description: Plan and execute migrations for databases, frameworks, and dependencies. Covers breaking change analysis, phased rollout, and rollback procedures.
5
5
  tags: [implementation, brownfield]
6
+ quality_charter: agents/shared/quality-charter.md
6
7
  ---
7
8
 
8
9
  # Migration Workflow
@@ -67,6 +68,12 @@ Task Progress:
67
68
  - Delete unused migration scripts after they've been applied to all environments.
68
69
  - Write a migration retrospective noting what went well and any issues encountered.
69
70
 
71
+ ## Error Handling
72
+
73
+ - **Migration phase fails partway through**: Roll back to the last successful phase checkpoint. Diagnose the failure before retrying. Each phase must leave the codebase in a working state.
74
+ - **Rollback procedure does not restore original behavior**: Treat this as a critical gap. Fix the rollback procedure before proceeding with the migration, since an untested rollback path is a deployment risk.
75
+ - **Dependency version conflict during migration**: Pin the conflicting dependency to the version compatible with the migration target. Document the pin and plan its removal after all consumers are updated.
76
+
70
77
  ## Definition of Done
71
78
 
72
79
  - [ ] All phases completed and verified
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-perf-audit
3
3
  description: Profile and optimize application performance against defined budgets. Use when investigating performance issues, auditing performance budgets, or optimizing hot paths.
4
4
  tags: [review, performance]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Performance Audit Workflow
9
10
 
@@ -74,7 +75,7 @@ Common strategies:
74
75
  - **Database:** Reduce reads (batch, cache, denormalize).
75
76
  - **Cloud/API:** Warm-up strategies, reduce cold starts.
76
77
 
77
- - Check project ADRs for constraints. Ensure optimizations don't violate privacy/security invariants.
78
+ - Check project ADRs for constraints. Verify optimizations do not violate privacy/security invariants documented in the ADRs.
78
79
  - For external library docs and current best practices, follow the project's tooling hierarchy.
79
80
 
80
81
  ## Step 5: Implement Optimizations
@@ -106,6 +107,12 @@ You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`
106
107
 
107
108
  - **Rule**: `hatch3r-performance-budgets` — reference this rule for the project's defined performance budget thresholds
108
109
 
110
+ ## Error Handling
111
+
112
+ - **No performance budgets defined for the project**: Use the defaults from `hatch3r-performance-budgets` rule as a baseline. Note in the report that custom budgets should be defined.
113
+ - **Profiling tool unavailable or incompatible**: Fall back to manual timing measurements (e.g., `performance.now()` or `console.time`) for critical paths. Document the measurement method used.
114
+ - **Optimization introduces functional regressions**: Revert the optimization, add a regression test for the broken behavior, then re-attempt with a different approach.
115
+
109
116
  ## Definition of Done
110
117
 
111
118
  - [ ] All performance budgets met
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-pr-creation
3
3
  description: Create a pull request or merge request following project conventions including branch naming, PR/MR template, checklist, and rollout plan. Use when opening or preparing a PR/MR, or when the user asks to create a PR or MR.
4
4
  tags: [core, implementation]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # PR / MR Creation Workflow
9
10
 
@@ -85,6 +86,12 @@ You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`
85
86
 
86
87
  - **Skill**: `hatch3r-issue-workflow` — use this skill for the parent issue-to-PR workflow that feeds into PR creation
87
88
 
89
+ ## Error Handling
90
+
91
+ - **PR/MR creation fails due to missing remote branch**: Push the local branch to the remote first (`git push -u origin {branch}`), then retry the PR/MR creation.
92
+ - **CI checks fail on the PR/MR**: Diagnose the failure locally, push fixes as new commits (do not force-push during review), and verify CI passes before requesting review.
93
+ - **Merge conflicts with the target branch**: Rebase onto the target branch, resolve conflicts, re-run all tests, and force-push the rebased branch only if no reviews have been submitted yet.
94
+
88
95
  ## Size Guidelines
89
96
 
90
97
  | Files Changed | Recommendation |
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-qa-validation
3
3
  description: E2E validation workflow producing a structured pass/fail report with evidence. Use when running QA validation, acceptance testing, verifying releases, or working on QA E2E validation issues.
4
4
  tags: [core, review]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # QA E2E Validation Workflow
7
8
 
@@ -46,7 +47,7 @@ Run the project's automated test suites (unit, integration, E2E) and record resu
46
47
 
47
48
  For each user-facing test case in the matrix:
48
49
 
49
- 1. Ensure the dev server is running. If not, start it in the background.
50
+ 1. Confirm the dev server is running by checking the expected port. If not running, start it in the background.
50
51
  2. Navigate to the page or surface under test using browser automation MCP.
51
52
  3. Execute the test steps exactly as described — click, type, navigate, trigger state changes.
52
53
  4. Observe the actual result and compare to the expected result.
@@ -76,6 +77,12 @@ Produce a structured report with:
76
77
  - If validation fails, state what must be fixed before re-validation.
77
78
  - Post report as comment on the issue/work item or linked PR/MR (check `platform` in `.agents/hatch.json`).
78
79
 
80
+ ## Error Handling
81
+
82
+ - **Test environment unavailable or misconfigured**: Document which tests could not be executed, note the environment gap, and recommend a fix. Do not mark untested scenarios as passing.
83
+ - **Validation discovers a blocking defect**: File an issue immediately, mark the validation as HOLD, and include the defect details in the validation report with reproduction steps.
84
+ - **Flaky test results (pass on retry)**: Run the test 3 times. If it passes inconsistently, mark it as flaky in the report, file a tracking issue, and exclude it from the pass/fail determination.
85
+
79
86
  ## Definition of Done
80
87
 
81
88
  - [ ] All test cases in the matrix executed
@@ -2,6 +2,7 @@
2
2
  id: hatch3r-recipe
3
3
  description: Create, test, and manage workflow recipes that compose hatch3r capabilities into guided sequences. Use when creating new recipes, customizing existing ones, or troubleshooting recipe execution.
4
4
  tags: [core]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
7
  # Recipe Management
7
8
 
@@ -47,7 +48,7 @@ Execute `--dry-run` to validate:
47
48
  - YAML schema is valid
48
49
  - All referenced commands/skills exist
49
50
  - Dependency graph has no cycles
50
- - Variables are properly referenced
51
+ - Variables are referenced with valid names that resolve to defined values
51
52
  - Prerequisites are checkable
52
53
 
53
54
  ## Step 5: Validate with Real Execution
@@ -59,6 +60,12 @@ Run the recipe on a test project to verify:
59
60
  - Error handling works (intentionally fail a step)
60
61
  - Completion message is accurate
61
62
 
63
+ ## Error Handling
64
+
65
+ - **Recipe step fails during execution**: The recipe runner should report which step failed, its inputs, and the error message. Provide a `resume-from` option to restart from the failed step after fixing the issue.
66
+ - **Recipe YAML has schema validation errors**: Report the specific field and line that violates the schema. Do not attempt to execute a recipe that fails validation.
67
+ - **Circular dependency between recipe steps**: Detect cycles during the dry-run phase and report the dependency chain that creates the loop.
68
+
62
69
  ## Definition of Done
63
70
 
64
71
  - [ ] Recipe YAML validates against schema
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-refactor
3
3
  description: Internal code quality improvement workflow without changing external behavior. Use when refactoring code structure, simplifying modules, or improving maintainability.
4
4
  tags: [core, implementation]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Code Refactor Workflow
9
10
 
@@ -46,7 +47,8 @@ Before changing code, output:
46
47
  - Preserve all public interfaces and external behavior.
47
48
  - Remove dead code created by the refactor.
48
49
  - Do not introduce new dependencies.
49
- - If a bug is found, document it fix in a separate PR.
50
+ - If a bug is found, document it -- fix in a separate PR.
51
+ - **Error handling preservation.** When moving or restructuring error handling code, verify that the error behavior is preserved. A common refactoring mistake is accidentally changing error types, removing error context, or altering error propagation paths. Run error-path tests after each structural change.
50
52
 
51
53
  ## Step 4: Verify
52
54
 
@@ -81,6 +83,12 @@ You MUST spawn these agents via the Task tool (`subagent_type: "generalPurpose"`
81
83
  - **Skill**: `hatch3r-logical-refactor` — use when the refactor changes internal logic flow while preserving external behavior
82
84
  - **Skill**: `hatch3r-visual-refactor` — use when the refactor targets UI/styling changes without altering functionality
83
85
 
86
+ ## Error Handling
87
+
88
+ - **Existing tests fail after refactor**: Do not modify tests to make them pass unless the test was verifying an implementation detail (not behavior). If a behavioral test fails, the refactor changed external behavior and must be revised.
89
+ - **Refactor scope expands beyond the original module**: If additional modules need changes due to coupling, stop and assess whether the refactor should be split into phases. Get confirmation before expanding scope.
90
+ - **Type errors after restructuring**: Resolve all type errors before running tests. If the type system reveals unexpected dependencies, document them as findings for the codebase health record.
91
+
84
92
  ## Definition of Done
85
93
 
86
94
  - [ ] All existing tests pass without modification
@@ -2,8 +2,9 @@
2
2
  id: hatch3r-release
3
3
  description: Cut a release with version bump, changelog, tagging, and deploy verification. Use when preparing a release, cutting a version, or deploying to production.
4
4
  tags: [devops]
5
+ quality_charter: agents/shared/quality-charter.md
5
6
  ---
6
- > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool as appropriate.
7
+ > **Note:** Commands below use `npm` as an example. Substitute with your project's package manager (`yarn`, `pnpm`, `bun`) or build tool when your project uses a different package manager.
7
8
 
8
9
  # Release Workflow
9
10
 
@@ -86,6 +87,12 @@ npm run build
86
87
  - Watch user-reported issues for first 24h.
87
88
  - If errors spike: rollback and investigate.
88
89
 
90
+ ## Error Handling
91
+
92
+ - **Quality gates fail during release preparation**: Do not proceed with the release. Fix the failing gate (test failures, lint errors, type errors), re-run all gates, and restart the release process.
93
+ - **Git tag already exists for the target version**: Check whether the existing tag points to the correct commit. If it was created in error, delete and recreate it. If it was a previous release attempt, bump the version and start over.
94
+ - **Post-deploy monitoring detects regressions**: Execute the rollback plan immediately. Document the regression in a post-mortem issue and block the next release until the regression is fixed.
95
+
89
96
  ## Definition of Done
90
97
 
91
98
  - [ ] Version bumped in package.json