jackson2w/claude-code-skills / artifact-font-embedding
artifact-font-embedding
VerifiedThis skill should be used when the user asks to "show me font pairing options", "preview typography choices", "compare fonts", "mock up different fonts", or asks to see design/typography options rendered with real fonts inside a Claude Artifact. Also applies whenever a Worker/Artifact needs a Google Font and the CSP blocks external font requests. Covers sourcing real font files via Fontsource and embedding them as base64 @font-face data URIs so an Artifact renders the actual typeface rather than silently falling back to a system font.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.8 KB |
| references/fontsource-cheatsheet.md | markdown | 3.7 KB |
| scripts/build-font-preview.js | script | 2.2 KB |
scripts/build-font-preview.js
View on GitHub// Skeleton build script for a font-preview Artifact. Copy this into a
// scratch directory next to the Fontsource packages, adjust FONTS and the
// HTML/CSS template, then `node build-font-preview.js`.
//
// Why a script and not inline base64 in a Write call: a variable font file
// is tens of KB; base64 inflates that ~33%. Doing the encoding in a script
// keeps that text out of the conversation entirely — only the final file
// path matters, not its content.
const fs = require("fs");
const path = require("path");
const b64 = (p) => fs.readFileSync(path.join(__dirname, p)).toString("base64");
// One entry per font file actually needed. `format` is "woff2-variations"
// for @fontsource-variable/* packages, "woff2" for static @fontsource/*
// packages. `weight` is the family's real min/max (or single value for a
// static font) — check node_modules/<pkg>/files/ and the family's page on
// fontsource.org rather than guessing.
const FONTS = [
{
name: "Example Variable",
file: "node_modules/@fontsource-variable/example/files/example-latin-wght-normal.woff2",
format: "woff2-variations",
weight: "300 900",
style: "normal",
},
// { name: "Example Static", file: "node_modules/@fontsource/example-static/files/example-static-latin-400-normal.woff2", format: "woff2", weight: "400", style: "normal" },
];
const fontFaces = FONTS.map(
(f) => `
@font-face {
font-family: "${f.name}";
src: url(data:font/woff2;base64,${b64(f.file)}) format("${f.format}");
font-weight: ${f.weight};
font-style: ${f.style};
font-display: swap;
}`
).join("\n");
const html = `<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Font preview</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
${fontFaces}
/* TODO: page chrome + comparison sections, reusing the real site's actual
design tokens (colors, spacing, type scale) and real copy — not generic
lorem ipsum. See the artifact-design skill for layout/treatment guidance. */
</style>
</head>
<body>
<!-- TODO: comparison sections -->
</body>
</html>
`;
const outPath = path.join(__dirname, "font-preview.html");
fs.writeFileSync(outPath, html);
console.log("wrote", outPath, html.length, "bytes");
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |