Module Generator
This skill automates the creation of a new NestJS module following the project's architectural patterns and naming conventions.
Workflow
- •Identify the module name: Use kebab-case (e.g.,
user-profile,audit-log). - •Execute the generator script: Use the bundled script to create the files and update the registry.
- •Verify the output: Check the newly created files and the
src/modules/index.module.tsfile. - •Format the code: Run
npm run lintornpm run formatto ensure the new code matches the project style.
Usage
Run the following command from the project root:
bash
node .gemini/skills/module-generator/scripts/generate_module.cjs <module-name>
Example
To create a user-settings module:
bash
node .gemini/skills/module-generator/scripts/generate_module.cjs user-settings
This will:
- •Create
src/modules/user-settings/directory. - •Create
user-settings.service.ts,user-settings.controller.ts, anduser-settings.module.ts. - •Add
import UserSettingsModule from './user-settings/user-settings.module';tosrc/modules/index.module.ts. - •Add
UserSettingsModuleto theApplicationModulesarray insrc/modules/index.module.ts.
Standards Applied
- •File Naming: kebab-case.
- •Class Naming: PascalCase.
- •Module Export:
export default class ...as per project convention. - •Controller/Service Export: Named exports.
- •Directory Structure: Modules are located under
src/modules/.