agentsclimarketplace

Typography system

Skill almasumdev/awesome-mobile-design-system-agent-skills/.github/skills/foundations/typography-system

Agent skills for building and maintaining mobile design systems, tokens, and component libraries.

Install
npx -y skills add almasumdev/awesome-mobile-design-system-agent-skills --skill typography-system

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Type scale, line height, letter spacing, dynamic type, and font loading for a cross-platform mobile design system. Use this when defining or revising the typography layer.

SKILL.md

4.3 KB, as published. Nobody here has run it

Typography System

Instructions

A mobile typography system encodes a finite, named type scale as tokens, supports platform dynamic type, and ships with predictable loading behavior.

1. Define a Named Scale, Not Ad-Hoc Sizes

Pick role-based names, not size numbers. Sizes change; roles do not.

RoleSizeLine HeightWeightLetter Spacing
display.lg4048700-0.02em
display.md3240700-0.015em
heading.lg2432600-0.01em
heading.md20286000
title.md16246000
body.lg16244000
body.md14204000
label.md12165000.02em
caption11144000.03em

2. Encode as Composite DTCG Tokens

Use $type: "typography" so one token carries family, size, weight, line height, and tracking.

{
  "text": {
    "$type": "typography",
    "body": {
      "md": {
        "$value": {
          "fontFamily": "{font.family.sans}",
          "fontSize":   "{font.size.14}",
          "fontWeight": "{font.weight.regular}",
          "lineHeight": "{font.lineHeight.20}",
          "letterSpacing": "0"
        }
      }
    }
  }
}

3. Line Height Rules

  • Tight headings: line height 1.1–1.25× of size.
  • Comfortable body: 1.4–1.5×.
  • Dense UI labels: 1.2–1.3×.
  • Lock line heights to an 8pt rhythm where possible (16 → 24, 14 → 20, 12 → 16).

4. Dynamic Type / Scaling

Mobile users can increase system font size. Do not defeat it.

SwiftUI: use Font.system(.body, design: .default) or register custom fonts with Font.custom("Inter", size: 14, relativeTo: .body) so they scale.

Text("Save")
    .font(.custom("Inter", size: 14, relativeTo: .body))
    .fontWeight(.semibold)

Jetpack Compose: use sp (not dp) and expose scales via a Typography object.

val AppTypography = Typography(
    bodyMedium = TextStyle(
        fontFamily = InterFamily,
        fontSize   = 14.sp,
        lineHeight = 20.sp,
        fontWeight = FontWeight.Normal,
    ),
)

Flutter: TextTheme with TextStyle whose fontSize is in logical pixels; respect MediaQuery.textScaler.

final textTheme = TextTheme(
  bodyMedium: TextStyle(
    fontFamily: 'Inter',
    fontSize: 14,
    height: 20 / 14,
    fontWeight: FontWeight.w400,
  ),
);

React Native: wrap Text with a Typography component that multiplies by PixelRatio.getFontScale() only if you need custom scaling; otherwise trust RN's default.

5. Font Loading

  • Bundle variable fonts (Inter, SF Pro fallback, Roboto Flex) over many static weights.
  • Preload on cold start; never let first-paint fall back to a system font that shifts layout.
  • On Android, register FontFamily.from(Font(R.font.inter_variable, ...)). On iOS, add to Info.plist UIAppFonts and load via UIFont. On Flutter, declare in pubspec.yaml fonts: with style/weight entries.

6. Line Length and Layout

  • Cap body text at ~70 characters per line even on tablet. Use maxWidth layout constraints, not font sizing.
  • Truncate with ellipsis only as a last resort; allow wrap on small screens.

7. Anti-Patterns

  • Exposing raw sizes (fontSize: 13.5) in components.
  • Disabling dynamic type globally.
  • Using color alone to distinguish hierarchy (fails a11y).
  • Mixing sp and dp for text on Android.
  • Hardcoding letterSpacing per screen.

Checklist

  • A named role-based type scale exists and is the only surface components use.
  • Composite $type: "typography" tokens drive every platform theme.
  • Dynamic Type / text scaler works end-to-end (tested at 200%).
  • Fonts preload and do not cause visible FOUT on cold start.
  • Line heights sit on the 4/8pt rhythm.
  • No raw fontSize / FontWeight in component source.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.