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
Try & save
Fill variables and copy, or save as a personal template.
This template has no variables and is ready to copy.
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Product Marketing - Mediterranean Male Sun-Drenched Portrait
An editorial-style photograph of a Mediterranean man in a linen shirt, featuring high contrast shadows and an elegant European summer vibe.
Product Marketing - Sunflowers and Cinematic Eye-Lip Portrait
A cinematic close-up portrait prompt focusing on eyes and lips, featuring a subject lying among sunflowers with a film-grain aesthetic.
Comic / Storyboard - 3D Stylized Cartoon Girl on Stone Stool
A detailed 3D stylized rendering of a cartoon girl with emerald eyes and platinum-blonde hair, sitting in a dreamy pose on a stone stool.
Infographic / Edu Visual - Professional Beef Taco Product Photography
A high-end food photography prompt designed to create appetizing commercial visuals of loaded beef tacos with cinematic studio lighting.