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.
- package/LICENSE +21 -0
- package/README.md +437 -0
- package/agents/hatch3r-a11y-auditor.md +126 -0
- package/agents/hatch3r-architect.md +160 -0
- package/agents/hatch3r-ci-watcher.md +123 -0
- package/agents/hatch3r-context-rules.md +97 -0
- package/agents/hatch3r-dependency-auditor.md +164 -0
- package/agents/hatch3r-devops.md +138 -0
- package/agents/hatch3r-docs-writer.md +97 -0
- package/agents/hatch3r-implementer.md +162 -0
- package/agents/hatch3r-learnings-loader.md +108 -0
- package/agents/hatch3r-lint-fixer.md +104 -0
- package/agents/hatch3r-perf-profiler.md +123 -0
- package/agents/hatch3r-researcher.md +642 -0
- package/agents/hatch3r-reviewer.md +81 -0
- package/agents/hatch3r-security-auditor.md +119 -0
- package/agents/hatch3r-test-writer.md +134 -0
- package/commands/hatch3r-agent-customize.md +146 -0
- package/commands/hatch3r-api-spec.md +49 -0
- package/commands/hatch3r-benchmark.md +50 -0
- package/commands/hatch3r-board-fill.md +504 -0
- package/commands/hatch3r-board-init.md +315 -0
- package/commands/hatch3r-board-pickup.md +672 -0
- package/commands/hatch3r-board-refresh.md +198 -0
- package/commands/hatch3r-board-shared.md +369 -0
- package/commands/hatch3r-bug-plan.md +410 -0
- package/commands/hatch3r-codebase-map.md +1182 -0
- package/commands/hatch3r-command-customize.md +94 -0
- package/commands/hatch3r-context-health.md +112 -0
- package/commands/hatch3r-cost-tracking.md +139 -0
- package/commands/hatch3r-dep-audit.md +171 -0
- package/commands/hatch3r-feature-plan.md +379 -0
- package/commands/hatch3r-healthcheck.md +307 -0
- package/commands/hatch3r-hooks.md +282 -0
- package/commands/hatch3r-learn.md +217 -0
- package/commands/hatch3r-migration-plan.md +51 -0
- package/commands/hatch3r-onboard.md +56 -0
- package/commands/hatch3r-project-spec.md +1153 -0
- package/commands/hatch3r-recipe.md +179 -0
- package/commands/hatch3r-refactor-plan.md +426 -0
- package/commands/hatch3r-release.md +328 -0
- package/commands/hatch3r-roadmap.md +556 -0
- package/commands/hatch3r-rule-customize.md +114 -0
- package/commands/hatch3r-security-audit.md +370 -0
- package/commands/hatch3r-skill-customize.md +93 -0
- package/commands/hatch3r-workflow.md +377 -0
- package/dist/cli/hooks-ZOTFDEA3.js +59 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3584 -0
- package/github-agents/hatch3r-docs-agent.md +46 -0
- package/github-agents/hatch3r-lint-agent.md +41 -0
- package/github-agents/hatch3r-security-agent.md +54 -0
- package/github-agents/hatch3r-test-agent.md +66 -0
- package/hooks/hatch3r-ci-failure.md +10 -0
- package/hooks/hatch3r-file-save.md +11 -0
- package/hooks/hatch3r-post-merge.md +10 -0
- package/hooks/hatch3r-pre-commit.md +11 -0
- package/hooks/hatch3r-pre-push.md +10 -0
- package/hooks/hatch3r-session-start.md +10 -0
- package/mcp/mcp.json +62 -0
- package/package.json +84 -0
- package/prompts/hatch3r-bug-triage.md +155 -0
- package/prompts/hatch3r-code-review.md +131 -0
- package/prompts/hatch3r-pr-description.md +173 -0
- package/rules/hatch3r-accessibility-standards.md +77 -0
- package/rules/hatch3r-accessibility-standards.mdc +75 -0
- package/rules/hatch3r-agent-orchestration.md +160 -0
- package/rules/hatch3r-api-design.md +176 -0
- package/rules/hatch3r-api-design.mdc +176 -0
- package/rules/hatch3r-browser-verification.md +73 -0
- package/rules/hatch3r-browser-verification.mdc +73 -0
- package/rules/hatch3r-ci-cd.md +70 -0
- package/rules/hatch3r-ci-cd.mdc +68 -0
- package/rules/hatch3r-code-standards.md +102 -0
- package/rules/hatch3r-code-standards.mdc +100 -0
- package/rules/hatch3r-component-conventions.md +102 -0
- package/rules/hatch3r-component-conventions.mdc +102 -0
- package/rules/hatch3r-data-classification.md +85 -0
- package/rules/hatch3r-data-classification.mdc +83 -0
- package/rules/hatch3r-dependency-management.md +17 -0
- package/rules/hatch3r-dependency-management.mdc +15 -0
- package/rules/hatch3r-error-handling.md +17 -0
- package/rules/hatch3r-error-handling.mdc +15 -0
- package/rules/hatch3r-feature-flags.md +112 -0
- package/rules/hatch3r-feature-flags.mdc +112 -0
- package/rules/hatch3r-git-conventions.md +47 -0
- package/rules/hatch3r-git-conventions.mdc +45 -0
- package/rules/hatch3r-i18n.md +90 -0
- package/rules/hatch3r-i18n.mdc +90 -0
- package/rules/hatch3r-learning-consult.md +29 -0
- package/rules/hatch3r-learning-consult.mdc +27 -0
- package/rules/hatch3r-migrations.md +17 -0
- package/rules/hatch3r-migrations.mdc +15 -0
- package/rules/hatch3r-observability.md +165 -0
- package/rules/hatch3r-observability.mdc +165 -0
- package/rules/hatch3r-performance-budgets.md +109 -0
- package/rules/hatch3r-performance-budgets.mdc +109 -0
- package/rules/hatch3r-secrets-management.md +76 -0
- package/rules/hatch3r-secrets-management.mdc +74 -0
- package/rules/hatch3r-security-patterns.md +211 -0
- package/rules/hatch3r-security-patterns.mdc +211 -0
- package/rules/hatch3r-testing.md +89 -0
- package/rules/hatch3r-testing.mdc +87 -0
- package/rules/hatch3r-theming.md +51 -0
- package/rules/hatch3r-theming.mdc +51 -0
- package/rules/hatch3r-tooling-hierarchy.md +92 -0
- package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
- package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
- package/skills/hatch3r-agent-customize/SKILL.md +75 -0
- package/skills/hatch3r-api-spec/SKILL.md +66 -0
- package/skills/hatch3r-architecture-review/SKILL.md +96 -0
- package/skills/hatch3r-bug-fix/SKILL.md +129 -0
- package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
- package/skills/hatch3r-command-customize/SKILL.md +67 -0
- package/skills/hatch3r-context-health/SKILL.md +76 -0
- package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
- package/skills/hatch3r-dep-audit/SKILL.md +82 -0
- package/skills/hatch3r-feature/SKILL.md +129 -0
- package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
- package/skills/hatch3r-incident-response/SKILL.md +86 -0
- package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
- package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
- package/skills/hatch3r-migration/SKILL.md +76 -0
- package/skills/hatch3r-perf-audit/SKILL.md +114 -0
- package/skills/hatch3r-pr-creation/SKILL.md +85 -0
- package/skills/hatch3r-qa-validation/SKILL.md +86 -0
- package/skills/hatch3r-recipe/SKILL.md +67 -0
- package/skills/hatch3r-refactor/SKILL.md +86 -0
- package/skills/hatch3r-release/SKILL.md +93 -0
- package/skills/hatch3r-rule-customize/SKILL.md +70 -0
- package/skills/hatch3r-skill-customize/SKILL.md +67 -0
- package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Feature flag patterns and lifecycle for the project
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
# Feature Flags
|
|
6
|
+
|
|
7
|
+
- Use flags for gradual rollout of user-facing changes. Not for A/B experiments without tracking.
|
|
8
|
+
- Naming: `FF_{AREA}_{FEATURE}` (e.g., `FF_PET_NEW_CELEBRATION`).
|
|
9
|
+
- Store flags in remote config or user document in your backend.
|
|
10
|
+
- Client: evaluate with composable/hook. Server: evaluate before processing.
|
|
11
|
+
- Every flag has an owner and cleanup deadline (max 30 days after full rollout).
|
|
12
|
+
- Remove flag code when feature is fully rolled out. No dead branches.
|
|
13
|
+
- Default to disabled. Safe fallback when flag evaluation fails.
|
|
14
|
+
- Flags must not gate security or privacy features. Those are always on.
|
|
15
|
+
- Document active flags in a tracking table (e.g., `.cursor/rules` or project specs).
|
|
16
|
+
|
|
17
|
+
## Gradual Rollout Strategies
|
|
18
|
+
|
|
19
|
+
- Percentage-based rollout: `1% → 5% → 25% → 50% → 100%`. Pause and monitor error rates at each step.
|
|
20
|
+
- Cohort-based rollout: internal team → beta users → general availability. Define cohorts by user attribute, not random sampling.
|
|
21
|
+
- Canary deployment: route a small traffic slice to the new code path. Promote only after health metrics stabilize.
|
|
22
|
+
- Geographic rollout: enable by region when latency, compliance, or locale behavior varies.
|
|
23
|
+
- Device-type targeting: roll out to web before mobile (or vice versa) when platform stability differs.
|
|
24
|
+
- Never skip straight from 1% to 100%. Each step must hold for a minimum observation window (e.g., 24 hours).
|
|
25
|
+
- Automate rollout progression when metrics (error rate, latency p99, crash-free rate) stay within thresholds.
|
|
26
|
+
|
|
27
|
+
## Flag Dependencies
|
|
28
|
+
|
|
29
|
+
- Model parent-child relationships when a feature flag gates a prerequisite for another flag.
|
|
30
|
+
- Prerequisite flags must be enabled before dependents. Enforce at evaluation time—return disabled if any prerequisite is off.
|
|
31
|
+
- Define mutual exclusion groups for flags that must not be active simultaneously (e.g., competing UI variants).
|
|
32
|
+
- Validate the dependency graph on flag creation or update. Reject cycles and orphaned references.
|
|
33
|
+
- Document dependencies in the flag tracking table so cleanup cascades are visible.
|
|
34
|
+
- When removing a parent flag, verify all dependent flags are also cleaned up or re-parented.
|
|
35
|
+
|
|
36
|
+
## Kill Switches
|
|
37
|
+
|
|
38
|
+
- Every user-facing feature with a flag must have a corresponding kill switch that disables it instantly.
|
|
39
|
+
- Kill switch naming: `KS_{AREA}_{FEATURE}`. Distinguish from rollout flags to avoid confusion.
|
|
40
|
+
- Kill switches are permanent operational flags—they do not follow the 30-day cleanup deadline.
|
|
41
|
+
- Integrate kill switches with circuit breakers: auto-disable when error rate or latency exceeds a threshold.
|
|
42
|
+
- Define automatic rollback triggers in monitoring (e.g., 5xx rate > 2% for 5 minutes → disable flag).
|
|
43
|
+
- Test kill switch behavior: verify the feature degrades gracefully and no data corruption occurs on disable.
|
|
44
|
+
- Include kill switch activation in the incident response runbook. On-call must know which flags to toggle.
|
|
45
|
+
|
|
46
|
+
## Stale Flag Detection
|
|
47
|
+
|
|
48
|
+
- Automate alerts when a flag exceeds its cleanup deadline. Notify the flag owner and their team lead.
|
|
49
|
+
- Track flag evaluation frequency. A flag evaluated zero times in 14 days is likely stale—investigate.
|
|
50
|
+
- Detect always-on flags (100% rollout for > 30 days) and always-off flags (never enabled) via scheduled scans.
|
|
51
|
+
- Lint for flag references in code. Flag identifiers with no code references are dead—remove from the config.
|
|
52
|
+
- Maintain a cleanup workflow: alert → owner acknowledges → PR to remove flag code → config deletion → verify.
|
|
53
|
+
- Enforce a hard cap on active flags per service (e.g., 30). Block new flag creation if the cap is reached until stale flags are cleaned up.
|
|
54
|
+
|
|
55
|
+
## Flag Audit & Compliance
|
|
56
|
+
|
|
57
|
+
- Log every flag state change with: who changed it, when, previous value, new value, and reason.
|
|
58
|
+
- Require approval workflows for flags in production environments. No direct toggle without review.
|
|
59
|
+
- Tag compliance-sensitive flags (e.g., flags affecting data collection, consent, or PII handling) for stricter review.
|
|
60
|
+
- Retain audit logs for the project's required compliance period (minimum 90 days).
|
|
61
|
+
- Maintain rollback history: store the last N states so a flag can be reverted to any prior configuration.
|
|
62
|
+
- Review flag audit logs during incident post-mortems to correlate flag changes with outages.
|
|
63
|
+
|
|
64
|
+
## Testing with Flags
|
|
65
|
+
|
|
66
|
+
- Test both flag states (`on` and `off`) for every flag-gated code path. Include the default/fallback state.
|
|
67
|
+
- Use parameterized tests to cover flag combinations without duplicating test logic.
|
|
68
|
+
- CI runs a flag matrix for critical flags: each PR verifies the feature works in both states.
|
|
69
|
+
- Integration tests must not depend on remote flag config. Use local overrides or test fixtures.
|
|
70
|
+
- After full rollout, verify in production that the flag-off code path is unreachable before removing it.
|
|
71
|
+
- Test kill switch activation in staging: simulate the disable and confirm graceful degradation.
|
|
72
|
+
- Flag-related test failures block deployment. Treat them with the same severity as regular test failures.
|
|
73
|
+
|
|
74
|
+
## OpenFeature Standard
|
|
75
|
+
|
|
76
|
+
Use the [OpenFeature](https://openfeature.dev) SDK for provider-agnostic feature flag evaluation. OpenFeature defines a vendor-neutral API so application code is decoupled from the flag management backend.
|
|
77
|
+
|
|
78
|
+
### Provider Interface
|
|
79
|
+
|
|
80
|
+
- Implement the OpenFeature Provider interface to connect to your flag backend (LaunchDarkly, Flagsmith, CloudBees, environment variables, or a custom solution).
|
|
81
|
+
- The provider must implement typed resolution methods: `resolveBooleanEvaluation`, `resolveStringEvaluation`, `resolveNumberEvaluation`, and `resolveObjectEvaluation`.
|
|
82
|
+
- Each resolution returns a `ResolutionDetails` object containing the resolved `value`, an optional `variant` name, and a `reason` (e.g., `TARGETING_MATCH`, `DEFAULT`, `DISABLED`).
|
|
83
|
+
- Register the provider at application startup: `OpenFeature.setProvider(new YourProvider())`. Only one provider is active at a time per client.
|
|
84
|
+
- For testing, use the in-memory provider shipped with the SDK. Seed flag values in test setup without needing a real backend.
|
|
85
|
+
|
|
86
|
+
### Evaluation Context
|
|
87
|
+
|
|
88
|
+
- Evaluation context carries ambient information used for targeting and rule evaluation. Set it at three levels:
|
|
89
|
+
- **API-level (global):** Environment, application version, deployment region.
|
|
90
|
+
- **Client-level:** Service name, module identifier.
|
|
91
|
+
- **Invocation-level:** User ID, user role, tenant ID, request-specific attributes.
|
|
92
|
+
- Contexts merge with invocation > client > API precedence. Invocation context overrides client, which overrides API.
|
|
93
|
+
- Include a `targetingKey` in the context for consistent user-level targeting (e.g., user ID or session ID).
|
|
94
|
+
- Keep context attributes minimal and non-sensitive. Never include passwords, tokens, or PII beyond what is necessary for targeting.
|
|
95
|
+
|
|
96
|
+
### Hooks
|
|
97
|
+
|
|
98
|
+
- Use OpenFeature hooks to add cross-cutting behavior at four lifecycle stages:
|
|
99
|
+
- **Before:** Enrich or validate evaluation context before the provider resolves the flag. Use for injecting common attributes.
|
|
100
|
+
- **After:** Log flag evaluation results, emit metrics, or trigger side effects after successful resolution.
|
|
101
|
+
- **Error:** Handle provider failures, log errors, and fall back to default values gracefully.
|
|
102
|
+
- **Finally:** Clean up resources or emit telemetry regardless of evaluation outcome.
|
|
103
|
+
- Hook execution order: API hooks → client hooks → invocation hooks (for before/after). Reverse order for error/finally.
|
|
104
|
+
- Use hooks for observability: emit a metric or structured log entry for every flag evaluation, including flag key, variant, and reason. This enables flag usage tracking and stale flag detection.
|
|
105
|
+
- Use hooks for validation: enforce naming conventions, flag key format, or context completeness before evaluation.
|
|
106
|
+
|
|
107
|
+
### Migration from Direct Provider SDKs
|
|
108
|
+
|
|
109
|
+
- Replace direct provider SDK calls (e.g., `ldClient.variation()`) with OpenFeature client calls (`client.getBooleanValue()`).
|
|
110
|
+
- Implement the OpenFeature Provider interface as a thin adapter around your existing provider SDK.
|
|
111
|
+
- This enables switching providers (e.g., LaunchDarkly → Flagsmith) by swapping the provider implementation without changing application code.
|
|
112
|
+
- During migration, both direct SDK calls and OpenFeature calls can coexist. Migrate incrementally by module.
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Feature flag patterns and lifecycle for the project
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
# Feature Flags
|
|
6
|
+
|
|
7
|
+
- Use flags for gradual rollout of user-facing changes. Not for A/B experiments without tracking.
|
|
8
|
+
- Naming: `FF_{AREA}_{FEATURE}` (e.g., `FF_PET_NEW_CELEBRATION`).
|
|
9
|
+
- Store flags in remote config or user document in your backend.
|
|
10
|
+
- Client: evaluate with composable/hook. Server: evaluate before processing.
|
|
11
|
+
- Every flag has an owner and cleanup deadline (max 30 days after full rollout).
|
|
12
|
+
- Remove flag code when feature is fully rolled out. No dead branches.
|
|
13
|
+
- Default to disabled. Safe fallback when flag evaluation fails.
|
|
14
|
+
- Flags must not gate security or privacy features. Those are always on.
|
|
15
|
+
- Document active flags in a tracking table (e.g., `.cursor/rules` or project specs).
|
|
16
|
+
|
|
17
|
+
## Gradual Rollout Strategies
|
|
18
|
+
|
|
19
|
+
- Percentage-based rollout: `1% → 5% → 25% → 50% → 100%`. Pause and monitor error rates at each step.
|
|
20
|
+
- Cohort-based rollout: internal team → beta users → general availability. Define cohorts by user attribute, not random sampling.
|
|
21
|
+
- Canary deployment: route a small traffic slice to the new code path. Promote only after health metrics stabilize.
|
|
22
|
+
- Geographic rollout: enable by region when latency, compliance, or locale behavior varies.
|
|
23
|
+
- Device-type targeting: roll out to web before mobile (or vice versa) when platform stability differs.
|
|
24
|
+
- Never skip straight from 1% to 100%. Each step must hold for a minimum observation window (e.g., 24 hours).
|
|
25
|
+
- Automate rollout progression when metrics (error rate, latency p99, crash-free rate) stay within thresholds.
|
|
26
|
+
|
|
27
|
+
## Flag Dependencies
|
|
28
|
+
|
|
29
|
+
- Model parent-child relationships when a feature flag gates a prerequisite for another flag.
|
|
30
|
+
- Prerequisite flags must be enabled before dependents. Enforce at evaluation time—return disabled if any prerequisite is off.
|
|
31
|
+
- Define mutual exclusion groups for flags that must not be active simultaneously (e.g., competing UI variants).
|
|
32
|
+
- Validate the dependency graph on flag creation or update. Reject cycles and orphaned references.
|
|
33
|
+
- Document dependencies in the flag tracking table so cleanup cascades are visible.
|
|
34
|
+
- When removing a parent flag, verify all dependent flags are also cleaned up or re-parented.
|
|
35
|
+
|
|
36
|
+
## Kill Switches
|
|
37
|
+
|
|
38
|
+
- Every user-facing feature with a flag must have a corresponding kill switch that disables it instantly.
|
|
39
|
+
- Kill switch naming: `KS_{AREA}_{FEATURE}`. Distinguish from rollout flags to avoid confusion.
|
|
40
|
+
- Kill switches are permanent operational flags—they do not follow the 30-day cleanup deadline.
|
|
41
|
+
- Integrate kill switches with circuit breakers: auto-disable when error rate or latency exceeds a threshold.
|
|
42
|
+
- Define automatic rollback triggers in monitoring (e.g., 5xx rate > 2% for 5 minutes → disable flag).
|
|
43
|
+
- Test kill switch behavior: verify the feature degrades gracefully and no data corruption occurs on disable.
|
|
44
|
+
- Include kill switch activation in the incident response runbook. On-call must know which flags to toggle.
|
|
45
|
+
|
|
46
|
+
## Stale Flag Detection
|
|
47
|
+
|
|
48
|
+
- Automate alerts when a flag exceeds its cleanup deadline. Notify the flag owner and their team lead.
|
|
49
|
+
- Track flag evaluation frequency. A flag evaluated zero times in 14 days is likely stale—investigate.
|
|
50
|
+
- Detect always-on flags (100% rollout for > 30 days) and always-off flags (never enabled) via scheduled scans.
|
|
51
|
+
- Lint for flag references in code. Flag identifiers with no code references are dead—remove from the config.
|
|
52
|
+
- Maintain a cleanup workflow: alert → owner acknowledges → PR to remove flag code → config deletion → verify.
|
|
53
|
+
- Enforce a hard cap on active flags per service (e.g., 30). Block new flag creation if the cap is reached until stale flags are cleaned up.
|
|
54
|
+
|
|
55
|
+
## Flag Audit & Compliance
|
|
56
|
+
|
|
57
|
+
- Log every flag state change with: who changed it, when, previous value, new value, and reason.
|
|
58
|
+
- Require approval workflows for flags in production environments. No direct toggle without review.
|
|
59
|
+
- Tag compliance-sensitive flags (e.g., flags affecting data collection, consent, or PII handling) for stricter review.
|
|
60
|
+
- Retain audit logs for the project's required compliance period (minimum 90 days).
|
|
61
|
+
- Maintain rollback history: store the last N states so a flag can be reverted to any prior configuration.
|
|
62
|
+
- Review flag audit logs during incident post-mortems to correlate flag changes with outages.
|
|
63
|
+
|
|
64
|
+
## Testing with Flags
|
|
65
|
+
|
|
66
|
+
- Test both flag states (`on` and `off`) for every flag-gated code path. Include the default/fallback state.
|
|
67
|
+
- Use parameterized tests to cover flag combinations without duplicating test logic.
|
|
68
|
+
- CI runs a flag matrix for critical flags: each PR verifies the feature works in both states.
|
|
69
|
+
- Integration tests must not depend on remote flag config. Use local overrides or test fixtures.
|
|
70
|
+
- After full rollout, verify in production that the flag-off code path is unreachable before removing it.
|
|
71
|
+
- Test kill switch activation in staging: simulate the disable and confirm graceful degradation.
|
|
72
|
+
- Flag-related test failures block deployment. Treat them with the same severity as regular test failures.
|
|
73
|
+
|
|
74
|
+
## OpenFeature Standard
|
|
75
|
+
|
|
76
|
+
Use the [OpenFeature](https://openfeature.dev) SDK for provider-agnostic feature flag evaluation. OpenFeature defines a vendor-neutral API so application code is decoupled from the flag management backend.
|
|
77
|
+
|
|
78
|
+
### Provider Interface
|
|
79
|
+
|
|
80
|
+
- Implement the OpenFeature Provider interface to connect to your flag backend (LaunchDarkly, Flagsmith, CloudBees, environment variables, or a custom solution).
|
|
81
|
+
- The provider must implement typed resolution methods: `resolveBooleanEvaluation`, `resolveStringEvaluation`, `resolveNumberEvaluation`, and `resolveObjectEvaluation`.
|
|
82
|
+
- Each resolution returns a `ResolutionDetails` object containing the resolved `value`, an optional `variant` name, and a `reason` (e.g., `TARGETING_MATCH`, `DEFAULT`, `DISABLED`).
|
|
83
|
+
- Register the provider at application startup: `OpenFeature.setProvider(new YourProvider())`. Only one provider is active at a time per client.
|
|
84
|
+
- For testing, use the in-memory provider shipped with the SDK. Seed flag values in test setup without needing a real backend.
|
|
85
|
+
|
|
86
|
+
### Evaluation Context
|
|
87
|
+
|
|
88
|
+
- Evaluation context carries ambient information used for targeting and rule evaluation. Set it at three levels:
|
|
89
|
+
- **API-level (global):** Environment, application version, deployment region.
|
|
90
|
+
- **Client-level:** Service name, module identifier.
|
|
91
|
+
- **Invocation-level:** User ID, user role, tenant ID, request-specific attributes.
|
|
92
|
+
- Contexts merge with invocation > client > API precedence. Invocation context overrides client, which overrides API.
|
|
93
|
+
- Include a `targetingKey` in the context for consistent user-level targeting (e.g., user ID or session ID).
|
|
94
|
+
- Keep context attributes minimal and non-sensitive. Never include passwords, tokens, or PII beyond what is necessary for targeting.
|
|
95
|
+
|
|
96
|
+
### Hooks
|
|
97
|
+
|
|
98
|
+
- Use OpenFeature hooks to add cross-cutting behavior at four lifecycle stages:
|
|
99
|
+
- **Before:** Enrich or validate evaluation context before the provider resolves the flag. Use for injecting common attributes.
|
|
100
|
+
- **After:** Log flag evaluation results, emit metrics, or trigger side effects after successful resolution.
|
|
101
|
+
- **Error:** Handle provider failures, log errors, and fall back to default values gracefully.
|
|
102
|
+
- **Finally:** Clean up resources or emit telemetry regardless of evaluation outcome.
|
|
103
|
+
- Hook execution order: API hooks → client hooks → invocation hooks (for before/after). Reverse order for error/finally.
|
|
104
|
+
- Use hooks for observability: emit a metric or structured log entry for every flag evaluation, including flag key, variant, and reason. This enables flag usage tracking and stale flag detection.
|
|
105
|
+
- Use hooks for validation: enforce naming conventions, flag key format, or context completeness before evaluation.
|
|
106
|
+
|
|
107
|
+
### Migration from Direct Provider SDKs
|
|
108
|
+
|
|
109
|
+
- Replace direct provider SDK calls (e.g., `ldClient.variation()`) with OpenFeature client calls (`client.getBooleanValue()`).
|
|
110
|
+
- Implement the OpenFeature Provider interface as a thin adapter around your existing provider SDK.
|
|
111
|
+
- This enables switching providers (e.g., LaunchDarkly → Flagsmith) by swapping the provider implementation without changing application code.
|
|
112
|
+
- During migration, both direct SDK calls and OpenFeature calls can coexist. Migrate incrementally by module.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-git-conventions
|
|
3
|
+
type: rule
|
|
4
|
+
description: Git commit message and branching conventions
|
|
5
|
+
scope: always
|
|
6
|
+
---
|
|
7
|
+
# Git Conventions
|
|
8
|
+
|
|
9
|
+
## Commit Messages
|
|
10
|
+
|
|
11
|
+
Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
type(scope)?: description
|
|
15
|
+
|
|
16
|
+
[optional body]
|
|
17
|
+
|
|
18
|
+
[optional footer(s)]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Types
|
|
22
|
+
- `feat` — new feature (triggers minor version bump)
|
|
23
|
+
- `fix` — bug fix (triggers patch version bump)
|
|
24
|
+
- `chore` — maintenance, dependencies, config
|
|
25
|
+
- `docs` — documentation only
|
|
26
|
+
- `refactor` — code change that neither fixes a bug nor adds a feature
|
|
27
|
+
- `test` — adding or updating tests
|
|
28
|
+
- `ci` — CI/CD configuration changes
|
|
29
|
+
- `perf` — performance improvement
|
|
30
|
+
- `build` — build system changes
|
|
31
|
+
- `style` — formatting, whitespace (no logic change)
|
|
32
|
+
|
|
33
|
+
### Rules
|
|
34
|
+
- Subject line: imperative mood, lowercase, no period, max 72 characters
|
|
35
|
+
- Body: wrap at 80 characters, explain what and why (not how)
|
|
36
|
+
- Breaking changes: add `!` after type/scope and `BREAKING CHANGE:` footer
|
|
37
|
+
- Reference issues: `Closes #123`, `Fixes #456`
|
|
38
|
+
|
|
39
|
+
## Branch Naming
|
|
40
|
+
|
|
41
|
+
Format: `{type}/{short-description}`
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
- `feat/user-authentication`
|
|
45
|
+
- `fix/null-pointer-on-login`
|
|
46
|
+
- `chore/update-dependencies`
|
|
47
|
+
- `refactor/extract-adapter-base`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Git commit message and branching conventions
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Git Conventions
|
|
6
|
+
|
|
7
|
+
## Commit Messages
|
|
8
|
+
|
|
9
|
+
Follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
type(scope)?: description
|
|
13
|
+
|
|
14
|
+
[optional body]
|
|
15
|
+
|
|
16
|
+
[optional footer(s)]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Types
|
|
20
|
+
- `feat` — new feature (triggers minor version bump)
|
|
21
|
+
- `fix` — bug fix (triggers patch version bump)
|
|
22
|
+
- `chore` — maintenance, dependencies, config
|
|
23
|
+
- `docs` — documentation only
|
|
24
|
+
- `refactor` — code change that neither fixes a bug nor adds a feature
|
|
25
|
+
- `test` — adding or updating tests
|
|
26
|
+
- `ci` — CI/CD configuration changes
|
|
27
|
+
- `perf` — performance improvement
|
|
28
|
+
- `build` — build system changes
|
|
29
|
+
- `style` — formatting, whitespace (no logic change)
|
|
30
|
+
|
|
31
|
+
### Rules
|
|
32
|
+
- Subject line: imperative mood, lowercase, no period, max 72 characters
|
|
33
|
+
- Body: wrap at 80 characters, explain what and why (not how)
|
|
34
|
+
- Breaking changes: add `!` after type/scope and `BREAKING CHANGE:` footer
|
|
35
|
+
- Reference issues: `Closes #123`, `Fixes #456`
|
|
36
|
+
|
|
37
|
+
## Branch Naming
|
|
38
|
+
|
|
39
|
+
Format: `{type}/{short-description}`
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
- `feat/user-authentication`
|
|
43
|
+
- `fix/null-pointer-on-login`
|
|
44
|
+
- `chore/update-dependencies`
|
|
45
|
+
- `refactor/extract-adapter-base`
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Internationalization, localization, and RTL support conventions for the project
|
|
3
|
+
globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx, src/**/*.ts
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Internationalization & RTL
|
|
7
|
+
|
|
8
|
+
## Locale Management
|
|
9
|
+
|
|
10
|
+
- Detect locale via resolution chain: explicit user preference → `Accept-Language` header (server) → `navigator.language` (client) → default locale.
|
|
11
|
+
- Define a fallback chain per locale (e.g., `fr-CA` → `fr` → `en`) and always resolve to a supported locale.
|
|
12
|
+
- Persist user locale choice in user settings or `localStorage`; pass locale via URL segment or header — never infer from IP alone.
|
|
13
|
+
- Load only the active locale's translations at runtime; lazy-load additional locales on demand.
|
|
14
|
+
|
|
15
|
+
## Text & Translation
|
|
16
|
+
|
|
17
|
+
- Use ICU MessageFormat syntax for plurals, gender, and select patterns (`{count, plural, one {# item} other {# items}}`).
|
|
18
|
+
- Never embed HTML markup inside translation strings — pass components or slots as interpolation values instead.
|
|
19
|
+
- Translation keys: use dot-separated, hierarchical namespaces matching feature structure (`settings.profile.title`, `cart.empty.message`).
|
|
20
|
+
- Never concatenate translated fragments to build sentences — each complete sentence is a single translation key.
|
|
21
|
+
- Maintain a string extraction workflow (e.g., `i18next-parser`, `vue-i18n-extract`) that runs in CI to flag unused and missing keys.
|
|
22
|
+
|
|
23
|
+
## RTL Support
|
|
24
|
+
|
|
25
|
+
- Use CSS logical properties exclusively: `margin-inline-start` (not `margin-left`), `padding-inline-end` (not `padding-right`), `inset-inline-start` (not `left`), `text-align: start` (not `text-align: left`).
|
|
26
|
+
- Set `dir` and `lang` attributes on `<html>` dynamically based on active locale (`<html dir="rtl" lang="ar">`).
|
|
27
|
+
- Use `dir="auto"` on user-generated content elements to let the Unicode Bidirectional Algorithm determine direction.
|
|
28
|
+
- Mirror directional icons (arrows, chevrons, navigation cues) in RTL; do not mirror semantic icons (checkmarks, search, external link).
|
|
29
|
+
- Use `logical` keyword for `resize`, `overflow`, and `float` where supported; provide fallbacks with `[dir="rtl"]` overrides where needed.
|
|
30
|
+
|
|
31
|
+
## Number & Date Formatting
|
|
32
|
+
|
|
33
|
+
- Format all numbers with `Intl.NumberFormat` — never manually insert thousands separators or decimal points.
|
|
34
|
+
- Format all dates with `Intl.DateTimeFormat`; use relative time with `Intl.RelativeTimeFormat` for recent timestamps.
|
|
35
|
+
- Format currency with `Intl.NumberFormat` using `style: 'currency'` and the correct currency code — never hard-code symbols.
|
|
36
|
+
- Sort locale-sensitive strings with `Intl.Collator` — never use raw `String.prototype.localeCompare` without options.
|
|
37
|
+
- Always pass the active locale to all `Intl` constructors.
|
|
38
|
+
|
|
39
|
+
## Layout Accommodations
|
|
40
|
+
|
|
41
|
+
- Allow 30–40% text expansion for German/Finnish translations relative to English; test UI with pseudo-localization that pads strings.
|
|
42
|
+
- Use `min-height` instead of fixed `height` on text containers to accommodate CJK line-height requirements (1.6–1.8 recommended).
|
|
43
|
+
- Define font stacks per script family: Latin, CJK, Arabic, Devanagari — ensure each stack includes a web-safe fallback and `system-ui`.
|
|
44
|
+
- Truncate overflowing text with `text-overflow: ellipsis` plus `overflow: hidden` and `white-space: nowrap` only when semantically safe; provide title/tooltip with full text.
|
|
45
|
+
- Avoid fixed-width containers for translatable text; prefer `min-width` / `max-width` with flex/grid layout.
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
- Enable pseudo-localization (e.g., `[Ḿéššàĝé]`) during development to surface hardcoded strings and layout overflow.
|
|
50
|
+
- Run RTL visual tests: render key pages with `dir="rtl"` and compare screenshots for layout correctness.
|
|
51
|
+
- Add a CI check that verifies translation completeness: every key in the default locale exists in all target locales.
|
|
52
|
+
- Compare screenshots across locales (especially German for expansion, Arabic for RTL, Japanese for CJK) at key viewport sizes.
|
|
53
|
+
- Validate that all `Intl` formatting output is correct for edge-case locales (e.g., `ar-SA` for Hindu-Arabic numerals, `de-DE` for comma decimals).
|
|
54
|
+
|
|
55
|
+
## ICU MessageFormat 2.0 (MF2)
|
|
56
|
+
|
|
57
|
+
ICU MessageFormat 2.0 reached Final Candidate status in CLDR 46.1 (January 2025). MF2 is a significant evolution from MessageFormat 1.0, designed as a platform-independent specification with improved extensibility.
|
|
58
|
+
|
|
59
|
+
### Key Syntax Changes from MF1
|
|
60
|
+
|
|
61
|
+
- **Variable references** use `$` prefix: `{$userName}` instead of positional `{0}` arguments.
|
|
62
|
+
- **Declarations** use `.input` and `.local` for explicit variable binding:
|
|
63
|
+
```
|
|
64
|
+
.input {$count :number}
|
|
65
|
+
.local $formattedDate = {$date :datetime dateStyle=medium}
|
|
66
|
+
```
|
|
67
|
+
- **Selection** uses `.match` instead of nested `{value, select, ...}` / `{value, plural, ...}`:
|
|
68
|
+
```
|
|
69
|
+
.input {$count :number}
|
|
70
|
+
.match $count
|
|
71
|
+
0 {{No items}}
|
|
72
|
+
one {{1 item}}
|
|
73
|
+
* {{{$count} items}}
|
|
74
|
+
```
|
|
75
|
+
- **Functions** are invoked with `:functionName` syntax inside placeholders: `{$date :datetime dateStyle=long}`, `{$amount :number style=currency currency=USD}`.
|
|
76
|
+
- **Markup** elements use `{#tag}` open, `{/tag}` close, and `{#tag /}` self-closing syntax for embedding structural elements without leaking HTML into translation strings.
|
|
77
|
+
|
|
78
|
+
### Custom Function Registry
|
|
79
|
+
|
|
80
|
+
- MF2 supports user-defined functions for domain-specific formatting. Register custom functions (e.g., `:relativeTime`, `:fileSize`, `:userName`) in the formatter's function registry.
|
|
81
|
+
- Custom functions receive the resolved value and a map of named options. They must return a formatted string.
|
|
82
|
+
- Document all custom functions in the project's i18n guide. Include: function name, accepted options, example usage, and expected output.
|
|
83
|
+
|
|
84
|
+
### Adoption Guidance
|
|
85
|
+
|
|
86
|
+
- **Runtime support:** As of early 2025, native browser/runtime support for MF2 is limited. Use the `messageformat` 4.0 npm package (or equivalent polyfill) for JavaScript/TypeScript.
|
|
87
|
+
- **ICU libraries:** Java (ICU4J 76+) and C/C++ (ICU4C 76+) include tech preview MF2 implementations.
|
|
88
|
+
- **Migration strategy:** New translation keys should use MF2 syntax. Existing MF1 keys can be migrated incrementally — both syntaxes can coexist during transition.
|
|
89
|
+
- **Tooling:** Verify that your translation management system (TMS) supports MF2 syntax before migrating. Test with a small key set first.
|
|
90
|
+
- **Stability:** The MF2 specification has stability guarantees post-approval (mid-2025). Syntax and semantics will not change incompatibly after that point.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Internationalization, localization, and RTL support conventions for the project
|
|
3
|
+
globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx, src/**/*.ts
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Internationalization & RTL
|
|
7
|
+
|
|
8
|
+
## Locale Management
|
|
9
|
+
|
|
10
|
+
- Detect locale via resolution chain: explicit user preference → `Accept-Language` header (server) → `navigator.language` (client) → default locale.
|
|
11
|
+
- Define a fallback chain per locale (e.g., `fr-CA` → `fr` → `en`) and always resolve to a supported locale.
|
|
12
|
+
- Persist user locale choice in user settings or `localStorage`; pass locale via URL segment or header — never infer from IP alone.
|
|
13
|
+
- Load only the active locale's translations at runtime; lazy-load additional locales on demand.
|
|
14
|
+
|
|
15
|
+
## Text & Translation
|
|
16
|
+
|
|
17
|
+
- Use ICU MessageFormat syntax for plurals, gender, and select patterns (`{count, plural, one {# item} other {# items}}`).
|
|
18
|
+
- Never embed HTML markup inside translation strings — pass components or slots as interpolation values instead.
|
|
19
|
+
- Translation keys: use dot-separated, hierarchical namespaces matching feature structure (`settings.profile.title`, `cart.empty.message`).
|
|
20
|
+
- Never concatenate translated fragments to build sentences — each complete sentence is a single translation key.
|
|
21
|
+
- Maintain a string extraction workflow (e.g., `i18next-parser`, `vue-i18n-extract`) that runs in CI to flag unused and missing keys.
|
|
22
|
+
|
|
23
|
+
## RTL Support
|
|
24
|
+
|
|
25
|
+
- Use CSS logical properties exclusively: `margin-inline-start` (not `margin-left`), `padding-inline-end` (not `padding-right`), `inset-inline-start` (not `left`), `text-align: start` (not `text-align: left`).
|
|
26
|
+
- Set `dir` and `lang` attributes on `<html>` dynamically based on active locale (`<html dir="rtl" lang="ar">`).
|
|
27
|
+
- Use `dir="auto"` on user-generated content elements to let the Unicode Bidirectional Algorithm determine direction.
|
|
28
|
+
- Mirror directional icons (arrows, chevrons, navigation cues) in RTL; do not mirror semantic icons (checkmarks, search, external link).
|
|
29
|
+
- Use `logical` keyword for `resize`, `overflow`, and `float` where supported; provide fallbacks with `[dir="rtl"]` overrides where needed.
|
|
30
|
+
|
|
31
|
+
## Number & Date Formatting
|
|
32
|
+
|
|
33
|
+
- Format all numbers with `Intl.NumberFormat` — never manually insert thousands separators or decimal points.
|
|
34
|
+
- Format all dates with `Intl.DateTimeFormat`; use relative time with `Intl.RelativeTimeFormat` for recent timestamps.
|
|
35
|
+
- Format currency with `Intl.NumberFormat` using `style: 'currency'` and the correct currency code — never hard-code symbols.
|
|
36
|
+
- Sort locale-sensitive strings with `Intl.Collator` — never use raw `String.prototype.localeCompare` without options.
|
|
37
|
+
- Always pass the active locale to all `Intl` constructors.
|
|
38
|
+
|
|
39
|
+
## Layout Accommodations
|
|
40
|
+
|
|
41
|
+
- Allow 30–40% text expansion for German/Finnish translations relative to English; test UI with pseudo-localization that pads strings.
|
|
42
|
+
- Use `min-height` instead of fixed `height` on text containers to accommodate CJK line-height requirements (1.6–1.8 recommended).
|
|
43
|
+
- Define font stacks per script family: Latin, CJK, Arabic, Devanagari — ensure each stack includes a web-safe fallback and `system-ui`.
|
|
44
|
+
- Truncate overflowing text with `text-overflow: ellipsis` plus `overflow: hidden` and `white-space: nowrap` only when semantically safe; provide title/tooltip with full text.
|
|
45
|
+
- Avoid fixed-width containers for translatable text; prefer `min-width` / `max-width` with flex/grid layout.
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
- Enable pseudo-localization (e.g., `[Ḿéššàĝé]`) during development to surface hardcoded strings and layout overflow.
|
|
50
|
+
- Run RTL visual tests: render key pages with `dir="rtl"` and compare screenshots for layout correctness.
|
|
51
|
+
- Add a CI check that verifies translation completeness: every key in the default locale exists in all target locales.
|
|
52
|
+
- Compare screenshots across locales (especially German for expansion, Arabic for RTL, Japanese for CJK) at key viewport sizes.
|
|
53
|
+
- Validate that all `Intl` formatting output is correct for edge-case locales (e.g., `ar-SA` for Hindu-Arabic numerals, `de-DE` for comma decimals).
|
|
54
|
+
|
|
55
|
+
## ICU MessageFormat 2.0 (MF2)
|
|
56
|
+
|
|
57
|
+
ICU MessageFormat 2.0 reached Final Candidate status in CLDR 46.1 (January 2025). MF2 is a significant evolution from MessageFormat 1.0, designed as a platform-independent specification with improved extensibility.
|
|
58
|
+
|
|
59
|
+
### Key Syntax Changes from MF1
|
|
60
|
+
|
|
61
|
+
- **Variable references** use `$` prefix: `{$userName}` instead of positional `{0}` arguments.
|
|
62
|
+
- **Declarations** use `.input` and `.local` for explicit variable binding:
|
|
63
|
+
```
|
|
64
|
+
.input {$count :number}
|
|
65
|
+
.local $formattedDate = {$date :datetime dateStyle=medium}
|
|
66
|
+
```
|
|
67
|
+
- **Selection** uses `.match` instead of nested `{value, select, ...}` / `{value, plural, ...}`:
|
|
68
|
+
```
|
|
69
|
+
.input {$count :number}
|
|
70
|
+
.match $count
|
|
71
|
+
0 {{No items}}
|
|
72
|
+
one {{1 item}}
|
|
73
|
+
* {{{$count} items}}
|
|
74
|
+
```
|
|
75
|
+
- **Functions** are invoked with `:functionName` syntax inside placeholders: `{$date :datetime dateStyle=long}`, `{$amount :number style=currency currency=USD}`.
|
|
76
|
+
- **Markup** elements use `{#tag}` open, `{/tag}` close, and `{#tag /}` self-closing syntax for embedding structural elements without leaking HTML into translation strings.
|
|
77
|
+
|
|
78
|
+
### Custom Function Registry
|
|
79
|
+
|
|
80
|
+
- MF2 supports user-defined functions for domain-specific formatting. Register custom functions (e.g., `:relativeTime`, `:fileSize`, `:userName`) in the formatter's function registry.
|
|
81
|
+
- Custom functions receive the resolved value and a map of named options. They must return a formatted string.
|
|
82
|
+
- Document all custom functions in the project's i18n guide. Include: function name, accepted options, example usage, and expected output.
|
|
83
|
+
|
|
84
|
+
### Adoption Guidance
|
|
85
|
+
|
|
86
|
+
- **Runtime support:** As of early 2025, native browser/runtime support for MF2 is limited. Use the `messageformat` 4.0 npm package (or equivalent polyfill) for JavaScript/TypeScript.
|
|
87
|
+
- **ICU libraries:** Java (ICU4J 76+) and C/C++ (ICU4C 76+) include tech preview MF2 implementations.
|
|
88
|
+
- **Migration strategy:** New translation keys should use MF2 syntax. Existing MF1 keys can be migrated incrementally — both syntaxes can coexist during transition.
|
|
89
|
+
- **Tooling:** Verify that your translation management system (TMS) supports MF2 syntax before migrating. Test with a small key set first.
|
|
90
|
+
- **Stability:** The MF2 specification has stability guarantees post-approval (mid-2025). Syntax and semantics will not change incompatibly after that point.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-learning-consult
|
|
3
|
+
type: rule
|
|
4
|
+
description: Auto-consult project learnings before implementation
|
|
5
|
+
scope: always
|
|
6
|
+
---
|
|
7
|
+
# Learning Consultation
|
|
8
|
+
|
|
9
|
+
Before implementing any task, check `/.agents/learnings/` for relevant past learnings.
|
|
10
|
+
|
|
11
|
+
## Consultation Process
|
|
12
|
+
|
|
13
|
+
1. If `/.agents/learnings/` exists and contains files:
|
|
14
|
+
- Scan learning file frontmatter for matching `tags` or `area` that overlap with the current task.
|
|
15
|
+
- Read the `## Applies When` section of potential matches.
|
|
16
|
+
- Surface relevant learnings to the developer/agent before implementation begins.
|
|
17
|
+
2. If no learnings directory exists, skip silently.
|
|
18
|
+
|
|
19
|
+
## Integration Points
|
|
20
|
+
|
|
21
|
+
- During `hatch3r-board-pickup` Step 6: consult learnings before implementation delegation.
|
|
22
|
+
- During `hatch3r-board-fill` Step 4: consult learnings when scoping and estimating issues.
|
|
23
|
+
- During any skill execution: check for relevant pitfalls before coding.
|
|
24
|
+
|
|
25
|
+
## Learning Priority
|
|
26
|
+
|
|
27
|
+
- **Pitfalls** are highest priority -- always surface these.
|
|
28
|
+
- **Patterns** are surfaced when the current task matches their trigger conditions.
|
|
29
|
+
- **Decisions** are surfaced when the current task might conflict with a past decision.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Auto-consult project learnings before implementation
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Learning Consultation
|
|
6
|
+
|
|
7
|
+
Before implementing any task, check `/.agents/learnings/` for relevant past learnings.
|
|
8
|
+
|
|
9
|
+
## Consultation Process
|
|
10
|
+
|
|
11
|
+
1. If `/.agents/learnings/` exists and contains files:
|
|
12
|
+
- Scan learning file frontmatter for matching `tags` or `area` that overlap with the current task.
|
|
13
|
+
- Read the `## Applies When` section of potential matches.
|
|
14
|
+
- Surface relevant learnings to the developer/agent before implementation begins.
|
|
15
|
+
2. If no learnings directory exists, skip silently.
|
|
16
|
+
|
|
17
|
+
## Integration Points
|
|
18
|
+
|
|
19
|
+
- During `hatch3r-board-pickup` Step 6: consult learnings before implementation delegation.
|
|
20
|
+
- During `hatch3r-board-fill` Step 4: consult learnings when scoping and estimating issues.
|
|
21
|
+
- During any skill execution: check for relevant pitfalls before coding.
|
|
22
|
+
|
|
23
|
+
## Learning Priority
|
|
24
|
+
|
|
25
|
+
- **Pitfalls** are highest priority -- always surface these.
|
|
26
|
+
- **Patterns** are surfaced when the current task matches their trigger conditions.
|
|
27
|
+
- **Decisions** are surfaced when the current task might conflict with a past decision.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-migrations
|
|
3
|
+
type: rule
|
|
4
|
+
description: Database migration and schema change patterns for the project
|
|
5
|
+
scope: always
|
|
6
|
+
---
|
|
7
|
+
# Migrations
|
|
8
|
+
|
|
9
|
+
- Schema changes must be backward-compatible. Add fields with defaults; never remove or rename without migration.
|
|
10
|
+
- Migration scripts live in a dedicated `migrations/` directory. One script per migration.
|
|
11
|
+
- Every migration is idempotent. Safe to re-run. Use document version or `migratedAt` to skip.
|
|
12
|
+
- Migration functions log progress and are resumable. Handle partial failures.
|
|
13
|
+
- Test migrations against emulator or staging before deploying. Verify data integrity.
|
|
14
|
+
- Order: deploy new code (handles old + new schema) → run migration → remove old schema handling.
|
|
15
|
+
- Document schema changes in project data model spec.
|
|
16
|
+
- Rollback plan required for every migration. Never run destructive migrations without backup verification.
|
|
17
|
+
- Hot documents must stay within size limits after migration.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Database migration and schema change patterns for the project
|
|
3
|
+
alwaysApply: false
|
|
4
|
+
---
|
|
5
|
+
# Migrations
|
|
6
|
+
|
|
7
|
+
- Schema changes must be backward-compatible. Add fields with defaults; never remove or rename without migration.
|
|
8
|
+
- Migration scripts live in a dedicated `migrations/` directory. One script per migration.
|
|
9
|
+
- Every migration is idempotent. Safe to re-run. Use document version or `migratedAt` to skip.
|
|
10
|
+
- Migration functions log progress and are resumable. Handle partial failures.
|
|
11
|
+
- Test migrations against emulator or staging before deploying. Verify data integrity.
|
|
12
|
+
- Order: deploy new code (handles old + new schema) → run migration → remove old schema handling.
|
|
13
|
+
- Document schema changes in project data model spec.
|
|
14
|
+
- Rollback plan required for every migration. Never run destructive migrations without backup verification.
|
|
15
|
+
- Hot documents must stay within size limits after migration.
|