Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

claude: Move CSS guidance into a path-scoped rule.

Evy Kassirer9749b14a9849
diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md
index ca4f056d052..c4e2bda18d0 100644
--- a/.claude/CLAUDE.md
+++ b/.claude/CLAUDE.md
@@ -172,21 +172,10 @@ Zulip has over 185,000 words of developer documentation. Before working on any a
- Prefer writing code that is readable without explanation over heavily
commented code using clever tricks. Comments should explain "why" when
the reason isn't obvious, not narrate "what" the code does.
-- Use `em` units instead of `px` for computed CSS values that need to
- scale with font size. Pixel approximations break at different zoom
- levels and font-size settings.
- Comments should have a line to themself except for CSS px math.
-- **Review CSS for redundant rules.** After writing CSS, review the
- full set of rules affecting the same elements. Look for rules that
- are immediately overridden by a more specific selector, duplicated
- selector lists, or cases where scoping (e.g., `:not()`) would
- eliminate the need for an override.
-- **Check CSS change scope.** When modifying CSS, always check what
- other pages or components use the same selectors, files, and
- classes. Use `git grep` on class names and check webpack bundle
- entries to understand which pages load the file. Prefer scoped
- overrides (e.g., `.parent .target`) over modifying shared rules,
- to avoid unintended changes to other parts of the app.
+
+CSS rules can be found in `.claude/rules/css.md` (loaded
+automatically when you work on CSS files).
See: https://zulip.readthedocs.io/en/latest/contributing/code-style.html
@@ -391,13 +380,6 @@ Recommend pausing for discussion when:
6. Verify completeness: use `git grep` to find all occurrences and
confirm nothing was missed
-When removing a CSS dependency (e.g., Bootstrap), audit the full
-property list of every rule, not just visually obvious properties like
-colors and backgrounds. Subtle properties like `line-height`, `margin`,
-`padding`, `text-decoration`, `font-weight`, and `border` are easy to
-miss but cause visible regressions. Check inherited properties too —
-e.g., a `body` rule's `line-height` or `margin` affects all descendants.
-
## Key Documentation Links
- Contributing guide: https://zulip.readthedocs.io/en/latest/contributing/contributing.html
diff --git a/.claude/rules/css.md b/.claude/rules/css.md
new file mode 100644
index 00000000000..26aa16dd610
--- /dev/null
+++ b/.claude/rules/css.md
@@ -0,0 +1,28 @@
+---
+paths:
+ - "web/styles/**"
+---
+
+# Writing CSS
+
+- Use `em` units instead of `px` for computed CSS values that need to
+ scale with font size. Pixel approximations break at different zoom
+ levels and font-size settings.
+- **Review CSS for redundant rules.** After writing CSS, review the
+ full set of rules affecting the same elements. Look for rules that
+ are immediately overridden by a more specific selector, duplicated
+ selector lists, or cases where scoping (e.g., `:not()`) would
+ eliminate the need for an override.
+- **Check CSS change scope.** When modifying CSS, always check what
+ other pages or components use the same selectors, files, and
+ classes. Use `git grep` on class names and check webpack bundle
+ entries to understand which pages load the file. Prefer scoped
+ overrides (e.g., `.parent .target`) over modifying shared rules,
+ to avoid unintended changes to other parts of the app.
+
+When removing a CSS dependency (e.g., Bootstrap), audit the full
+property list of every rule, not just visually obvious properties like
+colors and backgrounds. Subtle properties like `line-height`, `margin`,
+`padding`, `text-decoration`, `font-weight`, and `border` are easy to
+miss but cause visible regressions. Check inherited properties too —
+e.g., a `body` rule's `line-height` or `margin` affects all descendants.