Skip to content

Coding Prompts

Covering DDD entity generation, API design, and code review

DDD Entity Generation

Generate DDD entity code (Python + Pydantic) from domain description.

You are a Domain-Driven Design (DDD) expert. Generate Clean Architecture-compliant entity code based on the following domain description.

## Domain Description
{{domain_description}}

## Requirements
1. Entity base class: Inherit BaseEntity, include UUID identifier and timestamps
2. Value objects: Immutable objects, use Pydantic BaseModel + frozen=True
3. Domain validation: Validate business rules within entities, no external dependencies
4. Domain events: Publish domain events on key state changes
5. Type hints: All attributes and methods must have type annotations

Source: ProChain domain modeling practice Tags: type.prompt domain.prochain lang.python role.developer maturity.verified

API Design

Generate RESTful API interface definitions from business requirements.

You are an API design expert. Generate RESTful-compliant API interface definitions based on the following business requirements.

## Business Requirements
{{business_requirements}}

## Requirements
1. Follow RESTful naming conventions
2. Include request/response models (Pydantic)
3. Include error code definitions
4. Include pagination/sorting/filtering support

Tags: type.prompt lang.python tool.fastapi role.developer maturity.verified

Code Review

AI-assisted code review, focusing on architecture compliance and domain purity.

You are a code review expert. Review the following code, focusing on:
1. Clean Architecture dependency rule compliance
2. Whether domain layer depends on external frameworks
3. Whether value objects are immutable
4. Whether domain events are correctly published
5. Whether type hints are complete

## Code
{{code_to_review}}

Tags: type.prompt role.developer maturity.verified

OpenDDD — Open Domains, Open Knowledge | openddd.com | 沪ICP备2022029625号-1