← Back to list
Core (
Domain (
Data (
Presentation (

clean-architecture-implementation
by AVRA-CADAVRA
⭐ 0🍴 0📅 Jan 24, 2026
SKILL.md
name: clean-architecture-implementation description: Enforces Clean Architecture layer separation (core, data, domain, presentation). Use when creating new features, organizing code, or ensuring proper dependency direction.
Clean Architecture Implementation
Layer Structure
lib/
├── core/ # Core business logic, models, services
├── data/ # Data sources, repositories (implementation)
├── domain/ # Use cases, repository interfaces
└── presentation/ # UI, BLoCs, widgets, pages
Layer Responsibilities
Core (lib/core/)
- Business logic
- Models (entities)
- Services
- Common utilities
- No framework dependencies (as much as possible)
Domain (lib/domain/)
- Use cases (business logic workflows)
- Repository interfaces (abstract)
- Domain models/interfaces
- No implementation details
- Framework-independent
Data (lib/data/)
- Repository implementations
- Data sources (local/remote)
- Data models (DTOs)
- Framework-specific (Sembast, HTTP, etc.)
Presentation (lib/presentation/)
- UI components (widgets, pages)
- BLoCs (state management)
- Controllers
- Flutter-specific code
Dependency Direction
Dependencies flow inward:
- Presentation → Domain ← Data
- Presentation → Core
- Data → Domain
- Domain → Core
- Core has no dependencies on other layers
Presentation → Domain ← Data
↓ ↓
Core ←──────┘
Examples
✅ GOOD: Correct Dependency Direction
// Domain (abstract interface)
abstract class SpotsRepository {
Future<List<Spot>> getSpots();
}
// Data (implements domain interface)
class SpotsRepositoryImpl implements SpotsRepository {
final SpotsRemoteDataSource remoteDataSource;
final SpotsLocalDataSource localDataSource;
// Implementation
}
// Domain (use case uses repository interface)
class GetSpotsUseCase {
final SpotsRepository repository;
Future<List<Spot>> call() => repository.getSpots();
}
// Presentation (uses use case)
class SpotsBloc extends Bloc<SpotsEvent, SpotsState> {
final GetSpotsUseCase getSpotsUseCase;
// Uses use case
}
❌ BAD: Wrong Dependency Direction
// Domain depending on data (WRONG)
import 'package:avrai/data/models/spot_model.dart'; // ❌
// Presentation depending on data (WRONG)
import 'package:avrai/data/repositories/spots_repository_impl.dart'; // ❌
File Organization
✅ GOOD: Layer-Based Organization
lib/
├── core/
│ ├── models/
│ │ └── spot.dart
│ └── services/
│ └── spot_service.dart
├── domain/
│ ├── repositories/
│ │ └── spots_repository.dart
│ └── usecases/
│ └── get_spots_usecase.dart
├── data/
│ ├── datasources/
│ │ └── spots_remote_datasource.dart
│ └── repositories/
│ └── spots_repository_impl.dart
└── presentation/
├── pages/
│ └── spots_page.dart
└── blocs/
└── spots_bloc.dart
Service Patterns
Core Services
Core services belong in lib/core/services/:
// lib/core/services/my_service.dart
class MyService {
// Business logic
// No Flutter dependencies
}
Domain Use Cases
Use cases belong in lib/domain/usecases/:
// lib/domain/usecases/get_data_usecase.dart
class GetDataUseCase {
final RepositoryInterface repository;
Future<Data> call() {
// Orchestrates business logic
}
}
Testing by Layer
test/
├── unit/
│ ├── models/ # Domain entities
│ ├── repositories/ # Data layer
│ ├── usecases/ # Business logic
│ ├── blocs/ # State management
│ └── services/ # Core services
├── integration/ # Cross-layer
└── widget/ # Presentation layer
Reference
See existing architecture in:
lib/core/- Core layer exampleslib/domain/- Domain layer exampleslib/data/- Data layer exampleslib/presentation/- Presentation layer examples
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon