ワンクリックで
feature-structure
Guidelines for organizing feature module structure using package-by-feature principle
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Guidelines for organizing feature module structure using package-by-feature principle
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Implement provided test blueprints following the project guidelines.
Rules for structuring and connecting Decompose components - regular components, routers, Outputs, factories, navigation, and embedded children
Create compact, reviewable high-level designs for test suites before implementation or structural review.
Compose Multiplatform UI patterns for this project - Scaffold screens, AppToolbar, decomposition, CustomTheme, LCE widgets, insets, system bars, messages, core widgets, and previews.
Guidelines for API/DTO boundaries, repository-owned Replica data loading, loaded data observation in components, LCE state, data mutations, cache invalidation, ReplicaAction, ReplicaTag
Compact guide for using the project StringDesc wrapper over Compose Resources
| name | feature-structure |
| description | Guidelines for organizing feature module structure using package-by-feature principle |
This skill defines the structure of a feature module in this project.
The main idea is simple:
A feature is a self-contained package with four main parts:
DI.ktdata/domain/presentation/This structure stays the same even when the feature grows.
If a feature later contains clearly separable domains or contexts, you may introduce subfeatures.
Each subfeature follows the same data / domain / presentation logic inside its own scope.
Use this as the default shape:
Names in angle brackets are placeholders and should be replaced with project-specific names.
<feature_name>/
├── DI.kt
├── data/
│ ├── <Feature>Api.kt
│ ├── <Feature>Repository.kt
│ ├── <Feature>RepositoryImpl.kt
│ └── dto/
│ ├── <Entity>Response.kt
│ ├── <AnotherEntity>Response.kt
│ └── <Action>Request.kt # Optional
├── domain/
│ ├── <Entity>.kt
│ ├── <Entity>Id.kt
│ ├── <AnotherEntity>.kt
│ ├── <OneMoreEntity>.kt
│ └── <Entity>Query.kt # Optional
└── presentation/
├── <Feature>Component.kt
├── Real<Feature>Component.kt
├── Fake<Feature>Component.kt
├── <Feature>Ui.kt
├── <screen_name>/ # Optional screen package
├── <another_screen_name>/ # Optional screen package
└── widget/ # Optional feature-specific widgets
Nested screen packages inside presentation/ are a regular way to organize screens within one
feature.
If a feature contains logically separable domains or contexts, the package tree may expand like this:
feature_name/
├── DI.kt
├── data/
│ ├── subfeature_a/
│ ├── subfeature_b/
│ └── common/ # Rare; only when truly justified
├── domain/
│ ├── subfeature_a/
│ ├── subfeature_b/
│ └── common/
└── presentation/
├── subfeature_a/
├── subfeature_b/
└── common/
Subfeatures repeat the same internal structure within a narrower context.
Subfeatures make sense when:
If the feature is still one cohesive domain, keep a single feature package and organize only the
needed screens under presentation/.
data/Put infrastructure-facing code here:
domain/Put product-facing models here:
Do not place API DTOs or UI-specific formatting here.
presentation/Put screen-facing code here:
Do not call APIs directly from presentation.
DI.ktPlace DI.kt at the root of the feature package.
It contains:
ComponentFactory.createXxxComponent(...) extension functionsAdd one factory function for each public real component created through DI.kt.
Use one clear naming story across the whole feature.
Examples:
catalog, profile, settingsCatalogComponent, RealCatalogComponent, FakeCatalogComponent, CatalogUiCatalogListComponent, CatalogDetailsComponentCatalogItem, CatalogFilter, CatalogItemIdCatalogApi, CatalogRepository, CatalogRepositoryImplCatalogQueryCatalogItemViewData only when presentation needs a meaningful transformationCatalogCardLocation:
features/src/commonMain/composeResources/values/{feature_name}_strings.xml
Naming pattern:
{feature}_{context}_{element}Examples:
catalog_titlecatalog_list_emptycatalog_details_titlecatalog_filters_applyUse the feature name as the stable prefix for the whole resource file.
/core/widget/.Ui files.ComponentFactory.Use this only when you need a concrete illustration:
catalog example with structure,
strings, and DI.kt