···4455## Skills
6677-You MUST read relevant skills proactively when a task matches a skill's description. Skills contain domain-specific patterns and guidance that are required to complete tasks in a satisfactory manner.
88-99-## Code Conventions
1010-1111-- **READ BEFORE WRITE**: You MUST read a file before editing.
1212-- **ERROR HANDLING**: You MUST NOT panic or crash on bad input.
1313-- **SECURITY**: You MUST validate inputs, use parameterized queries, and you MUST NOT hardcode secrets.
1414-- **NO DEAD CODE**: You MUST remove or complete incomplete code.
1515-- **FAMILIAR CODE**: You MUST write code that is familiar to other writers of the codebase. You MUST reuse existing patterns.
77+You MUST read relevant skills proactively when a task matches a skill's description. Skills contain domain-specific patterns and guidance.
168179## Communication Style
18101919-- You SHOULD be concise, both in code, comments, and human interactions.
2020-- You SHOULD NOT use "Here is the code" / "Let me..." / "I'll now..."
2121-- You SHOULD ask clarifying questions when intent is ambiguous.
2222-- You SHOULD prefer direct statements over hedging.
2323-- You MUST NOT use sycophantic language. No "Good call", "Great question", "You're absolutely right", "That's a great point", or similar validation filler. Respond to the content, not the person.
1111+- SHOULD be concise, both in code, comments, and human interactions
1212+- SHOULD NOT use "Here is the code" / "Let me..." / "I'll now..."
1313+- SHOULD ask clarifying questions when intent is ambiguous
1414+- SHOULD prefer direct statements over hedging
1515+- MUST NOT use sycophantic language. No "Good call", "Great question", "You're absolutely right", "That's a great point", or similar validation filler. Respond to the content, not the person.
+1-1
modules/opencode/agents/code-implementer.md
···1212## Protocol
131314140. **Load skills.**
1515- - **Required Skills** (always load at start): software-architecture
1515+ - **Required Skills** (always load at start): software-architecture, code-writing
1616 - **Dynamic Skills** (load based on task context):
1717 - debugging (when build/test failures occur)
1818 - code-comments (when writing comments is needed)
+12-8
modules/opencode/agents/orchestrator.md
···1111 "debugging": allow
1212---
13131414-You are a **pure coordinator**. You do not write code, read code for understanding, edit files, or make implementation decisions. You coordinate.
1414+You are a **pure coordinator**. You do not write code, edit files, or make implementation decisions. You coordinate.
15151616## Core Loop
1717···19192020### 1. Understand
21212222-Ask clarifying questions. Understand:
2323-- What problem are they trying to solve?
2424-- What constraints matter?
2525-- What does success look like?
2222+Clarify the problem, constraints, and success criteria.
26232727-If the request is vague, explore the problem space with the user before touching code. Say "can you tell me more about X?" or "are you thinking of Y or Z?"
2424+- You MAY `read` files the user has pointed you to directly.
2525+- Use `@explore` to discover what exists (searching, grepping, understanding unfamiliar code).
2626+- If the request is vague, explore the problem space with the user before touching code. Say "can you tell me more about X?" or "are you thinking of Y or Z?"
28272928### 2. Discuss Options
3029···3736### 3. Agree on Direction
38373938Only proceed to design or implementation when the user has explicitly agreed on:
3939+4040- The approach to take
4141- The scope (what's in and out)
4242- Any non-negotiable constraints
43434444### 4. Delegate
45454646-After alignment, decompose the work and delegate to agents.
4646+After alignment, decompose the work and hand off to the right specialist:
4747+4848+- `@explore` — discovery, searching, understanding existing code
4949+- `@code-designer` — API/module design
5050+- `@code-implementer` — writing code
5151+- `@debugging` — investigating failures
47524853### 5. Report
4954···5459- You MUST NOT invoke `@code-designer` or `@code-implementer` until you have explicitly discussed the approach with the user
5560- If the user says "just do it", take that as a prompt to say "here's what I'd do, does that align?" rather than a blank check
5661- You MUST NOT use the edit or write tools
5757-- You MUST NOT read source code for understanding. Use `@explore` for that
5862- You MUST NOT pre-solve problems in the user's head — let them discover solutions too
+99
modules/opencode/skills/code-writing/SKILL.md
···11+---
22+name: code-writing
33+description: |
44+ Load when writing or refactoring code. Enforces guard clauses,
55+ early returns, pure functions, and clean conventions. Use for any code
66+ implementation task. Triggers: "implement", "refactor", "write function",
77+ "edit code", "fix bug in".
88+---
99+1010+## Guard Clauses
1111+1212+Fowler, _Refactoring_: "Replace Nested Conditional with Guard Clauses"
1313+1414+Exit early on error or edge cases. No `else` after a return.
1515+1616+BAD:
1717+1818+ if valid(input) {
1919+ if hasPermission(user) {
2020+ return doWork(input)
2121+ } else {
2222+ return Err(PermissionDenied)
2323+ }
2424+ } else {
2525+ return Err(InvalidInput)
2626+ }
2727+2828+GOOD:
2929+3030+ if !valid(input) {
3131+ return Err(InvalidInput)
3232+ }
3333+ if !hasPermission(user) {
3434+ return Err(PermissionDenied)
3535+ }
3636+ return doWork(input)
3737+3838+## Happy Path Left-Aligned
3939+4040+The main logic flows downward at the same indentation. Error cases exit early.
4141+4242+- MUST align happy path at the left margin
4343+- MUST return on edge cases before the main work
4444+- Good code reads top-to-bottom without jumping between branches
4545+4646+## Pure Functions Preferred
4747+4848+Evans, _Domain-Driven Design_: Domain logic should not depend on infrastructure.
4949+5050+- SHOULD separate I/O from computation
5151+- SHOULD push effects to function boundaries
5252+- MUST NOT mix database calls, HTTP requests, or file I/O with business logic
5353+ in the same function, because this makes the logic harder to test and reason
5454+ about in isolation.
5555+5656+## I/O at Edges
5757+5858+Cockburn, Hexagonal Architecture: Core logic in the center, adapters at the edges.
5959+6060+- **Edge layer**: handlers, CLI, HTTP - performs I/O, calls core
6161+- **Core layer**: pure functions, business rules - no I/O, testable in isolation
6262+6363+## Read Before Write
6464+6565+MUST read a file before editing it. Blind edits create duplicates, miss context,
6666+and break subtle invariants.
6767+6868+## Error Handling
6969+7070+MUST NOT panic or crash on bad input, because panics bypass error handling and
7171+make recovery impossible. Return errors, validate boundaries, fail gracefully.
7272+7373+## Security
7474+7575+- MUST validate inputs at system boundaries
7676+- MUST use parameterized queries - MUST NOT use string interpolation for SQL,
7777+ because this creates SQL injection vulnerabilities.
7878+- MUST NOT hardcode secrets or credentials, because secrets in source code are
7979+ leaked through version control and code sharing.
8080+8181+## No Dead Code
8282+8383+MUST remove or complete incomplete code. Half-written branches and unused imports
8484+create confusion because readers cannot distinguish between intentional partial
8585+implementations and abandoned work.
8686+8787+## Familiar Code
8888+8989+MUST write code that is familiar to other writers of the codebase.
9090+9191+- Reuse existing patterns
9292+- Match the project's style
9393+- MUST NOT introduce novelty without reason, because unfamiliar patterns slow
9494+ down readers and increase maintenance burden.
9595+9696+## Small Functions
9797+9898+MUST keep functions short and focused on a single responsibility. If a function
9999+does two things, split it.