Skill 09 · Human Architect Mindset
Subchapter 9.3
REFERENCE.mdMarkdown22 KBView on GitHub
Deep technical reference material for the foundation and each pillar.
BETRAYAL ←──────────────────────────────────→ LOYALTY
Rewrite everything Evolve incrementally
Chase every trend Stick with proven choices
Break APIs freely Maintain backwards compatibility
Abandon on difficulty Push through problems
Optimize locally Sacrifice for coherenceThe Endless Pivot
The Greenfield Fallacy
The Trend Chase
The Premature Abstraction
The Shiny Object Syndrome
Decision Records
Commitment Windows
Deprecation Rituals
The Strangler Fig
| Situation | Optimization Response | Loyal Response |
|---|---|---|
| New framework is 20% faster | Migrate | Profile YOUR code first |
| Dependency has security issue | Replace entirely | Patch or fork |
| Team wants to try new tech | Greenfield project | Master current stack |
| Performance is “slow” | Rewrite | Measure, optimize, iterate |
| Code feels “messy” | Full refactor | Incremental improvement |
Even then, prefer evolution over revolution.
Use this template to define unbreakable rules for a project.
<constitution project="[PROJECT-NAME]" version="[VERSION]" effective_date="[DATE]">
<tech_stack>
<language name="TypeScript" version="5.3.x" />
<framework name="Next.js" version="14.x" />
<database name="PostgreSQL" version="16.x" />
<runtime name="Node.js" version="20.x" />
</tech_stack>
<directory_structure>
<rule>src/ - All source code</rule>
<rule>src/components - React components</rule>
<rule>src/services - Business logic</rule>
<rule>src/types - TypeScript types/interfaces</rule>
<rule>tests/ - All test files (mirror src/)</rule>
</directory_structure>
<naming_conventions>
<rule type="files">kebab-case.ts for files</rule>
<rule type="components">PascalCase for React components</rule>
<rule type="functions">camelCase for functions</rule>
<rule type="constants">SCREAMING_SNAKE_CASE for constants</rule>
<rule type="types">PascalCase with prefix (IUser, TResponse)</rule>
</naming_conventions>
<anti_patterns>
<forbidden pattern="any" reason="Type safety violation">
<detection>TypeScript strict mode</detection>
</forbidden>
<forbidden pattern="console.log" reason="Use structured logging">
<detection>ESLint no-console rule</detection>
</forbidden>
<forbidden pattern="string concatenation for SQL" reason="SQL injection risk">
<detection>Security linter + code review</detection>
</forbidden>
</anti_patterns>
<performance_budgets>
<budget metric="API p95 latency" limit="200ms" />
<budget metric="Bundle size" limit="500KB" />
<budget metric="Memory per instance" limit="512MB" />
</performance_budgets>
<testing_requirements>
<requirement type="unit" coverage_minimum="80%" />
<requirement type="integration" coverage_minimum="70%" />
<requirement type="e2e" flows="all critical user journeys" />
</testing_requirements>
</constitution>| Quality Dimension | Human Standard | Superhuman Standard | Verification Method |
|---|---|---|---|
| Naming | Mostly consistent | Zero collisions, 100% convention compliance | Automated linting + namespace analysis |
| Test Coverage | 70-80% lines | 100% branches, all edge cases | Coverage tools with branch analysis |
| Structure | Generally follows patterns | Mathematically consistent (every file same shape) | AST analysis + pattern matching |
| Traceability | Comments mention tickets | // Implements: REQ-AUTH-001 on every function | Traceability matrix automation |
| Documentation | Key APIs | Every public interface fully documented | Documentation coverage tools |
| Error Handling | Happy path + common errors | Every error state explicitly handled | Error path analysis |
| Type Safety | No any, mostly typed | Zero implicit types, no casts | TypeScript strict mode |
| Dependencies | Up to date | Pinned versions, security-scanned | Dependency analysis tools |
# Traceability Matrix
## Requirements to Tasks
| Requirement ID | Description | Tasks | Status |
|----------------|-------------|-------|--------|
| REQ-AUTH-001 | User can register with email | TASK-AUTH-001, TASK-AUTH-002 | ✓ |
| REQ-AUTH-002 | Email must be unique | TASK-AUTH-003 | ✓ |
| REQ-AUTH-003 | Password meets strength requirements | TASK-AUTH-004, TASK-AUTH-005 | In Progress |
## Tasks to Code
| Task ID | Description | Files Modified | Tests |
|---------|-------------|----------------|-------|
| TASK-AUTH-001 | Create User entity | src/entities/user.ts | tests/entities/user.test.ts |
| TASK-AUTH-002 | Create registration endpoint | src/routes/auth.ts | tests/routes/auth.test.ts |
| TASK-AUTH-003 | Add email uniqueness validation | src/services/auth.ts | tests/services/auth.test.ts |
## Coverage Summary
- Requirements covered: 12/15 (80%)
- Tasks completed: 8/12 (67%)
- Test coverage: 85% lines, 78% branches
- Documentation coverage: 100% public APIs<task_spec id="TASK-[DOMAIN]-[SEQUENCE]" priority="[POSITION]">
<title>[One-line description]</title>
<implements>
<requirement ref="REQ-[DOMAIN]-[###]" />
</implements>
<input_context_files>
<file path="constitution.xml" purpose="Rules and standards" />
<file path="src/types/user.ts" purpose="Type definitions" />
</input_context_files>
<definition_of_done>
<signature>
export async function registerUser(dto: RegisterUserDto): Promise<User>
</signature>
<tests_pass>true</tests_pass>
<coverage_minimum>80%</coverage_minimum>
</definition_of_done>
<constraints>
<constraint>Use bcrypt for password hashing (cost factor 12)</constraint>
<constraint>Email validation per RFC 5322</constraint>
<constraint>Return 409 Conflict if email exists</constraint>
</constraints>
<dependencies>
<depends_on task="TASK-AUTH-001" reason="User entity must exist first" />
</dependencies>
<verification>
<command>npm test -- --grep "registerUser"</command>
<command>npm run typecheck</command>
<command>npm run lint</command>
</verification>
</task_spec><product_intent id="INT-[DOMAIN]-[##]">
<problem>
[What pain point are we solving? For whom?]
</problem>
<desired_outcome>
[What will be true when this is solved? Include metrics.]
</desired_outcome>
<success_metric>
[How do we measure success? What threshold defines success?]
</success_metric>
<constraints>
[What cannot change? Regulatory requirements, business rules, etc.]
</constraints>
</product_intent>Domain modeling is understanding the problem space - not the solution space.
Solution space: APIs, databases, frameworks, deployment Problem space: Users, their needs, business rules, regulatory requirements
Most technical failures are domain failures. The code works perfectly; it just solves the wrong problem.
For any new domain, ask:
Who are the actors?
What are the entities?
What are the processes?
What are the rules?
What’s the vocabulary?
Event Storming:
Domain Expert Interviews:
"Walk me through a typical [process]."
"What happens when [unusual case]?"
"What does [term] mean to you?"
"How would you know if [process] succeeded?"
"What's the worst thing that could happen?"Document Analysis:
Systems thinking sees relationships, not just components.
Component thinking: “The database stores user data.” Systems thinking: “Changes to user data propagate to search indexes, analytics pipelines, backup systems, and audit logs.”
1. Direct Dependencies
2. Indirect Dependencies
3. Reverse Dependencies
4. Shared Dependencies
1. Crash Failures
2. Omission Failures
3. Timing Failures
4. Byzantine Failures
5. Silent Failures
For any change, trace the cascade:
CHANGE: [What's changing]
DIRECT IMPACT:
- [ ] Component A: [How affected]
- [ ] Component B: [How affected]
INDIRECT IMPACT:
- [ ] What depends on A: [How affected]
- [ ] What depends on B: [How affected]
FAILURE MODES:
- [ ] If change fails: [What breaks]
- [ ] If change succeeds but is wrong: [What breaks]
- [ ] If change is slow: [What breaks]
DETECTION:
- [ ] How do we know change succeeded?
- [ ] How do we know change failed?
- [ ] How long until we know?
RECOVERY:
- [ ] Can we rollback?
- [ ] What's the rollback impact?
- [ ] What's manual recovery process?The Four Golden Signals (from Google SRE):
For each system, define:
Existing Systems:
Infrastructure:
Technical Debt:
Team Structure:
Process:
Knowledge:
Resources:
Compliance:
Strategic:
These are real. Ignoring them fails projects.
Power Dynamics:
Relationships:
Incentives:
Work Within:
Negotiate:
Escalate:
Ignore:
Properties of well-bounded AI tasks:
Clear Input Specification
Clear Output Specification
Verifiable Success Criteria
Bounded Scope
Context Independence
The Vague Task:
BAD: "Improve the code quality"
WHY: No measurable output, no verification
BETTER: "Add input validation to function X
that rejects strings longer than 100 chars"The Unbounded Task:
BAD: "Fix all the bugs"
WHY: No clear scope, no end condition
BETTER: "Fix the null pointer exception in
function X when input.name is undefined"The Context-Dependent Task:
BAD: "Write it the way our team does"
WHY: Requires knowledge AI doesn't have
BETTER: "Write a function following this example's
style: [specific example included]"The Judgment Task:
BAD: "Decide if we should use Redis or Postgres"
WHY: Requires tradeoff analysis, domain context
BETTER: "List pros/cons of Redis vs Postgres for
storing session data with these requirements: [specific]"Step 1: Identify the outcome
Step 2: List the sub-tasks
Step 3: For each sub-task, evaluate:
Step 4: Define boundaries
Step 5: Plan integration
After each AI task, verify:
Verification methods:
Sequential:
Task A → Verify → Task B → Verify → Task C → Verify → IntegrateUse when: Tasks have dependencies
Parallel:
Task A ↘
Task B → Verify All → Integrate
Task C ↗Use when: Tasks are independent
Iterative:
Task A → Verify → Feedback → Task A' → Verify → DoneUse when: First attempt may need refinement
Before implementing, answer:
PROJECT: [Name]
ASSUME THIS FAILS. What went wrong?
DOMAIN FAILURES:
- [ ] We misunderstood [domain concept]
- [ ] Users actually needed [different thing]
- [ ] Regulation required [thing we didn't know]
SYSTEMS FAILURES:
- [ ] Dependency [X] changed/failed
- [ ] Scale exceeded [Y]
- [ ] Performance hit [threshold]
CONSTRAINT FAILURES:
- [ ] Team [X] blocked us because [Y]
- [ ] Budget ran out before [milestone]
- [ ] Compliance issue with [requirement]
AI TASK FAILURES:
- [ ] Task boundaries were unclear
- [ ] Verification missed [issue]
- [ ] Integration failed at [point]
FOR EACH FAILURE MODE:
- Likelihood: High / Medium / Low
- Impact: Critical / Major / Minor
- Prevention: [What we'll do to prevent]
- Detection: [How we'll know if happening]
- Mitigation: [What we'll do if it happens]After a failure:
INCIDENT: [Description]
DATE: [When]
DURATION: [How long]
IMPACT: [What was affected]
TIMELINE:
- [Time]: [What happened]
- [Time]: [What happened]
- ...
ROOT CAUSE:
[The actual root cause, not just the trigger]
CONTRIBUTING FACTORS:
- [ ] [Factor 1]
- [ ] [Factor 2]
WHAT WORKED:
- [ ] [Thing that helped]
- [ ] [Thing that helped]
WHAT DIDN'T WORK:
- [ ] [Thing that failed]
- [ ] [Thing that failed]
ACTION ITEMS:
- [ ] [Specific action] - Owner: [Name] - Due: [Date]
- [ ] [Specific action] - Owner: [Name] - Due: [Date]
ARCHITECTURAL LESSONS:
- Domain: [What we learned about the problem space]
- Systems: [What we learned about dependencies/failures]
- Constraints: [What constraints we missed]
- AI Tasks: [What we learned about decomposition]| Dependency | Owner | Stability | Fallback | Monitoring | Risk |
|------------|-------|-----------|----------|------------|------|
| [Name] | [Who] | H/M/L | [What] | [How] | H/M/L|
| [Name] | [Who] | H/M/L | [What] | [How] | H/M/L|Risk = Impact if fails × Likelihood of failure
For HIGH risk dependencies:
For architectural decisions, document:
DECISION: [What was decided]
DATE: [When]
STATUS: Proposed / Accepted / Deprecated / Superseded
CONTEXT:
[Why is this decision needed?]
CONSTRAINTS:
- Technical: [What technical constraints apply]
- Organizational: [What org constraints apply]
- Business: [What business constraints apply]
OPTIONS CONSIDERED:
Option 1: [Name]
- Description: [What this option is]
- Pros: [Benefits]
- Cons: [Drawbacks]
- Fit with constraints: [How it fits]
Option 2: [Name]
- Description: [What this option is]
- Pros: [Benefits]
- Cons: [Drawbacks]
- Fit with constraints: [How it fits]
DECISION:
[What we decided and why]
CONSEQUENCES:
- Positive: [What good things result]
- Negative: [What trade-offs we're making]
- Risks: [What could go wrong]
AI DECOMPOSITION (if applicable):
- Tasks identified: [List]
- Verification approach: [How]
- Human checkpoints: [Where]Before ANY architecture work:
Can this ship? Check:
For each AI task:
This file
Nearby