Domain, Data, and Presentation layer separation with dependency inversion and use case patterns
Generates Clean Architecture layers with dependency inversion for Flutter/Dart applications.
/plugin marketplace add Kaakati/rails-enterprise-dev/plugin install reactree-flutter-dev@manifest-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
┌─────────────────────────────────────┐
│ PRESENTATION LAYER │
│ (Controllers, Widgets, Bindings) │
├─────────────────────────────────────┤
│ DOMAIN LAYER │
│ (Entities, Use Cases, Interfaces) │
├─────────────────────────────────────┤
│ DATA LAYER │
│ (Models, Repositories, Sources) │
└─────────────────────────────────────┘
Dependency Rule: Outer layers depend on inner layers, NEVER reverse.
// lib/domain/entities/user.dart
import 'package:equatable/equatable.dart';
class User extends Equatable {
final String id;
final String name;
final String email;
const User({
required this.id,
required this.name,
required this.email,
});
@override
List<Object?> get props => [id, name, email];
}
// lib/domain/repositories/user_repository.dart
import 'package:dartz/dartz.dart';
import '../../core/errors/failures.dart';
import '../entities/user.dart';
abstract class UserRepository {
Future<Either<Failure, User>> getUser(String id);
Future<Either<Failure, List<User>>> getAllUsers();
Future<Either<Failure, User>> createUser(User user);
}
// lib/domain/usecases/get_user.dart
import 'package:dartz/dartz.dart';
import '../../core/errors/failures.dart';
import '../entities/user.dart';
import '../repositories/user_repository.dart';
class GetUser {
final UserRepository repository;
GetUser(this.repository);
Future<Either<Failure, User>> call(String id) {
return repository.getUser(id);
}
}
// lib/data/models/user_model.dart
import '../../domain/entities/user.dart';
class UserModel extends User {
const UserModel({
required super.id,
required super.name,
required super.email,
});
factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
id: json['id'],
name: json['name'],
email: json['email'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'email': email,
};
}
User toEntity() {
return User(id: id, name: name, email: email);
}
}
// lib/data/repositories/user_repository_impl.dart
import 'package:dartz/dartz.dart';
import '../../core/errors/failures.dart';
import '../../core/errors/exceptions.dart';
import '../../domain/entities/user.dart';
import '../../domain/repositories/user_repository.dart';
import '../providers/user_provider.dart';
class UserRepositoryImpl implements UserRepository {
final UserProvider provider;
UserRepositoryImpl(this.provider);
@override
Future<Either<Failure, User>> getUser(String id) async {
try {
final model = await provider.fetchUser(id);
return Right(model.toEntity());
} on ServerException catch (e) {
return Left(ServerFailure(e.message));
}
}
}
// lib/presentation/controllers/user_controller.dart
import 'package:get/get.dart';
import '../../domain/usecases/get_user.dart';
class UserController extends GetxController {
final GetUser getUserUseCase;
UserController({required this.getUserUseCase});
final _user = Rx<User?>(null);
User? get user => _user.value;
Future<void> loadUser(String id) async {
final result = await getUserUseCase(id);
result.fold(
(failure) => Get.snackbar('Error', failure.message),
(user) => _user.value = user,
);
}
}
// ❌ BAD: High-level module depends on low-level module
class UserController {
final UserApiClient apiClient; // Concrete implementation
void loadUser() {
apiClient.fetchUser(); // Direct dependency on implementation
}
}
// ✅ GOOD: Both depend on abstraction
class UserController {
final UserRepository repository; // Abstract interface
void loadUser() {
repository.getUser(); // Depends on abstraction
}
}
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.