Iterating on Generated Code
Generated code is a starting point. Here's how to evolve it.
Adding Components
Use /reventless-add to add components to an existing plugin:
/reventless-add slice → new StateChangeSlice
/reventless-add viewslice → new StateViewSlice
/reventless-add aggregate → new Aggregate (spec + behavior)
/reventless-add readmodel → new ReadModel (spec + projection)
/reventless-add automation → new AutomationSlice
/reventless-add inbound → new InboundTranslationSlice
/reventless-add outbound → new OutboundTranslationSlice
/reventless-add extension → subscribe to another plugin's EP
/reventless-add extensionpoint → expose events to other plugins
/reventless-add plugin → new plugin + spec package
The AI detects your existing project structure and generates only what's needed, automatically updating the plugin composition root.
Modifying Business Logic
Adding a New Command
Describe what you want:
"Add an ArchiveProduct command that marks a product as archived. Archived products should reject all other commands."
The AI will:
- Add the command and event variants
- Update the state type and evolve function
- Add guard conditions in decide
- Update the view slice to reflect archive status
- Add tests
Changing Validation Rules
"PlaceOrder should also verify that the customer has a verified email."
The AI will update the decide function and add any necessary consumed events.
Adding Cross-Plugin Communication
"The Shipping plugin needs to know when orders are shipped."
The AI will:
- Create an extension point spec in
ordering-spec/ - Add EP mapping in the Ordering plugin
- Create an extension in the Shipping plugin
- Wire everything in both plugin composition roots
Validation After Changes
Always validate after making changes:
/reventless-validate
This catches:
- Missing
@schemaannotations - Missing
@s.matches(DcbTag.string)markers - Components not registered in plugin composition
- Compiler warnings
Rebuilding
After any code change:
npm run build # compile all packages
npm test # run all tests
If you've reorganized files (moved, renamed):
npx rescript clean && npm run build
When to Regenerate vs Modify
| Situation | Approach |
|---|---|
| Add a field to an existing command | Modify the .res file directly |
| Add a new command to existing entity | Ask the AI — it updates multiple files |
| Add a new entity to existing plugin | Use /reventless-add |
| Add a new plugin | Use /reventless-add plugin |
| Major domain restructure | Consider /reventless-new for a fresh start |
| Fix a bug in business logic | Modify the decide/evolve function directly |