layout-spacing-checker
[Design System] Validate margin/padding/gap values against spacing scale and grid rules. Use when (1) checking if spacing values follow the design system scale, (2) finding off-scale or inconsistent spacing, (3) auditing layout consistency across components, (4) user asks to 'check spacing', 'validate layout', 'audit margins/padding', or 'find off-scale values'.
When & Why to Use This Skill
The Layout & Spacing Scale Checker is a specialized Claude skill designed to automate design system compliance by validating UI spacing against predefined scales. It scans source code (CSS, SCSS, SwiftUI) to identify 'off-scale' values, inconsistent margins, and layout discrepancies, ensuring that the final implementation remains pixel-perfect and aligned with the brand's design language.
Use Cases
- Design System Auditing: Automatically scan frontend repositories to detect and correct 'magic numbers' or spacing values that deviate from the official design system scale.
- Automated Code Reviews: Use the skill during the PR review process to flag inconsistent padding or margins in new components before they reach production.
- Legacy Code Refactoring: Identify and update hardcoded layout values in older codebases when migrating to a standardized spacing token system.
- Cross-Platform UI Consistency: Ensure that layout spacing remains uniform across different platforms by validating both web (CSS) and mobile (SwiftUI) code against a shared spacing configuration.
| name | layout-spacing-checker |
|---|---|
| description | "[Design System] Validate margin/padding/gap values against spacing scale and grid rules. Use when (1) checking if spacing values follow the design system scale, (2) finding off-scale or inconsistent spacing, (3) auditing layout consistency across components, (4) user asks to 'check spacing', 'validate layout', 'audit margins/padding', or 'find off-scale values'." |
Layout & Spacing Scale Checker
Validate spacing values against a defined scale and find inconsistencies.
Quick Start
python3 scripts/check_spacing.py --scale spacing.yml --source src/
Issue Types
| Type | Severity | Description |
|---|---|---|
off-scale |
warning | Value not in spacing scale |
inconsistent |
info | Different spacing for similar components |
zero-spacing |
info | Potentially missing spacing |
excessive |
warning | Unusually large spacing value |
Detection Examples
CSS/SCSS
/* off-scale: 17px not in scale */
.card { padding: 17px; }
/* Suggested: 16px (md) or 20px */
SwiftUI
// off-scale: 15 not in scale
.padding(15)
// Suggested: .padding(16) or spacing token .md