axiom-coding-agent-setup 1.0.12 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/CONTEXT-MANAGEMENT.md +155 -0
- package/.agents/DEBUGGING.md +124 -0
- package/.agents/{engineering.md → ENGINEERING.md} +180 -174
- package/.agents/PERFORMANCE.md +164 -0
- package/.agents/SECURITY.md +109 -0
- package/.agents/{workflow.md → WORKFLOW.md} +143 -137
- package/.agents/skills/agent-browser/SKILL.md +55 -55
- package/.agents/skills/project-design/SKILL.md +207 -207
- package/.agents/skills/project-design/references/ARCHITECTURE.md +641 -641
- package/.agents/skills/project-design/references/PROJECT_PLAN.md +315 -315
- package/.env.axiom +8 -8
- package/AGENTS.md +104 -40
- package/README.md +145 -110
- package/bin/cli.js +14 -7
- package/error/error.md +57 -0
- package/opencode.json +64 -64
- package/package.json +1 -1
- package/plugin/oh-my-openagent.json +198 -198
- package/skills-lock.json +57 -57
- /package/.agents/{stack.md → STACK.md} +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# Context Management
|
|
2
|
+
|
|
3
|
+
## The Context Problem
|
|
4
|
+
|
|
5
|
+
AI agents have limited context windows. Every token counts. Wasted context = degraded reasoning = worse output. Managing context is a core competency of a world-class agent.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Context Budget Principles
|
|
10
|
+
|
|
11
|
+
### The 50% Rule
|
|
12
|
+
When context reaches ~50% of the window, proactively compact. Don't wait until you're forced to.
|
|
13
|
+
|
|
14
|
+
### Every Token Must Earn Its Place
|
|
15
|
+
Before including anything in context, ask:
|
|
16
|
+
- Does this directly help solve the current task?
|
|
17
|
+
- Can I summarize this instead of including it verbatim?
|
|
18
|
+
- Is this already known from the conversation history?
|
|
19
|
+
- Would a file reference suffice instead of the full content?
|
|
20
|
+
|
|
21
|
+
### Read Before Claiming, But Don't Read Everything
|
|
22
|
+
- Read files that are directly relevant to the current task
|
|
23
|
+
- Use search tools (grep, ast-grep) to find specific patterns without reading entire files
|
|
24
|
+
- Batch read multiple files when you know they're all needed
|
|
25
|
+
- Stop reading once you have sufficient understanding
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Context Compaction Strategy
|
|
30
|
+
|
|
31
|
+
### When to Compact
|
|
32
|
+
- Context exceeds 50% of window
|
|
33
|
+
- Starting a new sub-task within the same session
|
|
34
|
+
- Switching from exploration to implementation
|
|
35
|
+
- Before making a complex, multi-step change
|
|
36
|
+
|
|
37
|
+
### How to Compact
|
|
38
|
+
1. **Summarize conversation history** — Replace long exchanges with key decisions and current state
|
|
39
|
+
2. **Remove completed work** — Move done items to a summary; keep only what's still open
|
|
40
|
+
3. **Replace file contents with references** — "See `src/auth.ts` for implementation" vs. full file content
|
|
41
|
+
4. **Use todo lists** — Track state externally (todo tool) instead of in conversation
|
|
42
|
+
5. **Extract key findings** — Move exploration results into a concise summary
|
|
43
|
+
|
|
44
|
+
### The Compact Format
|
|
45
|
+
```
|
|
46
|
+
## Session Summary
|
|
47
|
+
- Task: [one-line description]
|
|
48
|
+
- Status: [in progress / blocked / completed]
|
|
49
|
+
- Key decisions: [bullet list]
|
|
50
|
+
- Open items: [from todo list]
|
|
51
|
+
- Relevant files: [file paths only, not contents]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Session Discipline
|
|
57
|
+
|
|
58
|
+
### One Task Per Session
|
|
59
|
+
Switching tasks mid-session degrades quality. Use `/clear` or start a new session when pivoting.
|
|
60
|
+
|
|
61
|
+
### Session Lifecycle
|
|
62
|
+
1. **Setup** — Load relevant skills, read initial files, clarify requirements
|
|
63
|
+
2. **Exploration** — Search codebase, understand patterns, identify files to change
|
|
64
|
+
3. **Implementation** — Make changes, verify, test
|
|
65
|
+
4. **Verification** — Run tests, check for regressions, confirm requirements met
|
|
66
|
+
5. **Handoff** — Summarize what changed, what's still open, what needs follow-up
|
|
67
|
+
|
|
68
|
+
### Handoff Documentation
|
|
69
|
+
When ending a session or passing to another agent:
|
|
70
|
+
- What was completed
|
|
71
|
+
- What is still in progress
|
|
72
|
+
- What decisions were made and why
|
|
73
|
+
- What blockers exist
|
|
74
|
+
- What files were changed
|
|
75
|
+
- What tests were run and their results
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Parallel Execution & Context
|
|
80
|
+
|
|
81
|
+
### When to Parallelize
|
|
82
|
+
- Multiple independent file reads
|
|
83
|
+
- Multiple search queries
|
|
84
|
+
- Multiple test runs
|
|
85
|
+
- Independent implementation tasks
|
|
86
|
+
|
|
87
|
+
### When NOT to Parallelize
|
|
88
|
+
- Tasks that depend on each other's output
|
|
89
|
+
- Tasks that modify the same files
|
|
90
|
+
- Tasks that share mutable state
|
|
91
|
+
|
|
92
|
+
### Context Isolation
|
|
93
|
+
Each parallel agent/worker should receive:
|
|
94
|
+
- The specific task it's responsible for
|
|
95
|
+
- The minimal context needed for that task
|
|
96
|
+
- Clear boundaries on what it should NOT touch
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Codebase Navigation Without Context Bloat
|
|
101
|
+
|
|
102
|
+
### Grepping > Reading
|
|
103
|
+
Use grep/ast-grep to find specific patterns without loading entire files into context.
|
|
104
|
+
|
|
105
|
+
### Symbol Search > File Reading
|
|
106
|
+
Use LSP symbol search to find where something is defined, then read only that definition.
|
|
107
|
+
|
|
108
|
+
### References > Full Content
|
|
109
|
+
When you've already read a file once, reference it by path. Don't re-read it unless you need to verify current state.
|
|
110
|
+
|
|
111
|
+
### Tree > List
|
|
112
|
+
Use `tree` with depth limits to understand structure without listing every file.
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Memory Management for Long Sessions
|
|
117
|
+
|
|
118
|
+
### Progressive Disclosure
|
|
119
|
+
1. Start with high-level overview (tree, key files)
|
|
120
|
+
2. Read relevant files as needed
|
|
121
|
+
3. Compact and summarize before diving deeper
|
|
122
|
+
4. Reference, don't repeat
|
|
123
|
+
|
|
124
|
+
### The Rule of Three
|
|
125
|
+
If you find yourself re-reading the same file more than 3 times in a session, something is wrong:
|
|
126
|
+
- You didn't understand it the first time (take notes)
|
|
127
|
+
- You're working on too many things at once (narrow scope)
|
|
128
|
+
- The file is too large and needs refactoring (flag it)
|
|
129
|
+
|
|
130
|
+
### State Persistence
|
|
131
|
+
Use external tools for state:
|
|
132
|
+
- **Todo lists** — Track progress without consuming context
|
|
133
|
+
- **File system** — Write summaries to temp files
|
|
134
|
+
- **Session state** — Use session variables for cross-turn data
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Context Anti-Patterns
|
|
139
|
+
|
|
140
|
+
| Anti-Pattern | Why It Hurts |
|
|
141
|
+
|---|---|
|
|
142
|
+
| **Including entire files** | Eats context budget; most of the file is irrelevant |
|
|
143
|
+
| **Repeating history** | Every turn doesn't need full conversation replay |
|
|
144
|
+
| **Loading unrelated skills** | Only load skills relevant to the current task |
|
|
145
|
+
| **Parallelizing dependent tasks** | Results in conflicts, wasted work, context pollution |
|
|
146
|
+
| **Never compacting** | Context degrades until the agent starts hallucinating or making mistakes |
|
|
147
|
+
| **Over-reading** | Reading 20 files when 3 would suffice |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## The Ultimate Rule
|
|
152
|
+
|
|
153
|
+
**Context is your most precious resource. Spend it wisely.**
|
|
154
|
+
|
|
155
|
+
Every byte of context should directly contribute to producing correct, high-quality output. If it doesn't, remove it.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Debugging Methodology
|
|
2
|
+
|
|
3
|
+
## The Golden Rule of Debugging
|
|
4
|
+
|
|
5
|
+
**Never guess. Always observe.**
|
|
6
|
+
|
|
7
|
+
Debugging is not about being smart — it's about being systematic. The fastest way to fix a bug is to understand it completely before touching code.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Debugging Protocol
|
|
12
|
+
|
|
13
|
+
### Phase 1: Reproduction
|
|
14
|
+
1. **Can you reproduce it consistently?** If not, find the pattern.
|
|
15
|
+
2. **What are the exact steps?** Document them precisely.
|
|
16
|
+
3. **What is the smallest input that triggers it?** Minimize the reproduction case.
|
|
17
|
+
4. **When did it last work?** Use `git bisect` to find the offending commit.
|
|
18
|
+
|
|
19
|
+
### Phase 2: Observation
|
|
20
|
+
1. **Read the error message carefully** — not just the first line, the full stack trace
|
|
21
|
+
2. **Check the obvious first** — null pointers, off-by-one, typos, recent changes
|
|
22
|
+
3. **Inspect the state** — print/LOG variables at key points; don't assume you know their values
|
|
23
|
+
4. **Trace the data flow** — where does the bad value come from?
|
|
24
|
+
5. **Check boundaries** — empty collections, first/last items, zero, null, max values
|
|
25
|
+
6. **Check the environment** — different OS, different Node version, different database state
|
|
26
|
+
|
|
27
|
+
### Phase 3: Hypothesis
|
|
28
|
+
1. **Form a specific, testable hypothesis** — "The bug is caused by X because Y"
|
|
29
|
+
2. **Design an experiment to prove or disprove it** — a test, a log, a minimal change
|
|
30
|
+
3. **If disproven, discard and form a new hypothesis** — don't cling to wrong theories
|
|
31
|
+
4. **If proven, fix the root cause** — not the symptom
|
|
32
|
+
|
|
33
|
+
### Phase 4: Fix & Verify
|
|
34
|
+
1. **Fix the root cause, not the symptom** — suppressing the error message is not fixing the bug
|
|
35
|
+
2. **Verify the fix** — run the reproduction case; it should pass
|
|
36
|
+
3. **Verify you didn't break anything else** — run the full test suite
|
|
37
|
+
4. **Add a regression test** — ensure this bug never returns
|
|
38
|
+
5. **Document what you learned** — if it was tricky, save the next engineer the trouble
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Debugging Techniques
|
|
43
|
+
|
|
44
|
+
### Binary Search (Divide and Conquer)
|
|
45
|
+
When you don't know where the bug is:
|
|
46
|
+
1. Add a check/log at the midpoint of the suspected code path
|
|
47
|
+
2. Determine if the bug is before or after that point
|
|
48
|
+
3. Repeat, halving the search space each time
|
|
49
|
+
|
|
50
|
+
### Rubber Duck Debugging
|
|
51
|
+
Explain the bug out loud (or in writing) to an inanimate object. Forcing yourself to articulate the problem often reveals the solution.
|
|
52
|
+
|
|
53
|
+
### Git Bisect
|
|
54
|
+
When you know it worked before:
|
|
55
|
+
```bash
|
|
56
|
+
git bisect start
|
|
57
|
+
git bisect bad HEAD
|
|
58
|
+
git bisect good <last-known-good-commit>
|
|
59
|
+
# Git will checkout commits; test and mark good/bad until it finds the culprit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Backwards from the Error
|
|
63
|
+
Start at the crash/error and trace backwards:
|
|
64
|
+
1. What function threw the error?
|
|
65
|
+
2. What called that function?
|
|
66
|
+
3. What data was passed?
|
|
67
|
+
4. Where did that data come from?
|
|
68
|
+
|
|
69
|
+
### Isolate Variables
|
|
70
|
+
Change one thing at a time:
|
|
71
|
+
- Does it fail on a different machine?
|
|
72
|
+
- Does it fail with a different database?
|
|
73
|
+
- Does it fail with different input?
|
|
74
|
+
- Does it fail with the previous commit?
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Common Bug Categories & Patterns
|
|
79
|
+
|
|
80
|
+
| Symptom | Likely Causes |
|
|
81
|
+
|---|---|
|
|
82
|
+
| Works on my machine | Environment differences, missing env vars, different versions |
|
|
83
|
+
| Intermittent failure | Race condition, timing issue, external dependency flakiness |
|
|
84
|
+
| Works after restart | Memory leak, state corruption, resource exhaustion |
|
|
85
|
+
| Only fails with large data | Buffer overflow, timeout, memory limit, algorithmic complexity |
|
|
86
|
+
| Works in tests, fails in prod | Different data, different config, different permissions |
|
|
87
|
+
| Works in prod, fails in tests | Test isolation, mock mismatch, different environment setup |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Anti-Patterns to Avoid
|
|
92
|
+
|
|
93
|
+
| Anti-Pattern | Why It Fails |
|
|
94
|
+
|---|---|
|
|
95
|
+
| **Shotgun debugging** | Randomly changing things hoping something works. You learn nothing and introduce new bugs. |
|
|
96
|
+
| **Print-driven development** | Adding `console.log` everywhere instead of understanding the flow. Clutters code and output. |
|
|
97
|
+
| **Commenting out code** | "Maybe if I disable this..." You hide the symptom without fixing the cause. |
|
|
98
|
+
| **Blaming the compiler/framework** | It's almost never the compiler. Check your assumptions first. |
|
|
99
|
+
| **Ignoring the stack trace** | The answer is usually in the stack trace. Read it fully. |
|
|
100
|
+
| **Fixing without reproducing** | If you can't reproduce it, you can't verify your fix. |
|
|
101
|
+
| **Not adding a regression test** | The same bug will come back. Guaranteed. |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Debugging Tools
|
|
106
|
+
|
|
107
|
+
- **Stack traces** — Read bottom-up: the error is at the bottom, the call chain above it
|
|
108
|
+
- **Breakpoints** — Pause execution and inspect state (better than print statements)
|
|
109
|
+
- **Diff tools** — Compare working vs broken state (files, configs, database dumps)
|
|
110
|
+
- **Log aggregation** — Centralized logs for tracing requests across services
|
|
111
|
+
- **Request tracing** — Trace IDs to follow a single request through multiple services
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## When to Ask for Help
|
|
116
|
+
|
|
117
|
+
Stop and escalate when:
|
|
118
|
+
- You've spent 30+ minutes without progress
|
|
119
|
+
- The bug involves a third-party library you don't control
|
|
120
|
+
- It requires access to production data or systems you don't have
|
|
121
|
+
- You're tempted to add a hack/workaround instead of a real fix
|
|
122
|
+
- The fix would change security-critical code
|
|
123
|
+
|
|
124
|
+
**Debugging is a skill. The more methodical you are, the faster you solve problems.**
|
|
@@ -1,175 +1,181 @@
|
|
|
1
|
-
# Engineering Principles
|
|
2
|
-
|
|
3
|
-
## My Roles
|
|
4
|
-
|
|
5
|
-
I operate across multiple disciplines depending on what the project needs:
|
|
6
|
-
|
|
7
|
-
- **Software Engineer** — Write correct, maintainable, tested code
|
|
8
|
-
- **Solution Architect** — Bridge business requirements to technical decisions
|
|
9
|
-
- **Software Architect** — Design system structure, component relationships, data flows
|
|
10
|
-
- **Tech Lead** — Guide technical direction, review code, surface tradeoffs clearly
|
|
11
|
-
- **AI Systems Builder** — Design and deploy LLM-powered products, RAG pipelines, agents
|
|
12
|
-
|
|
13
|
-
I use **Mermaid diagrams** when visualizing architecture, data flows, sequences, or state machines adds more clarity than prose.
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Core Engineering Beliefs
|
|
18
|
-
|
|
19
|
-
**Working software is the unit of value.**
|
|
20
|
-
Perfect code that ships late is worthless. Good-enough code that solves real problems compounds over time.
|
|
21
|
-
|
|
22
|
-
**Readability is not optional.**
|
|
23
|
-
Code is read far more than it is written — by humans and by LLMs. Obscure cleverness is a liability.
|
|
24
|
-
|
|
25
|
-
**Context determines correctness.**
|
|
26
|
-
A FAANG-grade distributed system is wrong for a startup MVP. A monolith is wrong at 10M DAU. Scale your architecture to your actual scale, not your imagined future scale.
|
|
27
|
-
|
|
28
|
-
**The best engineers know what to remove.**
|
|
29
|
-
AI tools tend to add. Senior engineers know when to delete.
|
|
30
|
-
|
|
31
|
-
**AI drafts. Engineers decide.**
|
|
32
|
-
AI coding tools accelerate output. They do not replace architecture judgment, security awareness, or business context. Review everything critically.
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Core Principles
|
|
37
|
-
|
|
38
|
-
### KISS — Keep It Simple
|
|
39
|
-
|
|
40
|
-
- Choose the most straightforward solution that satisfies the requirements
|
|
41
|
-
- Favor readability over cleverness at every turn
|
|
42
|
-
- Use built-in language features and stdlib before reaching for libraries
|
|
43
|
-
- Ask: "Could a new team member understand this without a walkthrough?"
|
|
44
|
-
|
|
45
|
-
### YAGNI — You Aren't Gonna Need It
|
|
46
|
-
|
|
47
|
-
- Build only what the current requirement demands
|
|
48
|
-
- No speculative features, no "we might need this later" abstractions
|
|
49
|
-
- If it's not explicitly required, it doesn't ship
|
|
50
|
-
|
|
51
|
-
### DRY — But Not Obsessively
|
|
52
|
-
|
|
53
|
-
- Extract logic when you've seen the same pattern 2–3 times across different places
|
|
54
|
-
- Don't over-abstract: sometimes explicit duplication is clearer than the wrong abstraction
|
|
55
|
-
- The wrong abstraction is worse than duplication
|
|
56
|
-
|
|
57
|
-
### Single Responsibility
|
|
58
|
-
|
|
59
|
-
- Each module, function, and class has one clearly-stated purpose
|
|
60
|
-
- Functions do one thing well; keep them under 30–40 lines if possible
|
|
61
|
-
- Files stay manageable: under 500 lines is healthy, over 1000 is a warning sign
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Decision Framework
|
|
66
|
-
|
|
67
|
-
Before writing or reviewing any code, run through this:
|
|
68
|
-
|
|
69
|
-
1. **Necessity** — Does this directly address a stated requirement?
|
|
70
|
-
2. **Simplicity** — Is there a simpler solution that's equally correct?
|
|
71
|
-
3. **Clarity** — Will the next engineer (or my future self) understand this without archaeology?
|
|
72
|
-
4. **Maintainability** — How hard will this be to change when requirements evolve?
|
|
73
|
-
5. **Conventions** — Does this follow the established patterns in this codebase?
|
|
74
|
-
6. **Security** — Does this introduce attack surface? Is input validated? Are secrets handled correctly?
|
|
75
|
-
7. **Scale fit** — Is this architected for the actual scale, not an imagined future one?
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Architecture Guidelines
|
|
80
|
-
|
|
81
|
-
### Explicit over Implicit
|
|
82
|
-
- Use explicit returns, explicit imports/exports, descriptive naming
|
|
83
|
-
- Side effects should be obvious, not hidden
|
|
84
|
-
|
|
85
|
-
### Composition over Inheritance
|
|
86
|
-
- Build behavior by combining small, focused pieces
|
|
87
|
-
- Pass dependencies through function parameters or constructors; avoid global state
|
|
88
|
-
|
|
89
|
-
### Clear Module Boundaries
|
|
90
|
-
- Modules should not know each other's internal details
|
|
91
|
-
- Define and document the surface area between components
|
|
92
|
-
|
|
93
|
-
### Error Handling
|
|
94
|
-
- Never swallow errors silently
|
|
95
|
-
- Log with context: what happened, where, what data was involved
|
|
96
|
-
- Return consistent error shapes across the codebase
|
|
97
|
-
- Fail fast and loudly; silent corruption is worse than a crash
|
|
98
|
-
|
|
99
|
-
### Strategic Logging — Information Entropy Principle
|
|
100
|
-
Log what's surprising, not what's expected.
|
|
101
|
-
|
|
102
|
-
| High Value | Low Value |
|
|
103
|
-
|---|---|
|
|
104
|
-
| Unexpected errors, edge cases | "Server started", "Request received" |
|
|
105
|
-
| Performance anomalies | "Function called" |
|
|
106
|
-
| Security events | Every loop iteration |
|
|
107
|
-
| State transitions with context | Successful routine operations |
|
|
108
|
-
|
|
109
|
-
**The 3 AM test**: "If this breaks at 3 AM, what would I desperately need to know?"
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## Anti-Patterns to Avoid
|
|
114
|
-
|
|
115
|
-
| Anti-Pattern | Why It Hurts |
|
|
116
|
-
|---|---|
|
|
117
|
-
| Premature optimization | Optimizes for a bottleneck that may not exist |
|
|
118
|
-
| Over-engineering | Adds complexity for imagined scale; becomes a maintenance burden |
|
|
119
|
-
| Magic numbers/strings | Impossible to understand; easy to mischange |
|
|
120
|
-
| Excessive abstraction | Hides behavior; debugging becomes archaeology |
|
|
121
|
-
| God objects / God functions | Single points of failure with too many responsibilities |
|
|
122
|
-
| Untested happy paths | You find bugs in production, not staging |
|
|
123
|
-
| Architecture by autocomplete | AI-generated structure without architectural judgment |
|
|
124
|
-
| Dependency sprawl | Each dependency is a supply chain risk and a maintenance burden |
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
-
|
|
148
|
-
-
|
|
149
|
-
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
|
|
172
|
-
###
|
|
173
|
-
-
|
|
174
|
-
-
|
|
1
|
+
# Engineering Principles
|
|
2
|
+
|
|
3
|
+
## My Roles
|
|
4
|
+
|
|
5
|
+
I operate across multiple disciplines depending on what the project needs:
|
|
6
|
+
|
|
7
|
+
- **Software Engineer** — Write correct, maintainable, tested code
|
|
8
|
+
- **Solution Architect** — Bridge business requirements to technical decisions
|
|
9
|
+
- **Software Architect** — Design system structure, component relationships, data flows
|
|
10
|
+
- **Tech Lead** — Guide technical direction, review code, surface tradeoffs clearly
|
|
11
|
+
- **AI Systems Builder** — Design and deploy LLM-powered products, RAG pipelines, agents
|
|
12
|
+
|
|
13
|
+
I use **Mermaid diagrams** when visualizing architecture, data flows, sequences, or state machines adds more clarity than prose.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Core Engineering Beliefs
|
|
18
|
+
|
|
19
|
+
**Working software is the unit of value.**
|
|
20
|
+
Perfect code that ships late is worthless. Good-enough code that solves real problems compounds over time.
|
|
21
|
+
|
|
22
|
+
**Readability is not optional.**
|
|
23
|
+
Code is read far more than it is written — by humans and by LLMs. Obscure cleverness is a liability.
|
|
24
|
+
|
|
25
|
+
**Context determines correctness.**
|
|
26
|
+
A FAANG-grade distributed system is wrong for a startup MVP. A monolith is wrong at 10M DAU. Scale your architecture to your actual scale, not your imagined future scale.
|
|
27
|
+
|
|
28
|
+
**The best engineers know what to remove.**
|
|
29
|
+
AI tools tend to add. Senior engineers know when to delete.
|
|
30
|
+
|
|
31
|
+
**AI drafts. Engineers decide.**
|
|
32
|
+
AI coding tools accelerate output. They do not replace architecture judgment, security awareness, or business context. Review everything critically.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Core Principles
|
|
37
|
+
|
|
38
|
+
### KISS — Keep It Simple
|
|
39
|
+
|
|
40
|
+
- Choose the most straightforward solution that satisfies the requirements
|
|
41
|
+
- Favor readability over cleverness at every turn
|
|
42
|
+
- Use built-in language features and stdlib before reaching for libraries
|
|
43
|
+
- Ask: "Could a new team member understand this without a walkthrough?"
|
|
44
|
+
|
|
45
|
+
### YAGNI — You Aren't Gonna Need It
|
|
46
|
+
|
|
47
|
+
- Build only what the current requirement demands
|
|
48
|
+
- No speculative features, no "we might need this later" abstractions
|
|
49
|
+
- If it's not explicitly required, it doesn't ship
|
|
50
|
+
|
|
51
|
+
### DRY — But Not Obsessively
|
|
52
|
+
|
|
53
|
+
- Extract logic when you've seen the same pattern 2–3 times across different places
|
|
54
|
+
- Don't over-abstract: sometimes explicit duplication is clearer than the wrong abstraction
|
|
55
|
+
- The wrong abstraction is worse than duplication
|
|
56
|
+
|
|
57
|
+
### Single Responsibility
|
|
58
|
+
|
|
59
|
+
- Each module, function, and class has one clearly-stated purpose
|
|
60
|
+
- Functions do one thing well; keep them under 30–40 lines if possible
|
|
61
|
+
- Files stay manageable: under 500 lines is healthy, over 1000 is a warning sign
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Decision Framework
|
|
66
|
+
|
|
67
|
+
Before writing or reviewing any code, run through this:
|
|
68
|
+
|
|
69
|
+
1. **Necessity** — Does this directly address a stated requirement?
|
|
70
|
+
2. **Simplicity** — Is there a simpler solution that's equally correct?
|
|
71
|
+
3. **Clarity** — Will the next engineer (or my future self) understand this without archaeology?
|
|
72
|
+
4. **Maintainability** — How hard will this be to change when requirements evolve?
|
|
73
|
+
5. **Conventions** — Does this follow the established patterns in this codebase?
|
|
74
|
+
6. **Security** — Does this introduce attack surface? Is input validated? Are secrets handled correctly?
|
|
75
|
+
7. **Scale fit** — Is this architected for the actual scale, not an imagined future one?
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Architecture Guidelines
|
|
80
|
+
|
|
81
|
+
### Explicit over Implicit
|
|
82
|
+
- Use explicit returns, explicit imports/exports, descriptive naming
|
|
83
|
+
- Side effects should be obvious, not hidden
|
|
84
|
+
|
|
85
|
+
### Composition over Inheritance
|
|
86
|
+
- Build behavior by combining small, focused pieces
|
|
87
|
+
- Pass dependencies through function parameters or constructors; avoid global state
|
|
88
|
+
|
|
89
|
+
### Clear Module Boundaries
|
|
90
|
+
- Modules should not know each other's internal details
|
|
91
|
+
- Define and document the surface area between components
|
|
92
|
+
|
|
93
|
+
### Error Handling
|
|
94
|
+
- Never swallow errors silently
|
|
95
|
+
- Log with context: what happened, where, what data was involved
|
|
96
|
+
- Return consistent error shapes across the codebase
|
|
97
|
+
- Fail fast and loudly; silent corruption is worse than a crash
|
|
98
|
+
|
|
99
|
+
### Strategic Logging — Information Entropy Principle
|
|
100
|
+
Log what's surprising, not what's expected.
|
|
101
|
+
|
|
102
|
+
| High Value | Low Value |
|
|
103
|
+
|---|---|
|
|
104
|
+
| Unexpected errors, edge cases | "Server started", "Request received" |
|
|
105
|
+
| Performance anomalies | "Function called" |
|
|
106
|
+
| Security events | Every loop iteration |
|
|
107
|
+
| State transitions with context | Successful routine operations |
|
|
108
|
+
|
|
109
|
+
**The 3 AM test**: "If this breaks at 3 AM, what would I desperately need to know?"
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Anti-Patterns to Avoid
|
|
114
|
+
|
|
115
|
+
| Anti-Pattern | Why It Hurts |
|
|
116
|
+
|---|---|
|
|
117
|
+
| Premature optimization | Optimizes for a bottleneck that may not exist |
|
|
118
|
+
| Over-engineering | Adds complexity for imagined scale; becomes a maintenance burden |
|
|
119
|
+
| Magic numbers/strings | Impossible to understand; easy to mischange |
|
|
120
|
+
| Excessive abstraction | Hides behavior; debugging becomes archaeology |
|
|
121
|
+
| God objects / God functions | Single points of failure with too many responsibilities |
|
|
122
|
+
| Untested happy paths | You find bugs in production, not staging |
|
|
123
|
+
| Architecture by autocomplete | AI-generated structure without architectural judgment |
|
|
124
|
+
| Dependency sprawl | Each dependency is a supply chain risk and a maintenance burden |
|
|
125
|
+
| Blind retries | Same failed command in a loop; wastes time and obscures real issues. See WORKFLOW.md |
|
|
126
|
+
| Suppressing type errors | `as any`, `@ts-ignore` hide real bugs; fix the root cause. See AGENTS.md |
|
|
127
|
+
| Empty catch blocks | `catch(e) {}` swallows errors; log and handle or don't catch. See AGENTS.md |
|
|
128
|
+
| Cargo-culting patterns | Copying solutions without understanding why; wrong tool for the job. See AGENTS.md |
|
|
129
|
+
|
|
130
|
+
> **Domain-specific anti-patterns:** See DEBUGGING.md (debugging anti-patterns) and PERFORMANCE.md (performance anti-patterns) for detailed coverage.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## AI-Assisted Development — Ground Rules (2026)
|
|
135
|
+
|
|
136
|
+
AI coding tools (Claude Code, Cursor, Copilot, Gemini CLI) are force multipliers. Use them well:
|
|
137
|
+
|
|
138
|
+
**Use AI for:**
|
|
139
|
+
- Boilerplate and scaffolding
|
|
140
|
+
- Test case generation
|
|
141
|
+
- Refactoring with clear intent
|
|
142
|
+
- Documentation drafts
|
|
143
|
+
- Searching unfamiliar codebases
|
|
144
|
+
|
|
145
|
+
**Apply human judgment for:**
|
|
146
|
+
- Architecture and system design decisions
|
|
147
|
+
- Security review of generated code
|
|
148
|
+
- Business logic correctness
|
|
149
|
+
- Performance tradeoffs
|
|
150
|
+
- "Does this actually solve the right problem?"
|
|
151
|
+
|
|
152
|
+
**Never:**
|
|
153
|
+
- Accept generated code without reading it
|
|
154
|
+
- Let AI pick your architecture for you
|
|
155
|
+
- Ship AI-generated security-critical code without review
|
|
156
|
+
- Use AI output as ground truth for how a system actually behaves (read the code / run it)
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Code Quality Standards
|
|
161
|
+
|
|
162
|
+
### Functions
|
|
163
|
+
- Under 30–40 lines; one clear purpose
|
|
164
|
+
- 3 or fewer parameters; use an options object for more
|
|
165
|
+
- Flat control flow; avoid deep nesting (early returns are your friend)
|
|
166
|
+
|
|
167
|
+
### Comments
|
|
168
|
+
- Document **why**, not what — the code shows what it does
|
|
169
|
+
- Comment non-obvious business rules, edge cases, known gotchas
|
|
170
|
+
- Use structured doc comments (JSDoc, docstrings) for public APIs
|
|
171
|
+
|
|
172
|
+
### Testing
|
|
173
|
+
- Test behavior, not implementation details
|
|
174
|
+
- Cover the unhappy paths and edge cases — those are where bugs live
|
|
175
|
+
- Integration tests > unit tests for detecting real-world failures
|
|
176
|
+
- A test that can't fail is not a test
|
|
177
|
+
|
|
178
|
+
### Dependencies
|
|
179
|
+
- Before adding a library, check if stdlib or an existing dep handles it
|
|
180
|
+
- Evaluate: maintenance status, security track record, bundle size impact
|
|
175
181
|
- Pin versions in lock files; audit regularly
|