← スキル一覧に戻る

file-organization-standards
by AVRA-CADAVRA
⭐ 0🍴 0📅 2026年1月24日
SKILL.md
name: file-organization-standards description: Enforces file naming conventions, directory structure, one class per file, Clean Architecture layer placement. Use when creating new files, organizing code, or refactoring file structure.
File Organization Standards
Clean Architecture Layers
Follow Clean Architecture layer structure:
lib/
├── core/ # Core business logic, models, services
├── data/ # Data sources, repositories (implementation)
├── domain/ # Use cases, repository interfaces
└── presentation/ # UI, BLoCs, widgets, pages
File Naming Conventions
File Names
- Use
lowercase_with_underscoresfor file names - Match file name to primary class name
- Use descriptive names
Examples:
create_event_page.dart→CreateEventPagespot_details_page.dart→SpotDetailsPageauth_service.dart→AuthServicespots_bloc.dart→SpotsBloc
Class Names
- Use
PascalCasefor classes, enums, typedefs - Match class name to file name
Examples:
- File:
user_service.dart→ Class:UserService - File:
spot_card.dart→ Class:SpotCard
Directory Structure
Core Layer
lib/core/
├── models/
│ ├── user.dart
│ └── spot.dart
├── services/
│ ├── auth_service.dart
│ └── storage_service.dart
└── utils/
└── validators.dart
Domain Layer
lib/domain/
├── repositories/
│ └── spots_repository.dart
└── usecases/
├── get_spots_usecase.dart
└── create_spot_usecase.dart
Data Layer
lib/data/
├── datasources/
│ ├── spots_remote_datasource.dart
│ └── spots_local_datasource.dart
└── repositories/
└── spots_repository_impl.dart
Presentation Layer
lib/presentation/
├── pages/
│ ├── auth/
│ │ ├── login_page.dart
│ │ └── signup_page.dart
│ └── spots/
│ ├── spots_page.dart
│ └── spot_details_page.dart
├── widgets/
│ ├── common/
│ │ └── custom_button.dart
│ └── spots/
│ └── spot_card.dart
└── blocs/
├── auth/
│ └── auth_bloc.dart
└── spots/
└── spots_bloc.dart
One Class Per File
Rule: One class per file (except closely related classes like models)
✅ GOOD:
// user.dart
class User {
// User class
}
// user_service.dart
class UserService {
// Service class
}
✅ GOOD (Related Classes):
// auth_events.dart
class SignInEvent {}
class SignUpEvent {}
class SignOutEvent {}
// auth_states.dart
class AuthInitial {}
class AuthLoading {}
class AuthAuthenticated {}
❌ BAD:
// services.dart (Multiple unrelated services)
class UserService {}
class SpotService {}
class EventService {}
Grouping Related Files
Group related files in subdirectories:
lib/presentation/pages/auth/
├── login_page.dart
├── signup_page.dart
└── auth_wrapper.dart
lib/presentation/widgets/spots/
├── spot_card.dart
├── spot_list.dart
└── spot_picker.dart
Naming Examples
Pages
login_page.dart→LoginPagespot_details_page.dart→SpotDetailsPagecreate_event_page.dart→CreateEventPage
Services
auth_service.dart→AuthServicestorage_service.dart→StorageServicepayment_service.dart→PaymentService
BLoCs
auth_bloc.dart→AuthBlocspots_bloc.dart→SpotsBlocsearch_bloc.dart→SearchBloc
Widgets
spot_card.dart→SpotCardcustom_button.dart→CustomButtonoffline_indicator.dart→OfflineIndicator
File Placement Rules
- Models →
lib/core/models/orlib/domain/entities/ - Services →
lib/core/services/ - Use Cases →
lib/domain/usecases/ - Repository Interfaces →
lib/domain/repositories/ - Repository Implementations →
lib/data/repositories/ - Data Sources →
lib/data/datasources/ - Pages →
lib/presentation/pages/[feature]/ - Widgets →
lib/presentation/widgets/[feature]/orlib/presentation/widgets/common/ - BLoCs →
lib/presentation/blocs/[feature]/
Reference
Check existing structure before creating new files:
lib/core/- Core layer exampleslib/presentation/pages/- Page exampleslib/presentation/widgets/- Widget examples
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓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
レビュー
💬
レビュー機能は近日公開予定です