Create Feature - Front-End Feature Generator
Purpose
This skill generates the boilerplate files for a new feature screen in our Kotlin Multiplatform front-end application following the established MVVM architecture pattern.
Required Information
Before creating a feature, gather:
- •Feature name (e.g., "SelectOrg", "AddProperty", "Notifications")
- •Parent folder. This is the directory where the new package will be created. If the feature is named "AddProperty", the package will be named
addproperty. So the parent folder could beedifikana/front-end/shared-app/src/commonMain/kotlin/com/cramsan/edifikana/client/lib/features/for a path likeedifikana/front-end/shared-app/src/commonMain/kotlin/com/cramsan/edifikana/client/lib/features/addproperty/.
Provide the user with some examples of valid feature names and parent folders but DO NOT provide them with options to select from.
Files to Create
For a feature named {FeatureName} in package {packagePath}:
Look at the templates in .idea/fileTemplates/Compose Feature* and create each file by injecting the feature name and package path.
Registration
After creating the files, run through the TODOs in the templates to complete each step. Some files may need to be moved, for example the test files should be moved to the test source set.
Verification
After creating all files, compile and run the tests to ensure everything is set up correctly.
Examples
Example 1: Creating "AddProperty" feature in home
- •
Feature name:
AddProperty - •
Parent folder:
edifikana/front-end/shared-app/src/commonMain/kotlin/com/cramsan/edifikana/client/lib/features/ - •
Creating feature
AddPropertyin packagecom.cramsan.edifikana.client.lib.features.addproperty - •
Source folder is
edifikana/front-end/shared-app/src/commonMain/kotlin/com/cramsan/edifikana/client/lib/features/addproperty/ - •
Files created:
- •
AddPropertyScreen.kt - •
AddPropertyViewModel.kt - •
AddPropertyUIState.kt - •
AddPropertyEvent.kt - •
AddPropertyViewModelTest.kt - •
AddPropertyScreen.preview.kt
- •
- •
Completing tasks in the TODOs in each file.