Token导航 LogoToken导航

Agent Skill · 前端设计

axiom-typography-ref(公理排版参考)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

axiom-typography-ref 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 1,725。

总安装 4,140周安装 176GitHub Stars 873下载 1,450核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:axiom-typography-ref(公理排版参考)
来源仓库:https://github.com/charleswiltgen/axiom
仓库路径:skills/axiom-typography-ref
安装命令:
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-typography-ref
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/charleswiltgen/axiom --skill axiom-typography-ref

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

axiom-typography-ref 汇总 Apple 平台字体体系,包括 San Francisco 各子家族与动态排版规则。适用于文本样式定制、字号缩放适配或国际化多语言字体回退方案设计。详细说明 SF Pro、SF Mono 等字体的适用场景与授权范围限制条件。

包含行距、字间距调整技巧及 watchOS 窄列环境下的字体压缩优化建议。动态类型(Dynamic Type)支持需配合 accessibilityPreferredFont 使用以确保无障碍合规。

来源仓库内路径:skills/axiom-typography-ref

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/charleswiltgen/axiom --skill axiom-typography-…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

axiom-typography-ref 怎么安装?

在终端执行 npx skills add https://github.com/charleswiltgen/axiom --skill axiom-typography-ref。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

axiom-typography-ref 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

axiom-typography-ref 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

axiom-typography-ref 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

axiom-typography-ref 用的人多吗?

公开数据是累计安装 4,140 次,近一周安装 176 次,下载 1,450 次,GitHub 873 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

axiom-typography-ref 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
axiom-typography-ref

公理排版参考 · 本页

4,140873需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Typography Reference

Complete reference for typography on Apple platforms including San Francisco font system, text styles, Dynamic Type, tracking, leading, and internationalization through iOS 26.

San Francisco Font System

Font Families

SF Pro and SF Pro Rounded (iOS, iPadOS, macOS, tvOS)

  • Main system fonts for most UI elements
  • Rounded variant for friendly, approachable interfaces (e.g., Reminders app)

SF Compact and SF Compact Rounded (watchOS, narrow columns)

  • Optimized for constrained spaces and small sizes
  • watchOS default system font

SF Mono (Code environments, monospaced text)

  • Monospaced font for code editors and technical content
  • Consistent character widths for alignment

New York (Serif system font)

  • Serif alternative for editorial content
  • Works with text styles just like SF Pro

Variable Font Axes

Weight Axis (9 weights)
  • Ultralight, Thin, Light, Regular, Medium, Semibold, Bold, Heavy, Black
  • Continuous weight spectrum via variable fonts
  • Avoid light weights at small sizes (legibility issues)
Width Axis (WWDC 2022)
  • Condensed — narrowest width
  • Compressed — narrow width
  • Regular — standard width (default)
  • Expanded — wide width

Access via:

// iOS/macOS
let descriptor = UIFontDescriptor(fontAttributes: [
    .family: "SF Pro",
    kCTFontWidthTrait: 1.0 // 1.0 = Expanded
])

SF Arabic (WWDC 2022)

  • Matches SF Pro design language for Arabic text
  • Proper right-to-left support
Optical Sizes

Variable fonts automatically adjust optical size based on point size:

  • Text variant (< 20pt) — more spacing, sturdier strokes
  • Display variant (≥ 20pt) — tighter spacing, refined details
  • Smooth transition (17-28pt) with variable SF Pro

From WWDC 2020:

"TextKit 2 abstracts away glyph handling to provide a consistent experience for international text."

Text Styles & Dynamic Type

System Text Styles

Text StyleDefault Size (iOS)Use Case
.largeTitle34ptPrimary page headings
.title28ptSecondary headings
.title222ptTertiary headings
.title320ptQuaternary headings
.headline17pt (Semibold)Emphasized body text
.body17ptPrimary body text
.callout16ptSecondary body text
.subheadline15ptTertiary body text
.footnote13ptFootnotes, captions
.caption12ptSmall annotations
.caption211ptSmallest annotations
Font Size Guidance
  • Avoid .caption2 for readable content — at 11pt, it's acceptable for timestamps and metadata annotations but too small for body text or labels users need to read. Prefer .caption or .footnote as the minimum for readable content.

Emphasized Text Styles

Apply .bold symbolic trait to get emphasized variants:

// UIKit
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .title1)
let boldDescriptor = descriptor.withSymbolicTraits(.traitBold)!
let font = UIFont(descriptor: boldDescriptor, size: 0)

// SwiftUI
Text("Bold Title")
    .font(.title.bold())

Actual weights by text style:

  • Some styles map to medium
  • Others map to semibold, bold, or heavy
  • Depends on semantic hierarchy

Leading Variants

Tight Leading (reduces line height by 2pt on iOS, 1pt on watchOS):

// UIKit
let descriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body)
let tightDescriptor = descriptor.withSymbolicTraits(.traitTightLeading)!

// SwiftUI
Text("Compact text")
    .font(.body.leading(.tight))

Loose Leading (increases line height by 2pt on iOS, 1pt on watchOS):

// SwiftUI
Text("Spacious paragraph")
    .font(.body.leading(.loose))

Dynamic Type

Automatic Scaling (iOS): Text styles scale automatically based on user preferences from Settings → Display & Brightness → Text Size.

Custom Fonts with Dynamic Type:

// UIKit - UIFontMetrics
let customFont = UIFont(name: "Avenir-Medium", size: 34)!
let bodyMetrics = UIFontMetrics(forTextStyle: .body)
let scaledFont = bodyMetrics.scaledFont(for: customFont)

// Also scale constants
let spacing = bodyMetrics.scaledValue(for: 20.0)
// SwiftUI - .font(.custom(_:relativeTo:))
Text("Custom scaled text")
    .font(.custom("Avenir-Medium", size: 34, relativeTo: .body))

// @ScaledMetric for values
@ScaledMetric(relativeTo: .body) var padding: CGFloat = 20

Platform Differences

macOS

  • No Dynamic Type support in AppKit
  • Text style sizes optimized for macOS control sizes
  • Catalyst apps use iOS sizes × 77% (legacy) or macOS-optimized sizes ("Optimize Interface for Mac")

watchOS

  • Smaller text styles optimized for watch faces
  • Tight leading default for compact displays

visionOS

  • System fonts work identically to iOS
  • Dynamic Type support included

Tracking & Leading

Tracking (Letter Spacing)

Tracking adjusts space between letters. Essential for optical size behavior.

Size-Specific Tracking Tables:

SF Pro includes tracking values that vary by point size to maintain optimal spacing:

  • Larger sizes: tighter tracking
  • Smaller sizes: looser tracking

Example from Apple Design Resources:

  • 34pt (largeTitle): +0.016 tracking
  • 17pt (body): +0.008 tracking
  • 11pt (caption2): +0.06 tracking

Tight Tracking API (for fitting text):

// UIKit
textView.allowsDefaultTightening(for: .byTruncatingTail)

// SwiftUI
Text("Long text that needs to fit")
    .lineLimit(1)
    .minimumScaleFactor(0.5) // Allows tight tracking

Manual Tracking:

// UIKit
let attributes: [NSAttributedString.Key: Any] = [
    .font: UIFont.preferredFont(forTextStyle: .body),
    .kern: 2.0 // 2pt tracking
]

// SwiftUI
Text("Tracked text")
    .tracking(2.0)
    .kerning(2.0) // Alternative API

Important: Use .tracking() not .kerning() API for semantic correctness. Tracking disables ligatures when necessary; kerning does not.

Leading (Line Spacing)

Default Line Height: Calculated from font's built-in metrics (ascender + descender + line gap).

Language-Aware Adjustments: iOS 17+ automatically increases line height for scripts with tall ascenders/descenders:

  • Arabic
  • Thai, Lao
  • Hindi, Bengali, Telugu

From WWDC 2023:

"Automatic line height adjustment for scripts with variable heights"

Manual Leading:

// UIKit
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 8.0 // 8pt additional space

// SwiftUI (iOS 13+)
Text("Custom spacing")
    .lineSpacing(8.0)

Line Height (iOS 26+):

.lineHeight() sets baseline-to-baseline distance directly — more intuitive than .lineSpacing() (which measures bottom-to-top).

// Presets
Text("Open layout").lineHeight(.loose)
Text("Compact layout").lineHeight(.tight)

// Precise control
Text("Scaled").lineHeight(.multiple(factor: 1.5))
Text("Fixed").lineHeight(.exact(points: 30)) // Does NOT scale with Dynamic Type

Also available as AttributedString.lineHeight for styled strings. See axiom-swiftui-26-ref for full API details.

Third-Party Font Tracking

New in iOS 18: Font vendors can embed tracking tables in custom fonts using STAT table + CTFont optical size attribute.

let attributes: [String: Any] = [
    kCTFontOpticalSizeAttribute as String: pointSize
]
let descriptor = CTFontDescriptorCreateWithAttributes(attributes as CFDictionary)
let font = CTFontCreateWithFontDescriptor(descriptor, pointSize, nil)

SwiftUI AttributedString Typography

Font Environment Interaction

Critical Pattern When using AttributedString with SwiftUI's Text, paragraph styles (like lineHeightMultiple) can be lost if fonts come from the environment instead of the attributed content.

From WWDC 2025-280:

"TextEditor substitutes the default value calculated from the environment for any AttributedStringKeys with a value of nil."

This same principle applies to Text—when your AttributedString doesn't specify a font, SwiftUI applies the environment font, which can cause it to rebuild text runs and drop or normalize paragraph style details.

The Problem

// ❌ WRONG - .font() modifier can override and drop paragraph styles
var s = AttributedString(longString)

// Set paragraph style
var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
s.paragraphStyle = p
// ⚠️ No font set in AttributedString

Text(s)
    .font(.body) // ⚠️ May rebuild runs, lose lineHeightMultiple

Why this fails:

  1. AttributedString has no font attribute set (value is nil)
  2. SwiftUI's .font(.body) modifier tells it "use this font for the whole run"
  3. SwiftUI rebuilds text runs with the environment font
  4. Paragraph styles get dropped or normalized during rebuild

The Solution

Keep typography inside the AttributedString when you need fine control:

// ✅ CORRECT - Font in AttributedString, no environment override
var s = AttributedString(longString)

// Set font INSIDE the attributed content
s.font = .system(.body) // ✅ Typography inside AttributedString

// Set paragraph style
var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
s.paragraphStyle = p

Text(s) // ✅ No .font() modifier

Why this works:

  1. Font is part of the attributed content (not nil)
  2. No environment override from .font() modifier
  3. SwiftUI preserves both font AND paragraph styles
  4. Text runs remain intact with all attributes

When to Use Each Approach

Use Font in AttributedString (Fine Control)
var s = AttributedString("Carefully styled text")
s.font = .system(.body)

var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
p.alignment = .leading
s.paragraphStyle = p

Text(s) // No modifier

When to use:

  • Need precise paragraph styling (line height, alignment)
  • Mixing multiple fonts in one string
  • Content will be displayed in both Text and TextEditor
  • Preserving exact formatting from rich text editor
Use.font() Modifier (Broad Override)
Text("Simple text")
    .font(.body)
    .lineSpacing(4.0) // SwiftUI-level spacing

When to use:

  • Simple text without paragraph styles
  • Want Dynamic Type automatic scaling
  • Need SwiftUI's semantic font behavior (Dark Mode, accessibility)
  • Intentionally overriding AttributedString fonts

Multiple Fonts in One String

var s = AttributedString("Title")
s.font = .system(.title).bold()

var body = AttributedString(" and body text")
body.font = .system(.body)

s.append(body)

Text(s) // ✅ No .font() modifier preserves both fonts

Common Mistake: Order Doesn't Matter

// ❌ WRONG mental model: "Create AttributedString first"
var s = AttributedString(text)
var p = AttributedString.ParagraphStyle()
p.lineHeightMultiple = 0.92
s.paragraphStyle = p
s.font = .system(.body) // ⚠️ Setting font last doesn't help if you use .font() modifier

Text(s).font(.body) // Still breaks!

The issue isn't when you set the font in AttributedString. The issue is whether the attributed content carries its own font attributes versus relying on SwiftUI's .font(...) environment.

Verification Checklist

When using AttributedString with paragraph styles:

  • Font set inside AttributedString (not nil)
  • No .font() modifier on Text view (unless intentionally overriding)
  • Paragraph styles set after or before font (order doesn't matter)
  • Tested with actual content to verify line height/alignment preserved

Internationalization

Bidirectional Text

Complex Script Example (from WWDC 2021):

Kannada word "October":

  • Character index 4 has split vowel → 2 glyphs
  • Glyphs reorder before ligature application
  • Glyph index ≠ character index

This is why TextKit 2 uses NSTextLocation instead of integer indices.

Hebrew/Arabic Selection: Single visual selection = multiple NSRanges in AttributedString due to right-to-left layout.

Line Breaking

Language-Aware (iOS 17+):

  • Chinese, Japanese, Korean: break at semantic boundaries
  • German: avoid breaking compound words
  • English: prefer breaking at hyphens

Even Line Breaking (TextKit 2): Justified paragraphs use improved line breaking algorithm:

  • Reduces stretched-out lines
  • More even interword spacing
  • Automatic in TextKit 2

Text Clipping Prevention

Best Practices:

  1. Use Dynamic Type (auto-adjusts)
  2. Set .lineLimit(nil) or .lineLimit(2...5) in SwiftUI
  3. Use .minimumScaleFactor() for constrained single-line text
  4. Test with large accessibility sizes

CSS & Web Typography

System UI Font Families:

font-family: system-ui; /* SF Pro */
font-family: ui-rounded; /* SF Pro Rounded */
font-family: ui-serif; /* New York */
font-family: ui-monospace; /* SF Mono */

Legacy:

font-family: -apple-system; /* deprecated, use system-ui */

Code Examples

Emphasized Large Title (SwiftUI)

Text("Recipe Editor")
    .font(.largeTitle.bold()) // Emphasized variant

Custom Font + Dynamic Type (UIKit)

let customFont = UIFont(name: "Avenir-Medium", size: 17)!
let metrics = UIFontMetrics(forTextStyle: .body)
label.font = metrics.scaledFont(for: customFont)
label.adjustsFontForContentSizeCategory = true

Rounded Design (UIKit)

let descriptor = UIFontDescriptor
    .preferredFontDescriptor(withTextStyle: .largeTitle)
    .withDesign(.rounded)!
let font = UIFont(descriptor: descriptor, size: 0)

Rounded Design (SwiftUI)

Text("Today")
    .font(.largeTitle.bold())
    .fontDesign(.rounded)

ScaledMetric (SwiftUI)

struct RecipeView: View {
    @ScaledMetric(relativeTo: .body) var padding: CGFloat = 20

    var body: some View {
        Text("Recipe")
            .padding(padding) // Scales with Dynamic Type
    }
}

Resources

WWDC: 2020-10175, 2022-110381, 2023-10058

Docs: /uikit/uifontdescriptor, /uikit/uifontmetrics, /swiftui/font

平台分布

Claude Code

28.51%
按下载量换算413

Codex

21.97%
按下载量换算319

OpenCode

17.95%
按下载量换算260

Antigravity

13.06%
按下载量换算189

Cursor

8.01%
按下载量换算116

Gemini CLI

3.63%
按下载量换算53

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills