codex-architecture
Skill1 starsChanged 4 months agoMITView on GitHub
Designs high-level system architecture, defines domain boundaries, models Domain-Driven Design (DDD) entities and aggregates, formulates C4 diagrams, and specifies data flows and state machines into timestamped architecture specifications in codex-drive/specs/.
In this repository24 other files it gives its agents.
- codex-brainSkill
- ai-codex-c-cppSkill
- ai-codex-csharp-dotnetSkill
- codex-debugSkill
- codex-deepSkill
- codex-elixirSkill
- codex-flutter-dartSkill
- codex-goalSkill
- ai-codex-goSkill
- ai-codex-java-kotlinSkill
- ai-codex-phpSkill
- codex-plansSkill
- ai-codex-pythonSkill
- codex-reviewSkill
- ai-codex-rustSkill
- codex-skillsSkill
- codex-solidity-web3Skill
- codex-sql-databaseSkill
- codex-startSkill
- ai-codex-swiftSkill
- codex-testSkill
- ai-codex-typescript-reactSkill
- ai-codex-ui-ux-designSkill
- codex-zigSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
When starting a new service, subsystem, database schema, or distributed system
- Very specific: line 67
All architecture files generated by codex-architecture MUST be Markdown (.md) files with exact date-time metadata.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codex Architecture — System & Domain Modeling Skill
The architectural design engine of AI Codex. Converts high-level requirements and system constraints into formal domain models, boundary definitions, and architectural specifications.
Overview
codex-architecture establishes robust system designs before implementation begins. It defines architectural boundaries, maps Domain-Driven Design (DDD) concepts (Aggregates, Entities, Value Objects, Domain Events), models state machines, and structures component diagrams. It writes timestamped architecture specifications into codex-drive/specs/.
When to Trigger
- User runs
/codex-architecture(e.g.,/codex-architecture design payment gateway,/codex-architecture model user authentication & RBAC,/codex-architecture decompose monolithic service) - When starting a new service, subsystem, database schema, or distributed system
- Refactoring tangled dependencies or establishing Clean / Hexagonal Architecture boundaries
Execution Workflow
┌────────────────────────────────────────────────────────┐
│ 1. DOMAIN DISCOVERY & BOUNDED CONTEXT IDENTIFICATION │
│ Identify core domain, subdomains, and context maps. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 2. ENTITY, VALUE OBJECT & AGGREGATE MODELING │
│ Formulate immutable models and business invariants. │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 3. DATA FLOW, PROTOCOLS & STATE MACHINE DESIGN │
│ Diagram component interactions and lifecycle states.│
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 4. GENERATE TIMESTAMPED SPEC IN CODEX-DRIVE │
│ Write codex-drive/specs/YYYY-MM-DD-<slug>.arch.md │
└──────────────────────────┬─────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ 5. RECOMMEND IMPLEMENTATION PATHWAY │
│ Provide clickable spec link and transition to plans.│
└────────────────────────────────────────────────────────┘Architecture Spec File Specification (codex-drive/specs/)
All architecture files generated by codex-architecture MUST be Markdown (.md) files with exact date-time metadata.
Filename Format:
codex-drive/specs/YYYY-MM-DD-<slug>.arch.md
Standard Architecture Specification Template:
# [Subsystem / Feature Name] Architectural Specification
> **Created At**: YYYY-MM-DD HH:MM:SS (Local Time)
> **Active Codex Edition**: [`skills/codex/<edition>/`](file:///...)
> **Status**: DRAFT | APPROVED | LIVING_DOC
> **Architecture Pattern**: [e.g., Clean / Hexagonal / Event-Driven / Microservices]
---
## 1. Executive Summary & Problem Space
[Overview of the system, business drivers, scalability targets, and key constraints]
## 2. Bounded Context & System Context (C4 Level 1/2)
```mermaid
flowchart TD
Client["Client Applications (Web / Mobile)"]
API["API Gateway / BFF"]
Service["Core Domain Service"]
DB[("Primary Database")]
Queue[["Event Bus / Message Queue"]]
ThirdParty["External Systems"]
Client -->|HTTPS / WSS| API
API -->|gRPC / HTTP| Service
Service -->|Read / Write| DB
Service -->|Publish Events| Queue
Service -->|API Calls| ThirdParty3. Domain Model & Invariants (DDD)
Aggregates & Entities:
OrderAggregate(Root):- Entities:
Order,OrderItem - Value Objects:
OrderId,Money,ShippingAddress,OrderStatus - Invariants Enforced:
- An order cannot transition to
Paidwithout valid payment confirmation. - Total amount must equal the sum of item prices plus tax minus discounts.
- An order cannot transition to
- Entities:
Domain Events:
OrderPlacedEvent(OrderId, CustomerId, Timestamp)PaymentCapturedEvent(OrderId, TransactionId, Amount)OrderCancelledEvent(OrderId, Reason, Timestamp)
4. State Machine & Lifecycle Transitions
stateDiagram-v2
[*] --> Draft
Draft --> PendingPayment : Submit Order
PendingPayment --> Paid : Payment Succeeded
PendingPayment --> PaymentFailed : Payment Declined
PaymentFailed --> PendingPayment : Retry Payment
PaymentFailed --> Cancelled : Timeout / User Cancel
Paid --> Processing : Warehouse Allocates
Processing --> Shipped : Carrier Dispatched
Shipped --> Delivered : Customer Receives
Delivered --> [*]
Cancelled --> [*]5. Ports & Adapters (Interface Contracts)
Driving / Inbound Ports:
export interface CreateOrderUseCase {
execute(command: CreateOrderCommand): Promise<Result<OrderDTO, OrderError>>;
}Driven / Outbound Ports:
export interface OrderRepositoryPort {
getById(id: OrderId): Promise<Order | null>;
save(order: Order): Promise<void>;
}
export interface PaymentGatewayPort {
charge(amount: Money, token: PaymentToken): Promise<PaymentResult>;
}6. Non-Functional Requirements & Cross-Cutting Concerns
- Concurrency & Locking: Optimistic concurrency with version tokens.
- Idempotency: Idempotency keys required on all mutating API calls.
- Observability: Distributed trace ID injected at gateway and propagated across RPCs.
- Failure Recovery & Outbox: Transactional outbox pattern for guaranteed event delivery.
7. Next Steps
- Run
/codex-plansto translate this architectural spec into execution tasks.
---
## Response Protocol
When `codex-architecture` finishes:
1. Provide a clickable link to `[View Architecture Spec](file:///.../codex-drive/specs/YYYY-MM-DD-<slug>.arch.md)`.
2. Highlight key domain boundaries, state transitions, or integration risks.
3. Suggest running `/codex-plans` to proceed with implementation planning.Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

