Code Writing
Understand the Change
- Extract the requested behavior and what done means from the request or user-spec. Resolve
ambiguity from repository evidence; ask only when a substantive choice changes the result or
scope.
- Read repository instructions, affected code, its usages, and only the project documentation
needed to change it safely. A localized edit needs local context; cross-cutting work needs its
contracts, architecture, and relevant patterns.
- For non-trivial work, read every source file that will change, find affected contracts and
reusable code, and establish the smallest useful baseline check. Inspect generated, lock,
snapshot, or other mechanical artifacts through their generator, relevant diff, and
deterministic validation rather than an unhelpful full read.
- Discuss the approach before editing only when evidence exposes a substantive fork, risk, or
scope decision. Otherwise choose the smallest safe implementation that follows project or
framework conventions.
- Treat a new idea, risk, edge case, or opportunity discovered during implementation or review
as a proposal, not authorization. A rare or unagreed scenario is a user decision even when its
correction looks local. Correct autonomously only an authorized local defect in agreed normal
behavior; ask before adding behavior, state, entities, contracts, dependencies, architecture,
or material complexity.
Implement and Verify
- Implement only the requested behavior. Reuse existing capabilities before adding abstractions
or dependencies. Do not add speculative validation, fallbacks, configuration, optimization,
or future flexibility without a current requirement or realistic project condition.
- Validate untrusted input at its boundary, keep secrets out of source, preserve useful error
information, and handle failures where the program can recover or add context.
- Let straightforward code explain itself. Comment only when code cannot communicate the reason
for a business rule, safety invariant, external constraint, compatibility workaround,
deliberate tradeoff, or required ordering.
- When the change can alter observable behavior, apply
test-master to select and run the
protecting tests. If it has no test subject, state that instead of creating artificial
assertions.
- Run the smallest supported lint, format, type, build, render, and user-requested checks that
cover the change. Use a project-wide command only when it is the available entrypoint or the
change is cross-cutting. Separate unrelated baseline failures from regressions.
Run Fresh Reviews
Run no more than two review waves. One wave launches the complete reviewer set selected for the
implementation in parallel against the same revision. Use that same complete set in both waves.
Include reviewers required by other active skills in these same waves instead of starting a
separate wave sequence.
After every completed implementation, include a fresh code-reviewer without a model override.
Its review scope matches the change: a localized edit gets focused connected context; a broad
change gets all affected contracts and architecture.
Also launch in parallel when applicable:
security-auditor when a security boundary changed or the user requested a security review.
test-master owns the additional test-reviewer invocation when meaningful test code changed.
Include that reviewer in every wave for this implementation.
Give each reviewer the user request or user-spec, applicable repository instructions, validation
evidence, every touched source file with relevant callers and dependencies, deleted or renamed
file evidence, and generator/diff/validation evidence for mechanical artifacts.
Review findings are diagnoses, not a work queue. Check the evidence and exact correction. Apply
only an authorized local correction to agreed normal behavior. If the scenario is rare or
unagreed, or the correction adds behavior, state, entities, contracts, dependencies, architecture,
or material complexity, reject it with a short reason or ask the user before editing.
user_decision_required: false does not replace this check. Reject unsupported findings with
evidence and report unrelated findings without expanding the task.
After wave 1, correct only authorized local defects in agreed normal behavior that do not require a
user decision, then rerun affected direct checks. If those corrections changed the reviewed result,
launch wave 2 with the same complete reviewer set. Stop after a clean wave or when no authorized
correction changes the result.
After wave 2, do not launch another reviewer automatically. Correct remaining local defects only
in agreed normal behavior and only when they do not require a user decision, rerun the applicable
direct checks, and hand off any remaining findings or required decisions about scope, behavior,
approach, or material complexity. Briefly explain rejected rare findings in the handoff.
1---2name: code-writing-23description: Guides code implementation through proportional context reading, focused changes, verification, and fresh reviews. Use whenever code needs to be written — from a short ad-hoc edit to a full user-spec. Use when: "напиши код", "закодь", "реализуй", "write code", "implement" Do NOT use for pure layout from Figma, Claude Design, screenshots, or an existing visual style ("сверстай", "подвинь блок", responsive) — use layout-writing instead. Direct mixed layout + business-logic work uses both layout-writing and code-writing. For creating a user-spec → user-spec-planning skill.4---5<!-- Generated by sync-to-codex v1. Do not edit directly. -->67# Code Writing89## Understand the Change10111. Extract the requested behavior and what done means from the request or user-spec. Resolve12 ambiguity from repository evidence; ask only when a substantive choice changes the result or13 scope.142. Read repository instructions, affected code, its usages, and only the project documentation15 needed to change it safely. A localized edit needs local context; cross-cutting work needs its16 contracts, architecture, and relevant patterns.173. For non-trivial work, read every source file that will change, find affected contracts and18 reusable code, and establish the smallest useful baseline check. Inspect generated, lock,19 snapshot, or other mechanical artifacts through their generator, relevant diff, and20 deterministic validation rather than an unhelpful full read.214. Discuss the approach before editing only when evidence exposes a substantive fork, risk, or22 scope decision. Otherwise choose the smallest safe implementation that follows project or23 framework conventions.245. Treat a new idea, risk, edge case, or opportunity discovered during implementation or review25 as a proposal, not authorization. A rare or unagreed scenario is a user decision even when its26 correction looks local. Correct autonomously only an authorized local defect in agreed normal27 behavior; ask before adding behavior, state, entities, contracts, dependencies, architecture,28 or material complexity.2930## Implement and Verify31321. Implement only the requested behavior. Reuse existing capabilities before adding abstractions33 or dependencies. Do not add speculative validation, fallbacks, configuration, optimization,34 or future flexibility without a current requirement or realistic project condition.352. Validate untrusted input at its boundary, keep secrets out of source, preserve useful error36 information, and handle failures where the program can recover or add context.373. Let straightforward code explain itself. Comment only when code cannot communicate the reason38 for a business rule, safety invariant, external constraint, compatibility workaround,39 deliberate tradeoff, or required ordering.404. When the change can alter observable behavior, apply `test-master` to select and run the41 protecting tests. If it has no test subject, state that instead of creating artificial42 assertions.435. Run the smallest supported lint, format, type, build, render, and user-requested checks that44 cover the change. Use a project-wide command only when it is the available entrypoint or the45 change is cross-cutting. Separate unrelated baseline failures from regressions.4647## Run Fresh Reviews4849Run no more than two review waves. One wave launches the complete reviewer set selected for the50implementation in parallel against the same revision. Use that same complete set in both waves.51Include reviewers required by other active skills in these same waves instead of starting a52separate wave sequence.5354After every completed implementation, include a fresh `code-reviewer` without a model override.55Its review scope matches the change: a localized edit gets focused connected context; a broad56change gets all affected contracts and architecture.5758Also launch in parallel when applicable:5960- `security-auditor` when a security boundary changed or the user requested a security review.6162`test-master` owns the additional `test-reviewer` invocation when meaningful test code changed.63Include that reviewer in every wave for this implementation.6465Give each reviewer the user request or user-spec, applicable repository instructions, validation66evidence, every touched source file with relevant callers and dependencies, deleted or renamed67file evidence, and generator/diff/validation evidence for mechanical artifacts.6869Review findings are diagnoses, not a work queue. Check the evidence and exact correction. Apply70only an authorized local correction to agreed normal behavior. If the scenario is rare or71unagreed, or the correction adds behavior, state, entities, contracts, dependencies, architecture,72or material complexity, reject it with a short reason or ask the user before editing.73`user_decision_required: false` does not replace this check. Reject unsupported findings with74evidence and report unrelated findings without expanding the task.7576After wave 1, correct only authorized local defects in agreed normal behavior that do not require a77user decision, then rerun affected direct checks. If those corrections changed the reviewed result,78launch wave 2 with the same complete reviewer set. Stop after a clean wave or when no authorized79correction changes the result.8081After wave 2, do not launch another reviewer automatically. Correct remaining local defects only82in agreed normal behavior and only when they do not require a user decision, rerun the applicable83direct checks, and hand off any remaining findings or required decisions about scope, behavior,84approach, or material complexity. Briefly explain rejected rare findings in the handoff.