flutter-init
Use when user wants to create a new Flutter project (Todo/Habit/Note/Expense/Custom domain) with Clean Architecture, Riverpod 3.0, Drift, and modern Flutter stack
$ Instalar
git clone https://github.com/bear2u/my-skills /tmp/my-skills && cp -r /tmp/my-skills/skills/flutter-init ~/.claude/skills/my-skills// tip: Run this command in your terminal to install the skill
name: flutter-init description: Use when user wants to create a new Flutter project (Todo/Habit/Note/Expense/Custom domain) with Clean Architecture, Riverpod 3.0, Drift, and modern Flutter stack
Flutter Init Skill
๋๋ฉ์ธ ๊ธฐ๋ฐ Flutter ํ๋ก์ ํธ๋ฅผ ์์ฑํ๊ณ ํ๋์ ์ธ ์ํคํ ์ฒ๋ก ์๋ ์ค์ ํฉ๋๋ค. Todo, Habit, Note, Expense ๋๋ Custom ๋๋ฉ์ธ์ ์ ํํ์ฌ Clean Architecture ๊ธฐ๋ฐ์ ์์ ํ CRUD ์ฑ์ ์ฆ์ ์์ฑํ ์ ์์ต๋๋ค.
Quick Start
์คํฌ ์คํ ์ ๋ค์ ์ ๋ณด๋ฅผ ์ ๋ ฅ๋ฐ์ต๋๋ค:
- ํด๋๋ช (์: my_habit_app)
- ํ๋ก์ ํธ๋ช /ํจํค์ง๋ช (์: habit_app)
- ๋๋ฉ์ธ ์ ํ (Todo/Habit/Note/Expense/Custom)
- ์คํ ํ๋ฆฌ์ (Minimal/Essential/Full Stack/Custom)
๊ทธ ํ ์๋์ผ๋ก ๋ค์ ๋จ๊ณ๊ฐ ์คํ๋ฉ๋๋ค:
# 1. ํ๋ก์ ํธ ์์ฑ (Android/Kotlin, iOS/Swift)
flutter create --platforms android,ios --android-language kotlin --org com.example [ํด๋๋ช
]
# 2. ํจํค์ง ์ค์น
flutter pub get
# 3. ๋๋ฉ์ธ๋ณ Clean Architecture ์ฝ๋ ์๋ ์์ฑ
# - domain/entities/[domain].dart (Freezed ์ํฐํฐ)
# - data/datasources/local/app_database.dart (Drift ํ
์ด๋ธ)
# - data/repositories/[domain]_repository_impl.dart (Repository ๊ตฌํ)
# - presentation/providers/[domain]_providers.dart (Riverpod 3.0)
# - presentation/screens/* (List/Detail/Form ํ๋ฉด)
# 4. ์ฝ๋ ์์ฑ (Freezed, Drift, JSON Serializable)
dart run build_runner build --delete-conflicting-outputs
# 5. ์ฝ๋ ๊ฒ์ฆ ๋ฐ ์ค๋ฅ ์๋ ์์ (ํ์)
flutter analyze
# 6. ์ฑ ์คํ
flutter run
Task Instructions
IMPORTANT: ์ด ์คํฌ์ ๋ํํ์ผ๋ก ์งํ๋ฉ๋๋ค.
Step 1: ๋๋ฉ์ธ ๋ฐ ํ๋ก์ ํธ ์ค์ ์ง๋ฌธ
๋จผ์ ์ฌ์ฉ์์๊ฒ ์ด๋ ๊ฒ ๋ฌผ์ด๋ณด์ธ์:
"Flutter ์ฑ์ ์์ฑํฉ๋๋ค. ๋ค์ ์ ๋ณด๋ฅผ ์๋ ค์ฃผ์ธ์:
1. ๋๋ฉ์ธ(์ํฐํฐ) ์ ํ
์ด๋ค ๋๋ฉ์ธ์ ์ฑ์ ๋ง๋์๊ฒ ์ต๋๊น?
A) Todo (ํ ์ผ ๊ด๋ฆฌ)
- ํ๋: title, description, isCompleted, createdAt, completedAt
- ๊ธฐ๋ฅ: CRUD, ํํฐ๋ง(์ ์ฒด/์งํ์ค/์๋ฃ), ์ฒดํฌ๋ฐ์ค ํ ๊ธ
B) Habit (์ต๊ด ํธ๋์ปค)
- ํ๋: name, description, frequency(daily/weekly/monthly), streak, lastCompletedAt, goal, isActive
- ๊ธฐ๋ฅ: CRUD, ์ฐ์ ๊ธฐ๋ก ์ถ์ , ๋ชฉํ ๋ฌ์ฑ๋ฅ , ์๋ฃ ์ฒดํฌ
C) Note (๋ฉ๋ชจ)
- ํ๋: title, content, tags, isPinned, createdAt, updatedAt
- ๊ธฐ๋ฅ: CRUD, ํ๊ทธ ํํฐ๋ง, ๊ณ ์ ๋ฉ๋ชจ, ๊ฒ์
D) Expense (์ง์ถ ๊ด๋ฆฌ)
- ํ๋: amount, category, description, date, paymentMethod
- ๊ธฐ๋ฅ: CRUD, ์นดํ ๊ณ ๋ฆฌ๋ณ ์ง๊ณ, ์๋ณ ํต๊ณ, ํํฐ๋ง
E) Custom (์ง์ ์ ์)
- ์ํฐํฐ๋ช ๊ณผ ํ๋๋ฅผ ์ง์ ์ ๋ ฅ
2. ํ๋ก์ ํธ ์ ๋ณด
- ํด๋๋ช
: ํ๋ก์ ํธ๋ฅผ ์์ฑํ ํด๋ ์ด๋ฆ (๊ธฐ๋ณธ๊ฐ: [๋๋ฉ์ธ]_app, ์: habit_app)
- ์ด ํด๋์ Flutter ํ๋ก์ ํธ๊ฐ ์์ฑ๋ฉ๋๋ค
- ํ๋ก์ ํธ๋ช
(ํจํค์ง๋ช
): Flutter ํจํค์ง ์ด๋ฆ (๊ธฐ๋ณธ๊ฐ: ํด๋๋ช
๊ณผ ๋์ผ)
- pubspec.yaml์ name ํ๋์ ์ฌ์ฉ๋ฉ๋๋ค
- import ๋ฌธ์ ์ฌ์ฉ๋ฉ๋๋ค (์: package:habit_app/...)
- ์กฐ์ง๋ช
: (๊ธฐ๋ณธ๊ฐ: com.example)
- Android/iOS ํจํค์ง ์๋ณ์์ ์ฌ์ฉ๋ฉ๋๋ค (์: com.example.habit_app)
3. ์คํ ํ๋ฆฌ์ ์ ํ
๋ค์ ์ค ํ๋๋ฅผ ์ ํํด์ฃผ์ธ์:
A) Essential (๊ถ์ฅ)
- โ GoRouter (ํ์ ์์ ํ ๋ผ์ฐํ )
- โ SharedPreferences (๋ก์ปฌ ์ค์ ์ ์ฅ)
- โ FPDart (ํจ์ํ ์๋ฌ ํธ๋ค๋ง)
- โ Google Fonts
- โ FluentUI Icons
- โ Auth ์์คํ ์ ์ธ
- โ Responsive Utils ์ ์ธ
B) Minimal (๊ฐ์ฅ ๋จ์)
- โ GoRouter (๊ธฐ๋ณธ Navigator ์ฌ์ฉ)
- โ SharedPreferences
- โ FPDart ์ ์ธ
- โ Google Fonts ์ ์ธ
- โ ๊ธฐ๋ณธ FluentUI Icons
- โ Auth ์์คํ ์ ์ธ
- โ Responsive Utils ์ ์ธ
C) Full Stack (๋ชจ๋ ๊ธฐ๋ฅ)
- โ GoRouter
- โ SharedPreferences
- โ FPDart (ํจ์ํ ์๋ฌ ํธ๋ค๋ง)
- โ Google Fonts
- โ Responsive Utils
- โ FluentUI Icons
- โ Auth ์์คํ (Login/Register) - ์ ํ ๋๋ฉ์ธ์ ๋ฐ๋ผ
D) Custom (์ง์ ์ ํ)
- ๊ฐ ๊ธฐ๋ฅ์ ๊ฐ๋ณ์ ์ผ๋ก ์ ํ
์ด๋ค ๋๋ฉ์ธ๊ณผ ํ๋ฆฌ์ ์ ์ ํํ์๊ฒ ์ต๋๊น? (๋๋ฉ์ธ: A/B/C/D/E, ํ๋ฆฌ์ : A/B/C/D)"
Step 2: Custom ์ ํ ์ ์ถ๊ฐ ์ง๋ฌธ
2-1. Custom ๋๋ฉ์ธ (E) ์ ํ ์:
- ์ํฐํฐ๋ช : ์ํฐํฐ ์ด๋ฆ์ ์ ๋ ฅํ์ธ์ (์: Task, Event, Book)
- ํ๋ ์ ์: ๊ฐ ํ๋๋ฅผ ์
๋ ฅํ์ธ์ (ํ์: ํ๋๋ช
:ํ์
, ์: title:String, amount:double, isActive:bool)
- ์ง์ ํ์ : String, int, double, bool, DateTime
- createdAt, updatedAt์ ์๋ ์ถ๊ฐ๋จ
- ์ฃผ์ ๊ธฐ๋ฅ: ํํฐ๋ง/์ ๋ ฌ ๊ธฐ์ค์ด ๋ ํ๋๋ฅผ ์ ํํ์ธ์
2-2. Custom ์คํ ํ๋ฆฌ์ (D) ์ ํ ์:
๋ค์ ์ง๋ฌธ๋ค์ ์์ฐจ์ ์ผ๋ก ํ์ธ์:
- ๋ค๋น๊ฒ์ด์ : GoRouter๋ฅผ ์ฌ์ฉํ์๊ฒ ์ต๋๊น? (์/์๋์ค)
- ์๋ฌ ํธ๋ค๋ง: FPDart๋ฅผ ์ฌ์ฉํ์๊ฒ ์ต๋๊น? (์/์๋์ค)
- UI: Google Fonts๋ฅผ ์ฌ์ฉํ์๊ฒ ์ต๋๊น? (์/์๋์ค)
- ๋ฐ์ํ: Responsive Utils๋ฅผ ํฌํจํ์๊ฒ ์ต๋๊น? (์/์๋์ค)
- ์ธ์ฆ ์์คํ : Auth ์์คํ ์ ํฌํจํ์๊ฒ ์ต๋๊น? (์/์๋์ค)
Step 3: ์ ํ๋ ๋๋ฉ์ธ๊ณผ ์คํ์ ๋ฐ๋ผ ํ๋ก์ ํธ ์์ฑ
-
Flutter ํ๋ก์ ํธ ์์ฑ:
- ์ฌ์ฉ์๊ฐ ์ง์ ํ ํด๋๋ช ์ผ๋ก ํ๋ก์ ํธ ์์ฑ
- ๋ช
๋ น์ด:
flutter create --platforms android,ios --android-language kotlin --org [์กฐ์ง๋ช ] [ํด๋๋ช ] - ์:
flutter create --platforms android,ios --android-language kotlin --org com.example my_habit_app - ํด๋๋ช
๊ณผ ํ๋ก์ ํธ๋ช
(ํจํค์ง๋ช
)์ด ๋ค๋ฅธ ๊ฒฝ์ฐ, ์์ฑ ํ pubspec.yaml์
nameํ๋๋ฅผ ์์
-
Kotlin DSL ํ์ธ (์ต์ Flutter๋ ์๋์ผ๋ก Kotlin DSL ์ฌ์ฉ)
-
์ ํ๋ ํจํค์ง ์ค์น:
pubspec.yaml์ ๋ฐ์ดํธ ํflutter pub get -
ํด๋ ๊ตฌ์กฐ ์์ฑ: Clean Architecture (core, data, domain, presentation)
-
๋๋ฉ์ธ๋ณ ๋ณด์ผ๋ฌํ๋ ์ดํธ ์์ฑ:
A) Todo: title, description, isCompleted, createdAt, completedAt
- Repository: getTodos, createTodo, updateTodo, toggleCompletion, deleteTodo
- Providers: filteredTodosProvider (all/pending/completed)
- UI: TodoListScreen (ํํฐ๋ง), TodoDetailScreen, TodoFormDialog
B) Habit: name, description, frequency, streak, lastCompletedAt, goal, isActive
- Repository: getHabits, createHabit, updateHabit, completeHabit, deleteHabit
- Providers: filteredHabitsProvider (active/inactive), habitStatsProvider
- UI: HabitListScreen (ํต๊ณ), HabitDetailScreen, HabitFormDialog
C) Note: title, content, tags, isPinned, createdAt, updatedAt
- Repository: getNotes, createNote, updateNote, togglePin, deleteNote
- Providers: filteredNotesProvider (pinned/all/byTag), searchProvider
- UI: NoteListScreen (๊ฒ์/ํ๊ทธ), NoteDetailScreen, NoteFormDialog
D) Expense: amount, category, description, date, paymentMethod
- Repository: getExpenses, createExpense, updateExpense, deleteExpense
- Providers: expensesByCategory, monthlyStats, filteredExpenses
- UI: ExpenseListScreen (ํต๊ณ), ExpenseDetailScreen, ExpenseFormDialog
E) Custom: ์ฌ์ฉ์ ์ ์ ํ๋
- Repository: ๊ธฐ๋ณธ CRUD ๋ฉ์๋
- Providers: ๊ธฐ๋ณธ list provider
- UI: ๊ธฐ๋ณธ List/Detail/Form ํ๋ฉด
-
์ค์ ํ์ผ ์์ฑ (๋ผ์ฐํ , ์คํ ๋ฆฌ์ง, ๋ค๊ตญ์ด ๋ฑ)
-
Android ์ค์ ์ ๋ฐ์ดํธ (CRITICAL for flutter_local_notifications):
android/app/build.gradle.kts์ core library desugaring ํ์ฑํ:android { compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 isCoreLibraryDesugaringEnabled = true // ์ถ๊ฐ } } dependencies { coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4") // ์ถ๊ฐ }
-
์ฝ๋ ์์ฑ:
dart run build_runner build --delete-conflicting-outputs -
์ฝ๋ ๊ฒ์ฆ ๋ฐ ์ค๋ฅ ์์ :
a.
flutter analyze์คํb. ๋ฐ๊ฒฌ๋ ์ค๋ฅ ์์ :
- Freezed 3.0 ํธํ์ฑ (CRITICAL): ๋ชจ๋ Freezed ์ํฐํฐ๋
sealed class์ฌ์ฉ- โ
class User with _$User - โ
sealed class User with _$User
- โ
- ํ
๋ง ์ค์ :
CardThemeโCardThemeData์ฌ์ฉ (deprecated) - API Client Map ํ์
:
Map<String, dynamic>๋ฐํ ์ ์์ฑ ์ฝ๋ ๊ฒ์ฆ- retrofit_generator๊ฐ ์์ฑํ
dynamic.fromJson์๋ฌ ๋ฐ์ ์ ์์ ํ์
- retrofit_generator๊ฐ ์์ฑํ
- import ๊ฒฝ๋ก ์์ : ๋ชจ๋ ์๋ ๊ฒฝ๋ก๋ฅผ
package:ํ์์ผ๋ก ๋ณ๊ฒฝ- ์:
import '../../domain/entities/todo.dart';โimport 'package:todo_app/domain/entities/todo.dart';
- ์:
- ํจํค์ง ์์กด์ฑ ํ์ธ: ๋๋ฝ๋ ํจํค์ง ์ถ๊ฐ (์:
shared_preferences) - Riverpod 3.0 ํธํ์ฑ:
StateNotifierโNotifier,StateProviderโNotifierProvider - FluentUI ์์ด์ฝ ์ด๋ฆ ํ์ธ: ์กด์ฌํ์ง ์๋ ์์ด์ฝ์ ๋์ฒด
- ํ์ ์์ ์ฑ: switch expression ์ฌ์ฉ, null safety ์ค์
c. ์ฌ๊ฒ์ฆ: ๋ชจ๋ error ๋ ๋ฒจ ์ค๋ฅ๊ฐ ์์ ๋๊น์ง ๋ฐ๋ณต
d. ๋ชฉํ:
flutter analyze๊ฒฐ๊ณผ๊ฐ "0-1 issues found" (info ๋ ๋ฒจ๋ง ํ์ฉ)โ CRITICAL: ์ด ๋จ๊ณ๋ ํ์์ ๋๋ค. ๋ชจ๋ error๋ฅผ ์ ๊ฑฐํด์ผ ๋ค์ ๋จ๊ณ๋ก ์งํํ ์ ์์ต๋๋ค.
- Freezed 3.0 ํธํ์ฑ (CRITICAL): ๋ชจ๋ Freezed ์ํฐํฐ๋
Step 4: ์ต์ข ๊ฒ์ฆ ๋ฐ ์๋ด
โ CRITICAL: ์ด ๋จ๊ณ๋ ํ๋ก์ ํธ ์๋ฃ์ ํ์ ์กฐ๊ฑด์ ๋๋ค.
-
์ต์ข ๋ถ์ ์คํ:
flutter analyze -
์ฑ๊ณต ๊ธฐ์ค:
-
โ ์ฑ๊ณต ์์:
Analyzing todo_app... No issues found!๋๋
Analyzing todo_app... 1 issue found. (ran in 2.3s) info โข Prefer using lowerCamelCase for constant names โข lib/core/constants.dart:5:7 โข constant_identifier_names -
โ ์คํจ ์์ (error๊ฐ ์์ผ๋ฉด ๋ฐ๋์ ์์ ):
error โข Target of URI doesn't exist: 'package:...' โข lib/main.dart:5:8 โข uri_does_not_exist error โข The getter 'xyz' isn't defined for the type 'ABC' โข lib/presentation/screens/home.dart:42:15
-
-
๊ฒ์ฆ ๊ฒฐ๊ณผ ์์ฝ (์ฑ๊ณต ์):
โ Flutter ํ๋ก์ ํธ ์์ฑ ์๋ฃ! โ ์ฝ๋ ์์ฑ ์๋ฃ (Freezed, Drift, JSON Serializable) โ Flutter analyze ํต๊ณผ (0-1 issues found, info ๋ ๋ฒจ๋ง) โ ๋ชจ๋ ํจํค์ง ์ค์น ์๋ฃ -
ํ๋ก์ ํธ ์ ๋ณด ์ ๊ณต:
- ํด๋๋ช : [์ฌ์ฉ์ ์ ๋ ฅ๊ฐ] (์: my_habit_app)
- ํ๋ก์ ํธ๋ช (ํจํค์ง๋ช ): [์ฌ์ฉ์ ์ ๋ ฅ๊ฐ] (์: habit_app)
- ์กฐ์ง๋ช : [์ฌ์ฉ์ ์ ๋ ฅ๊ฐ] (์: com.example)
- ๋๋ฉ์ธ: [์ ํ๋ ๋๋ฉ์ธ] (Todo/Habit/Note/Expense/Custom)
- ์ ํ๋ ์คํ: [ํ๋ฆฌ์ ๋ช ] (GoRouter, Drift, FPDart ๋ฑ)
- ์ฃผ์ ๊ธฐ๋ฅ: [๋๋ฉ์ธ] CRUD, ๋ค๊ตญ์ด ์ง์, ๋ก์ปฌ ์ ์ฅ์ ๋ฑ
- ์์ฑ๋ ํ์ผ: XX๊ฐ Dart ํ์ผ (core, data, domain, presentation)
-
์คํ ๋ฐฉ๋ฒ ์๋ด:
cd [ํด๋๋ช ] flutter run -
๋ค์ ๋จ๊ณ ์ ์ (์ ํ์ฌํญ, ๋๋ฉ์ธ๋ณ):
- Todo: ํญ๋ชฉ ์ถ๊ฐ/์์ /์ญ์ , ํํฐ๋ง(์ ์ฒด/์งํ์ค/์๋ฃ), ์๋ฃ ํ ๊ธ
- Habit: ์ต๊ด ๊ธฐ๋ก, ์ฐ์ ๊ธฐ๋ก ํ์ธ, ๋ชฉํ ๋ฌ์ฑ๋ฅ , ํต๊ณ ํ์ธ
- Note: ๋ฉ๋ชจ ์์ฑ/ํธ์ง, ํ๊ทธ ์ถ๊ฐ, ๊ณ ์ ๋ฉ๋ชจ, ๊ฒ์
- Expense: ์ง์ถ ๊ธฐ๋ก, ์นดํ ๊ณ ๋ฆฌ๋ณ ํต๊ณ, ์๋ณ ์ง๊ณ, ํํฐ๋ง
- ๊ณตํต: ์ธ์ด ์ ํ (์์ด โ ํ๊ตญ์ด), ๋คํฌ/๋ผ์ดํธ ํ ๋ง ์ ํ
Core Principles
- Repository ํจํด: ๋ฐ์ดํฐ ๋ ์ด์ด์ ๋๋ฉ์ธ ๋ ์ด์ด ๋ถ๋ฆฌ
- ์์กด์ฑ ์ฃผ์ : Riverpod 3.x๋ฅผ ํตํ ์์กด์ฑ ๊ด๋ฆฌ
- ๋ถ๋ณ์ฑ: Freezed๋ก ๋ถ๋ณ ๋ชจ๋ธ ์์ฑ
- ๋ค๊ตญ์ด ์ง์: Easy Localization์ผ๋ก i18n
- ๋ชจ๋ UI: FluentUI Icons ์ฌ์ฉ
Reference Files
references/setup-guide.md - ์์ ํ ๊ฐ์ด๋
- ๊ธฐ๋ณธ ์ ์ (๋๋ฉ์ธ๋ณ CRUD, ๋ค๊ตญ์ด, FluentUI Icons)
- ์ ํ ์ต์ : GoRouter, Auth, FPDart, Google Fonts, Responsive Utils, ํจํค์ง ์ ๋ฐ์ดํธ
Notes
- ๋ํํ ์คํฌ: ์ฌ์ฉ์์๊ฒ ๋๋ฉ์ธ๊ณผ ํ๋ฆฌ์ ์ ํ์ ํตํด ๋ง์ถคํ ์ฑ ๊ตฌ์ฑ
- ๋๋ฉ์ธ ์ง์: Todo, Habit, Note, Expense, Custom (์ฌ์ฉ์ ์ ์)
- ํ๋ฆฌ์ ์ ๊ณต: Full Stack, Essential, Minimal, Custom
- ์ ํ ๊ฐ๋ฅ ๊ธฐ๋ฅ: GoRouter, Auth, FPDart, Google Fonts, Responsive Utils
- ๊ธฐ๋ณธ ํฌํจ: Riverpod 3.x, Easy Localization, FluentUI Icons, Drift, Dio, SharedPreferences
- ๋ค๊ตญ์ด: ์์ด/ํ๊ตญ์ด (ํ์ฅ ๊ฐ๋ฅ)
- ํ๋ซํผ: Android/Kotlin, iOS/Swift (์น/์๋์ฐ/๋ฆฌ๋ ์ค ์ ์ธ)
- ํ์ง ๋ณด์ฆ:
- ๋ชจ๋ ํ๋ก์ ํธ๋
flutter analyzeํต๊ณผ ํ์ - package: imports ์คํ์ผ ์ค์
- ํ์ ์์ ์ฑ ๋ณด์ฅ
- ์ฝ๋ ์์ฑ ์๋ํ
- ๋๋ฉ์ธ๋ณ ์ต์ ํ๋ UI/UX
- ๋ชจ๋ ํ๋ก์ ํธ๋
