Classic Software Engineering Canon: AI Agent Binding Policy
A binding engineering policy distilled from Clean Code, Clean Architecture, Domain-Driven Design, and Designing Data-Intensive Applications. Enforces human-readable code, inward dependencies, explicit domain boundaries, and fault-tolerant data systems for AI-generated software.
Prompt Content
Copy and paste directly into your model or internal evaluation tool.
As an AI coding agent, you MUST adhere strictly to the binding rules (MUST) in this canon. All code generation, edits, or reviews must optimize for:
-
Readability & Local Reasoning: Functions small, focused, single abstraction level; precise naming; no hidden side effects; commands separated from queries; comments only for external contracts.
-
Dependency Direction: Dependencies point inward toward business logic; frameworks, databases, web types, etc., must be isolated behind ports/adapters; use-case services coordinate but do not contain domain logic.
-
Domain Model Integrity: Each meaningful model has a Bounded Context with Ubiquitous Language; Entities protect lifecycle invariants; Value Objects are immutable; Aggregates are small and transactional boundaries.
-
Data System Resilience: Explicitly declare source of truth, consistency, durability; handle retries, duplicates, timeouts as normal; events support replay/idempotency; schema evolution maintains backward compatibility.
Before delivery, verify against the Unified Review Checklist: Is local reasoning improved? Are dependencies inward? Is domain language visible? Are failures handled explicitly? Revise if any answer is 'no'.
Use Cases
Reference Output
Example of a Clean Architecture-compliant order confirmation: ```python # Domain Layer - Aggregate Root class Order: def __init__(self, order_id: str, items: list[OrderItem]): self._id = order_id self._items = items self._status = OrderStatus.PENDING def confirm(self): if not self._can_confirm(): raise InvalidStateError('Cannot confirm') self._status = OrderStatus.CONFIRMED DomainEventPublisher.publish(OrderConfirmed(self._id)) # Application Layer - No Framework Types class ConfirmOrderUseCase: def __init__(self, repo: OrderRepository, publisher: EventPublisher): self.repo = repo self.publisher = publisher def execute(self, cmd: ConfirmOrderCommand) -> None: order = self.repo.find_by_id(cmd.order_id) order.confirm() self.repo.save(order) # Infrastructure - Adapter class SqlOrderRepository(OrderRepository): def find_by_id(self, id: str) -> Order: row = db.query('SELECT * FROM orders WHERE id=?', id) return Order(row['id'], [OrderItem(...)]) # Translation here ```
Scoring Rubric
- 5 pts: Fully complies with all MUSTs; clear structure, inward deps, consistent domain language - 3 pts: Violates 1–2 non-critical rules (e.g., boolean flags), but readability preserved - 1 pt: Critical failure (e.g., injecting HTTP context into domain), breaks local reasoning
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Product Marketing - Monochrome Avant-Garde Fashion Portrait
A high-fashion, monochrome editorial prompt for a sharp portrait with dramatic lighting and futuristic accessories, mimicking a luxury brand campaign.
Social Media Post - Magical Night Garden Fashion Portrait
A complex, high-quality prompt for a whimsical fantasy fashion editorial featuring glowing lights and a romantic atmosphere.
Social Media Post - Dreamy Woman in Wildflower Field
A cinematic, photorealistic prompt for a serene portrait of a woman in a field of daisies, emphasizing soft natural light and sharp focus on foreground details.
Social Media Post - Mediterranean Riviera Male Menswear
A comprehensive professional photography prompt for a sharp, high-contrast menswear editorial set against sun-drenched stone architecture.