spacing-scale
Skill50 starsChanged 11 months agoMITView on GitHub
Generates consistent spacing tokens using base values and ratios. Use when creating margin/padding systems, gap tokens, or layout spacing. Outputs CSS custom properties, Tailwind config, or JSON tokens.
In this repository29 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- aria-patternsSkill
- color-contrastSkill
- focus-statesSkill
- component-docsSkill
- token-docsSkill
- angularSkill
- reactSkill
- svelteSkill
- vueSkill
- getting-startedSkill
- animation-principlesSkill
- compound-componentsSkill
- dark-modeSkill
- icon-systemSkill
- layout-primitivesSkill
- breakpointsSkill
- color-scaleSkill
- design-tokens-structureSkill
- motion-scaleSkill
- radius-scaleSkill
- responsive-typographySkill
- shadow-scaleSkill
- type-scaleSkill
- z-index-scaleSkill
- figmaSkill
- framerSkill
- storybookSkill
- style-dictionarySkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Get base value: Default 4px or 0.25rem (common base unit)
- Distinctive: line 40
Generate: Create scale centered on base, expanding in both directions
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Spacing Scale Generator
Overview
Generate consistent spacing scales using a base value and ratio. Creates exponentially distributed values centered around a base unit for harmonious layouts.
When to Use
- Setting up spacing tokens for a new project
- Standardizing padding and margin values
- Creating a gap/grid system
- Migrating from arbitrary spacing to tokens
Quick Reference
| Naming Style | Example Names | Best For |
| T-shirt | xs, sm, md, lg, xl | Semantic, readable |
| Numeric | 100, 200, 300... | Precise, extensible |
| Unit | When to Use |
| px | Fixed layouts, pixel-perfect designs |
| rem | Scalable, respects user font settings |
| em | Component-relative spacing |
The Process
- Get base value: Default 4px or 0.25rem (common base unit)
- Get ratio: How much each step grows (1.5 is balanced, 2 is dramatic)
- Ask steps: How many spacing values (8-12 is typical)
- Ask naming: T-shirt sizes (xs, sm, md, lg) or numeric (100, 200, 300)?
- Ask unit: px, rem, or em?
- Ask format: CSS, Tailwind, or JSON?
- Generate: Create scale centered on base, expanding in both directions
Common Ratios
| Ratio | Character | Example (base 4px) |
| 1.25 | Tight | 2, 2.5, 3, 4, 5, 6, 8 |
| 1.5 | Balanced | 1.8, 2.7, 4, 6, 9, 13.5 |
| 1.618 | Golden | 1.5, 2.5, 4, 6.5, 10.5, 17 |
| 2 | Dramatic | 1, 2, 4, 8, 16, 32 |
Output Formats
CSS Custom Properties:
:root {
--spacing-xs: 2px;
--spacing-sm: 4px;
--spacing-md: 8px;
--spacing-lg: 16px;
--spacing-xl: 32px;
}Tailwind Config:
module.exports = {
theme: {
spacing: {
'xs': '2px',
'sm': '4px',
'md': '8px',
'lg': '16px',
'xl': '32px',
}
}
}JSON Tokens:
{
"spacing": {
"xs": "2px",
"sm": "4px",
"md": "8px",
"lg": "16px",
"xl": "32px"
}
}Algorithm
The scale is centered on the base value at the midpoint:
value = baseValue * (ratio ^ (step - midpoint))For a 10-step scale with base 4 and ratio 1.5:
- Step 0 (5 below mid): 4 * 1.5^-5 = 0.53
- Step 5 (midpoint): 4 * 1.5^0 = 4
- Step 9 (4 above mid): 4 * 1.5^4 = 20.25
T-shirt Size Mapping
Full range: 3xs, 2xs, xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl
The midpoint of your scale maps to "md" and expands outward.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

