Sub-skill of orcaflex-model-generator: Builder Registry Pattern (+3).
Scanned 9/9/2026
Install to Claude Code
npx -y skills add vamseeachanta/workspace-hub --skill builder-registry-pattern --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Builder Registry Pattern?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/vamseeachanta-builder-registry-pattern)More formats (shields.io, HTML) on the badges page.
---
name: orcaflex-model-generator-builder-registry-pattern
description: 'Sub-skill of orcaflex-model-generator: Builder Registry Pattern (+3).'
version: 2.0.0
category: engineering
type: reference
scripts_exempt: true
---
# Builder Registry Pattern (+3)
## Builder Registry Pattern
```python
@BuilderRegistry.register("03_environment.yml", order=30)
class EnvironmentBuilder(BaseBuilder):
def should_generate(self) -> bool:
return True # Always needed
def build(self) -> dict[str, Any]:
return {"Environment": {...}}
```
Builders self-register via the `@register` decorator. The orchestrator iterates them in order without maintaining a hardcoded list.
## Core Classes
| Class | Location | Purpose |
|-------|----------|---------|
| `ModularModelGenerator` | `__init__.py` | Orchestrator: loads spec, runs builders, writes output |
| `BuilderRegistry` | `builders/registry.py` | Auto-discovery registry with ordered execution |
| `BaseBuilder` | `builders/base.py` | ABC with `build()`, `should_generate()`, entity sharing |
| `BuilderContext` | `builders/context.py` | Typed dataclass for cross-builder data sharing |
| `ProjectInputSpec` | `schema/root.py` | Pydantic root model (metadata + environment + simulation + generic/pipeline/riser) |
## Builder Execution Flow
```
1. ModularModelGenerator.generate(output_dir)
2. for (filename, builder_class) in BuilderRegistry.get_ordered_builders():
3. builder = builder_class(spec, context)
4. if not builder.should_generate(): continue
5. data = builder.build()
6. context.update_from_dict(builder.get_generated_entities())
7. yaml.dump(data, includes_dir / filename)
8. write master.yml with include directives
```
## Cross-Builder Entity Sharing
Builders register entities via `_register_entity(key, value)` for downstream builders:
```python
# VesselBuilder registers vessel name
self._register_entity("main_vessel_name", vessel.name)
# LinesBuilder reads it from context
vessel_name = self.context.main_vessel_name
```
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!