Tailwind CSS in Flutter: I gave two AI agents the same page, and only one got keyboard focus right
DEV Community

Tailwind CSS in Flutter: I gave two AI agents the same page, and only one got keyboard focus right

Two AI agents, one prompt, one Flutter pricing page. Both pages compiled, both passed flutter analyze, and at a glance they look almost the same. Then I pressed Tab.

TL;DR

wind_kit lets you style Flutter widgets with Tailwind class strings, and its wind-ui agent skill teaches Claude Code, Cursor or Codex the rules that differ from web Tailwind.

I gave two agents the same pricing page: both pages compiled and looked right, but only the one with the skill showed keyboard focus.

Flutter 3.50 was announced on 11 November, and the announcement says package authors can now ship agent skills inside a top-level skills/ directory of their pub.dev packages.

The Dart docs give the reason in one line: "Without skills, AI coding agents often guess APIs, suggest deprecated methods, or miss architectural patterns specific to your library."

A Tailwind-style package is a good place to test that claim, because your agent already knows Tailwind from the web, and the web is exactly where its habits come from.

wind_kit is my open source package: Tailwind CSS for Flutter. Its skill, wind-ui, is the rule book I give agents for it. There is a catch, and I'll be honest about it near the end.

What you'll walk away with:

  • wind_kit in a Flutter app, with a dark theme in one file
  • The wind-ui skill installed for Claude Code, Cursor, Codex or Copilot with one Dart command
  • The same pricing page written by two agents, one with the skill and one without
  • The bug only the run without the skill shipped: keyboard focus nobody can see

Let's start.

1. Tailwind classes, Flutter widgets

First, bring the package into your project:

flutter pub add wind_kit material_ui

material_ui is there because Flutter 3.50 deprecates package:flutter/material.dart in favour of the standalone package, so a wind_kit app imports MaterialApp from package:material_ui/material_ui.dart.

wind_kit reads a className string and builds the widget tree from it. A rounded card with a dark variant and a hover shadow is one widget:

WDiv(
  className: 'p-6 mx-4 bg-white dark:bg-gray-800 rounded-xl shadow-lg hover:shadow-xl',
  child: WText('Hello', className: 'text-xl font-bold'),
)

In plain Flutter, the same card is a Container with a BoxDecoration, two BoxShadows and a brightness check, and the hover state needs a StatefulWidget and a MouseRegion on top.

It's not a literal Tailwind port, though. Some web classes have no Wind version: group-hover:, peer-*, backdrop-blur, @apply, negative margins. Wind drops what it can't build, and some drops are silent: text-7xl is past Wind's text-6xl cap, so it does nothing and says nothing.

That's fine when you write the class yourself and see the result. It's a trap when an agent writes it from web habits.

2. A dark theme in one file

The palette lives in one file, as aliases, so views use short names like bg-panel and text-ink and the hex values stay in one place:

syncWithSystem: false matters. Without it, Wind follows the OS brightness on start and your dark app turns light on a machine set to light mode.

main.dart wraps the app once, with WindTheme above MaterialApp, so every route and overlay reaches the palette:

3. Install the skill

The skill lives in the wind_kit repository. Dart's skills CLI installs it, no Node needed:

dart run skills@ add https://github.com/anilcancakir/wind_kit --agent claude --all
Cloning https://github.com/anilcancakir/wind_kit...
Updating https://github.com/anilcancakir/wind_kit...
[claude] Installed wind-ui
Installed 1 skill(s) for claude at .claude/skills.

--agent also takes cursor, codex, copilot, cline, opencode, antigravity and generic.

Note: The Flutter 3.50 announcement also points to dart run skills@ get, which installs skills from your dependencies. get doesn't find wind_kit's skill today: the skill is not inside the pub.dev archive, and its folder name lacks the wind_kit- prefix get looks for. Add it from the repository as above.

The skill is a SKILL.md and nine reference files. Think of it as the house rules you give a new colleague on their first day. They already know how to code; the rules tell them how this house works.

A few lines from it:

  • Every bg-, text-, border-, ring-, shadow- and fill- class gets a dark: peer in the same className, unless the colour reads the same in both modes.
  • Conditional styling goes through states: and prefixed classes like selected:bg-accent, never Dart string interpolation inside a className.
  • A table of what web Tailwind does and Wind doesn't, so the agent stops writing group-hover: and text-7xl.
  • A definition of done, with this as item three: every interactive surface has hover: and focus: states.

Remember that last one. It comes back.

4. Same prompt, two agents

Now the test. I made one small app with the theme above, copied it twice, and installed the skill in one copy only. Then I gave Claude Code the same prompt in both, headless, one run each:

This Flutter app uses wind_kit for styling. Build a pricing page in lib/pricing_page.dart and show it from lib/main.dart in place of the placeholder home. The page has a heading and a one-line subheading, a Monthly / Yearly toggle, and three plan cards (Starter, Pro, Team). Each card shows a price, four features with check icons and a "Choose plan" button. Pro is highlighted as the recommended plan. The cards sit in one column on a phone and in three columns from 768 px wide. Use wind_kit className styling and the palette aliases in lib/config/theme.dart. When you are done, run flutter analyze and fix what it reports. Do not run the app.

Both runs finished on their own:

  • Without the skill / With the skill
  • What it read first: wind_kit's llms.txt and pages under doc/ in the pub cache / The wind-ui skill and its widget reference
  • Turns: 13 / 13
  • Time: 97 s / 91 s
  • Cost: $0.71 / $0.62
  • flutter analyze: No issues found / No issues found

Let's give it a shot. This is the page the agent with the skill wrote, at desktop width:

The pricing page from the agent with the skill. The page from the agent without the skill looks almost the same, and I want to be fair to it: it did a good job.

wind_kit ships its llms.txt and its docs inside the package, and the agent found them in the pub cache on its own. Both agents built every styled element from W-widgets, with no Container or Text, both routed the selected plan through states: instead of string interpolation, both set scrollPrimary on the scroll, and neither wrote a dark: peer, for the same reason: the palette is dark only.

So where is the difference? Put the mouse down.

5. Press Tab

On the page without the skill, I clicked an empty spot and pressed Tab twice:

Two Tabs in: focus is somewhere, the screen doesn't say where. Nothing changed. Then I pressed Enter:

Enter switched the plan to yearly: the focus was on Yearly all along. The prices switched to yearly. The focus was on Yearly the whole time, and nothing on the screen said so. For someone who moves through the page with a keyboard, that page is a guessing game.

The same two Tabs on the page with the skill, and Yearly turns into a darker pill:

With the skill, two Tabs in: Yearly says it has focus. One more Tab, and the focused "Choose plan" gets an accent border:

With the skill: the focused button says so. The code shows why. This is the toggle button's className without the skill:

className: 'px-4 py-2 rounded-full selected:bg-accent',

And with it:

className: '''flex flex-row items-center gap-2 px-5 py-2.5 rounded-full bg-transparent hover:bg-surface focus:bg-surface selected:bg-accent selected:hover:bg-accent-hover selected:focus:bg-accent-hover cursor-pointer duration-150 ease-in-out''',

The first agent did see focus: wind_kit's llms.txt names it as a state you can style, and the button and state pages it opened show focus: classes. None of the pages it read asks for one on every control. The skill makes it item three of its definition of done.

That's the whole point of a skill: the docs tell an agent what exists, and the skill tells it what "done" means.

6. One more difference: the background

At the bottom of the page without the skill:

Without the skill: the page colour stops where the content stops. bg-surface sits on the scrolling box, so it ends where the content ends and the Scaffold colour shows under it. The page with the skill paints the background on an outer box and scrolls inside it.

I can't tie this one to a single line of the skill; it's simply what this run did. Here is the whole page the agent wrote with the skill, unchanged apart from the path comment on top:

7. The catch

One run each. An agent doesn't give the same answer twice, so read this as one honest example, not a benchmark. The agent without the skill could add focus states on its next run, and the one with the skill could miss something else.

The skill is not a linter. Nothing fails the build when a focus: class is missing or a class does nothing: flutter analyze was clean on both pages. You still press Tab yourself, or let an agent drive the app with a tool like Tapir.

wind_kit is a styling engine, not a widget catalogue. Scaffold, AppBar, showDialog and ListView.builder stay Flutter. A grid in Wind is a static Wrap, so a long or growing list still wants ListView.builder.

If your team doesn't think in Tailwind, the class strings are one more language to learn. In that case, my opinion is that plain widgets with a good ThemeData are the better call.

dart run skills@ get doesn't install the skill today, for the two reasons in the note above.

8. Install

flutter pub add wind_kit material_ui
dart run skills@ add https://github.com/anilcancakir/wind_kit --agent claude --all

Every class, every widget and the theme options are on the wind_kit page.

Do you give your agent package skills, or do you let it read the docs on its own? I'd like to hear what it gets wrong for you. That's all.

Originally published on my blog.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.