pnpm sonamu stub command auto-generates code templates to reduce repetitive work. You can quickly create Practice scripts or new Entities to speed up development.
Commands
practice - Generate Practice Script
Generate scripts for temporary experiments or data processing.src/practices/p1-test-api.ts
The practice name may contain only letters, digits,
., -, and _, and must start with a
letter or digit. Other names are rejected, and an existing practice file is never overwritten.entity - Generate Entity
Create a new Entity. By default, template cones are automatically generated along with the Entity.
Examples:
Template cones can be generated without
ANTHROPIC_API_KEY. You can later upgrade them using the
cone gen command with AI.src/application/product/product.entity.json
The default
desc labels are emitted in Korean by the generator template. Rewrite them to match
your project’s locale.Practice Scripts
Use Cases
Practice scripts are useful for these tasks:Automatic Numbering
Practice files are automatically numbered: When you create a new practice, it automatically gets the highest number + 1.Practical Examples
1. API Testing
src/practices/p1-test-payment-api.ts
2. Data Migration
src/practices/p2-migrate-user-data.ts
3. Batch Jobs
src/practices/p3-send-welcome-emails.ts
Entity Generation
Basic Structure
Entities generated withstub entity include basic fields:
Customization
Add needed fields after generation:FK columns such as
category_id are created automatically from a relation prop when the
migration is generated. See Defining Entities for
the full list of prop types and field rules.Development Workflow
1. Validate Ideas
2. Add Entity
3. Data Operations
Practical Tips
1. Reuse Practice Scripts
2. Error Handling
3. Progress Display
4. Cleanup Practices
Cautions
Next Steps
scaffold
Auto-generate Models with code scaffolding
Entity
Learn more about Entity definitions