スキル一覧に戻る
AVRA-CADAVRA

file-organization-standards

by AVRA-CADAVRA

0🍴 0📅 2026年1月24日
GitHubで見るManusで実行

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_underscores for file names
  • Match file name to primary class name
  • Use descriptive names

Examples:

  • create_event_page.dartCreateEventPage
  • spot_details_page.dartSpotDetailsPage
  • auth_service.dartAuthService
  • spots_bloc.dartSpotsBloc

Class Names

  • Use PascalCase for 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 {}

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.dartLoginPage
  • spot_details_page.dartSpotDetailsPage
  • create_event_page.dartCreateEventPage

Services

  • auth_service.dartAuthService
  • storage_service.dartStorageService
  • payment_service.dartPaymentService

BLoCs

  • auth_bloc.dartAuthBloc
  • spots_bloc.dartSpotsBloc
  • search_bloc.dartSearchBloc

Widgets

  • spot_card.dartSpotCard
  • custom_button.dartCustomButton
  • offline_indicator.dartOfflineIndicator

File Placement Rules

  1. Modelslib/core/models/ or lib/domain/entities/
  2. Serviceslib/core/services/
  3. Use Caseslib/domain/usecases/
  4. Repository Interfaceslib/domain/repositories/
  5. Repository Implementationslib/data/repositories/
  6. Data Sourceslib/data/datasources/
  7. Pageslib/presentation/pages/[feature]/
  8. Widgetslib/presentation/widgets/[feature]/ or lib/presentation/widgets/common/
  9. BLoCslib/presentation/blocs/[feature]/

Reference

Check existing structure before creating new files:

  • lib/core/ - Core layer examples
  • lib/presentation/pages/ - Page examples
  • lib/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

レビュー

💬

レビュー機能は近日公開予定です