Skip to content

feat: add antiPatterns to styling_preflight output#174

Merged
himerus merged 4 commits intodevfrom
feat/preflight-anti-patterns
Mar 21, 2026
Merged

feat: add antiPatterns to styling_preflight output#174
himerus merged 4 commits intodevfrom
feat/preflight-anti-patterns

Conversation

@himerus
Copy link
Contributor

@himerus himerus commented Mar 21, 2026

Summary

  • Exports buildAntiPatterns from quick-ref.ts and imports it in styling-preflight.ts
  • Adds antiPatterns: string[] to PreflightResult interface
  • Agents now get positive examples (correctSnippet), validation (issues), AND negative examples (antiPatterns) in a single styling_preflight call
  • 4 new tests (26 total for preflight), all passing

Why

The styling_preflight tool is the primary validation tool agents call after writing CSS. It returned validation issues and correct snippets but no explicit "don't do this" examples. Agents kept repeating the same mistakes (descendant selectors into shadow DOM, tokens on :root, ::part() chaining) because they only saw what was wrong with their specific CSS, not the broader patterns to avoid.

Test plan

  • 4 new tests verifying antiPatterns presence and content
  • Full suite: 2381/2382 pass (pre-existing phantom events failure only)

🤖 Generated with Claude Code

himerus and others added 2 commits March 21, 2026 04:15
Exports buildAntiPatterns from quick-ref and includes component-specific
negative examples in the styling_preflight result. Agents now get
positive examples (correctSnippet), validation (issues), AND negative
examples (antiPatterns) in one call — reducing the need for separate
tool invocations and preventing common Shadow DOM mistakes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 21, 2026

Warning

Rate limit exceeded

@himerus has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 72c420ee-93a8-4978-8a72-37645c5c8786

📥 Commits

Reviewing files that changed from the base of the PR and between 907399d and 95f6967.

📒 Files selected for processing (6)
  • .changeset/preflight-anti-patterns.md
  • custom-elements.json
  • packages/core/src/handlers/quick-ref.ts
  • packages/core/src/handlers/styling-preflight.ts
  • tests/__fixtures__/benchmark-results/latest-benchmark.json
  • tests/handlers/styling-preflight.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/preflight-anti-patterns

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

himerus and others added 2 commits March 21, 2026 04:17
The barrel re-exports both quick-ref.js and styling-diagnostics.js,
both of which exported buildAntiPatterns (with different return types).
Rename quick-ref's version to buildAntiPatternHints to resolve TS2308.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@himerus himerus merged commit 62cf8c8 into dev Mar 21, 2026
9 of 10 checks passed
himerus added a commit that referenced this pull request Mar 21, 2026
Both features now present in styling_preflight: antiPatterns array
from PR #174 and inline fix suggestions from this branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant