diff --git a/.claude/rules/18-preexisting-issues.md b/.claude/rules/18-preexisting-issues.md new file mode 100644 index 0000000..f92363f --- /dev/null +++ b/.claude/rules/18-preexisting-issues.md @@ -0,0 +1,12 @@ +# Preexisting Issues + +Never ignore problems you encounter in the codebase, even if they are outside the current task scope. + +## Rules + +- When you encounter a bug, lint error, type error, broken test, or code smell while working on a task, do not skip it. +- If the fix is straightforward (under ~15 minutes of work), fix it in a separate commit with a clear message explaining what was wrong. +- If the fix is complex (large refactor, architectural change, risk of regression), stop and inform the user: describe the issue, its severity, where it lives, and propose a plan to fix it. Do not attempt complex fixes without approval. +- Never suppress warnings, disable lint rules, or add `// @ts-ignore` to hide preexisting issues. Surface them. +- When fixing a preexisting issue, add a test that would have caught it if one does not already exist. +- Track issues you cannot fix immediately: flag them to the user and, if Memora is available, create an issue memory. diff --git a/.claude/rules/53-relative-units.md b/.claude/rules/53-relative-units.md new file mode 100644 index 0000000..648dd35 --- /dev/null +++ b/.claude/rules/53-relative-units.md @@ -0,0 +1,17 @@ +# Relative Units (CSS) + +Use relative units (`em`, `rem`, `%`, `vh`, `vw`) for layout and spacing. Pixels are acceptable only for: + +- Icon sizes (`width`/`height` on `` or icon containers) +- Borders and outlines (`1px solid ...`) +- Box shadows + +## Rules + +- **Layout dimensions** (width, height, max-width, min-width): use `em`, `rem`, `%`, or viewport units. +- **Padding and margin**: use `em` or `rem`. +- **Font sizes**: use `rem` or `em`, never `px`. +- **Gap, border-radius**: use `em` or `rem`. +- **Media queries**: use `em`. +- When existing code uses `px` for layout elements, convert to relative units as part of the change. +- CSS custom properties for typography (`--ui-font-size`, `--term-font-size`) store `px` values because they feed into JS APIs (xterm.js) that require pixels. This is the only exception beyond icons/borders. diff --git a/.claude/rules/54-testing-gate.md b/.claude/rules/54-testing-gate.md new file mode 100644 index 0000000..c155759 --- /dev/null +++ b/.claude/rules/54-testing-gate.md @@ -0,0 +1,32 @@ +# Testing Gate (Post-Implementation) + +Run the full test suite after every major change before considering work complete. + +## What Counts as a Major Change + +- New feature or component +- Refactoring that touches 3+ files +- Store, adapter, or bridge modifications +- Rust backend changes (commands, SQLite, sidecar) +- Build or CI configuration changes + +## Required Command + +```bash +cd v2 && npm run test:all +``` + +This runs vitest (frontend) + cargo test (backend). For changes touching E2E-relevant UI or interaction flows, also run: + +```bash +cd v2 && npm run test:all:e2e +``` + +## Rules + +- Do NOT skip tests to save time. A broken test suite is a blocking issue. +- If tests fail, fix them before moving on. Do not defer test fixes to a follow-up. +- If a change breaks existing tests, that's signal — investigate whether the change or the test is wrong. +- When adding new logic, add tests in the same commit (TDD preferred, see rule 06). +- After fixing test failures, re-run the full suite to confirm no cascading breakage. +- Report test results to the user: pass count, fail count, skip count.