Skip to content

Commit 220d3ec

Browse files
committed
docs: clarify formatter-friendly code shape
1 parent bf95f76 commit 220d3ec

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,10 @@ Skills own workflows; root owns hard policy and routing.
111111
- No `@ts-nocheck`. Lint suppressions only intentional + explained.
112112
- External boundaries: prefer `zod` or existing schema helpers.
113113
- Runtime branching: discriminated unions/closed codes over freeform strings. Avoid semantic sentinels (`?? 0`, empty object/string).
114-
- If formatter output becomes a jagged staircase, refactor the expression instead of accepting the formatted shape.
115-
- For function calls with config objects, compute complex fields above the call; keep object fields simple.
116-
- Avoid dense inline plumbing: no nested ternaries, long `??` chains, or repeated `params.foo?.bar` inside argument objects.
117-
- Prefer named intermediate values when a value has domain meaning, e.g. `channel`, `parentSessionKey`, `selectedModelRef`, `sourceProvider`.
118-
- Code should read top-down: gather inputs, normalize/resolve, then call helpers.
114+
- Formatter-friendly shape: when oxfmt explodes an expression vertically, extract named booleans, payloads, or small helpers. Do not change width or use format-ignore for local compactness.
115+
- Calls should be boring: complex decisions happen above; call args/object fields are names, literals, or simple property reads.
116+
- Prefer early returns over nested condition pyramids. Split code into gather -> normalize -> decide -> act.
117+
- Use named intermediates only for domain meaning or readability; avoid temp-variable soup.
119118
- Dynamic import: no static+dynamic import for same prod module. Use `*.runtime.ts` lazy boundary. After edits: `pnpm build`; check `[INEFFECTIVE_DYNAMIC_IMPORT]`.
120119
- Cycles: keep `pnpm check:import-cycles` + architecture/madge green.
121120
- Classes: no prototype mixins/mutations. Prefer inheritance/composition. Tests prefer per-instance stubs.

0 commit comments

Comments
 (0)