Skip to content

docs: add Claude Code usage skill for pretext - #197

Open
GuyNachshon wants to merge 1 commit into
chenglou:mainfrom
GuyNachshon:add-pretext-usage-skill
Open

docs: add Claude Code usage skill for pretext#197
GuyNachshon wants to merge 1 commit into
chenglou:mainfrom
GuyNachshon:add-pretext-usage-skill

Conversation

@GuyNachshon

Copy link
Copy Markdown

What

Adds .claude/skills/pretext/SKILL.md — a Claude Code skill that teaches the assistant how to use @chenglou/pretext correctly. Since the repo already ships a CLAUDE.md, this lets anyone working in the repo with Claude Code get accurate, on-demand guidance without re-reading the full README each time.

It's a single Markdown file, no code or build changes.

Why a skill instead of more README

The README is (rightly) the exhaustive API reference. A skill is a thin decision/usage layer on top of it — it loads only when relevant and focuses on the judgment calls the reference doesn't foreground:

  • Leads with the prepare-once / layout-many model and the "never re-prepare() the same (text, font, options)" rule, since most correct usage follows from respecting that seam.
  • A decision guide for picking between the three API families: fast path (prepare/layout), rich manual layout (prepareWithSegments + walkLineRanges/layoutNextLineRange/layoutWithLines), and the rich-inline helper.
  • An accuracy contract — the silent-wrong-number traps: sync font/lineHeight/letterSpacing with CSS, avoid system-ui, await font load, clamp empty strings.
  • Supported vs. out-of-scope CSS surface, common recipes (shrink-wrap, virtualization, flow-around-obstacle, inline chips), and a best-practices checklist.

It explicitly points back to README.md as the authoritative API reference (per the repo's CLAUDE.md convention), so it stays a usage layer rather than a second copy of the signatures that could drift.

Notes

  • API names in the skill were verified against the current 0.0.7 exports in src/layout.ts and src/rich-inline.ts.
  • Scoped to consumer usage, not the contributor workflow (which CLAUDE.md / DEVELOPMENT.md already cover).
  • Fully optional for anyone not using Claude Code — it's an inert Markdown file otherwise. Happy to relocate it (e.g. under docs/) or drop it if a tool-specific directory isn't wanted in the repo.

🤖 Generated with Claude Code

Adds .claude/skills/pretext/SKILL.md, a usage-oriented skill that helps
Claude Code (and contributors using it) apply the library correctly:

- leads with the prepare-once / layout-many model and the "never re-prepare
  the same input" rule
- a decision guide for choosing between the fast path (prepare/layout), rich
  manual layout (prepareWithSegments/walkLineRanges/layoutNextLineRange), and
  the rich-inline helper
- an accuracy contract (sync font/lineHeight/letterSpacing with CSS, avoid
  system-ui, await font load, empty-string clamp)
- supported vs. out-of-scope CSS surface, recipes, and a best-practices
  checklist

Points back to README.md as the authoritative API reference per CLAUDE.md, so
the skill stays a thin decision/usage layer rather than duplicating signatures.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@GuyNachshon

Copy link
Copy Markdown
Author

also created this as a separate repo -> https://github.com/GuyNachshon/pretext-claude-skill

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant