Skip to main content
The pnpm 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.
Example:
Generated file:
src/practices/p1-test-api.ts
Run:

entity - Generate Entity

Create a new Entity. By default, template cones are automatically generated along with the Entity.
Options: Examples:
Template cones can be generated without ANTHROPIC_API_KEY. You can later upgrade them using the cone gen command with AI.
Generated file:
src/entities/Product.entity.ts

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 with stub entity include basic fields:

Customization

Add needed fields after generation:

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

Cautions when using Practice scripts:
  1. Production data: Practice uses real DB. Be careful!
  2. Backup: Always backup before important data operations.
  3. Transactions: Use transactions when modifying data.
  4. Testing: Test in development environment before production run.

Next Steps

scaffold

Auto-generate Models with code scaffolding

Entity

Learn more about Entity definitions