/duology-design:duo-design-systemfrom duology-design
Provides design tokens and a SwiftUI token module for iPhone Duo that adapt by size class, covering spacing, grids, type, Liquid Glass, corners, touch targets, and color contrast.
Ships in duology-design. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
One set of design tokens for both iPhone Duo displays. The tokens follow the size class and Dynamic Type size of the view that reads them. They never ask which display, device or screen the app is on.
Load other skills for neighbouring work: duo-layout (size classes, safe areas, reserved regions, ArrangementView), duo-patterns (which layout, feed reflow), duo-navigation (vertical bars), duo-design-review (checking screenshots against the rules).
Labels: measured means we ran it on the iOS 27.1 simulator runtime (offscreen renders and command-line checks, or the iPhone Duo simulator in an earlier skill). Derived means arithmetic on measured or Apple numbers. Duology default means Apple gives no number and we picked one. Unverified means we could not confirm it. Sources: reference/sources.md.
| Outer display, closed | Inner display, open | |
|---|---|---|
| Size class | compact width (111461) | regular width |
| Window, portrait or held wide | 466 × 678 pt (measured) | 951 × 669 pt (measured) |
| Safe area | 382 × 644 pt (measured) | 867 × 635 pt (measured, bar on the right) |
| Layout columns | 4 | 8 |
| Gutter | 12 pt | 16 pt, the middle one on the fold line; partly folded, the fold's frame (40 pt, measured) |
| Margins | system, per side: 16 to 20 pt on iPhone (doc), asymmetric next to the status bar column (gallery app: 20 pt leading, 0 pt trailing) | system, per side; asymmetric next to the vertical bar |
| Card padding, radius | 16 pt, 24 pt | 20 pt, 28 pt |
| Section spacing | 24 pt | 32 pt |
| Text | system text styles | the same sizes; lines capped at readableWidth |
Never copy these numbers into code. The tokens produce them.
Copy the complete file from references/tokens.md into the app as DuoTokens.swift. It adds text roles (DuoType), colours (DuoColor), DuoCard and the modifiers used below. If the app still has the v0.1 version of duo-start's debug logger, delete it first: it declares a struct DuoSpace, and the build fails (v0.2 renamed it DuoFirstPassSize). This is its core:
import SwiftUI
/// Duology's 4-point spacing scale. The suffix is the number of 4-point steps.
nonisolated enum DuoSpace {
static let x1: CGFloat = 4 // icon to badge, label to value
static let x2: CGFloat = 8 // related items in a row
static let x3: CGFloat = 12 // padding around a control with a bezel (HIG)
static let x4: CGFloat = 16
static let x5: CGFloat = 20
static let x6: CGFloat = 24 // padding around a control without a bezel (HIG)
static let x8: CGFloat = 32
static let x10: CGFloat = 40
static let x12: CGFloat = 48
}
/// Design tokens for one view. Read them with `@DuoMetrics`.
nonisolated struct DuoTokens: Equatable, Sendable {
var isRegularWidth: Bool
var isAccessibilitySize: Bool
/// Longest comfortable line of body text, already scaled for Dynamic Type.
var readableWidth: CGFloat
init(widthClass: UserInterfaceSizeClass?,
isAccessibilitySize: Bool = false,
readableWidth: CGFloat = 600) {
self.isRegularWidth = widthClass == .regular
self.isAccessibilitySize = isAccessibilitySize
self.readableWidth = readableWidth
}
/// Layout grid columns. Even in both size classes, so a fold never lands inside a column.
var columns: Int { isRegularWidth ? 8 : 4 }
var gutter: CGFloat { isRegularWidth ? DuoSpace.x4 : DuoSpace.x3 }
var sectionSpacing: CGFloat { isRegularWidth ? DuoSpace.x8 : DuoSpace.x6 }
var cardPadding: CGFloat { isRegularWidth ? DuoSpace.x5 : DuoSpace.x4 }
/// Padding plus the inner radius, so nested corners stay concentric.
var cardRadius: CGFloat { cardPadding + Self.innerRadius }
/// Grid columns an item spans. Doubles at accessibility text sizes.
func span(_ base: Int) -> Int { min(columns, isAccessibilitySize ? base * 2 : base) }
static let minTouchTarget: CGFloat = 44 // HIG
static let innerRadius: CGFloat = 8 // smallest radius, concentric fallback
static let clearGlassDimming: Double = 0.35 // HIG, behind clear glass on bright media
}
/// Tokens for the view it sits in: `@DuoMetrics private var tokens`.
@propertyWrapper
struct DuoMetrics: DynamicProperty {
@Environment(\.horizontalSizeClass) private var widthClass
@Environment(\.dynamicTypeSize) private var typeSize
@ScaledMetric(relativeTo: .body) private var readableWidth: CGFloat = 600
init() {}
var wrappedValue: DuoTokens {
DuoTokens(widthClass: widthClass,
isAccessibilitySize: typeSize.isAccessibilitySize,
readableWidth: readableWidth)
}
}
It builds for iOS 17 and later and typechecks with no warnings in Swift 5, Swift 6 and main actor default isolation modes. Use it in any view:
import SwiftUI
// requires: DuoTokens.swift (references/tokens.md)
struct AccountScreen: View {
@DuoMetrics private var tokens
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: tokens.sectionSpacing) {
Text("Account").font(DuoType.sectionTitle)
DuoCard {
VStack(alignment: .leading, spacing: DuoSpace.x2) {
Text("Signed in").font(DuoType.itemTitle)
Text("Sync is on.").font(DuoType.secondary).foregroundStyle(.secondary)
}
}
}
.duoContainerMargins()
}
.background(DuoColor.groupedBackground) // cards are white in light mode
}
}
Every value, its source and how to change it safely: references/tokens.md.
@DuoMetrics reads the size class where the view sits. Inside an ArrangementView half on the inner display it returns compact tokens, because that half reports compact width (measured in duo-layout).EvenSplit in duo-layout: regular on the inner display). Give each half compact tokens with .environment(\.horizontalSizeClass, .compact) on the half.@DuoMetrics followed the size class and the Dynamic Type size set in the environment, and readableWidth scaled from 518 pt (xSmall) to 1691 pt (AX5).AnyLayout, so views keep their state. ViewThatFits swaps children and resets their @State (measured); use it only for stateless labels and icons (see duo-continuity).| Don't | Do |
|---|---|
if UIScreen.main.bounds.width > 900 | tokens.columns, or the view's own width |
userInterfaceIdiom == .pad ? 24 : 16 | tokens.cardPadding |
Font.system(size: isOpen ? 20 : 17) | DuoType.body, the same everywhere |
cornerRadius: 55 to match the screen | ConcentricRectangle |
.padding(.horizontal, 20) | .duoContainerMargins() |
DuoSpace: steps of 4 pt. Apple's padding advice (about 12 pt around controls with a bezel, about 24 pt around those without) sits on it (HIG, Accessibility)..duoContainerMargins() uses contentMargins(for: .container) on iOS 27.1, which can differ on each side next to a vertical bar.tokens.gutter, 12 pt compact and 16 pt regular (Duology default).duo-layout, and 40 pt partly folded in the gallery app's region overlay). Apple's Fitness example keeps the outer margins and widens only the middle (111463).Lay designed screens out on tokens.columns (4 or 8) and give content a span, not a width: tokens.span(1) for thumbnails, span(2) for cards, span(4) for wide cards. Spans double at accessibility text sizes, which gives fewer, wider columns, as Apple asks (HIG, Typography).
DuoColumns in references/grid.md turns tokens and the fold into LazyVGrid columns. When a fold crosses the grid, flat or folded, it rounds to an even count, puts half the columns on each side of the fold and never lets a span cross it. If one side is too narrow (in a half of an EvenSplit), every column goes on the other side:
let columns = DuoColumns(width: geometry.width, count: tokens.columns,
gutter: tokens.gutter, fold: geometry.fold)
.grouped(by: tokens.span(2))
// LazyVGrid(columns: columns.gridItems, spacing: tokens.gutter) { ... }
// .padding(.leading, columns.leadingInset)
// .frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
// .onGeometryChange(for: DuoGridGeometry.self) { DuoGridGeometry($0) } action: { ... }
Measure the grid's width on that frame, never on the LazyVGrid itself: with fixed columns it reports their sum, so it never shrinks when the phone closes or enters Split View (measured). The full CardGrid view, the version for apps below iOS 27.1, and worked numbers for both displays are in references/grid.md. For an endless feed that should fit as many tiles as possible, use feed reflow from duo-patterns.
DuoType roles (system text styles). Body is 17 pt at the default size, from 14 pt (xSmall) to 53 pt (AX5) (HIG, Typography)..duoReadableWidth(tokens) (600 pt at the default size, scaled). On the 867 pt inner display, a full-width paragraph is too long to read.Font.custom(_:size:relativeTo:).Role table with sizes, the stacking row, and the test matrix: references/typography.md.
Liquid Glass is the controls layer (iOS 26 and later). On Duo the system already draws the vertical bar, sheets, menus and alerts in it.
GlassEffectContainer; glass can't sample other glass (WWDC25 323)..regular for almost everything. .clear only over media, with a 35% black layer behind it when the media is bright..buttonStyle(.glassProminent)) (HIG, Color).duo-layout).GlassEffectContainer(spacing: DuoSpace.x3) {
HStack(spacing: DuoSpace.x3) {
Button { } label: {
Label("Play", systemImage: "play.fill").labelStyle(.iconOnly).duoTouchTarget()
}
.buttonStyle(.glassProminent)
// More buttons with .buttonStyle(.glass)
}
.buttonBorderShape(.circle)
}
Full controls, clear glass with dimming, Reduce Transparency and UIKit: references/liquid-glass.md.
ConcentricRectangle or .rect(corners: .concentric(minimum: .fixed(DuoTokens.innerRadius))). The same code follows the outer display's corners and the inner display's..containerShape(_:). Apply it before any .background(_:in:) on the same view; the other order made concentricCornerRadii read nil in our test.if #available(iOS 26.0, *), as duoContainerShape(_:) does. Outside that check the compiler picks the iOS 15 overload, and concentricCornerRadii read nil (measured).cardRadius = cardPadding + innerRadius, so the first nested element lands on 8 pt. Measured: a child inset 16 pt in a 24 pt container resolves to 8 pt.Code, measured radii and UIKit cornerConfiguration: references/corners.md.
duo-shared-screen), drop labels and spacing before you shrink a target.Button was 23 × 20 pt and a symbol-only .glassProminent circle 29 × 30 pt until we added duoTouchTarget() (then 44 × 44 and 58 × 58 pt). Never trust a style to reach 44 pt on its own.Button { isFavorite.toggle() } label: {
Image(systemName: isFavorite ? "star.fill" : "star").duoTouchTarget()
}
.accessibilityLabel(isFavorite ? "Remove Favorite" : "Add Favorite")
DuoColor backgrounds and .primary / .secondary text styles. They adapt to light, dark and Increase Contrast.DuoCard on DuoColor.groupedBackground, never on DuoColor.background: in light mode the card and systemBackground are the same white (measured).label on systemBackground is 21:1. secondaryLabel is 3.44:1 in light mode (5.97:1 with Increase Contrast) and systemBlue, the default tint, 3.52:1. Use those for 18 pt and up, bold text, symbols and controls; use label for small text people must read.DuoColor.dynamic(light:dark:lightHighContrast:darkHighContrast:) or an asset catalog colour with Dark and High Contrast variants.duoWorstContrast(text:on:) from references/color.md.Same tokens, read with DuoTokens(traitCollection) and re-applied on trait changes. readableContentGuide, UIFontMetrics, cornerConfiguration and UIGlassEffect replace the SwiftUI pieces. Code: references/uikit.md.
The token module builds for iOS 17. Glass, ConcentricRectangle and scrollEdgeEffectStyle need iOS 26. concentricCornerRadii needs iOS 27.0. Container margins and the fold need iOS 27.1. Mark types @available and call them inside if #available; iPhone Duo always runs iOS 27.1.
simctl can't change the pose.xcrun simctl ui <device> content_size accessibility-extra-extra-extra-large; set it back afterwards on a shared simulator).xcrun simctl ui <device> appearance dark), Increase Contrast (increase_contrast enabled), and Reduce Transparency in Settings, one at a time and together. Put each setting back when you finish.xcrun simctl io booted screenshot --display=primary (outer) and --display=primary-1 (inner).duo-design-review's checklist, rules R5 (even grids) and R13 (touch targets) at least.DuoTokens.swift is in the app; no spacing, radius or font size is written as a literal in views.UIScreen.main.duoContainerMargins() (or layoutMarginsGuide), per side.DuoType roles or Font.custom(_:size:relativeTo:); sizes are the same on both displays.duoReadableWidth; AX5 works on the closed outer display.GlassEffectContainer, regular unless over media; one tinted action at most.containerShape comes before background(_:in:).DuoColor.groupedBackground.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
8 skills in this plugin
/duo-accessibilityMakes iPhone Duo apps work with VoiceOver, Dynamic Type, Reduce Motion, Increase Contrast, hardware keyboards, Switch Control and Voice Control on both displays. Use it when VoiceOver reads two panes row by row or loses its place after the phone folds or unfolds, when text truncates or clips on the 5.4-inch outer display at large text sizes, when a hinge effect or resize animation ignores Reduce Motion, when colours fail contrast, when keyboard shortcuts or focus don't work, or when you add accessibility labels, identifiers or audits. Covers accessibilityElement(children: .contain), accessibilitySortPriority, AccessibilityFocusState with a delayed move after a size-class change, AnyLayout and ViewThatFits reflow with isAccessibilitySize, ScaledMetric, accessibilityReduceMotion with onHingeChange, colorSchemeContrast, keyboardShortcut, accessibilityInputLabels, modifiers before .position, Accessibility Inspector, performAccessibilityAudit and XCUIDevice voiceOverService UI tests on the iPhone Duo simulator./duo-design-reviewReviews screenshots, simulator captures and Figma frames for iPhone Duo, Apple's foldable, against a 15-point checklist (letterboxing, state lost on fold and unfold, sizing from UIScreen.main, text or buttons in the fold via reservedRegions .division and .occlusion, odd grid columns, vertical toolbars with symbols and titles, tabletop and book layouts with ArrangementView overlay, camera preview rotation, outer display feature parity, multiple windows with UIWindowScene.ActivationAction, transitions, 44 pt touch targets, hardware keyboard, drag and drop) and writes findings with severity, rule, where and fix. Use it when someone asks to critique, audit or review a design, mockup, concept or Dribbble shot for the foldable, the outer display or the inner display, or asks what breaks when the phone is closed, open, partly folded like a book, propped on a table, in Split View or under Picture in Picture./duo-ergonomicsPuts controls where hands can reach them on iPhone Duo, Apple's foldable iPhone: one-handed on the closed phone, two hands on the open display, the book grip, and hands-free on a table. Use it when you decide where a primary action, a floating button, player controls or a custom control strip goes; when buttons sit at the top centre of the open display, on the fold or out of thumb reach; when you check thumb zones or reachability; when you design for left-handed people or right-to-left languages; or when touch targets are small. Covers why bars move to the side edge, toolbarVerticalEdge and verticalBarEdge (read them; right to left changes the name, not the side), visibilityPriority for bottom-bar actions, a ThumbCorner modifier for floating controls, an in-app hand preference, ArrangementView with the overlay style to put controls in the bottom half, reservedRegions(kind: .division) to keep targets off the fold, and 44 pt hit regions with frame(minWidth:minHeight:) and contentShape on the label./duo-patternsPicks and builds layout patterns for iPhone Duo, Apple's foldable iPhone, in SwiftUI - list-detail, supporting pane, two-page, dual view, extended canvas, feed reflow with even columns, tabs to sidebar, and displacement off the fold. Use it when you design or fix a screen for the outer display and the inner display, when content or buttons land in the fold, or when choosing between NavigationSplitView, inspector, ArrangementView (split and overlay styles), TabView with sidebarAdaptable and defaultTabBarPlacement, and reserved regions (division, occlusion, includeInactive)./duo-posturesDesigns iPhone Duo screens for every pose Apple shows: closed on the outer display, open flat (wide or tall), partly folded like a book, propped on a table like a laptop (tabletop), standing like a tent, and open and turned around (flipped, rear cameras facing the user). Use it when a screen must work half folded, when you build a tabletop media player or video call (video on top, the same controls below the fold), a book-pose layout with two regions, or a hinge effect. There is no posture API: read size classes and the .division reserved region (active only when partly folded) with FoldGeometry and FoldRegionsLayout, and keep onHingeChange and UIHingeInteraction for effects, with Reduce Motion and accessibility rules./duo-shared-screenBuilds screens that two people use at the same time on one iPhone Duo, Apple's foldable iPhone - two-player games, teaching, showing a customer, kid and parent. Use when two people share the inner display or the outer display, sit side by side or face to face across a phone lying flat, or when you need one half per person (SharedSplit, an EvenSplit with seating, not ArrangementView), per-half named coordinate spaces and contentShape, DragGesture minimumDistance with onTapGesture, input gated per seat, one-sided destructive controls, sensoryFeedback per half, persistentSystemOverlays and defersSystemGestures during play, rotationEffect to turn a half for face-to-face use, accessibility per half, and XCUITest identifiers namespaced by seat.npx claudepluginhub kimeur/duology --plugin duology-designOther plugins' skills for the same job