Stringers/Guides
Mobile UI Design Systems & DESIGN.md

.cursorrules and CLAUDE.md for SwiftUI and Expo iOS apps: a copy-paste starter pack

An agent with no project rules writes plausible SwiftUI: the wrong state model for your deployment target, a literal blue on every button, an animation that stutters in a list. This is a starter pack that prevents that: a CLAUDE.md, scoped Cursor rules, an Expo variant, and the three files that make the rules enforceable (a DESIGN.md, motion references, and a submit hook).

Updated Starter pack for Claude Code, Cursor and CodexBy Stringers

6files an agent reads, and what belongs in each
2stacks covered: SwiftUI and Expo / React Native
301ready-made DESIGN.md styles to pair the rules with
26App Store rules enforced by the pre-submission hook

What goes where

A coding agent reads instructions from a handful of files. Putting the right rule in the right file is most of the work, because rules in the wrong place are either ignored or loaded on every request and crowd out the code.

FileRead byPut here
CLAUDE.mdClaude Code, at the start of every sessionProject facts, commands, hard rules. Keep it under about 150 lines
.cursor/rules/*.mdcCursor (current format: one rule per file, with front matter)Scoped rules that attach by file glob, such as SwiftUI rules for **/*.swift
.cursorrulesCursor (legacy single file, still read)The same content, if you want one file
AGENTS.mdCodex and several other agentsA copy of, or pointer to, CLAUDE.md
DESIGN.mdAny agent you point at itThe visual system: tokens, type scale, spacing, component rules
.claude/settings.json, .cursor/hooks.jsonThe harness, not the modelHooks that run commands, such as a pre-submission scan

Two principles shape the pack below. Write rules as checks an agent can verify ("no literal colors in views"), not as taste ("make it beautiful"). And keep visual decisions out of the rules file: they live in DESIGN.md, where they can be swapped without touching architecture rules.

CLAUDE.md for a SwiftUI app

Copy this into the repository root and replace the bracketed parts.

markdown
# [App Name]

iOS app in SwiftUI. Minimum target iOS 17. Swift 6, strict concurrency.

## Commands
- Build: `xcodebuild -scheme [Scheme] -destination 'platform=iOS Simulator,name=iPhone 16' build`
- Test:  `xcodebuild -scheme [Scheme] -destination 'platform=iOS Simulator,name=iPhone 16' test`
- Preflight: `stringer-preflight .` (must print CLEAR or WARN before any archive)

## Architecture
- Feature folders: `Features/<Name>/{<Name>View.swift, <Name>Model.swift}`.
- State: `@Observable` models owned with `@State`; pass down with `@Bindable` or the environment.
  Do not add ObservableObject, @Published or Combine to new code.
- Navigation: one `NavigationStack` per tab with a typed `enum Route: Hashable`.
- Persistence: SwiftData. Network: `URLSession` with async/await. No third-party
  networking or state libraries without asking first.
- Views are small: extract a subview when `body` passes about 40 lines.

## Design (read DESIGN.md before any UI work)
- Every color, font size, radius and spacing value comes from `Theme.swift`,
  which mirrors DESIGN.md. No literal hex values, `.blue`, or magic numbers in views.
- Support light and dark, and Dynamic Type up to accessibility sizes.
- Never add: purple-to-blue gradients, glassmorphism on everything, emoji as icons,
  a card around every element, centered body text. Use SF Symbols for icons.
- Every tappable element is at least 44x44 pt and has an accessibility label.

## Motion
- Use spring animations (`.snappy`, `.smooth`, or an explicit `spring(duration:bounce:)`).
- Animate transforms and opacity. Do not animate layout inside lists.
- Respect `accessibilityReduceMotion`.

## App Store rules (do not break these)
- Purchases use StoreKit 2. Paywalls show the billed price, renewal terms,
  Terms and Privacy links, and Restore Purchases.
- Any account creation ships with in-app account deletion.
- Every permission has a specific purpose string in Info.plist before the API is called.
- Data sent to an AI provider needs a disclosure and consent screen first.
- No `localhost`, staging hosts, API secrets, "Lorem ipsum" or bypass flags
  outside `#if DEBUG`.

## Working agreement
- Make the smallest change that solves the task. Do not rename, reformat or
  delete unrelated code.
- Build after every change and fix warnings you introduced.
- Ask before adding a dependency, a new target or a new permission.

Cursor rules: the current format and the legacy file

Cursor now reads project rules from .cursor/rules/, one .mdc file per rule, each with front matter that says when it applies. Scoping keeps Swift rules out of the context when the agent is editing a JSON file.

.cursor/rules/swiftui.mdc:

markdown
---
description: SwiftUI architecture and style rules for this app
globs: **/*.swift
alwaysApply: false
---

- Target iOS 17+. Use `@Observable`, `@State`, `@Bindable`, `NavigationStack`.
  Never introduce ObservableObject, @Published, NavigationView or UIKit wrappers
  unless the file already uses them.
- Read DESIGN.md before creating or restyling a view. All colors, fonts, radii
  and spacing come from `Theme.swift`. No literal values in views.
- Use SF Symbols, not emoji, for icons. Minimum tap target 44x44 pt.
- Use async/await. No completion handlers in new code. Mark UI code `@MainActor`.
- Every new view gets a `#Preview` in light and dark.
- Do not add packages. Ask first.

.cursor/rules/app-store.mdc:

markdown
---
description: App Store review guardrails that apply to every change
alwaysApply: true
---

- Never hardcode API secrets, localhost or staging URLs outside `#if DEBUG` / `__DEV__`.
- Purchases: StoreKit 2 or RevenueCat only. A paywall must show the billed price,
  auto-renewal terms, Terms of Use, Privacy Policy and Restore Purchases.
- New permission API usage requires its purpose string in Info.plist or app.json
  in the same change.
- Sign-up requires in-app account deletion. Social login requires Sign in with Apple.
- Before any `eas submit`, `fastlane deliver` or `xcodebuild archive`,
  run `stringer-preflight .` and stop if the verdict is BLOCKED.

If you prefer the single legacy file, concatenate the bullet lists into .cursorrules at the repository root. Cursor still reads it, but it is loaded for every request and cannot be scoped.

The Expo and React Native variant

Swap the SwiftUI section for this in either file:

markdown
## Stack
Expo SDK [version], React Native new architecture, TypeScript strict, Expo Router.

## Rules
- Components are function components with typed props. No `any`.
- Styling: `StyleSheet.create` with tokens from `theme.ts`, which mirrors DESIGN.md.
  No inline hex values or magic numbers.
- Lists use FlashList or FlatList with stable keys. Never map inside a ScrollView
  for more than about 20 rows.
- Animations use Reanimated worklets on the UI thread and Gesture Handler for
  gestures. Never drive animation from React state updates.
- Native config lives in `app.json` / `app.config.ts`: permissions go through config
  plugins with real purpose strings, and privacy manifest entries under
  `ios.privacyManifests`.
- Use `expo-secure-store` for tokens. Nothing secret in `EXPO_PUBLIC_` variables.
- Commands: `npx expo start`, `npx tsc --noEmit`, `npx expo-doctor`,
  `eas build -p ios --profile production`.

Pair the rules with a DESIGN.md

The rules say "follow DESIGN.md". The agent then needs one worth following. A useful spec has color roles for light and dark with hex values, a type scale with sizes and weights, a spacing scale, radii, component rules and a short list of prohibitions. Writing one from scratch takes a designer an afternoon.

The styles gallery has 301 ready-made ones (162 light, 139 dark), each derived from a real iOS visual direction and shipped with four reference screens. Save one into the repository:

bash
# Pick a style at https://stringers.io/en/styles/ and save its spec
curl -s https://stringers.io/styles/cards/oat-margin.md -o DESIGN.md

Or install the skill and let the agent do the picking and fetching:

bash
npx skills add komako-workshop/stringers

Then ask: "redesign this screen with stringers". The agent proposes three contrasting styles, you choose one, and it writes the UI against that DESIGN.md without removing existing features. The DESIGN.md guide explains the anatomy of the file, and the SwiftUI styles guide shows how to turn the tokens into a Theme.swift.

Motion that holds 60fps

Agents asked to "add a nice animation" tend to produce a 0.3-second ease-in-out on everything, or a layout animation that drops frames in a list. Two things fix it: the motion rules in the files above, and working reference code.

The motion library has 100 mobile motions recorded at 60fps on a real device, each with runnable SwiftUI source and most with an Expo and Reanimated version. Copy the one you need into the agent's context instead of describing it. A reference implementation is a far tighter constraint than an adjective.

The underlying rules, for when you write your own:

Add a pre-submission hook

Rules in a markdown file are advice, and a model can forget advice. A hook is enforced by the harness. stringer-preflight is a single-file, read-only scanner with 26 App Store rejection rules, and its hook mode inspects each shell command and blocks only submission and archive commands while a blocker remains.

Install it once:

bash
curl -fsSL https://raw.githubusercontent.com/komako-workshop/stringers/main/cli/stringer-preflight -o ~/.local/bin/stringer-preflight
chmod +x ~/.local/bin/stringer-preflight

Claude Code, in .claude/settings.json:

json
{
  "hooks": {
    "PreToolUse": [
      { "matcher": "Bash", "hooks": [{ "type": "command", "command": "stringer-preflight --hook" }] }
    ]
  }
}

Cursor, in .cursor/hooks.json:

json
{ "version": 1, "hooks": { "beforeShellExecution": [{ "command": "stringer-preflight --hook" }] } }

Now eas submit, fastlane deliver, xcodebuild archive and flutter build ipa are scanned first, and every other command passes straight through. If you must override once, prefix the command with STRINGER_PREFLIGHT_OK=1. The preflight page lists every rule.

Checklist: a repository an agent can ship from

Mistakes that make rules files useless

Browse all 301 design styles

301 curated mobile UI design systems, each with a complete DESIGN.md (color tokens, type scale, spacing, component rules) and four reference screens. Install the skill and tell your agent which style to build in.

Open Mobile UI Design Styles
npx skills add komako-workshop/stringers
★ Star on GitHub

Open Source (MIT) · Star komako-workshop/stringers on GitHub

Frequently asked questions

Does Cursor still read .cursorrules?

Yes, the single .cursorrules file at the repository root is still read as a legacy format. The current format is a .cursor/rules/ folder with one .mdc file per rule and front matter (description, globs, alwaysApply) that controls when each rule is attached, which keeps unrelated rules out of the context.

What is the difference between CLAUDE.md, .cursorrules and DESIGN.md?

CLAUDE.md is loaded by Claude Code at the start of each session and holds project facts, commands and hard rules. .cursorrules and .cursor/rules/ do the same job for Cursor. DESIGN.md is not tied to a tool: it is the visual specification that either agent reads when you point to it.

How long should a CLAUDE.md be for an iOS project?

Short enough to be read every session: roughly 100 to 150 lines. Include the build and test commands, the architecture conventions that differ from defaults, App Store rules that must not be broken and a pointer to DESIGN.md. Move long reference material into separate files the agent can open when needed.

How do I stop an AI agent from generating generic-looking SwiftUI?

Give it numbers. Save a DESIGN.md with exact color roles, a type scale, spacing and radii, mirror it in a Theme.swift, and add a rule that views may not contain literal colors or font sizes. Add an explicit list of patterns to avoid, and one or two reference screens for density.

Related guides