Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

A smartphone displaying a code editor with CSS styling rules, placed on a desk next to a laptop, illustrating mobile…
Open SourceScore: 75

CLAUDE.md for Mobile: How One File Fixes Claude Code's CSS Blindspot

A specialized CLAUDE.md file fixes Claude Code's generic CSS by injecting mobile-specific rules, preventing iOS zoom, untappable buttons, and dark mode failures before shipping.

·6h ago·4 min read··2 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_claudecodeSingle Source
How does a CLAUDE.md file improve Claude Code's mobile CSS output?

A specialized CLAUDE.md file for mobile redesign provides Claude Code with explicit CSS rules, audit workflows, and test checklists, preventing generic output like iOS zoom on inputs or untappable 32px buttons.

TL;DR

Claude Code produces generic CSS without mobile context. · A specialized CLAUDE.md file injects mobile-specific rules. · Fixes include iOS zoom, touch targets, and dark mode.

Claude Code's generic CSS output — 32px buttons, iOS zoom on inputs, desktop-first media queries — stems from a lack of mobile-specific context, not incompetence. A specialized CLAUDE.md file, detailed in a new developer guide, injects that context to fix six common responsive design failures before they ship.

Key facts

  • Six common mobile CSS bugs from generic Claude Code output.
  • Input font-size under 16px triggers automatic iOS zoom.
  • Touch targets under 44px height are untappable on mobile.
  • Lighthouse targets: Performance ≥ 80, Accessibility ≥ 90.
  • File supports 3 deployment options: temp replace, reference, or .claude/ dir.

The problem is structural, not skill-based. Claude Code, Anthropic's agentic coding tool, knows CSS and responsive design, but it doesn't know a project's specific priorities: iPhone SE at 375px vs. iPad at 768px, Lighthouse Accessibility target of 90, dark mode mandatory or optional, BEM or utility-first naming. [According to the CLAUDE.md for mobile redesign guide on Dev.to] Without this context, Claude produces correct but generic CSS that introduces predictable mobile bugs.

The six failure modes

Claude Code without mobile context will:

  • Start from desktop and work down (max-width), rather than mobile-first (min-width)
  • Forget min-width: 0 on flex items, causing mysterious overflows
  • Leave inputs at 14px, triggering automatic iOS zoom on every tap
  • Add text-align: justify because "it looks clean"
  • Ignore prefers-reduced-motion and safe-area-inset
  • Not test dark mode

Each bug takes 10 seconds to fix once detected. The problem is they pile up and get caught after shipping. [per the guide]

The specialized CLAUDE.md concept

Claude Code automatically reads CLAUDE.md files at project root and in subdirectories. Most projects have a generic one: architecture, conventions, dev commands. The innovation here is creating a specialized file for mobile redesign — CLAUDE-MOBILE.md referenced from the main file, or placed in .claude/mobile-css.md for automatic loading. [According to the guide] This stacks with existing context rather than replacing it.

What the file contains

The guide provides a complete five-section CLAUDE.md file:

Section 1 — Audit workflow. Before writing CSS, Claude checks viewport tag, input font sizes, horizontal overflow, touch targets (44px minimum), and justified text. This order minimizes debug time.

Section 2 — Mobile testing tools. Playwright scripts for automated screenshots across iPhone SE (375px), iPhone 14 (390px), Pixel 7 (412px), and iPad (768px), plus dark mode and prefers-reduced-motion variants. MCP servers (Puppeteer MCP, Playwright MCP) let Claude interact with a headless browser during the session. Lighthouse via CLI audits in JSON or HTML.

Section 3 — CSS rules. Ready-to-use snippets with edge cases handled: min-width: 0 on flex items, coexistence of manual toggle with prefers-color-scheme, HTML inputmode attributes for forms.

Section 4 — Generic CSS conventions. Custom properties for theming, BEM for components, focus-visible for keyboard accessibility, modern properties (clamp(), gap, aspect-ratio, logical properties), and a rule against !important.

Section 5 — Test checklist. Devices, modes (landscape, dark, reduced motion, text zoom), Lighthouse targets (Performance ≥ 80, Accessibility ≥ 90, Best Practices ≥ 90, SEO ≥ 90), and screen reader testing basics.

Unique take

This is not a Claude Code feature update — it's a workflow pattern that exposes a deeper limitation: agentic coding tools lack a project's tacit knowledge. Cursor and GitHub Copilot face the same problem. The CLAUDE.md pattern for mobile is a template for any domain-specific context injection — security audit, database migration, accessibility compliance. The tool's value scales with the quality of the context file, not the model's general knowledge.

What to watch

Watch for Anthropic to formalize this pattern with official CLAUDE.md templates or a context marketplace. Cursor and Copilot will likely adopt similar domain-specific context files within 90 days. The metric: whether enterprise teams standardize on task-specific CLAUDE.md files for security, accessibility, and performance audits.


Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

This guide reveals a fundamental tension in agentic coding tools: the model's general knowledge is insufficient for domain-specific work without explicit context injection. Claude Code knows CSS syntax but not a project's design system, breakpoint strategy, or accessibility targets. The CLAUDE.md pattern is a workaround that effectively turns the tool into a domain-specific agent by constraining its output space. Compare to Cursor's rules feature and Copilot's custom instructions — same concept, different syntax. The insight here is granularity: a single global CLAUDE.md is too coarse. Specialized files for mobile, security, or performance audits let developers rotate context like tooling. This is a pattern that will likely be absorbed into the product as a feature (context profiles) within two quarters. The guide's emphasis on automated testing via Playwright and MCP servers is notable. It treats Claude Code not as a code generator but as a code reviewer that can also write fixes. The audit-first workflow — check viewport, inputs, overflow, touch targets before writing CSS — mirrors how a senior engineer would approach a responsive redesign. The tool becomes an extension of that engineer's process, not a replacement.

Mentioned in this article

Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Open Source

View all