Skip to content

fix: add Tailwind v4 @theme inline guidance to prevent v3 patterns#246

Merged
rubenmarcus merged 1 commit intomainfrom
fix/tailwind-v4-patterns
Feb 23, 2026
Merged

fix: add Tailwind v4 @theme inline guidance to prevent v3 patterns#246
rubenmarcus merged 1 commit intomainfrom
fix/tailwind-v4-patterns

Conversation

@rubenmarcus
Copy link
Copy Markdown
Member

Summary

  • Adds comprehensive Tailwind v4 @theme inline guidance to the context builder preamble and spec generator
  • Prevents agents from generating manual utility classes (.bg-brand { background-color: ... }) that break opacity modifiers, gradients, and other auto-generated utilities
  • Adds Vite-specific guidance (@tailwindcss/vite vs @tailwindcss/postcss)
  • Documents bg-color/opacity syntax, tw-animate-css, and no-manual-reset rules

Test plan

  • Run ralph-starter run with a Tailwind v4 project and verify agent uses @theme inline for custom colors
  • Verify generated CSS doesn't contain manual utility class definitions
  • Check that opacity modifiers (bg-brand/80) work correctly

Closes #211

🤖 Generated with Claude Code

The agent was generating manual utility classes (.bg-brand) instead of
using @theme inline for custom design tokens, breaking opacity modifiers,
gradients, and other auto-generated utilities.

Updates context-builder and spec-generator with complete v4 guidance:
- @theme inline for custom colors/fonts
- @tailwindcss/vite for Vite projects
- bg-color/opacity syntax (not bg-opacity-*)
- tw-animate-css for animations
- No manual CSS resets

Closes #211

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added bug Something isn't working candidate-release PR is ready for release core labels Feb 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

✔️ Bundle Size Analysis

Metric Value
Base 1926.12 KB
PR 1927.54 KB
Diff 1.41 KB (0%)
Bundle breakdown
156K	dist/auth
32K	dist/automation
4.0K	dist/cli.d.ts
4.0K	dist/cli.d.ts.map
16K	dist/cli.js
12K	dist/cli.js.map
492K	dist/commands
28K	dist/config
4.0K	dist/index.d.ts
4.0K	dist/index.d.ts.map
4.0K	dist/index.js
4.0K	dist/index.js.map
560K	dist/integrations
84K	dist/llm
736K	dist/loop
188K	dist/mcp
32K	dist/presets
92K	dist/setup
36K	dist/skills
392K	dist/sources
76K	dist/ui
84K	dist/utils
336K	dist/wizard

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 23, 2026

Greptile Summary

Adds comprehensive Tailwind CSS v4 @theme inline guidance to prevent agents from manually defining utility classes that break opacity modifiers and gradient utilities.

Key Changes:

  • Added @theme inline examples and best practices to context-builder.ts preamble (shown to agents during execution)
  • Enhanced Tailwind v4 setup notes in spec-generator.ts for wizard-generated specs
  • Clarified Vite vs non-Vite setup (@tailwindcss/vite vs @tailwindcss/postcss)
  • Documented bg-color/opacity syntax (replacing deprecated bg-opacity-*)
  • Added animation library guidance (tw-animate-css not tailwindcss-animate)
  • Explicitly warns against manual utility class definitions

Impact:
This ensures agents use CSS-based configuration correctly and avoid common Tailwind v4 migration pitfalls that break utility functionality.

Confidence Score: 5/5

  • Safe to merge - documentation-only changes that improve agent guidance
  • This PR only adds documentation and guidance text to help agents use Tailwind v4 correctly. No logic changes, no breaking changes, no security concerns. The changes are well-structured, accurate, and address a real problem (agents generating manual utility classes instead of using @theme inline).
  • No files require special attention

Important Files Changed

Filename Overview
src/loop/context-builder.ts Added comprehensive Tailwind v4 @theme inline guidance to preamble with Vite-specific setup instructions and opacity syntax
src/wizard/spec-generator.ts Enhanced Tailwind v4 setup notes in generated specs with @theme inline examples and best practices

Last reviewed commit: 7d2e711

@rubenmarcus rubenmarcus merged commit c9803cd into main Feb 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working candidate-release PR is ready for release core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent generates Tailwind v3 CSS patterns in Tailwind v4 projects

1 participant