| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 11 | 14 | 0% |
| Commands | 0 | 1 | 0 | 0% |
| Section tags | 1 | 0 | 7 | 13% |
What each file covers
Sections
0 shared · 11 only in A · 14 only in B- − Dart/Flutter Patterns
- − Repository Pattern
- − State Management: BLoC/Cubit
- − State Management: Riverpod
- − Dependency Injection
- − ViewModel Pattern (without BLoC/Riverpod)
- − UseCase Pattern
- − Immutable State with freezed
- − Clean Architecture Layer Boundaries
- − Navigation (GoRouter)
- − References
- + Everything Claude Code (ECC) — Agent Instructions
- + Core Principles
- + Available Agents
- + Agent Orchestration
- + Security Guidelines
- + Coding Style
- + Testing Requirements
- + Development Workflow
- + Workflow Surface Policy
- + Git Workflow
- + Architecture Patterns
- + Performance
- + Project Structure
- + Success Metrics
Commands
0 shared · 1 only in A · 0 only in B- − flutter-dart-code-review
Section tags
1 shared · 0 only in A · 7 only in B- + build
- + test
- + architecture
- + git-pr
- + security
- + performance
- + agent-behaviour
- code-style
Line diff
ThanhTrunggDEV/DontBeLazy · .cursor/rules/dart-patterns.mdc
@@ −1 @@
1---
2paths:
3 - "**/*.dart"
4 - "**/pubspec.yaml"
5---
6# Dart/Flutter Patterns
7
8> This file extends [common/patterns.md](../common/patterns.md) with Dart, Flutter, and common ecosystem-specific content.
9
10## Repository Pattern
11
12```dart
13abstract interface class UserRepository {
14 Future<User?> getById(String id);
15 Future<List<User>> getAll();
16 Stream<List<User>> watchAll();
17 Future<void> save(User user);
18 Future<void> delete(String id);
19}
20
21class UserRepositoryImpl implements UserRepository {
22 const UserRepositoryImpl(this._remote, this._local);
23
24 final UserRemoteDataSource _remote;
25 final UserLocalDataSource _local;
26
27 @override
28 Future<User?> getById(String id) async {
29 final local = await _local.getById(id);
30 if (local != null) return local;
31 final remote = await _remote.getById(id);
32 if (remote != null) await _local.save(remote);
33 return remote;
34 }
35
36 @override
37 Future<List<User>> getAll() async {
38 final remote = await _remote.getAll();
39 for (final user in remote) {
40 await _local.save(user);
41 }
42 return remote;
43 }
44
45 @override
46 Stream<List<User>> watchAll() => _local.watchAll();
47
48 @override
49 Future<void> save(User user) => _local.save(user);
50
51 @override
52 Future<void> delete(String id) async {
53 await _remote.delete(id);
54 await _local.delete(id);
55 }
56}
57```
58
59## State Management: BLoC/Cubit
60
61```dart
62// Cubit — simple state transitions
63class CounterCubit extends Cubit<int> {
64 CounterCubit() : super(0);
65
66 void increment() => emit(state + 1);
67 void decrement() => emit(state - 1);
68}
69
70// BLoC — event-driven
71@immutable
72sealed class CartEvent {}
73class CartItemAdded extends CartEvent { CartItemAdded(this.item); final Item item; }
74class CartItemRemoved extends CartEvent { CartItemRemoved(this.id); final String id; }
75class CartCleared extends CartEvent {}
76
77@immutable
78class CartState {
79 const CartState({this.items = const []});
80 final List<Item> items;
81 CartState copyWith({List<Item>? items}) => CartState(items: items ?? this.items);
82}
83
84class CartBloc extends Bloc<CartEvent, CartState> {
85 CartBloc() : super(const CartState()) {
86 on<CartItemAdded>((event, emit) =>
87 emit(state.copyWith(items: [...state.items, event.item])));
88 on<CartItemRemoved>((event, emit) =>
89 emit(state.copyWith(items: state.items.where((i) => i.id != event.id).toList())));
90 on<CartCleared>((_, emit) => emit(const CartState()));
91 }
92}
93```
94
95## State Management: Riverpod
96
97```dart
98// Simple provider
99@riverpod
100Future<List<User>> users(Ref ref) async {
101 final repo = ref.watch(userRepositoryProvider);
102 return repo.getAll();
103}
104
105// Notifier for mutable state
106@riverpod
107class CartNotifier extends _$CartNotifier {
108 @override
109 List<Item> build() => [];
110
111 void add(Item item) => state = [...state, item];
112 void remove(String id) => state = state.where((i) => i.id != id).toList();
113 void clear() => state = [];
114}
115
116// ConsumerWidget
117class CartPage extends ConsumerWidget {
118 const CartPage({super.key});
119
120 @override
121 Widget build(BuildContext context, WidgetRef ref) {
122 final items = ref.watch(cartNotifierProvider);
123 return ListView(
124 children: items.map((item) => CartItemTile(item: item)).toList(),
125 );
126 }
127}
128```
129
130## Dependency Injection
131
132Constructor injection is preferred. Use `get_it` or Riverpod providers at composition root:
133
134```dart
135// get_it registration (in a setup file)
136void setupDependencies() {
137 final di = GetIt.instance;
138 di.registerSingleton<ApiClient>(ApiClient(baseUrl: Env.apiUrl));
139 di.registerSingleton<UserRepository>(
140 UserRepositoryImpl(di<ApiClient>(), di<LocalDatabase>()),
141 );
142 di.registerFactory(() => UserListViewModel(di<UserRepository>()));
143}
144```
145
146## ViewModel Pattern (without BLoC/Riverpod)
147
148```dart
149class UserListViewModel extends ChangeNotifier {
150 UserListViewModel(this._repository);
151
152 final UserRepository _repository;
153
154 AsyncState<List<User>> _state = const Loading();
155 AsyncState<List<User>> get state => _state;
156
157 Future<void> load() async {
158 _state = const Loading();
159 notifyListeners();
160 try {
161 final users = await _repository.getAll();
162 _state = Success(users);
163 } on Exception catch (e) {
164 _state = Failure(e);
165 }
166 notifyListeners();
167 }
168}
169```
170
171## UseCase Pattern
172
173```dart
174class GetUserUseCase {
175 const GetUserUseCase(this._repository);
176 final UserRepository _repository;
177
178 Future<User?> call(String id) => _repository.getById(id);
179}
180
181class CreateUserUseCase {
182 const CreateUserUseCase(this._repository, this._idGenerator);
183 final UserRepository _repository;
184 final IdGenerator _idGenerator; // injected — domain layer must not depend on uuid package directly
185
186 Future<void> call(CreateUserInput input) async {
187 // Validate, apply business rules, then persist
188 final user = User(id: _idGenerator.generate(), name: input.name, email: input.email);
189 await _repository.save(user);
190 }
191}
192```
193
194## Immutable State with freezed
195
196```dart
197@freezed
198class UserState with _$UserState {
199 const factory UserState({
200 @Default([]) List<User> users,
201 @Default(false) bool isLoading,
202 String? errorMessage,
203 }) = _UserState;
204}
205```
206
207## Clean Architecture Layer Boundaries
208
209```
210lib/
211├── domain/ # Pure Dart — no Flutter, no external packages
212│ ├── entities/
213│ ├── repositories/ # Abstract interfaces
214│ └── usecases/
215├── data/ # Implements domain interfaces
216│ ├── datasources/
217│ ├── models/ # DTOs with fromJson/toJson
218│ └── repositories/
219└── presentation/ # Flutter widgets + state management
220 ├── pages/
221 ├── widgets/
222 └── providers/ (or blocs/ or viewmodels/)
223```
224
225- Domain must not import `package:flutter` or any data-layer package
226- Data layer maps DTOs to domain entities at repository boundaries
227- Presentation calls use cases, not repositories directly
228
229## Navigation (GoRouter)
230
231```dart
232final router = GoRouter(
233 routes: [
234 GoRoute(
235 path: '/',
236 builder: (context, state) => const HomePage(),
237 ),
238 GoRoute(
239 path: '/users/:id',
240 builder: (context, state) {
241 final id = state.pathParameters['id']!;
242 return UserDetailPage(userId: id);
243 },
244 ),
245 ],
246 // refreshListenable re-evaluates redirect whenever auth state changes
247 refreshListenable: GoRouterRefreshStream(authCubit.stream),
248 redirect: (context, state) {
249 final isLoggedIn = context.read<AuthCubit>().state is AuthAuthenticated;
250 if (!isLoggedIn && !state.matchedLocation.startsWith('/login')) {
251 return '/login';
252 }
253 return null;
254 },
255);
256```
257
258## References
259
260See skill: `flutter-dart-code-review` for the comprehensive review checklist.
261See skill: `compose-multiplatform-patterns` for Kotlin Multiplatform/Flutter interop patterns.
262
ThanhTrunggDEV/DontBeLazy · .agent/AGENTS.md
@@ +1 @@
1# Everything Claude Code (ECC) — Agent Instructions
2
3This is a **production-ready AI coding plugin** providing 48 specialized agents, 183 skills, 79 commands, and automated hook workflows for software development.
4
5**Version:** 1.10.0
6
7## Core Principles
8
91. **Agent-First** — Delegate to specialized agents for domain tasks
102. **Test-Driven** — Write tests before implementation, 80%+ coverage required
113. **Security-First** — Never compromise on security; validate all inputs
124. **Immutability** — Always create new objects, never mutate existing ones
135. **Plan Before Execute** — Plan complex features before writing code
14
15## Available Agents
16
17| Agent | Purpose | When to Use |
18|-------|---------|-------------|
19| planner | Implementation planning | Complex features, refactoring |
20| architect | System design and scalability | Architectural decisions |
21| tdd-guide | Test-driven development | New features, bug fixes |
22| code-reviewer | Code quality and maintainability | After writing/modifying code |
23| security-reviewer | Vulnerability detection | Before commits, sensitive code |
24| build-error-resolver | Fix build/type errors | When build fails |
25| e2e-runner | End-to-end Playwright testing | Critical user flows |
26| refactor-cleaner | Dead code cleanup | Code maintenance |
27| doc-updater | Documentation and codemaps | Updating docs |
28| cpp-reviewer | C/C++ code review | C and C++ projects |
29| cpp-build-resolver | C/C++ build errors | C and C++ build failures |
30| docs-lookup | Documentation lookup via Context7 | API/docs questions |
31| go-reviewer | Go code review | Go projects |
32| go-build-resolver | Go build errors | Go build failures |
33| kotlin-reviewer | Kotlin code review | Kotlin/Android/KMP projects |
34| kotlin-build-resolver | Kotlin/Gradle build errors | Kotlin build failures |
35| database-reviewer | PostgreSQL/Supabase specialist | Schema design, query optimization |
36| python-reviewer | Python code review | Python projects |
37| java-reviewer | Java and Spring Boot code review | Java/Spring Boot projects |
38| java-build-resolver | Java/Maven/Gradle build errors | Java build failures |
39| loop-operator | Autonomous loop execution | Run loops safely, monitor stalls, intervene |
40| harness-optimizer | Harness config tuning | Reliability, cost, throughput |
41| rust-reviewer | Rust code review | Rust projects |
42| rust-build-resolver | Rust build errors | Rust build failures |
43| pytorch-build-resolver | PyTorch runtime/CUDA/training errors | PyTorch build/training failures |
44| typescript-reviewer | TypeScript/JavaScript code review | TypeScript/JavaScript projects |
45
46## Agent Orchestration
47
48Use agents proactively without user prompt:
49- Complex feature requests → **planner**
50- Code just written/modified → **code-reviewer**
51- Bug fix or new feature → **tdd-guide**
52- Architectural decision → **architect**
53- Security-sensitive code → **security-reviewer**
54- Autonomous loops / loop monitoring → **loop-operator**
55- Harness config reliability and cost → **harness-optimizer**
56
57Use parallel execution for independent operations — launch multiple agents simultaneously.
58
59## Security Guidelines
60
61**Before ANY commit:**
62- No hardcoded secrets (API keys, passwords, tokens)
63- All user inputs validated
64- SQL injection prevention (parameterized queries)
65- XSS prevention (sanitized HTML)
66- CSRF protection enabled
67- Authentication/authorization verified
68- Rate limiting on all endpoints
69- Error messages don't leak sensitive data
70
71**Secret management:** NEVER hardcode secrets. Use environment variables or a secret manager. Validate required secrets at startup. Rotate any exposed secrets immediately.
72
73**If security issue found:** STOP → use security-reviewer agent → fix CRITICAL issues → rotate exposed secrets → review codebase for similar issues.
74
75## Coding Style
76
77**Immutability (CRITICAL):** Always create new objects, never mutate. Return new copies with changes applied.
78
79**File organization:** Many small files over few large ones. 200-400 lines typical, 800 max. Organize by feature/domain, not by type. High cohesion, low coupling.
80
81**Error handling:** Handle errors at every level. Provide user-friendly messages in UI code. Log detailed context server-side. Never silently swallow errors.
82
83**Input validation:** Validate all user input at system boundaries. Use schema-based validation. Fail fast with clear messages. Never trust external data.
84
85**Code quality checklist:**
86- Functions small (<50 lines), files focused (<800 lines)
87- No deep nesting (>4 levels)
88- Proper error handling, no hardcoded values
89- Readable, well-named identifiers
90
91## Testing Requirements
92
93**Minimum coverage: 80%**
94
95Test types (all required):
961. **Unit tests** — Individual functions, utilities, components
972. **Integration tests** — API endpoints, database operations
983. **E2E tests** — Critical user flows
99
100**TDD workflow (mandatory):**
1011. Write test first (RED) — test should FAIL
1022. Write minimal implementation (GREEN) — test should PASS
1033. Refactor (IMPROVE) — verify coverage 80%+
104
105Troubleshoot failures: check test isolation → verify mocks → fix implementation (not tests, unless tests are wrong).
106
107## Development Workflow
108
1091. **Plan** — Use planner agent, identify dependencies and risks, break into phases
1102. **TDD** — Use tdd-guide agent, write tests first, implement, refactor
1113. **Review** — Use code-reviewer agent immediately, address CRITICAL/HIGH issues
1124. **Capture knowledge in the right place**
113 - Personal debugging notes, preferences, and temporary context → auto memory
114 - Team/project knowledge (architecture decisions, API changes, runbooks) → the project's existing docs structure
115 - If the current task already produces the relevant docs or code comments, do not duplicate the same information elsewhere
116 - If there is no obvious project doc location, ask before creating a new top-level file
1175. **Commit** — Conventional commits format, comprehensive PR summaries
118
119## Workflow Surface Policy
120
121- `skills/` is the canonical workflow surface.
122- New workflow contributions should land in `skills/` first.
123- `commands/` is a legacy slash-entry compatibility surface and should only be added or updated when a shim is still required for migration or cross-harness parity.
124
125## Git Workflow
126
127**Commit format:** `<type>: <description>` — Types: feat, fix, refactor, docs, test, chore, perf, ci
128
129**PR workflow:** Analyze full commit history → draft comprehensive summary → include test plan → push with `-u` flag.
130
131## Architecture Patterns
132
133**API response format:** Consistent envelope with success indicator, data payload, error message, and pagination metadata.
134
135**Repository pattern:** Encapsulate data access behind standard interface (findAll, findById, create, update, delete). Business logic depends on abstract interface, not storage mechanism.
136
137**Skeleton projects:** Search for battle-tested templates, evaluate with parallel agents (security, extensibility, relevance), clone best match, iterate within proven structure.
138
139## Performance
140
141**Context management:** Avoid last 20% of context window for large refactoring and multi-file features. Lower-sensitivity tasks (single edits, docs, simple fixes) tolerate higher utilization.
142
143**Build troubleshooting:** Use build-error-resolver agent → analyze errors → fix incrementally → verify after each fix.
144
145## Project Structure
146
147```
148agents/ — 48 specialized subagents
149skills/ — 183 workflow skills and domain knowledge
150commands/ — 79 slash commands
151hooks/ — Trigger-based automations
152rules/ — Always-follow guidelines (common + per-language)
153scripts/ — Cross-platform Node.js utilities
154mcp-configs/ — 14 MCP server configurations
155tests/ — Test suite
156```
157
158`commands/` remains in the repo for compatibility, but the long-term direction is skills-first.
159
160## Success Metrics
161
162- All tests pass with 80%+ coverage
163- No security vulnerabilities
164- Code is readable and maintainable
165- Performance is acceptable
166- User requirements are met
167
@@ −1 +1 @@
1−---
2−paths:
3− - "**/*.dart"
4− - "**/pubspec.yaml"
5−---
6−# Dart/Flutter Patterns
1+# Everything Claude Code (ECC) — Agent Instructions
72
8−> This file extends [common/patterns.md](../common/patterns.md) with Dart, Flutter, and common ecosystem-specific content.
3+This is a **production-ready AI coding plugin** providing 48 specialized agents, 183 skills, 79 commands, and automated hook workflows for software development.
94
10−## Repository Pattern
5+**Version:** 1.10.0
116
12−```dart
13−abstract interface class UserRepository {
14− Future<User?> getById(String id);
15− Future<List<User>> getAll();
16− Stream<List<User>> watchAll();
17− Future<void> save(User user);
18− Future<void> delete(String id);
19−}
7+## Core Principles
208
21−class UserRepositoryImpl implements UserRepository {
22− const UserRepositoryImpl(this._remote, this._local);
9+1. **Agent-First** — Delegate to specialized agents for domain tasks
10+2. **Test-Driven** — Write tests before implementation, 80%+ coverage required
11+3. **Security-First** — Never compromise on security; validate all inputs
12+4. **Immutability** — Always create new objects, never mutate existing ones
13+5. **Plan Before Execute** — Plan complex features before writing code
2314
24− final UserRemoteDataSource _remote;
25− final UserLocalDataSource _local;
15+## Available Agents
2616
27− @override
28− Future<User?> getById(String id) async {
29− final local = await _local.getById(id);
30− if (local != null) return local;
31− final remote = await _remote.getById(id);
32− if (remote != null) await _local.save(remote);
33− return remote;
34− }
17+| Agent | Purpose | When to Use |
18+|-------|---------|-------------|
19+| planner | Implementation planning | Complex features, refactoring |
20+| architect | System design and scalability | Architectural decisions |
21+| tdd-guide | Test-driven development | New features, bug fixes |
22+| code-reviewer | Code quality and maintainability | After writing/modifying code |
23+| security-reviewer | Vulnerability detection | Before commits, sensitive code |
24+| build-error-resolver | Fix build/type errors | When build fails |
25+| e2e-runner | End-to-end Playwright testing | Critical user flows |
26+| refactor-cleaner | Dead code cleanup | Code maintenance |
27+| doc-updater | Documentation and codemaps | Updating docs |
28+| cpp-reviewer | C/C++ code review | C and C++ projects |
29+| cpp-build-resolver | C/C++ build errors | C and C++ build failures |
30+| docs-lookup | Documentation lookup via Context7 | API/docs questions |
31+| go-reviewer | Go code review | Go projects |
32+| go-build-resolver | Go build errors | Go build failures |
33+| kotlin-reviewer | Kotlin code review | Kotlin/Android/KMP projects |
34+| kotlin-build-resolver | Kotlin/Gradle build errors | Kotlin build failures |
35+| database-reviewer | PostgreSQL/Supabase specialist | Schema design, query optimization |
36+| python-reviewer | Python code review | Python projects |
37+| java-reviewer | Java and Spring Boot code review | Java/Spring Boot projects |
38+| java-build-resolver | Java/Maven/Gradle build errors | Java build failures |
39+| loop-operator | Autonomous loop execution | Run loops safely, monitor stalls, intervene |
40+| harness-optimizer | Harness config tuning | Reliability, cost, throughput |
41+| rust-reviewer | Rust code review | Rust projects |
42+| rust-build-resolver | Rust build errors | Rust build failures |
43+| pytorch-build-resolver | PyTorch runtime/CUDA/training errors | PyTorch build/training failures |
44+| typescript-reviewer | TypeScript/JavaScript code review | TypeScript/JavaScript projects |
3545
36− @override
37− Future<List<User>> getAll() async {
38− final remote = await _remote.getAll();
39− for (final user in remote) {
40− await _local.save(user);
41− }
42− return remote;
43− }
46+## Agent Orchestration
4447
45− @override
46− Stream<List<User>> watchAll() => _local.watchAll();
48+Use agents proactively without user prompt:
49+- Complex feature requests → **planner**
50+- Code just written/modified → **code-reviewer**
51+- Bug fix or new feature → **tdd-guide**
52+- Architectural decision → **architect**
53+- Security-sensitive code → **security-reviewer**
54+- Autonomous loops / loop monitoring → **loop-operator**
55+- Harness config reliability and cost → **harness-optimizer**
4756
48− @override
49− Future<void> save(User user) => _local.save(user);
57+Use parallel execution for independent operations — launch multiple agents simultaneously.
5058
51− @override
52− Future<void> delete(String id) async {
53− await _remote.delete(id);
54− await _local.delete(id);
55− }
56−}
57−```
59+## Security Guidelines
5860
59−## State Management: BLoC/Cubit
61+**Before ANY commit:**
62+- No hardcoded secrets (API keys, passwords, tokens)
63+- All user inputs validated
64+- SQL injection prevention (parameterized queries)
65+- XSS prevention (sanitized HTML)
66+- CSRF protection enabled
67+- Authentication/authorization verified
68+- Rate limiting on all endpoints
69+- Error messages don't leak sensitive data
6070
61−```dart
62−// Cubit — simple state transitions
63−class CounterCubit extends Cubit<int> {
64− CounterCubit() : super(0);
71+**Secret management:** NEVER hardcode secrets. Use environment variables or a secret manager. Validate required secrets at startup. Rotate any exposed secrets immediately.
6572
66− void increment() => emit(state + 1);
67− void decrement() => emit(state - 1);
68−}
73+**If security issue found:** STOP → use security-reviewer agent → fix CRITICAL issues → rotate exposed secrets → review codebase for similar issues.
6974
70−// BLoC — event-driven
71−@immutable
72−sealed class CartEvent {}
73−class CartItemAdded extends CartEvent { CartItemAdded(this.item); final Item item; }
74−class CartItemRemoved extends CartEvent { CartItemRemoved(this.id); final String id; }
75−class CartCleared extends CartEvent {}
75+## Coding Style
7676
77−@immutable
78−class CartState {
79− const CartState({this.items = const []});
80− final List<Item> items;
81− CartState copyWith({List<Item>? items}) => CartState(items: items ?? this.items);
82−}
77+**Immutability (CRITICAL):** Always create new objects, never mutate. Return new copies with changes applied.
8378
84−class CartBloc extends Bloc<CartEvent, CartState> {
85− CartBloc() : super(const CartState()) {
86− on<CartItemAdded>((event, emit) =>
87− emit(state.copyWith(items: [...state.items, event.item])));
88− on<CartItemRemoved>((event, emit) =>
89− emit(state.copyWith(items: state.items.where((i) => i.id != event.id).toList())));
90− on<CartCleared>((_, emit) => emit(const CartState()));
91− }
92−}
93−```
79+**File organization:** Many small files over few large ones. 200-400 lines typical, 800 max. Organize by feature/domain, not by type. High cohesion, low coupling.
9480
95−## State Management: Riverpod
81+**Error handling:** Handle errors at every level. Provide user-friendly messages in UI code. Log detailed context server-side. Never silently swallow errors.
9682
97−```dart
98−// Simple provider
99−@riverpod
100−Future<List<User>> users(Ref ref) async {
101− final repo = ref.watch(userRepositoryProvider);
102− return repo.getAll();
103−}
83+**Input validation:** Validate all user input at system boundaries. Use schema-based validation. Fail fast with clear messages. Never trust external data.
10484
105−// Notifier for mutable state
106−@riverpod
107−class CartNotifier extends _$CartNotifier {
108− @override
109− List<Item> build() => [];
85+**Code quality checklist:**
86+- Functions small (<50 lines), files focused (<800 lines)
87+- No deep nesting (>4 levels)
88+- Proper error handling, no hardcoded values
89+- Readable, well-named identifiers
11090
111− void add(Item item) => state = [...state, item];
112− void remove(String id) => state = state.where((i) => i.id != id).toList();
113− void clear() => state = [];
114−}
91+## Testing Requirements
11592
116−// ConsumerWidget
117−class CartPage extends ConsumerWidget {
118− const CartPage({super.key});
93+**Minimum coverage: 80%**
11994
120− @override
121− Widget build(BuildContext context, WidgetRef ref) {
122− final items = ref.watch(cartNotifierProvider);
123− return ListView(
124− children: items.map((item) => CartItemTile(item: item)).toList(),
125− );
126− }
127−}
128−```
95+Test types (all required):
96+1. **Unit tests** — Individual functions, utilities, components
97+2. **Integration tests** — API endpoints, database operations
98+3. **E2E tests** — Critical user flows
12999
130−## Dependency Injection
100+**TDD workflow (mandatory):**
101+1. Write test first (RED) — test should FAIL
102+2. Write minimal implementation (GREEN) — test should PASS
103+3. Refactor (IMPROVE) — verify coverage 80%+
131104
132−Constructor injection is preferred. Use `get_it` or Riverpod providers at composition root:
105+Troubleshoot failures: check test isolation → verify mocks → fix implementation (not tests, unless tests are wrong).
133106
134−```dart
135−// get_it registration (in a setup file)
136−void setupDependencies() {
137− final di = GetIt.instance;
138− di.registerSingleton<ApiClient>(ApiClient(baseUrl: Env.apiUrl));
139− di.registerSingleton<UserRepository>(
140− UserRepositoryImpl(di<ApiClient>(), di<LocalDatabase>()),
141− );
142− di.registerFactory(() => UserListViewModel(di<UserRepository>()));
143−}
144−```
107+## Development Workflow
145108
146−## ViewModel Pattern (without BLoC/Riverpod)
109+1. **Plan** — Use planner agent, identify dependencies and risks, break into phases
110+2. **TDD** — Use tdd-guide agent, write tests first, implement, refactor
111+3. **Review** — Use code-reviewer agent immediately, address CRITICAL/HIGH issues
112+4. **Capture knowledge in the right place**
113+ - Personal debugging notes, preferences, and temporary context → auto memory
114+ - Team/project knowledge (architecture decisions, API changes, runbooks) → the project's existing docs structure
115+ - If the current task already produces the relevant docs or code comments, do not duplicate the same information elsewhere
116+ - If there is no obvious project doc location, ask before creating a new top-level file
117+5. **Commit** — Conventional commits format, comprehensive PR summaries
147118
148−```dart
149−class UserListViewModel extends ChangeNotifier {
150− UserListViewModel(this._repository);
119+## Workflow Surface Policy
151120
152− final UserRepository _repository;
121+- `skills/` is the canonical workflow surface.
122+- New workflow contributions should land in `skills/` first.
123+- `commands/` is a legacy slash-entry compatibility surface and should only be added or updated when a shim is still required for migration or cross-harness parity.
153124
154− AsyncState<List<User>> _state = const Loading();
155− AsyncState<List<User>> get state => _state;
125+## Git Workflow
156126
157− Future<void> load() async {
158− _state = const Loading();
159− notifyListeners();
160− try {
161− final users = await _repository.getAll();
162− _state = Success(users);
163− } on Exception catch (e) {
164− _state = Failure(e);
165− }
166− notifyListeners();
167− }
168−}
169−```
127+**Commit format:** `<type>: <description>` — Types: feat, fix, refactor, docs, test, chore, perf, ci
170128
171−## UseCase Pattern
129+**PR workflow:** Analyze full commit history → draft comprehensive summary → include test plan → push with `-u` flag.
172130
173−```dart
174−class GetUserUseCase {
175− const GetUserUseCase(this._repository);
176− final UserRepository _repository;
131+## Architecture Patterns
177132
178− Future<User?> call(String id) => _repository.getById(id);
179−}
133+**API response format:** Consistent envelope with success indicator, data payload, error message, and pagination metadata.
180134
181−class CreateUserUseCase {
182− const CreateUserUseCase(this._repository, this._idGenerator);
183− final UserRepository _repository;
184− final IdGenerator _idGenerator; // injected — domain layer must not depend on uuid package directly
135+**Repository pattern:** Encapsulate data access behind standard interface (findAll, findById, create, update, delete). Business logic depends on abstract interface, not storage mechanism.
185136
186− Future<void> call(CreateUserInput input) async {
187− // Validate, apply business rules, then persist
188− final user = User(id: _idGenerator.generate(), name: input.name, email: input.email);
189− await _repository.save(user);
190− }
191−}
192−```
137+**Skeleton projects:** Search for battle-tested templates, evaluate with parallel agents (security, extensibility, relevance), clone best match, iterate within proven structure.
193138
194−## Immutable State with freezed
139+## Performance
195140
196−```dart
197−@freezed
198−class UserState with _$UserState {
199− const factory UserState({
200− @Default([]) List<User> users,
201− @Default(false) bool isLoading,
202− String? errorMessage,
203− }) = _UserState;
204−}
205−```
141+**Context management:** Avoid last 20% of context window for large refactoring and multi-file features. Lower-sensitivity tasks (single edits, docs, simple fixes) tolerate higher utilization.
206142
207−## Clean Architecture Layer Boundaries
143+**Build troubleshooting:** Use build-error-resolver agent → analyze errors → fix incrementally → verify after each fix.
208144
145+## Project Structure
146+
209147 ```
210−lib/
211−├── domain/ # Pure Dart — no Flutter, no external packages
212−│ ├── entities/
213−│ ├── repositories/ # Abstract interfaces
214−│ └── usecases/
215−├── data/ # Implements domain interfaces
216−│ ├── datasources/
217−│ ├── models/ # DTOs with fromJson/toJson
218−│ └── repositories/
219−└── presentation/ # Flutter widgets + state management
220− ├── pages/
221− ├── widgets/
222− └── providers/ (or blocs/ or viewmodels/)
148+agents/ — 48 specialized subagents
149+skills/ — 183 workflow skills and domain knowledge
150+commands/ — 79 slash commands
151+hooks/ — Trigger-based automations
152+rules/ — Always-follow guidelines (common + per-language)
153+scripts/ — Cross-platform Node.js utilities
154+mcp-configs/ — 14 MCP server configurations
155+tests/ — Test suite
223156 ```
224157
225−- Domain must not import `package:flutter` or any data-layer package
226−- Data layer maps DTOs to domain entities at repository boundaries
227−- Presentation calls use cases, not repositories directly
158+`commands/` remains in the repo for compatibility, but the long-term direction is skills-first.
228159
229−## Navigation (GoRouter)
160+## Success Metrics
230161
231−```dart
232−final router = GoRouter(
233− routes: [
234− GoRoute(
235− path: '/',
236− builder: (context, state) => const HomePage(),
237− ),
238− GoRoute(
239− path: '/users/:id',
240− builder: (context, state) {
241− final id = state.pathParameters['id']!;
242− return UserDetailPage(userId: id);
243− },
244− ),
245− ],
246− // refreshListenable re-evaluates redirect whenever auth state changes
247− refreshListenable: GoRouterRefreshStream(authCubit.stream),
248− redirect: (context, state) {
249− final isLoggedIn = context.read<AuthCubit>().state is AuthAuthenticated;
250− if (!isLoggedIn && !state.matchedLocation.startsWith('/login')) {
251− return '/login';
252− }
253− return null;
254− },
255−);
256−```
257−
258−## References
259−
260−See skill: `flutter-dart-code-review` for the comprehensive review checklist.
261−See skill: `compose-multiplatform-patterns` for Kotlin Multiplatform/Flutter interop patterns.
162+- All tests pass with 80%+ coverage
163+- No security vulnerabilities
164+- Code is readable and maintainable
165+- Performance is acceptable
166+- User requirements are met
262167
