Core - Infrastructure Generation
Generates the core infrastructure that all features depend on.
When to Use This Skill
- After
/init completes
- Before adding any features or
/auth
- Setting up app-wide infrastructure
- User asks to "generate core", "create infrastructure", or "setup theme/router"
What This Skill Creates
lib/app.dart - Root app widget with MaterialApp.router
lib/core/theme/ - AppColors, AppTypography, AppTheme
lib/core/router/ - GoRouter configuration
lib/core/services/ - SecureStorage, SharedPrefs, Supabase, iOS network permission
lib/core/errors/ - Typed failures and exceptions
lib/core/constants/ - App constants, legal URLs, storage keys, debug flags
lib/core/network/ - Dio client (if custom API)
lib/core/navigation/ - StatefulShellRoute (if bottom nav)
lib/core/providers.dart - Core Riverpod providers
Workflow
Phase 1: Gather Requirements
Use AskUserQuestion to confirm settings from /init:
- Primary Color (hex, from /init or ask)
- Theme Mode (light/dark/both)
- Use Supabase? (from /init)
- Use Custom API? (from /init)
- Bottom Navigation? (yes/no - determines shell creation)
- Privacy Policy URL? (can be placeholder, required before release)
- Terms of Service URL? (can be placeholder, required before release)
Phase 2: Create Directory Structure
mkdir -p lib/core/{constants,errors,network,router,navigation,services,theme,utils,widgets}
mkdir -p lib/features
Phase 3: Generate Files
Copy from reference/ directories and customize:
| Category |
Files |
Notes |
theme/ |
app_colors, app_typography, app_theme |
Customize primary color |
services/ |
secure_storage, shared_prefs, ios_network_permission |
Always |
services/ |
supabase_service |
If Supabase = yes |
network/ |
dio_client |
If Custom API = yes |
router/ |
app_router |
Customize routes |
navigation/ |
main_shell |
If bottom nav = yes |
errors/ |
failures, exceptions |
Always |
constants/ |
app_constants, legal_constants, storage_keys, debug_constants |
Always |
utils/ |
legal_utils |
Always |
| root |
providers.dart |
Customize based on services |
Note: ios_network_permission_service.dart triggers the iOS permission dialog early to prevent first API call failures.
Phase 10: Generate App Widget
Copy reference/app.dart and customize with theme/router.
Phase 11: Update main.dart
Replace placeholder with actual App():
import 'app.dart';
runApp(const ProviderScope(child: App()));
Phase 12: Verify
dart run build_runner build --delete-conflicting-outputs
flutter analyze
Reference Files
| Directory |
Content |
reference/theme/ |
AppColors, AppTypography, AppTheme |
reference/router/ |
GoRouter setup |
reference/navigation/ |
StatefulShellRoute scaffold |
reference/services/ |
Storage, Supabase, iOS permission services |
reference/network/ |
Dio client with interceptors |
reference/errors/ |
Failure types, exceptions |
reference/constants/ |
App constants, legal URLs, storage keys, debug flags |
reference/utils/ |
Legal URL utilities |
reference/ |
app.dart, providers.dart |
Guides
This skill is code-heavy with all templates in reference/. No separate guides needed.
Related guidance from other skills:
| Topic |
See |
| Architecture patterns |
.claude/skills/plan/architecture.md |
| Color usage (contrast, dark mode) |
/design → visual-guide.md |
| Typography sizes & hierarchy |
/design → visual-guide.md |
| Color contrast requirements |
/a11y → semantics-guide.md |
| Text scaling accessibility |
/a11y → testing-guide.md |
Quick Reference
AppColors.primary; AppTheme.light(); // Theme
context.go('/dashboard'); context.push('/profile'); // Router
ref.watch(secureStorageProvider).write('key', 'value'); // Secure storage
ref.watch(sharedPrefsProvider).setBool('onboarded', true); // Shared prefs
triggerIOSNetworkPermission(); // iOS permission (call in main.dart)
Next Steps
After /core:
/auth - Add authentication feature
/feature-init dashboard - Initialize dashboard scaffold
/i18n - Add localization
Checklist
Related Skills
/init - Run before core (project setup)
/auth - Run after core (authentication)
/feature-init - Initialize feature scaffolds after core
/design - UI patterns reference
1---2name: core3description: Generate core infrastructure for Flutter apps. Creates theme system (AppColors, AppTheme), router (GoRouter), services (SecureStorage, SharedPrefs, Supabase), error handling (Failures), and providers. Run after /init, before /auth.4---56# Core - Infrastructure Generation78Generates the core infrastructure that all features depend on.910## When to Use This Skill1112- After `/init` completes13- Before adding any features or `/auth`14- Setting up app-wide infrastructure15- User asks to "generate core", "create infrastructure", or "setup theme/router"1617## What This Skill Creates1819- `lib/app.dart` - Root app widget with MaterialApp.router20- `lib/core/theme/` - AppColors, AppTypography, AppTheme21- `lib/core/router/` - GoRouter configuration22- `lib/core/services/` - SecureStorage, SharedPrefs, Supabase, iOS network permission23- `lib/core/errors/` - Typed failures and exceptions24- `lib/core/constants/` - App constants, legal URLs, storage keys, debug flags25- `lib/core/network/` - Dio client (if custom API)26- `lib/core/navigation/` - StatefulShellRoute (if bottom nav)27- `lib/core/providers.dart` - Core Riverpod providers2829## Workflow3031### Phase 1: Gather Requirements3233Use AskUserQuestion to confirm settings from `/init`:34351. **Primary Color** (hex, from /init or ask)362. **Theme Mode** (light/dark/both)373. **Use Supabase?** (from /init)384. **Use Custom API?** (from /init)395. **Bottom Navigation?** (yes/no - determines shell creation)406. **Privacy Policy URL?** (can be placeholder, required before release)417. **Terms of Service URL?** (can be placeholder, required before release)4243### Phase 2: Create Directory Structure4445```bash46mkdir -p lib/core/{constants,errors,network,router,navigation,services,theme,utils,widgets}47mkdir -p lib/features48```4950### Phase 3: Generate Files5152Copy from `reference/` directories and customize:5354| Category | Files | Notes |55|----------|-------|-------|56| `theme/` | app_colors, app_typography, app_theme | Customize primary color |57| `services/` | secure_storage, shared_prefs, ios_network_permission | Always |58| `services/` | supabase_service | If Supabase = yes |59| `network/` | dio_client | If Custom API = yes |60| `router/` | app_router | Customize routes |61| `navigation/` | main_shell | If bottom nav = yes |62| `errors/` | failures, exceptions | Always |63| `constants/` | app_constants, legal_constants, storage_keys, debug_constants | Always |64| `utils/` | legal_utils | Always |65| root | providers.dart | Customize based on services |6667**Note:** `ios_network_permission_service.dart` triggers the iOS permission dialog early to prevent first API call failures.6869### Phase 10: Generate App Widget7071Copy `reference/app.dart` and customize with theme/router.7273### Phase 11: Update main.dart7475Replace placeholder with actual App():7677```dart78import 'app.dart';7980runApp(const ProviderScope(child: App()));81```8283### Phase 12: Verify8485```bash86dart run build_runner build --delete-conflicting-outputs87flutter analyze88```8990## Reference Files9192| Directory | Content |93|-----------|---------|94| `reference/theme/` | AppColors, AppTypography, AppTheme |95| `reference/router/` | GoRouter setup |96| `reference/navigation/` | StatefulShellRoute scaffold |97| `reference/services/` | Storage, Supabase, iOS permission services |98| `reference/network/` | Dio client with interceptors |99| `reference/errors/` | Failure types, exceptions |100| `reference/constants/` | App constants, legal URLs, storage keys, debug flags |101| `reference/utils/` | Legal URL utilities |102| `reference/` | app.dart, providers.dart |103104## Guides105106This skill is code-heavy with all templates in `reference/`. No separate guides needed.107108**Related guidance from other skills:**109110| Topic | See |111|-------|-----|112| Architecture patterns | `.claude/skills/plan/architecture.md` |113| Color usage (contrast, dark mode) | `/design` → `visual-guide.md` |114| Typography sizes & hierarchy | `/design` → `visual-guide.md` |115| Color contrast requirements | `/a11y` → `semantics-guide.md` |116| Text scaling accessibility | `/a11y` → `testing-guide.md` |117118## Quick Reference119120```dart121AppColors.primary; AppTheme.light(); // Theme122context.go('/dashboard'); context.push('/profile'); // Router123ref.watch(secureStorageProvider).write('key', 'value'); // Secure storage124ref.watch(sharedPrefsProvider).setBool('onboarded', true); // Shared prefs125triggerIOSNetworkPermission(); // iOS permission (call in main.dart)126```127128## Next Steps129130After `/core`:1311321. `/auth` - Add authentication feature1332. `/feature-init dashboard` - Initialize dashboard scaffold1343. `/i18n` - Add localization135136## Checklist137138- [ ] `lib/app.dart` created with MaterialApp.router139- [ ] `lib/core/theme/` has AppColors, AppTypography, AppTheme140- [ ] `lib/core/router/app_router.dart` configured141- [ ] `lib/core/services/` has required services142- [ ] `lib/core/services/ios_network_permission_service.dart` created143- [ ] `lib/core/errors/failures.dart` has typed failures144- [ ] `lib/core/constants/` has storage keys, legal URLs, and debug flags145- [ ] `lib/core/utils/legal_utils.dart` created146- [ ] `lib/core/providers.dart` exports all providers147- [ ] `main.dart` updated to use App()148- [ ] `main.dart` calls `triggerIOSNetworkPermission()` early149- [ ] `build_runner` executed successfully150- [ ] `flutter analyze` passes151152## Related Skills153154- `/init` - Run before core (project setup)155- `/auth` - Run after core (authentication)156- `/feature-init` - Initialize feature scaffolds after core157- `/design` - UI patterns reference