Business Model Builder

Create Python dataclass business models with validation and derived properties.

1|Updated Jul 10, 2025
One-click install
npx skills add https://github.com/jzallen/fred_simulations --skill business-model-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Business Model Builder
Source: https://github.com/jzallen/fred_simulations/tree/main/.claude/skills/business-model-builder
Command: npx skills add https://github.com/jzallen/fred_simulations --skill business-model-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers create robust, maintainable Python business models using dataclasses, ensuring clean architecture and clear separation of concerns. It prevents models from becoming bloated with application logic and enforces data integrity at the model level, leading to more predictable and easier-to-manage data structures.

Core Features & Use Cases

  • Clean Dataclasses: Generate pure data containers with comprehensive type hints and sensible defaults.
  • Derived Properties: Add read-only computed values for convenience without modifying the model's state.
  • Model-Level Validation: Implement __post_init__ for enforcing business rules directly within the model's initialization.
  • Use Case: Create a Python dataclass for a Customer entity, including fields like id, name, email, address, and registration_date, ensuring proper type hints, default values, and a derived property for full_address.

Quick Start

Generate a Python dataclass for a Product with fields name, sku, price, category, and inventory_count, including type hints and a __post_init__ validation for price and inventory_count.

Frequently Asked Questions about Business Model Builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create Python dataclasses with type hints and validation?

Python dataclasses provide a clean way to define models with type hints, default values, and `__post_init__` validation. Use the `@dataclass` decorator, annotate fields with types like `Optional`, `List`, and `Dict`, set sensible defaults, and implement `__post_init__` to enforce business rules directly during initialization.

What's the best way to structure business models in a clean architecture?

Organize models into a two-layer structure: place domain models in `models/` and data mappers in `mappers/`, then integrate them into `use_cases/`, `repositories/`, and `controllers`. This separation enforces clean architecture, ensures validation at the model level, and enables predictable data flow across your application.

How do I add computed properties to Python dataclasses without modifying state?

Implement read-only derived properties using `@property` decorators on your dataclass. These computed values derive from existing fields without altering the model's state, providing convenience for complex calculations while maintaining immutability and predictable behavior.

Can I use frozen dataclasses to enforce immutability in my domain models?

Yes, frozen dataclasses prevent accidental mutation after initialization by raising an error on field assignment. Set `frozen=True` in the `@dataclass` decorator to create immutable models that enforce data integrity and support safer concurrent usage patterns.

Why should business logic stay separate from dataclass models?

Keeping models as pure data containers prevents them from becoming bloated and tangled with application logic. This separation ensures models remain predictable, easier to test, and reusable across different use cases while application logic belongs in dedicated layers like repositories and use cases.

Do I need field factories for complex default values in dataclasses?

Yes, use `field(default_factory=...)` for mutable default values like lists or dictionaries. This prevents unintended sharing of defaults across instances and ensures each dataclass instance gets its own independent collection, maintaining data integrity.