hatch3r 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +437 -0
  3. package/agents/hatch3r-a11y-auditor.md +126 -0
  4. package/agents/hatch3r-architect.md +160 -0
  5. package/agents/hatch3r-ci-watcher.md +123 -0
  6. package/agents/hatch3r-context-rules.md +97 -0
  7. package/agents/hatch3r-dependency-auditor.md +164 -0
  8. package/agents/hatch3r-devops.md +138 -0
  9. package/agents/hatch3r-docs-writer.md +97 -0
  10. package/agents/hatch3r-implementer.md +162 -0
  11. package/agents/hatch3r-learnings-loader.md +108 -0
  12. package/agents/hatch3r-lint-fixer.md +104 -0
  13. package/agents/hatch3r-perf-profiler.md +123 -0
  14. package/agents/hatch3r-researcher.md +642 -0
  15. package/agents/hatch3r-reviewer.md +81 -0
  16. package/agents/hatch3r-security-auditor.md +119 -0
  17. package/agents/hatch3r-test-writer.md +134 -0
  18. package/commands/hatch3r-agent-customize.md +146 -0
  19. package/commands/hatch3r-api-spec.md +49 -0
  20. package/commands/hatch3r-benchmark.md +50 -0
  21. package/commands/hatch3r-board-fill.md +504 -0
  22. package/commands/hatch3r-board-init.md +315 -0
  23. package/commands/hatch3r-board-pickup.md +672 -0
  24. package/commands/hatch3r-board-refresh.md +198 -0
  25. package/commands/hatch3r-board-shared.md +369 -0
  26. package/commands/hatch3r-bug-plan.md +410 -0
  27. package/commands/hatch3r-codebase-map.md +1182 -0
  28. package/commands/hatch3r-command-customize.md +94 -0
  29. package/commands/hatch3r-context-health.md +112 -0
  30. package/commands/hatch3r-cost-tracking.md +139 -0
  31. package/commands/hatch3r-dep-audit.md +171 -0
  32. package/commands/hatch3r-feature-plan.md +379 -0
  33. package/commands/hatch3r-healthcheck.md +307 -0
  34. package/commands/hatch3r-hooks.md +282 -0
  35. package/commands/hatch3r-learn.md +217 -0
  36. package/commands/hatch3r-migration-plan.md +51 -0
  37. package/commands/hatch3r-onboard.md +56 -0
  38. package/commands/hatch3r-project-spec.md +1153 -0
  39. package/commands/hatch3r-recipe.md +179 -0
  40. package/commands/hatch3r-refactor-plan.md +426 -0
  41. package/commands/hatch3r-release.md +328 -0
  42. package/commands/hatch3r-roadmap.md +556 -0
  43. package/commands/hatch3r-rule-customize.md +114 -0
  44. package/commands/hatch3r-security-audit.md +370 -0
  45. package/commands/hatch3r-skill-customize.md +93 -0
  46. package/commands/hatch3r-workflow.md +377 -0
  47. package/dist/cli/hooks-ZOTFDEA3.js +59 -0
  48. package/dist/cli/index.d.ts +2 -0
  49. package/dist/cli/index.js +3584 -0
  50. package/github-agents/hatch3r-docs-agent.md +46 -0
  51. package/github-agents/hatch3r-lint-agent.md +41 -0
  52. package/github-agents/hatch3r-security-agent.md +54 -0
  53. package/github-agents/hatch3r-test-agent.md +66 -0
  54. package/hooks/hatch3r-ci-failure.md +10 -0
  55. package/hooks/hatch3r-file-save.md +11 -0
  56. package/hooks/hatch3r-post-merge.md +10 -0
  57. package/hooks/hatch3r-pre-commit.md +11 -0
  58. package/hooks/hatch3r-pre-push.md +10 -0
  59. package/hooks/hatch3r-session-start.md +10 -0
  60. package/mcp/mcp.json +62 -0
  61. package/package.json +84 -0
  62. package/prompts/hatch3r-bug-triage.md +155 -0
  63. package/prompts/hatch3r-code-review.md +131 -0
  64. package/prompts/hatch3r-pr-description.md +173 -0
  65. package/rules/hatch3r-accessibility-standards.md +77 -0
  66. package/rules/hatch3r-accessibility-standards.mdc +75 -0
  67. package/rules/hatch3r-agent-orchestration.md +160 -0
  68. package/rules/hatch3r-api-design.md +176 -0
  69. package/rules/hatch3r-api-design.mdc +176 -0
  70. package/rules/hatch3r-browser-verification.md +73 -0
  71. package/rules/hatch3r-browser-verification.mdc +73 -0
  72. package/rules/hatch3r-ci-cd.md +70 -0
  73. package/rules/hatch3r-ci-cd.mdc +68 -0
  74. package/rules/hatch3r-code-standards.md +102 -0
  75. package/rules/hatch3r-code-standards.mdc +100 -0
  76. package/rules/hatch3r-component-conventions.md +102 -0
  77. package/rules/hatch3r-component-conventions.mdc +102 -0
  78. package/rules/hatch3r-data-classification.md +85 -0
  79. package/rules/hatch3r-data-classification.mdc +83 -0
  80. package/rules/hatch3r-dependency-management.md +17 -0
  81. package/rules/hatch3r-dependency-management.mdc +15 -0
  82. package/rules/hatch3r-error-handling.md +17 -0
  83. package/rules/hatch3r-error-handling.mdc +15 -0
  84. package/rules/hatch3r-feature-flags.md +112 -0
  85. package/rules/hatch3r-feature-flags.mdc +112 -0
  86. package/rules/hatch3r-git-conventions.md +47 -0
  87. package/rules/hatch3r-git-conventions.mdc +45 -0
  88. package/rules/hatch3r-i18n.md +90 -0
  89. package/rules/hatch3r-i18n.mdc +90 -0
  90. package/rules/hatch3r-learning-consult.md +29 -0
  91. package/rules/hatch3r-learning-consult.mdc +27 -0
  92. package/rules/hatch3r-migrations.md +17 -0
  93. package/rules/hatch3r-migrations.mdc +15 -0
  94. package/rules/hatch3r-observability.md +165 -0
  95. package/rules/hatch3r-observability.mdc +165 -0
  96. package/rules/hatch3r-performance-budgets.md +109 -0
  97. package/rules/hatch3r-performance-budgets.mdc +109 -0
  98. package/rules/hatch3r-secrets-management.md +76 -0
  99. package/rules/hatch3r-secrets-management.mdc +74 -0
  100. package/rules/hatch3r-security-patterns.md +211 -0
  101. package/rules/hatch3r-security-patterns.mdc +211 -0
  102. package/rules/hatch3r-testing.md +89 -0
  103. package/rules/hatch3r-testing.mdc +87 -0
  104. package/rules/hatch3r-theming.md +51 -0
  105. package/rules/hatch3r-theming.mdc +51 -0
  106. package/rules/hatch3r-tooling-hierarchy.md +92 -0
  107. package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
  108. package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
  109. package/skills/hatch3r-agent-customize/SKILL.md +75 -0
  110. package/skills/hatch3r-api-spec/SKILL.md +66 -0
  111. package/skills/hatch3r-architecture-review/SKILL.md +96 -0
  112. package/skills/hatch3r-bug-fix/SKILL.md +129 -0
  113. package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
  114. package/skills/hatch3r-command-customize/SKILL.md +67 -0
  115. package/skills/hatch3r-context-health/SKILL.md +76 -0
  116. package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
  117. package/skills/hatch3r-dep-audit/SKILL.md +82 -0
  118. package/skills/hatch3r-feature/SKILL.md +129 -0
  119. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
  120. package/skills/hatch3r-incident-response/SKILL.md +86 -0
  121. package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
  122. package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
  123. package/skills/hatch3r-migration/SKILL.md +76 -0
  124. package/skills/hatch3r-perf-audit/SKILL.md +114 -0
  125. package/skills/hatch3r-pr-creation/SKILL.md +85 -0
  126. package/skills/hatch3r-qa-validation/SKILL.md +86 -0
  127. package/skills/hatch3r-recipe/SKILL.md +67 -0
  128. package/skills/hatch3r-refactor/SKILL.md +86 -0
  129. package/skills/hatch3r-release/SKILL.md +93 -0
  130. package/skills/hatch3r-rule-customize/SKILL.md +70 -0
  131. package/skills/hatch3r-skill-customize/SKILL.md +67 -0
  132. package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
@@ -0,0 +1,102 @@
1
+ ---
2
+ id: hatch3r-code-standards
3
+ type: rule
4
+ description: Code quality and file naming conventions for the project
5
+ scope: always
6
+ ---
7
+ # Code Standards
8
+
9
+ ## Core Conventions
10
+
11
+ - Enable strict type checking. No type escape hatches (e.g., `any`, `@ts-ignore`, or equivalent) without a linked issue.
12
+ - Functions: `camelCase`. Types/Interfaces: `PascalCase`. Constants: `SCREAMING_SNAKE`.
13
+ - Component files: `PascalCase` (match framework convention). Logic files: `camelCase` (or language convention).
14
+ - Max function length: 50 lines. Max file: 400 lines. Cyclomatic complexity: 10.
15
+ - Use framework-recommended component patterns (e.g., typed props and emits).
16
+ - Use stores or equivalent for shared state. Prefer composables/hooks over mixins.
17
+ - Use design tokens for colors, spacing, typography. No ad-hoc styling.
18
+ - All animations must respect `prefers-reduced-motion`.
19
+ - Run lint and typecheck before committing.
20
+
21
+ ## TypeScript-Specific Patterns
22
+
23
+ ### `satisfies` Over `as`
24
+
25
+ - 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.
26
+ - 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`.
27
+
28
+ ### Discriminated Unions
29
+
30
+ - 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`).
31
+ - Use exhaustive `switch` with a `never` default case to ensure all variants are handled. The compiler will error when a new variant is added but not handled.
32
+
33
+ ### Branded Types
34
+
35
+ - 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 }`.
36
+ - Provide factory functions (`createUserId(raw: string): UserId`) that validate the input before branding. Never brand raw values without validation.
37
+
38
+ ### Strict Utility Types
39
+
40
+ - Prefer `Readonly<T>` for function parameters and return types that should not be mutated by the caller.
41
+ - Use `Record<string, never>` instead of `{}` to represent an empty object type. `{}` matches any non-nullish value.
42
+ - Avoid `Omit` with string literals that do not exist on the source type — use `satisfies` or a helper type that enforces key existence.
43
+
44
+ ## Architecture Patterns
45
+
46
+ ### Barrel Exports
47
+
48
+ - 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.
49
+ - Never import from a module's internal files directly — import from the barrel. Enforce with ESLint `no-restricted-imports` or equivalent.
50
+ - Keep barrel files thin — only re-exports, no logic. A barrel with logic is a code smell.
51
+
52
+ ### Module Boundaries
53
+
54
+ - Define clear module boundaries: each module owns its types, logic, and tests. Cross-module imports go through barrel exports.
55
+ - Circular imports between modules are forbidden. Use dependency inversion (interfaces at the boundary) to break cycles.
56
+ - Shared types used across modules live in a `types/` or `shared/` directory, not duplicated in each module.
57
+
58
+ ### Dependency Injection
59
+
60
+ - Inject dependencies through constructor parameters or factory function arguments — not through global imports of concrete implementations.
61
+ - Define dependencies as interfaces at the module boundary. Concrete implementations live inside the module.
62
+ - This enables testability (inject fakes in tests) and flexibility (swap implementations without changing consumers).
63
+
64
+ ## Error Handling Patterns
65
+
66
+ ### Result Types
67
+
68
+ - For operations that can fail in expected ways (validation, parsing, external calls), prefer returning a `Result<T, E>` discriminated union over throwing exceptions. Exceptions are for unexpected/unrecoverable failures.
69
+ - Define a project-wide `Result` type: `type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E }`.
70
+ - Callers must handle both variants — the type system enforces exhaustive error handling.
71
+
72
+ ### Custom Error Classes
73
+
74
+ - Define domain-specific error classes extending a base `AppError` class. Include a machine-readable `code` field (string enum) for programmatic handling, separate from the human-readable `message`.
75
+ - Error hierarchy example: `AppError` → `ValidationError`, `AuthError`, `NotFoundError`, `ConflictError`. Map error classes to HTTP status codes in the API layer.
76
+ - Never throw raw `Error("message")` — always use a domain error class so error handlers can distinguish error types.
77
+
78
+ ### Error Boundaries
79
+
80
+ - Catch errors at architectural boundaries: API route handlers, event handlers, background job processors, UI component error boundaries.
81
+ - Log the full error (including stack trace) at the boundary. Return a safe, sanitized error response to the caller — no internal details.
82
+ - Let errors propagate naturally within a module. Catching errors mid-flow and re-throwing obscures the stack trace. Handle at the boundary.
83
+
84
+ ## Import Ordering
85
+
86
+ Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import`). The canonical order:
87
+
88
+ 1. **Built-in modules** — `node:fs`, `node:path`, etc.
89
+ 2. **External packages** — `zod`, `express`, etc.
90
+ 3. **Internal aliases** — `@/utils`, `@/types`, etc.
91
+ 4. **Relative imports** — `./sibling`, `../parent`, etc.
92
+ 5. **Type-only imports** — `import type { ... }` (grouped separately where the linter supports it)
93
+
94
+ Separate each group with a blank line. Sort alphabetically within each group.
95
+
96
+ ## Dead Code Prevention
97
+
98
+ - Remove unused imports, variables, functions, and type definitions immediately. Do not comment them out "for later."
99
+ - Use the TypeScript compiler (`noUnusedLocals`, `noUnusedParameters`) and ESLint (`no-unused-vars`) to catch dead code automatically.
100
+ - After removing a feature or completing a refactor, search for all references to the removed code. Delete orphaned tests, fixtures, and documentation.
101
+ - Feature-flagged code that has been fully rolled out (flag removed) must have the flag-off branch deleted in the same PR.
102
+ - Commented-out code is never acceptable in committed code. Use version control history to retrieve old implementations.
@@ -0,0 +1,100 @@
1
+ ---
2
+ description: TypeScript and file naming conventions for the project
3
+ alwaysApply: true
4
+ ---
5
+ # Code Standards
6
+
7
+ ## Core Conventions
8
+
9
+ - TypeScript strict mode. No `any`. No `@ts-ignore` without a linked issue.
10
+ - Functions: `camelCase`. Types/Interfaces: `PascalCase`. Constants: `SCREAMING_SNAKE`.
11
+ - Component files: `PascalCase` (match framework convention). Logic files: `camelCase.ts`.
12
+ - Max function length: 50 lines. Max file: 400 lines. Cyclomatic complexity: 10.
13
+ - Use framework-recommended component patterns (e.g., typed props and emits).
14
+ - Use stores or equivalent for shared state. Prefer composables/hooks over mixins.
15
+ - Use design tokens for colors, spacing, typography. No ad-hoc styling.
16
+ - All animations must respect `prefers-reduced-motion`.
17
+ - Run lint and typecheck before committing.
18
+
19
+ ## TypeScript-Specific Patterns
20
+
21
+ ### `satisfies` Over `as`
22
+
23
+ - 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.
24
+ - 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`.
25
+
26
+ ### Discriminated Unions
27
+
28
+ - 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`).
29
+ - Use exhaustive `switch` with a `never` default case to ensure all variants are handled. The compiler will error when a new variant is added but not handled.
30
+
31
+ ### Branded Types
32
+
33
+ - 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 }`.
34
+ - Provide factory functions (`createUserId(raw: string): UserId`) that validate the input before branding. Never brand raw values without validation.
35
+
36
+ ### Strict Utility Types
37
+
38
+ - Prefer `Readonly<T>` for function parameters and return types that should not be mutated by the caller.
39
+ - Use `Record<string, never>` instead of `{}` to represent an empty object type. `{}` matches any non-nullish value.
40
+ - Avoid `Omit` with string literals that do not exist on the source type — use `satisfies` or a helper type that enforces key existence.
41
+
42
+ ## Architecture Patterns
43
+
44
+ ### Barrel Exports
45
+
46
+ - 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.
47
+ - Never import from a module's internal files directly — import from the barrel. Enforce with ESLint `no-restricted-imports` or equivalent.
48
+ - Keep barrel files thin — only re-exports, no logic. A barrel with logic is a code smell.
49
+
50
+ ### Module Boundaries
51
+
52
+ - Define clear module boundaries: each module owns its types, logic, and tests. Cross-module imports go through barrel exports.
53
+ - Circular imports between modules are forbidden. Use dependency inversion (interfaces at the boundary) to break cycles.
54
+ - Shared types used across modules live in a `types/` or `shared/` directory, not duplicated in each module.
55
+
56
+ ### Dependency Injection
57
+
58
+ - Inject dependencies through constructor parameters or factory function arguments — not through global imports of concrete implementations.
59
+ - Define dependencies as interfaces at the module boundary. Concrete implementations live inside the module.
60
+ - This enables testability (inject fakes in tests) and flexibility (swap implementations without changing consumers).
61
+
62
+ ## Error Handling Patterns
63
+
64
+ ### Result Types
65
+
66
+ - For operations that can fail in expected ways (validation, parsing, external calls), prefer returning a `Result<T, E>` discriminated union over throwing exceptions. Exceptions are for unexpected/unrecoverable failures.
67
+ - Define a project-wide `Result` type: `type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E }`.
68
+ - Callers must handle both variants — the type system enforces exhaustive error handling.
69
+
70
+ ### Custom Error Classes
71
+
72
+ - Define domain-specific error classes extending a base `AppError` class. Include a machine-readable `code` field (string enum) for programmatic handling, separate from the human-readable `message`.
73
+ - Error hierarchy example: `AppError` → `ValidationError`, `AuthError`, `NotFoundError`, `ConflictError`. Map error classes to HTTP status codes in the API layer.
74
+ - Never throw raw `Error("message")` — always use a domain error class so error handlers can distinguish error types.
75
+
76
+ ### Error Boundaries
77
+
78
+ - Catch errors at architectural boundaries: API route handlers, event handlers, background job processors, UI component error boundaries.
79
+ - Log the full error (including stack trace) at the boundary. Return a safe, sanitized error response to the caller — no internal details.
80
+ - Let errors propagate naturally within a module. Catching errors mid-flow and re-throwing obscures the stack trace. Handle at the boundary.
81
+
82
+ ## Import Ordering
83
+
84
+ Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import`). The canonical order:
85
+
86
+ 1. **Built-in modules** — `node:fs`, `node:path`, etc.
87
+ 2. **External packages** — `zod`, `express`, etc.
88
+ 3. **Internal aliases** — `@/utils`, `@/types`, etc.
89
+ 4. **Relative imports** — `./sibling`, `../parent`, etc.
90
+ 5. **Type-only imports** — `import type { ... }` (grouped separately where the linter supports it)
91
+
92
+ Separate each group with a blank line. Sort alphabetically within each group.
93
+
94
+ ## Dead Code Prevention
95
+
96
+ - Remove unused imports, variables, functions, and type definitions immediately. Do not comment them out "for later."
97
+ - Use the TypeScript compiler (`noUnusedLocals`, `noUnusedParameters`) and ESLint (`no-unused-vars`) to catch dead code automatically.
98
+ - After removing a feature or completing a refactor, search for all references to the removed code. Delete orphaned tests, fixtures, and documentation.
99
+ - Feature-flagged code that has been fully rolled out (flag removed) must have the flag-off branch deleted in the same PR.
100
+ - Commented-out code is never acceptable in committed code. Use version control history to retrieve old implementations.
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: Rules for component development in web applications
3
+ globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx
4
+ alwaysApply: false
5
+ ---
6
+ # Component Conventions
7
+
8
+ ## Structure
9
+
10
+ - Use framework-recommended component syntax (e.g., `<script setup>` for Vue).
11
+ - Define props with typed interfaces.
12
+ - Define emits/events with typed interfaces.
13
+ - Use composables/hooks from project composables directory — never mixins.
14
+ - Use stores or equivalent for shared state.
15
+
16
+ ## Naming
17
+
18
+ - Component files: PascalCase (e.g., `PetWidget.vue`, `QuestPanel.vue`).
19
+ - Component names match file names.
20
+ - Props: camelCase. Events: kebab-case.
21
+
22
+ ## Styling
23
+
24
+ - Use the project's design tokens for colors, spacing, typography.
25
+ - Prefer utility classes or scoped CSS with BEM naming.
26
+ - No inline styles except for dynamic values that can't be expressed as classes.
27
+ - No hardcoded color values — use tokens.
28
+
29
+ ## Accessibility (Required)
30
+
31
+ - All animations: wrap in `prefers-reduced-motion` media query AND check user's `reducedMotion` setting.
32
+ - Color contrast: ≥ 4.5:1 for text (WCAG AA).
33
+ - Interactive elements: keyboard focusable with visible focus indicator.
34
+ - Dynamic content changes: use `aria-live` regions.
35
+ - Support high contrast mode.
36
+
37
+ ## State Patterns (Required)
38
+
39
+ ### Loading States
40
+ - Use skeleton screens (not spinners) for content areas — match the layout shape of the loaded content.
41
+ - Apply a shimmer/pulse CSS animation on skeletons to indicate activity.
42
+ - Load content progressively: show available data immediately, fill remaining sections as they resolve.
43
+ - Buttons that trigger async actions must show an inline loading indicator (spinner + disabled state) and prevent double-click.
44
+
45
+ ### Error States
46
+ - Wrap route-level components in an error boundary that catches render failures and displays a fallback UI.
47
+ - Show inline error messages directly below the failed content area with a retry action button.
48
+ - Use toast/notification for non-blocking errors (network hiccups, background sync failures) — auto-dismiss after 5–8 seconds with a manual dismiss option.
49
+ - Failed components must never render a blank space — always show a fallback with a brief explanation and recovery action.
50
+
51
+ ### Empty States
52
+ - Display an illustration or icon with a concise, helpful message explaining why the area is empty.
53
+ - Include a primary action CTA that guides the user toward populating the area (e.g., "Create your first project").
54
+ - Provide contextual guidance or links to documentation when relevant.
55
+ - Differentiate "no data yet" (first-time experience) from "no results found" (active filter/search with a clear-filters action).
56
+
57
+ ### Transition States
58
+ - Apply optimistic updates for mutations: reflect the expected outcome immediately, roll back on failure with an error toast.
59
+ - Show a pending/saving indicator for in-flight mutations (e.g., subtle progress bar or "Saving..." text).
60
+ - Use stale-while-revalidate patterns: display cached data immediately, update in the background, and indicate when a refresh is available.
61
+
62
+ ## Form UX (Required)
63
+
64
+ ### Validation Timing
65
+ - Validate on blur for the user's initial input into a field.
66
+ - After the first validation error, switch to validate on change so the user sees corrections in real time.
67
+ - Always run full form validation on submit as a fallback.
68
+
69
+ ### Error Display
70
+ - Show inline error messages directly below the field, linked via `aria-errormessage` and `aria-invalid="true"`.
71
+ - Provide an error summary at the top of the form (linked to individual fields) for screen reader users.
72
+ - Use a clear visual error indicator: red border + error icon + descriptive text — never rely on color alone.
73
+
74
+ ### Field Patterns
75
+ - Group related fields with `<fieldset>` and `<legend>` (e.g., "Shipping Address", "Payment Details").
76
+ - Use progressive disclosure for complex forms: show advanced options behind an expandable section or a follow-up step.
77
+ - Autofocus the first input field on form mount.
78
+ - Ensure tab order follows the visual layout order — never use positive `tabindex` values.
79
+
80
+ ### Submit Behavior
81
+ - Disable the submit button when the form has known validation errors (but keep it focusable for screen readers).
82
+ - Show a loading indicator on the submit button during submission.
83
+ - Provide clear success feedback: redirect to the result page or display a success toast.
84
+ - Prevent double submission by disabling the button and ignoring duplicate submit events during pending requests.
85
+
86
+ ### Accessible Labels
87
+ - Every `<input>`, `<select>`, and `<textarea>` must have a visible `<label>` element with a matching `for`/`id` pair.
88
+ - Mark required fields with a visual asterisk (`*`) and screen-reader-only text ("required").
89
+ - Associate help text or format hints with the field via `aria-describedby`.
90
+
91
+ ## Performance
92
+
93
+ - UI must render at 60fps (≤ 16ms per frame).
94
+ - Prefer CSS animations/transitions over JavaScript animations.
95
+ - Use conditional visibility (e.g., `v-show`) over conditional mount (e.g., `v-if`) for frequently toggled elements.
96
+ - Lazy-load panels that aren't immediately visible.
97
+
98
+ ## Testing
99
+
100
+ - Snapshot tests for all visual states.
101
+ - Component tests for interactive behavior.
102
+ - Verify reduced-motion behavior in tests.
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: Rules for component development in web applications
3
+ globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx
4
+ alwaysApply: false
5
+ ---
6
+ # Component Conventions
7
+
8
+ ## Structure
9
+
10
+ - Use framework-recommended component syntax (e.g., `<script setup>` for Vue).
11
+ - Define props with typed interfaces.
12
+ - Define emits/events with typed interfaces.
13
+ - Use composables/hooks from project composables directory — never mixins.
14
+ - Use stores or equivalent for shared state.
15
+
16
+ ## Naming
17
+
18
+ - Component files: PascalCase (e.g., `PetWidget.vue`, `QuestPanel.vue`).
19
+ - Component names match file names.
20
+ - Props: camelCase. Events: kebab-case.
21
+
22
+ ## Styling
23
+
24
+ - Use the project's design tokens for colors, spacing, typography.
25
+ - Prefer utility classes or scoped CSS with BEM naming.
26
+ - No inline styles except for dynamic values that can't be expressed as classes.
27
+ - No hardcoded color values — use tokens.
28
+
29
+ ## Accessibility (Required)
30
+
31
+ - All animations: wrap in `prefers-reduced-motion` media query AND check user's `reducedMotion` setting.
32
+ - Color contrast: ≥ 4.5:1 for text (WCAG AA).
33
+ - Interactive elements: keyboard focusable with visible focus indicator.
34
+ - Dynamic content changes: use `aria-live` regions.
35
+ - Support high contrast mode.
36
+
37
+ ## State Patterns (Required)
38
+
39
+ ### Loading States
40
+ - Use skeleton screens (not spinners) for content areas — match the layout shape of the loaded content.
41
+ - Apply a shimmer/pulse CSS animation on skeletons to indicate activity.
42
+ - Load content progressively: show available data immediately, fill remaining sections as they resolve.
43
+ - Buttons that trigger async actions must show an inline loading indicator (spinner + disabled state) and prevent double-click.
44
+
45
+ ### Error States
46
+ - Wrap route-level components in an error boundary that catches render failures and displays a fallback UI.
47
+ - Show inline error messages directly below the failed content area with a retry action button.
48
+ - Use toast/notification for non-blocking errors (network hiccups, background sync failures) — auto-dismiss after 5–8 seconds with a manual dismiss option.
49
+ - Failed components must never render a blank space — always show a fallback with a brief explanation and recovery action.
50
+
51
+ ### Empty States
52
+ - Display an illustration or icon with a concise, helpful message explaining why the area is empty.
53
+ - Include a primary action CTA that guides the user toward populating the area (e.g., "Create your first project").
54
+ - Provide contextual guidance or links to documentation when relevant.
55
+ - Differentiate "no data yet" (first-time experience) from "no results found" (active filter/search with a clear-filters action).
56
+
57
+ ### Transition States
58
+ - Apply optimistic updates for mutations: reflect the expected outcome immediately, roll back on failure with an error toast.
59
+ - Show a pending/saving indicator for in-flight mutations (e.g., subtle progress bar or "Saving..." text).
60
+ - Use stale-while-revalidate patterns: display cached data immediately, update in the background, and indicate when a refresh is available.
61
+
62
+ ## Form UX (Required)
63
+
64
+ ### Validation Timing
65
+ - Validate on blur for the user's initial input into a field.
66
+ - After the first validation error, switch to validate on change so the user sees corrections in real time.
67
+ - Always run full form validation on submit as a fallback.
68
+
69
+ ### Error Display
70
+ - Show inline error messages directly below the field, linked via `aria-errormessage` and `aria-invalid="true"`.
71
+ - Provide an error summary at the top of the form (linked to individual fields) for screen reader users.
72
+ - Use a clear visual error indicator: red border + error icon + descriptive text — never rely on color alone.
73
+
74
+ ### Field Patterns
75
+ - Group related fields with `<fieldset>` and `<legend>` (e.g., "Shipping Address", "Payment Details").
76
+ - Use progressive disclosure for complex forms: show advanced options behind an expandable section or a follow-up step.
77
+ - Autofocus the first input field on form mount.
78
+ - Ensure tab order follows the visual layout order — never use positive `tabindex` values.
79
+
80
+ ### Submit Behavior
81
+ - Disable the submit button when the form has known validation errors (but keep it focusable for screen readers).
82
+ - Show a loading indicator on the submit button during submission.
83
+ - Provide clear success feedback: redirect to the result page or display a success toast.
84
+ - Prevent double submission by disabling the button and ignoring duplicate submit events during pending requests.
85
+
86
+ ### Accessible Labels
87
+ - Every `<input>`, `<select>`, and `<textarea>` must have a visible `<label>` element with a matching `for`/`id` pair.
88
+ - Mark required fields with a visual asterisk (`*`) and screen-reader-only text ("required").
89
+ - Associate help text or format hints with the field via `aria-describedby`.
90
+
91
+ ## Performance
92
+
93
+ - UI must render at 60fps (≤ 16ms per frame).
94
+ - Prefer CSS animations/transitions over JavaScript animations.
95
+ - Use conditional visibility (e.g., `v-show`) over conditional mount (e.g., `v-if`) for frequently toggled elements.
96
+ - Lazy-load panels that aren't immediately visible.
97
+
98
+ ## Testing
99
+
100
+ - Snapshot tests for all visual states.
101
+ - Component tests for interactive behavior.
102
+ - Verify reduced-motion behavior in tests.
@@ -0,0 +1,85 @@
1
+ ---
2
+ id: hatch3r-data-classification
3
+ type: rule
4
+ description: Data classification standards covering PII handling, encryption, retention policies, and regulatory compliance
5
+ scope: always
6
+ ---
7
+ # Data Classification Standards
8
+
9
+ ## Classification Levels
10
+
11
+ | Level | Label | Examples | Handling |
12
+ |-------|-------|----------|----------|
13
+ | 1 | **Public** | Marketing content, open-source code, public docs | No restrictions |
14
+ | 2 | **Internal** | Internal docs, non-sensitive configs, aggregated metrics | Access-controlled, no external sharing |
15
+ | 3 | **Confidential** | PII, financial data, API keys, credentials | Encrypted at rest and in transit, audit-logged |
16
+ | 4 | **Restricted** | SSN, payment card data, health records, biometrics | All Level 3 controls + additional access approval, data masking in non-production |
17
+
18
+ ## PII Handling
19
+
20
+ - Identify and inventory all PII fields in the data model. Maintain a data map.
21
+ - Minimize PII collection — only collect what's necessary for the stated purpose.
22
+ - PII fields must be marked in the schema (annotation, decorator, or comment convention).
23
+ - Never log PII. Use structured logging with PII fields explicitly excluded or masked.
24
+ - Pseudonymize PII in analytics and reporting. Use irreversible hashing for identifiers.
25
+ - Provide data export and deletion endpoints for data subject requests (GDPR Article 15/17, CCPA).
26
+
27
+ ## Encryption
28
+
29
+ ### At Rest
30
+ - All Level 3+ data must be encrypted at rest using AES-256 or equivalent.
31
+ - Use the cloud provider's managed encryption service (AWS KMS, GCP KMS, Azure Key Vault).
32
+ - Database-level encryption is the minimum. Column-level encryption for highly sensitive fields.
33
+ - Encryption keys must be rotated at least annually.
34
+
35
+ ### In Transit
36
+ - All network communication uses TLS 1.2+ (prefer TLS 1.3).
37
+ - Internal service-to-service communication also uses TLS — no plaintext even on private networks.
38
+ - Certificate pinning for mobile and critical API clients.
39
+ - HSTS headers on all web responses with a minimum max-age of 1 year.
40
+
41
+ ## Data Retention
42
+
43
+ - Define retention periods per data category. Document in the data retention schedule.
44
+ - Default retention: 90 days for logs, 1 year for transactional data, 3 years for financial records.
45
+ - Implement automated deletion for data past its retention period.
46
+ - Retention exceptions require written justification and legal review.
47
+ - Backup retention aligns with source data retention — don't keep backups longer than the data policy allows.
48
+
49
+ ## Access Controls
50
+
51
+ - Apply least-privilege access to all data stores.
52
+ - Use role-based access control (RBAC) with named roles matching business functions.
53
+ - Level 3+ data access requires multi-factor authentication.
54
+ - Level 4 data access requires explicit per-request approval with audit trail.
55
+ - Service accounts accessing Level 3+ data must use short-lived credentials (< 1 hour).
56
+ - Review and recertify data access permissions quarterly.
57
+
58
+ ## Audit Logging
59
+
60
+ - Log all access to Level 3+ data: who, what, when, from where.
61
+ - Audit logs are immutable — write to append-only storage.
62
+ - Retain audit logs for at least 1 year (or as required by applicable regulation).
63
+ - Alert on anomalous access patterns: bulk reads, off-hours access, new IP addresses.
64
+ - Audit log entries must include: timestamp, user/service identity, action, resource, result (success/failure).
65
+
66
+ ## Regulatory Compliance
67
+
68
+ ### GDPR
69
+ - Maintain Records of Processing Activities (ROPA).
70
+ - Implement consent management with granular per-purpose consent.
71
+ - Support data portability (machine-readable export format).
72
+ - 72-hour breach notification procedure documented and tested.
73
+
74
+ ### CCPA
75
+ - Honor Do Not Sell requests.
76
+ - Provide a clear privacy policy with data collection categories.
77
+ - Support opt-out mechanisms for data sale/sharing.
78
+ - Verify consumer identity before processing deletion or access requests.
79
+
80
+ ## Non-Production Environments
81
+
82
+ - Never use production data in development or staging without anonymization.
83
+ - Use synthetic data generators or anonymization pipelines for test data.
84
+ - Level 4 data is never present in non-production environments under any circumstances.
85
+ - Access to non-production environments follows the same RBAC model as production.
@@ -0,0 +1,83 @@
1
+ ---
2
+ description: Data classification standards covering PII handling, encryption, retention policies, and regulatory compliance
3
+ alwaysApply: true
4
+ ---
5
+ # Data Classification Standards
6
+
7
+ ## Classification Levels
8
+
9
+ | Level | Label | Examples | Handling |
10
+ |-------|-------|----------|----------|
11
+ | 1 | **Public** | Marketing content, open-source code, public docs | No restrictions |
12
+ | 2 | **Internal** | Internal docs, non-sensitive configs, aggregated metrics | Access-controlled, no external sharing |
13
+ | 3 | **Confidential** | PII, financial data, API keys, credentials | Encrypted at rest and in transit, audit-logged |
14
+ | 4 | **Restricted** | SSN, payment card data, health records, biometrics | All Level 3 controls + additional access approval, data masking in non-production |
15
+
16
+ ## PII Handling
17
+
18
+ - Identify and inventory all PII fields in the data model. Maintain a data map.
19
+ - Minimize PII collection — only collect what's necessary for the stated purpose.
20
+ - PII fields must be marked in the schema (annotation, decorator, or comment convention).
21
+ - Never log PII. Use structured logging with PII fields explicitly excluded or masked.
22
+ - Pseudonymize PII in analytics and reporting. Use irreversible hashing for identifiers.
23
+ - Provide data export and deletion endpoints for data subject requests (GDPR Article 15/17, CCPA).
24
+
25
+ ## Encryption
26
+
27
+ ### At Rest
28
+ - All Level 3+ data must be encrypted at rest using AES-256 or equivalent.
29
+ - Use the cloud provider's managed encryption service (AWS KMS, GCP KMS, Azure Key Vault).
30
+ - Database-level encryption is the minimum. Column-level encryption for highly sensitive fields.
31
+ - Encryption keys must be rotated at least annually.
32
+
33
+ ### In Transit
34
+ - All network communication uses TLS 1.2+ (prefer TLS 1.3).
35
+ - Internal service-to-service communication also uses TLS — no plaintext even on private networks.
36
+ - Certificate pinning for mobile and critical API clients.
37
+ - HSTS headers on all web responses with a minimum max-age of 1 year.
38
+
39
+ ## Data Retention
40
+
41
+ - Define retention periods per data category. Document in the data retention schedule.
42
+ - Default retention: 90 days for logs, 1 year for transactional data, 3 years for financial records.
43
+ - Implement automated deletion for data past its retention period.
44
+ - Retention exceptions require written justification and legal review.
45
+ - Backup retention aligns with source data retention — don't keep backups longer than the data policy allows.
46
+
47
+ ## Access Controls
48
+
49
+ - Apply least-privilege access to all data stores.
50
+ - Use role-based access control (RBAC) with named roles matching business functions.
51
+ - Level 3+ data access requires multi-factor authentication.
52
+ - Level 4 data access requires explicit per-request approval with audit trail.
53
+ - Service accounts accessing Level 3+ data must use short-lived credentials (< 1 hour).
54
+ - Review and recertify data access permissions quarterly.
55
+
56
+ ## Audit Logging
57
+
58
+ - Log all access to Level 3+ data: who, what, when, from where.
59
+ - Audit logs are immutable — write to append-only storage.
60
+ - Retain audit logs for at least 1 year (or as required by applicable regulation).
61
+ - Alert on anomalous access patterns: bulk reads, off-hours access, new IP addresses.
62
+ - Audit log entries must include: timestamp, user/service identity, action, resource, result (success/failure).
63
+
64
+ ## Regulatory Compliance
65
+
66
+ ### GDPR
67
+ - Maintain Records of Processing Activities (ROPA).
68
+ - Implement consent management with granular per-purpose consent.
69
+ - Support data portability (machine-readable export format).
70
+ - 72-hour breach notification procedure documented and tested.
71
+
72
+ ### CCPA
73
+ - Honor Do Not Sell requests.
74
+ - Provide a clear privacy policy with data collection categories.
75
+ - Support opt-out mechanisms for data sale/sharing.
76
+ - Verify consumer identity before processing deletion or access requests.
77
+
78
+ ## Non-Production Environments
79
+
80
+ - Never use production data in development or staging without anonymization.
81
+ - Use synthetic data generators or anonymization pipelines for test data.
82
+ - Level 4 data is never present in non-production environments under any circumstances.
83
+ - Access to non-production environments follows the same RBAC model as production.
@@ -0,0 +1,17 @@
1
+ ---
2
+ id: hatch3r-dependency-management
3
+ type: rule
4
+ description: Rules for managing project dependencies
5
+ scope: always
6
+ ---
7
+ # Dependency Management
8
+
9
+ - Always commit the lockfile. Never install without saving.
10
+ - Justify new dependencies in PR description: what it does, why needed, alternatives considered, bundle size impact.
11
+ - Prefer well-maintained packages: recent commits, active issues, no known CVEs.
12
+ - Pin exact versions for production deps. Use clean install (e.g., `npm ci`, `pip install -r`, `cargo build`) in CI.
13
+ - Run a dependency security scanner (e.g., `npm audit`, `pip-audit`, `cargo audit`) before merging dependency changes. Fix high/critical before merge.
14
+ - No duplicate packages serving the same purpose. Consolidate on one.
15
+ - Remove unused dependencies on every cleanup pass.
16
+ - Security patches (CVEs) are P0/P1 priority. Patch within 48h for critical.
17
+ - Check bundle size impact against budget. Reject deps that exceed.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Rules for managing npm dependencies in the project
3
+ alwaysApply: false
4
+ ---
5
+ # Dependency Management
6
+
7
+ - Always commit `package-lock.json`. Never use `npm install --no-save`.
8
+ - Justify new dependencies in PR description: what it does, why needed, alternatives considered, bundle size impact.
9
+ - Prefer well-maintained packages: recent commits, active issues, no known CVEs.
10
+ - Pin exact versions for production deps. Use `npm ci` in CI.
11
+ - Run `npm audit` before merging dependency changes. Fix high/critical before merge.
12
+ - No duplicate packages serving the same purpose. Consolidate on one.
13
+ - Remove unused dependencies on every cleanup pass.
14
+ - Security patches (CVEs) are P0/P1 priority. Patch within 48h for critical.
15
+ - Check bundle size impact against budget. Reject deps that exceed.
@@ -0,0 +1,17 @@
1
+ ---
2
+ id: hatch3r-error-handling
3
+ type: rule
4
+ description: Error handling patterns and conventions for the project
5
+ scope: always
6
+ ---
7
+ # Error Handling
8
+
9
+ - Define a structured error hierarchy: base error class with `code`, `message`, `cause`.
10
+ - Never swallow errors silently. Always re-throw or log with context.
11
+ - Use typed error codes (not raw strings). Reference codes in project glossary when applicable.
12
+ - User-facing errors are separate from internal errors. Never expose internal details to clients.
13
+ - Retry with exponential backoff for transient failures (network, rate limits). Honor `Retry-After` on 429.
14
+ - API endpoints return structured error responses `{ code, message, details? }`. Never return stack traces.
15
+ - Use framework error boundaries for UI components. Surface user-friendly fallback UI.
16
+ - Include `correlationId` in all error logs for tracing across client and server.
17
+ - Security: no secrets, tokens, or PII in error messages or logs.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Error handling patterns and conventions for the project
3
+ alwaysApply: false
4
+ ---
5
+ # Error Handling
6
+
7
+ - Define a structured error hierarchy: base error class with `code`, `message`, `cause`.
8
+ - Never swallow errors silently. Always re-throw or log with context.
9
+ - Use typed error codes (not raw strings). Reference codes in project glossary when applicable.
10
+ - User-facing errors are separate from internal errors. Never expose internal details to clients.
11
+ - Retry with exponential backoff for transient failures (network, rate limits). Honor `Retry-After` on 429.
12
+ - API endpoints return structured error responses `{ code, message, details? }`. Never return stack traces.
13
+ - Use framework error boundaries for UI components. Surface user-friendly fallback UI.
14
+ - Include `correlationId` in all error logs for tracing across client and server.
15
+ - Security: no secrets, tokens, or PII in error messages or logs.