home / skills / hoangnguyen0403 / agent-skills-standard / react-native-dls
This skill enforces React Native design token usage to ensure consistent theming and avoids hardcoded styles across components.
npx playbooks add skill hoangnguyen0403/agent-skills-standard --skill react-native-dlsReview the files below or copy the command above to add this skill to your agents.
---
name: React Native Design System
description: Enforce design token usage in React Native. Prevents hardcoded styles, encourages theme and design system consistency.
metadata:
labels: [react-native, dls, design-tokens, theme, styling]
triggers:
files:
['**/*Screen.tsx', '**/*Component.tsx', '**/theme/**', '**/styles/**']
keywords: [StyleSheet, styled-components, theme, colors, spacing]
---
# React Native Design System
## **Priority: P1 (OPERATIONAL)**
Enforce design token usage in React Native apps.
## Guidelines
- **Structure**: Define tokens in `theme/colors.ts`, `spacing.ts`, `typography.ts`.
- **Usage**: Import tokens (`colors.primary`) instead of literals (`#000`).
- **Styling**: Compatible with `StyleSheet` and `styled-components`.
[Usage Examples](references/usage.md)
## Anti-Patterns
- **No Inline Colors**: Use `'#FF0000'` → Error. Import from `theme/colors`.
- **No Magic Spacing**: Use `padding: 16` → Error. Use `spacing.md`.
- **No Inline Fonts**: Define `fontSize: 20` → Error. Use `typography.h1`.
## Related Topics
mobile-ux-core | react-native/performance
This skill enforces consistent design token usage across React Native projects to prevent hardcoded styles and encourage a centralized theme. It checks for inline colors, magic spacing numbers, and direct font values, steering developers to use tokens defined in theme files. The goal is predictable, themable UI and easier cross-platform maintenance.
The skill inspects source files for style definitions and flags literals like hex colors, numeric spacing values, and direct font sizes. It expects tokens to be referenced from theme modules such as theme/colors.ts, spacing.ts, and typography.ts and supports detection in both StyleSheet and styled-components patterns. Violations are reported with actionable guidance pointing to the proper token import and usage.
Does this skill work with both StyleSheet and styled-components?
Yes. It detects inline literals in StyleSheet objects and styled-components templates, recommending token imports for both patterns.
What token file locations are expected?
By default it looks for theme/colors.ts, spacing.ts, and typography.ts. You can adapt conventions to your project if needed.