home / skills / hoangnguyen0403 / agent-skills-standard / flutter-design-system
This skill enforces Flutter design system adherence by replacing hardcoded values with project tokens, enhancing consistency and maintainability.
npx playbooks add skill hoangnguyen0403/agent-skills-standard --skill flutter-design-systemReview the files below or copy the command above to add this skill to your agents.
---
name: Flutter Design System
description: Enforce strict Design Language System (DLS) adherence. Prevents hardcoded colors, spacing, and typography. Detects and uses project tokens.
metadata:
labels: [flutter, dls, design-tokens, theme, styling]
triggers:
files:
[
'**/theme/**',
'**/*_theme.dart',
'**/*_colors.dart',
'**/*_dls/**',
'**/foundation/**',
]
keywords:
[
ThemeData,
ColorScheme,
AppColors,
VColors,
VSpacing,
AppTheme,
design token,
]
---
# Flutter Design System Enforcement
## **Priority: P0 (CRITICAL)**
Zero tolerance for hardcoded design values.
## Guidelines
- **Colors**: Use tokens (`VColors.*`, `AppColors.*`), never `Color(0xFF...)` or `Colors.red`.
- **Spacing**: Use tokens (`VSpacing.*`), never magic numbers like `16` or `24`.
- **Typography**: Use tokens (`VTypography.*`, `textTheme.*`), never inline `TextStyle`.
- **Borders**: Use tokens (`VBorders.*`), never raw `BorderRadius.`
- **Components**: Use DLS widgets (`VButton`) over raw Material widgets (`ElevatedButton`) if available.
[Detailed Examples](references/usage.md)
## Anti-Patterns
- **No Hex Colors**: `Color(0xFF...)` is strictly forbidden.
- **No Color Enums**: `Colors.blue` is forbidden in UI code.
- **No Magic Spacing**: `SizedBox(height: 10)` is forbidden.
- **No Inline Styles**: `TextStyle(fontSize: 14)` is forbidden.
- **No Raw Widgets**: Don't use `ElevatedButton` when `VButton` exists.
## Related Topics
mobile-ux-core | flutter/widgets | idiomatic-flutter
This skill enforces a strict Flutter Design Language System (DLS) to ensure consistent UI across the codebase. It prevents hardcoded colors, spacing, typography, and raw widgets, and encourages use of centralized design tokens and DLS components. The goal is uniform visual language, easier theme updates, and fewer UI regressions.
The skill scans Dart/Flutter source for banned patterns such as hex Color constructors, direct Colors.* enums, magic numeric spacing, inline TextStyle definitions, raw BorderRadius, and use of Material widgets when DLS widgets exist. When it detects violations it highlights the exact locations and suggests the corresponding token or DLS component (for example VColors.primary, VSpacing.x4, VTypography.body). It integrates as a rule set that can be used in CI checks or editor linting to block merges that violate the DLS.
What if a DLS token does not yet exist for a needed value?
Create a new token in the design token registry following naming conventions and add it to the shared tokens; then use that token rather than a hardcoded value.
Does this block non-UI code using Colors enums?
The rule focuses on UI code paths; utility or test code can be reviewed separately, but UI layers must use tokens to preserve design consistency.