Component Architecture Skill
This skill defines how the component architect designs the internal structure of a component at a logical level. The component architect is the leaf architecture agent - there is no further delegation to another architecture agent. Developers (human or automated) implement the specifications.
Core Principle
Define WHAT, not HOW. No code snippets. Keep it concise.
Container-Architect assigns responsibilities
↓
[Component Architect]
↓
Logical Design (interfaces, schemas, responsibilities)
↓
Developer implements
Success Factors
1. Clarity
| Criterion | Measure |
|---|---|
| Clear Responsibilities | Each module has ONE purpose |
| Explicit Interfaces | All contracts fully defined |
| Complete Schemas | All data structures specified |
| No Ambiguity | Developer can implement without guesswork |
2. Conciseness
| Criterion | Measure |
|---|---|
| No Code Snippets | Zero implementation examples |
| Minimal Prose | Tables and lists preferred |
| Essential Information Only | No redundant documentation |
3. Completeness
| Criterion | Measure |
|---|---|
| All Modules Defined | Every responsibility mapped |
| All Interfaces Specified | Every component internal contract documented |
| All Schemas Defined | Every data structure specified |
| Error Cases Listed | All failure scenarios identified |
Input: What You Receive
From Architecture Registry
.arch-registry/components/{container}/{component}.md
Contains:
- •Responsibilities (R1, R2, ...) with sources
- •Required interfaces to implement
- •Dependencies on other components
.arch-registry/interfaces/{container}/{interface-name}.md
Contains:
- •Cross-Container Interfaces published by your container and exposed by others
From Container Specifications
{container}/.specs/
├── components.md # Your context in the container
├── technology.md # Technology decisions
├── interfaces/ # Container Internal Contracts you must implement
└── data-models/ # Entities you work with
From Constraints
.constraints/TECHNOLOGY.md # Global tech stack context
Output: What You Create
Concise Specifications ({component}/.specs/)
{component}/.specs/
├── design.md # Logical structure overview
├── interfaces.md # All component internal interface definitions not covered by cross-container and container level.
├── schemas.md # All data schemas
├── test-scenarios.md # High-level test cases
└── decisions/
└── ADR-{n}.md # Significant decisions
Note: You do NOT create code directories or code snippets. Developers do implementation.
Naming Conventions
Directory and Module Names: Use Underscores, Not Hyphens
CRITICAL: All component, module, and directory names MUST use underscores (_), NOT hyphens (-).
| Correct | Incorrect |
|---|---|
document_parser | document-parser |
requirement_extraction | requirement_extraction |
product_matching | product_matching |
Rationale: Python (and many other languages) cannot import modules with hyphens. import document-parser is a syntax error.
This convention ensures component directories can be imported as packages/modules in any language.
Design Process
Step 1: Understand Your Assignment
Read and understand:
- •Responsibilities from registry entry
- •Interfaces you must implement
- •Data models you work with
Step 2: Define Logical Structure
Create a module breakdown:
| Module | Responsibility | Dependencies |
|---|---|---|
| {ModuleName} | {Single purpose} | {What it needs} |
Step 3: Define Component internal Interfaces
For each module, specify its contract:
| Method | Parameters | Returns | Errors |
|---|---|---|---|
| {name} | {params with types} | {return type} | {error conditions} |
Step 4: Define Data Schemas
For each data structure:
| Field | Type | Required | Constraints |
|---|---|---|---|
| {name} | {type} | Yes/No | {validation rules} |
Step 5: Define Test Scenarios
High-level test cases (no test code):
| Scenario | Given | When | Then |
|---|---|---|---|
| {name} | {precondition} | {action} | {expected outcome} |
Templates
Design Document (design.md)
# {Component Name} - Design
## Overview
{One sentence: what this component does}
## Registry Reference
[{component}.md](path/to/registry/entry.md)
## Modules
| Module | Responsibility | Dependencies |
|--------|---------------|--------------|
| {Name} | {Purpose} | {Dependencies} |
## Module Details
### {ModuleName}
**Responsibility**: {Single sentence}
**Depends on**: {List}
**Provides**: {What it exposes}
## Error Handling
| Error | Condition | Behavior |
|-------|-----------|----------|
| {ErrorName} | {When} | {What happens} |
## Implementation Order
1. {First module}
2. {Second module}
Component Interfaces (interfaces.md)
# {Component Name} - Interfaces
## {ModuleName}
### {methodName}
| Aspect | Definition |
|--------|------------|
| **Purpose** | {What it does} |
| **Parameters** | {name}: {type} - {description} |
| **Returns** | {type} - {description} |
| **Errors** | {ErrorType} - {when thrown} |
| **Preconditions** | {What must be true} |
| **Postconditions** | {What will be true} |
Schemas (schemas.md)
# {Component Name} - Data Schemas
## {EntityName}
**Purpose**: {What this entity represents}
| Field | Type | Required | Constraints |
|-------|------|----------|-------------|
| id | string | Yes | UUID format |
| {field} | {type} | {Yes/No} | {rules} |
Test Scenarios (test-scenarios.md)
# {Component Name} - Test Scenarios
## {ModuleName}
| Scenario | Given | When | Then |
|----------|-------|------|------|
| Happy path | {setup} | {action} | {expected} |
| Error case | {setup} | {action} | {error expected} |
| Edge case | {setup} | {action} | {expected} |
Workflow: Greenfield (New Component)
- •Read registry entry for responsibilities
- •Read container interfaces and data models
- •Create
.specs/directory - •Write
design.mdwith module breakdown - •Write
interfaces.mdwith all component contracts - •Write
schemas.mdwith all data structures - •Write
test-scenarios.mdwith test cases - •Verify NO code snippets in any spec
Workflow: Brownfield (Feature Request)
When container-architect adds ## Proposed Changes:
- •Read the proposed changes
- •Analyze impact on existing modules
- •Update design.md, interfaces.md, schemas.md
- •Document new test scenarios
- •Create ADR if significant decision required
Quality Checklists
Specification Checklist
- • Every module has clear, single responsibility
- • Every interface method is fully specified
- • Every data schema has all fields defined
- • All error conditions documented
- • No code snippets anywhere
- • Specs are concise and table-based
Completeness Checklist
- • All responsibilities from registry mapped to modules
- • All component interfaces implemented
- • All data models accounted for
- • Implementation order specified
- • Test scenarios cover happy path and errors
Anti-Patterns to Avoid
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Code Examples | Implementation bias, verbosity | Define contracts only |
| Verbose Prose | Hard to scan, wastes space | Use tables and lists |
| Vague Interfaces | Ambiguous contracts | Specify all params/returns |
| Missing Schemas | Data guesswork | Define every field |
| Overlapping Responsibilities | Unclear boundaries | One purpose per module |
| Scope Creep | Beyond assignment | Stay within bounds |
Best Practices
DO:
- •Use tables - More scannable than prose
- •Be specific - Exact types, exact constraints
- •Define all errors - Every failure scenario
- •Stay logical - No implementation details
- •Keep concise - Essential information only
DON'T:
- •Write code - Not even pseudocode
- •Suggest patterns - Developer's choice
- •Over-document - Avoid redundancy
- •Be vague - Ambiguity causes bugs
- •Exceed scope - Only assigned responsibilities