architect-first
Architect First
Overview
This skill embodies the "Architect-First" development philosophy: Perfect architecture, pragmatic execution, quality guaranteed by tests. Apply this skill when making architectural decisions, starting new features, refactoring existing systems, or when quality gates need to be enforced.
The core principle: Architecture and documentation are non-negotiable and must precede implementation. Code quality is negotiable IF backed by tests as a safety net (escape hatch).
Core Philosophy
Mantra
"Arquitetura perfeita, execução pragmática, qualidade garantida por testes"
Quality Gates
Non-Negotiable (STOP if violated):
- Architecture: Complete design and documentation BEFORE any code
- Documentation: Must precede and accompany implementation
- Capability Preservation: Never lose capability/granularity vs previous versions
- Zero Coupling: Expansion packs must be independent
- Multi-Agent Validation: Structural decisions validated by PO/Architect/User
Negotiable (with escape hatch):
- Code Style: Acceptable if backed by tests as safety net
- Feature Completeness: 80% acceptable IF core use case works
- Quick & Dirty Code: Allowed ONLY with test plan and minimal logging
Decision Modes
Architect-First Mode (default):
- Design and document completely before coding
- Map structure and pointers before proposing implementation
- Validate architecture with multiple agents/perspectives
- Externalize all mutable configurations to YAML
Fast Mode (post-validation only):
- Binary decisions and rapid delegation
- Activated ONLY after architectural validation is complete
- Speed through automation, not shortcuts
Workflow Decision Tree
New Task/Feature Request
↓
┌──────────────────────────────────────┐
│ Is this a structural/architectural │
│ decision? │
└──────────────────────────────────────┘
↓ YES ↓ NO
↓ ↓
[Architecture Flow] [Execution Flow]
Architecture Flow (Structural Decisions)
STOP and follow this sequence:
-
Map Before Modify
- Document current state completely
- Identify all dependencies and touch points
- Create architectural diagrams/flows
- Load
references/architecture-checklist.mdfor validation
-
Multi-Agent Validation
- Present A/B/C options with explicit trade-offs
- Get validation from:
- Product Owner (business alignment)
- Architect (technical soundness)
- User (final decision)
- Document decision rationale
-
Design Documentation
- Complete design document BEFORE code
- Include:
- System architecture diagrams
- Component interactions
- Data flows
- Configuration schema (YAML)
- Integration points
- Use templates from
assets/architecture-template.md
-
Gold Standard Baseline
- Ensure new design meets/exceeds capability baseline
- Validate: Does this maintain ALL previous capabilities?
- STOP if capability loss detected → restore or redesign
-
Zero Coupling Validation
- Run validation script:
scripts/check_coupling.py - Ensure expansion pack independence
- No hardcoded cross-module dependencies
- Run validation script:
-
Proceed to Implementation
- Now and only now: write code
- Follow execution flow for implementation
Execution Flow (Implementation)
-
Pre-Implementation Checklist
- Architecture documented and validated?
- Core use case clearly defined?
- Configuration externalized to YAML?
- Test strategy defined?
- Use
references/pre-implementation-checklist.md
-
Test-Driven Safety Net
- Define test plan FIRST
- Identify logging/observation points
- Tests permit temporary imperfection (escape hatch)
- Quality validation via: tests + logs + manual inspection
-
Implementation Style
ACCEPTABLE: ✓ "Ugly" code WITH comprehensive tests ✓ 80% feature completeness IF core case works ✓ Quick implementation WITH test plan + logging REJECTED: ✗ "Ugly" code WITHOUT tests ✗ Capability loss without explicit justification ✗ Hardcoded mutable values (must be YAML) ✗ Deployment without core case working -
Debugging Philosophy
- Observational via logs (console/logging) > static analysis
- Add strategic log points before debugging
- Inspect actual runtime behavior
- Validate through execution, not just reading code
-
Documentation
- Update docs as code evolves
- Keep short and actionable: "How to customize"
- Include code examples
- Document configuration options
Heuristics (Decision Rules)
Apply these heuristics when making decisions:
- Gold Standard Baseline: 22 artifacts minimum (adjust to your context)
- Never Lose Capability: Accumulate, never reduce
- Architect Before Build: Design/docs before code, always
- Zero Coupling, Max Modularity: Independent expansion packs
- Config > Hardcoding: Externalize to YAML for all mutable values
- Map Before Modify: Document structure before changing it
- Binary Decision Post-Validation: Fast execution after architectural validation
- Speed via Automation: Not via shortcuts or cutting corners
- Quality Escape Hatch: Tests permit temporary imperfection
Stop Rules (Hard Boundaries)
STOP immediately if detecting:
- ⛔ Capability loss vs baseline
- ⛔ Structural decision without multi-agent validation
- ⛔ Coupling between modules
- ⛔ Missing architectural documentation
- ⛔ Quick & dirty code WITHOUT test plan and logs
- ⛔ Hardcoded mutable configuration values
When stopped, consult references/stop-rules-guide.md for remediation.
Risk Mitigation
Common risks and their mitigations:
| Risk | Mitigation Strategy |
|---|---|
| Excessive planning | Time-box + mandatory POC before full formalization |
| Perfectionism cascade | Rule of 3: simple pilot → 2 iterations → formalize |
| Premature configuration | Generalize only after ≥2 real scenarios |
| Context switching | Checklist of pending items at each pivot |
Use scripts/validate_risk_mitigation.py to check risk mitigation coverage.
Collaboration Contract
When working with this skill, follow these collaboration patterns:
✓ Do:
- Present A/B/C options with explicit trade-offs
- Map structure and pointers before proposing code
- Externalize configs in YAML; nothing mutable hardcoded
- Deliver short, actionable docs ("how to customize")
- For quick code: include test plan and log points
- Document pending items when pivoting
✗ Don't:
- Propose code without architectural context
- Hardcode values that might change
- Skip multi-agent validation on structural changes
- Write "quick & dirty" without tests
- Make architectural decisions unilaterally
Acceptance Criteria
Will Accept
- ✓ "Ugly" code WITH comprehensive tests
- ✓ 80% features IF core case covered
- ✓ Large refactors that increase flexibility
- ✓ Extensive documentation if it teaches customization
Will Reject
- ✗ "Ugly" code WITHOUT tests
- ✗ Capability loss without explicit justification
- ✗ Hardcoded mutable values
- ✗ Deployment without core case working
Unknown Areas (For Future Refinement)
Areas not yet fully defined in the philosophy:
- Hotfix philosophy (production emergencies)
- Performance thresholds (latency/throughput minimums)
- Code duplication tolerance (when to refactor)
- Observability targets (log levels, correlation, tracing)
When encountering these areas, apply the core heuristics and document decisions for future refinement.
Resources
scripts/
Validation and automation scripts:
check_coupling.py- Validates zero-coupling principlevalidate_risk_mitigation.py- Checks risk coveragearchitecture_validator.py- Validates architectural completeness
references/
Detailed checklists and guides:
architecture-checklist.md- Complete architecture validation checklistpre-implementation-checklist.md- Pre-coding validationstop-rules-guide.md- Remediation guide when stop rules triggertesting-strategy-guide.md- Test-driven development patterns
assets/
Templates for consistent outputs:
architecture-template.md- Standard architecture document templateconfig-template.yaml- Configuration externalization templateadr-template.md- Architecture Decision Record template
Quick Reference
Starting a new feature:
- Map current architecture (
references/architecture-checklist.md) - Design with A/B/C options
- Multi-agent validation
- Document architecture (
assets/architecture-template.md) - Define tests
- Implement with logging
- Validate and iterate
Making architectural changes:
- STOP - Do not code yet
- Document current state completely
- Present options with trade-offs
- Get PO/Architect/User validation
- Check coupling (
scripts/check_coupling.py) - Document decision (
assets/adr-template.md) - Now implement
Quick implementation (with safety net):
- Pre-implementation checklist
- Define test plan
- Add log points
- Implement (can be "ugly")
- Verify tests pass
- Inspect logs
- Refactor if needed
More from synkraai/aios-core
aiox-po
Product Owner (Pax). Use for backlog management, story refinement, acceptance criteria, sprint planning, and prioritization decisions
1aiox-dev
Full Stack Developer (Dex). Use for code implementation, debugging, refactoring, and development best practices
1aiox-qa
Test Architect & Quality Advisor (Quinn). Use for comprehensive test architecture review, quality gate decisions, and code improvement. Provides thorough analysis including requ...
1aiox-pm
Product Manager (Morgan). Use for PRD creation (greenfield and brownfield), epic creation and management, product strategy and vision, feature prioritization (MoSCoW, RICE), roa...
1aiox-sm
Scrum Master (River). Use for user story creation from PRD, story validation and completeness checking, acceptance criteria definition, story refinement, sprint planning, backlo...
1aiox-master
AIOX Master Orchestrator & Framework Developer (Orion). Use when you need comprehensive expertise across all domains, framework component creation/modification, workflow orchest...
1