Format numbers

A coding rule for displaying numbers in Shade interfaces through the shared `formatNumber` utility. It covers counts, measurements, analytics, and monetary values after any required currency conversion.

In plain words
What is it for?
Use it when editing TSX that shows member counts, visitor numbers, email metrics, revenue, post analytics, or other quantities.
Why use it?
It prevents inconsistent number formatting and stops raw values or one-off formatting code from appearing in the user interface.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tryghost/ghost/format-number
Any agent
npx skills add TryGhost/Ghost --skill format-number
Clone the repo
git clone --depth 1 https://github.com/TryGhost/Ghost

Made for: Claude Code, Codex.

Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 444 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00020 $0.00444
Opus 5 $0.00010 $0.00222
Sonnet 5 $0.00004 $0.00089
Haiku 4.5 $0.00002 $0.00044

Measured yesterday against content hash 363dde2cb772, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Format numbers scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/format-number/SKILL.md · 62 lines

What it actually says

Format Numbers

When editing .tsx files, ensure all user-facing numbers are formatted using the formatNumber utility from @tryghost/shade/utils.

Import

import { formatNumber } from '@tryghost/shade/utils';

When to use formatNumber

Use formatNumber() when rendering any numeric value that is displayed to the user, including:

  • Member counts, visitor counts, subscriber counts
  • Email engagement metrics (opens, clicks, bounces)
  • Revenue amounts (combine with centsToDollars() for monetary values)
  • Post analytics (views, link clicks)
  • Any count or quantity shown in UI

Correct usage

<span>{formatNumber(totalMembers)}</span>
<span>{formatNumber(link.count || 0)}</span>
<span>{`${currencySymbol}${formatNumber(centsToDollars(mrr))}`}</span>
<span>{post.members > 0 ? `+${formatNumber(post.members)}` : '0'}</span>

Antipatterns to avoid

Do NOT use any of these patterns for formatting numbers in TSX files:

// BAD: raw .toLocaleString()
<span>{count.toLocaleString()}</span>

// BAD: manual Intl.NumberFormat
<span>{new Intl.NumberFormat('en-US').format(count)}</span>

// BAD: raw number without formatting
<span>{memberCount}</span>

// BAD: manual regex formatting
<span>{count.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')}</span>
  • formatPercentage() - for percentages (e.g., open rates, click rates)
  • abbreviateNumber() - for compact notation (e.g., 1.2M, 50k)
  • centsToDollars() - convert cents to dollars before passing to formatNumber

All are imported from @tryghost/shade/utils.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 62 lines · 20 tokens per session scan A 363dde2cb772

Subscribe to this mod's changes

Format numbers is a skill published in the GitHub repository TryGhost/Ghost (55,095 stars, last pushed today), licensed MIT. It adds 20 tokens to every session and 444 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.