css-noop-checker
CLAUDE.md24 starsChanged 8 months agoMITView on GitHub
css-noop-checker is a Chrome DevTools extension (Manifest V3) that detects "no-op" CSS properties on the selected element. Built with React 19, TypeScript 5.9, and Vite 7. Package manager is pnpm (not npm/yarn). Runtime: Node.js 24, pnpm 10 (managed via .mise.toml). Chrome DevTools extension with two entry points (multi-page Vite build): Pure-function rules with zero Chrome API dependency — fully testable. Each rule file is named after its rule ID (e.g. container-no-gap.ts → rule ID container-no-gap). Key infrastructure files: Rule IDs…
- Commits and pushes
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- .claude/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- team-devSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- verify-ruleSkill
- web-design-guidelinesSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
25 rules. About 0 are common, 9 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 59
When adding a new rule, pick a descriptive target and qualifier — avoid numbered IDs like D-1 or C-2.
- Very specific: line 63
Create src/rules/<rule-id>.ts — implement RuleDescriptor, call registerRule(), export the check function.
- Very specific: line 64
Add side-effect import in src/rules/engine.ts (keep alphabetical order)
- Very specific: line 65
Add DEFAULT_COMPUTED_STYLES entries in src/rules/__tests__/helpers/make-element.ts for any new requiredProperties (the validation test will …
- Very specific: line 66
Add unit tests in src/rules/__tests__/<rule-id>.test.ts
- Very specific: line 67
Add "should warn" and "should NOT warn" test cases to examples/test.html (keep alphabetical order by rule ID)
- Distinctive: line 68
Update the Detected Patterns table in README.md
- Very specific: line 69
Add docs/rules/<rule-id>.md — explain why the property combination is a no-op, with examples (see existing docs for the template)
- Very specific: line 70
Run pnpm test and pnpm test:e2e to verify
- Distinctive: line 79
Do not assume a property is a full no-op just because one aspect is ignored.
- Distinctive: line 81
Prefer avoiding false positives over maximizing warning count.
- Distinctive: line 82
If you intentionally keep a false negative or a known limitation, say so in the rule comment with the specific trade-off.
- Distinctive: line 90
Update the rule logic.
- Distinctive: line 91
Update unit tests that encoded the old assumption.
- Very specific: line 92
Update examples/test.html and EXPECTED_CASE_COUNT if cases were added or removed.
- Very specific: line 93
Run both pnpm test and pnpm test:e2e.
- Distinctive: line 95
Avoid absolute language such as "this rule is correct" unless it has been validated in Chromium and the remaining limitations are …
- Very specific: line 150
When modifying any of these behaviors, update both build-scan-script.ts and extract-element-data.ts.
- Very specific: line 173
Use import type for type-only imports (verbatimModuleSyntax is enabled)
- Distinctive: line 183
Write messages in English
- Distinctive: line 184
Add a body after a blank line when extra context is needed
- Very specific: line 185
Run pnpm fmt before committing to apply formatting
- Very specific: line 186
Run pnpm build or pnpm lint before committing to verify nothing is broken
- Very specific: line 194
Update version in both package.json (root) and mcp-server/package.json — keep them in sync
- Very specific: line 207
Follow semver: 0.Y.Z during pre-1.0 development
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
css-noop-checker is a Chrome DevTools extension (Manifest V3) that detects "no-op" CSS properties on the selected element. Built with React 19, TypeScript 5.9, and Vite 7.
Commands
pnpm dev— Watch-mode build (vite build --watch)pnpm build— Type-check withtsc -bthen bundle with Vitepnpm lint— Lint with Oxlintpnpm fmt— Format with Oxfmtpnpm fmt:check— Check formatting without writingpnpm test— Run tests with Vitestpnpm test:watch— Run tests in watch modepnpm test:e2e— Run Playwright browser integration testspnpm test:e2e:ui— Run Playwright tests with interactive UI
Package manager is pnpm (not npm/yarn). Runtime: Node.js 24, pnpm 10 (managed via .mise.toml).
Tech Stack
- Build: Vite 7 + SWC via
@vitejs/plugin-react-swc - Framework: React 19 (
react-jsxtransform) - Language: TypeScript 5.9 (strict,
verbatimModuleSyntax,erasableSyntaxOnly) - Linting: Oxlint (
.oxlintrc.json) — plugins: typescript, react - Formatting: Oxfmt (
.oxfmtrc.jsonc) — singleQuote, trailingComma all, printWidth 100 - Testing: Vitest 4 (
vitest.config.ts, separate fromvite.config.ts), Playwright (playwright.config.ts) for browser integration tests
Architecture
Chrome DevTools extension with two entry points (multi-page Vite build):
devtools.html→src/devtools.ts— Creates "CSS Noop" sidebar pane in Elements tabsidebar.html→src/sidebar/main.tsx— React app rendered inside the sidebar pane
Rules Engine (src/rules/)
Pure-function rules with zero Chrome API dependency — fully testable. Each rule file is named after its rule ID (e.g. container-no-gap.ts → rule ID container-no-gap).
Key infrastructure files:
types.ts—ElementData,Warning,Rule,RuleContext,RuleIdcontext.ts—createRuleContext()normalizes computed styles; helper predicatesstacking-context.ts—isStackingContext()detects CSS stacking context triggersengine.ts—analyzeElement()creates context then runs all registered rulesregistry.ts— rule registration via side-effect imports inengine.ts
Rule ID Naming Convention
Rule IDs follow Stylelint's thing-no-qualifier pattern — the de facto standard in CSS lint tooling. This makes rule purposes immediately obvious without looking up documentation.
- Format:
<target>-no-<what-is-disallowed> target— the element/context being checked (e.g.inline,container)no-<qualifier>— the property or behavior that has no effect in that context
When adding a new rule, pick a descriptive target and qualifier — avoid numbered IDs like D-1 or C-2.
New Rule Checklist
- Create
src/rules/<rule-id>.ts— implementRuleDescriptor, callregisterRule(), export the check function. UsecreateWarning()factory via a scopedwarnhelper for all warnings. - Add side-effect import in
src/rules/engine.ts(keep alphabetical order) - Add
DEFAULT_COMPUTED_STYLESentries insrc/rules/__tests__/helpers/make-element.tsfor any newrequiredProperties(the validation test will fail if missed). If the rule usesrequiredInlineProperties, ensure unit tests pass appropriate inline style overrides viamakeElement's third parameter. - Add unit tests in
src/rules/__tests__/<rule-id>.test.ts - Add "should warn" and "should NOT warn" test cases to
examples/test.html(keep alphabetical order by rule ID) - Update the Detected Patterns table in
README.md - Add
docs/rules/<rule-id>.md— explain why the property combination is a no-op, with examples (see existing docs for the template) - Run
pnpm testandpnpm test:e2eto verify
Rule Correctness Expectations
This project should be treated as Chromium-behavior-driven, not purely spec-driven.
- The extension analyzes styles from Chrome DevTools, so the most important question is: does this declaration actually have an effect in current Chromium?
- Unit tests are necessary but not sufficient. They often encode assumptions; those assumptions can be wrong.
- For any non-trivial rule change, add or update a real browser case in
examples/test.htmland verify it with Playwright. - Do not assume a property is a full no-op just because one aspect is ignored. Shorthands and composite features can be partially effective.
- Example pattern:
place-itemscan still matter if either thealign-itemshalf or thejustify-itemshalf is effective in Chromium.
- Example pattern:
- Prefer avoiding false positives over maximizing warning count. If behavior is conditional, context-sensitive, or unclear in Chromium, bias toward silence and document the limitation.
- If you intentionally keep a false negative or a known limitation, say so in the rule comment with the specific trade-off.
When Auditing or Fixing Existing Rules
Use this order:
- Reproduce the case in real Chromium with a minimal layout.
- Confirm whether the declaration is fully ineffective, partially effective, or effective.
- Update the rule logic.
- Update unit tests that encoded the old assumption.
- Update
examples/test.htmlandEXPECTED_CASE_COUNTif cases were added or removed. - Run both
pnpm testandpnpm test:e2e.
Avoid absolute language such as "this rule is correct" unless it has been validated in Chromium and the remaining limitations are explicitly called out.
test.html Test Case Format
Each test case in examples/test.html must include data-target and data-rule attributes for Playwright integration tests:
<!-- "should warn" case -->
<div class="case expect-warn" data-rule="<rule-id>">
<div class="label label-warn"><rule-id> warn: description</div>
<TARGET_ELEMENT data-target style="...">...</TARGET_ELEMENT>
</div>
<!-- "should NOT warn" case -->
<div class="case expect-ok" data-rule="<rule-id>">
<div class="label label-ok"><rule-id> ok: description</div>
<TARGET_ELEMENT data-target style="...">...</TARGET_ELEMENT>
</div>data-rule— the rule ID being tested (e.g.inline-no-dimensions). Usedata-rule="none"for cases that should produce zero warnings from any ruledata-target— boolean attribute on the element to inspect (must be exactly one per.case)- For cases where the target is a nested child (e.g. flex/grid items), place
data-targeton the actual inspectable element, not the wrapper - Ordering — rule sections in
test.htmlmust be sorted alphabetically by rule ID (e.g.block-no-vertical-alignbeforecontainer-no-align). The "No issues" section stays at the end. This matches the Scan Page display order.
MCP Server (mcp-server/)
Standalone MCP server that reuses the rules engine and e2e extraction helpers to analyze live pages via Playwright. Separate package.json managed as a pnpm workspace.
src/index.ts— MCP tool handlers (list_rules,analyze_element,scan_page)src/url-validation.ts— SSRF-safe URL validation (scheme + private IP checks)
Element Extraction: Dual Implementation
Element extraction (getting computed styles from in-page elements) exists in two parallel implementations due to different API constraints:
| Extension sidebar | E2E helpers / MCP server | |
| Files | src/sidebar/hooks/build-eval-script.ts, build-scan-script.ts | e2e/helpers/extract-element-data.ts |
| API | chrome.devtools.inspectedWindow.eval() — requires string-serialized JS | Playwright page.evaluate() — accepts functions directly |
| Used by | Chrome extension UI | Playwright e2e tests, MCP server |
Adding a new rule does NOT require changes to either extraction implementation — both dynamically query registry.ts for required CSS properties.
However, changes to extraction behavior itself require updating both implementations. The two implementations currently have known divergences:
Both implementations share SKIP_TAGS and other constants from src/rules/scan-constants.ts. The remaining divergences:
| Behavior | Extension sidebar | E2E / MCP server |
display: none | Filters out (cs.display === 'none') | Does not filter |
| Query scope | document.body.querySelectorAll('*') | document.querySelectorAll('*') |
| Selector format | CSS.escape() + max 3 classes | nth-of-type + all classes |
| Scan cap | Chunked pagination (offset/limit) | Single pass, 5 000 element cap |
When modifying any of these behaviors, update both build-scan-script.ts and extract-element-data.ts.
Browser Integration Tests (e2e/)
Playwright-based tests that verify rules against real browser getComputedStyle():
helpers/extract-element-data.ts— registry-driven computed style extraction (mirrors extension eval script)integration/rules-against-real-styles.test.ts— openstest.html, extracts real styles, runsanalyzeElement(), asserts againstdata-rule/expect-warn/expect-ok
New rules are automatically covered when test cases are added to test.html with proper data-target and data-rule attributes. No changes to the integration test code are needed.
Sidebar UI (src/sidebar/)
React app rendered in the DevTools sidebar pane. See src/sidebar/components/ and src/sidebar/hooks/ for the full list.
Build Constraints
base: ''in vite.config.ts — relative paths required for extensionmodulePreload: false— MV3 CSP blocks<link rel="modulepreload">. Do not remove.
Code Style
- ESM modules (
"type": "module") - Use
import typefor type-only imports (verbatimModuleSyntaxis enabled) - No barrel exports — do not create
index.tsre-export files. Import directly from the source module. - Format with Oxfmt before committing
Commit Rules
- Make small, meaningful commits (1 commit = 1 logical change)
- Focus on "why" in commit messages, not "what" changed
- Format:
<type>: <why-focused message>- type:
feat,fix,refactor,chore,docs,test
- type:
- Write messages in English
- Add a body after a blank line when extra context is needed
- Run
pnpm fmtbefore committing to apply formatting - Run
pnpm buildorpnpm lintbefore committing to verify nothing is broken
Release Rules
Releases are triggered by pushing a v* tag. The GitHub Actions workflow (.github/workflows/release.yml) automatically runs CI, creates a GitHub Release with the extension zip, and publishes the MCP server to npm via OIDC trusted publisher.
Version bump procedure
- Update
versionin bothpackage.json(root) andmcp-server/package.json— keep them in sync - Commit:
chore: bump version to X.Y.Z - Merge to main via PR
- Tag and push:
git checkout main && git pull git tag vX.Y.Z git push --tags - Workflow runs automatically — verify at GitHub Actions
Versioning
- Follow semver:
0.Y.Zduring pre-1.0 development - Root package and MCP server share the same version
PR Rules
- Title and body must be written in English
- Title: short (under 70 chars), format
<type>: <concise description> - Body structure:
## Summary— bullet points describing what and why## Test plan— checklist of verification steps
- Include a table or list for any non-obvious design decisions
- Link to related issues if applicable
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

