Craft It
Build the smallest complete solution so the touched code is understandable from
the repository alone. Treat actual public interfaces as package-quality
contracts without imposing speculative stability on private code. Leave a
coherent, verified candidate; do not plan, review, commit, or deliver it here.
Establish the change
- Inspect repository instructions, the active goal, architecture, neighboring
code, public surfaces, tests, and validation commands.
- Identify existing contracts and the smallest coherent change that satisfies
the outcome.
- Follow sound repository patterns. Keep deliberate improvements internally
consistent and leave broader convergence outside the change.
- Decide implementation details and perform necessary research independently.
Pause only when new evidence invalidates the approved outcome or scope,
requires unavailable authority, or creates serious irreversible risk.
Build code that can grow
- Give each module clear ownership of related data, state, and behavior. Keep
cohesion high and coupling low, explicit, and directed.
- Avoid cycles, hidden shared state, and contracts that expose private or
third-party representations.
- Share a component only when consumers truly share semantics and lifecycle.
Prefer composition over premature reuse or a broad common layer.
- Prefer a functional core with an imperative shell: pure transformations for
domain logic, explicit dependencies, and narrow effectful boundaries.
- Keep public interfaces small, stable, and consumer-oriented. Export only what
callers need and document public contracts to package-quality standards.
- Minimize change amplification. Let each function tell one coherent story and
extract concepts, not arbitrary fragments.
- Handle errors, edge cases, and operational failure deliberately. Build the
smallest complete solution without speculative abstractions.
Write durable documentation
- Prefer expressive names, types, structure, and tests over narrated code.
- Document public behavior, inputs, outputs, errors, side effects, invariants,
and non-obvious usage with the repository's established documentation form.
- Use inline comments only for durable rationale, constraints, invariants,
surprising dependency behavior, or non-obvious coupling.
- Write for the code at HEAD: never address a reviewer or refer to a
conversation, diff, temporary plan, or plan step. Link an issue only when it
is the durable source of an external constraint and the repository expects it.
- Remove stale or redundant documentation; a false explanation is worse than
none.
Test contracts, not implementation
- Cover observable behavior, important boundaries, failure modes, and
regressions introduced or exposed by the change.
- Test pure transformations directly. At effectful boundaries, prefer small
fakes, in-memory implementations, or injected ports.
- Use mocks or spies only when the interaction itself is the contract or the
boundary cannot be controlled directly. Assert behavior, not incidental call
counts. Keep tests deterministic and resilient to sound refactoring.
Own the touched codebase
Fix a pre-existing defect without asking when it is understood, bounded,
low-risk, testable, and does not change the approved outcome. Keep it separate
when combining it would obscure either change. Leave broad, risky, or independent
work outside the candidate and preserve enough context to resume it. Do not
publish external work items without authorization.
Finish the candidate
- Run relevant focused and repository-wide checks.
- Inspect the complete diff for accidental scope, debug artifacts, stale
documentation, and repository inconsistencies.
- Preserve material decisions, deviations, evidence, and refactoring pressure
in an existing handoff; otherwise report them without creating a new artifact.
- Report the outcome, important decisions, validation, nearby defects fixed,
and follow-ups.
The candidate is ready when it fulfills the agreed outcome, fits the repository,
has evidence for its behavior, and can be judged by an independent reviewer
without reconstructing the implementation conversation.
1---2name: craft-it3description: Implement or refactor code once the intended outcome is clear. Use for production changes that must fit the repository, remain maintainable, and be ready for independent review.4---56# Craft It78Build the smallest complete solution so the touched code is understandable from9the repository alone. Treat actual public interfaces as package-quality10contracts without imposing speculative stability on private code. Leave a11coherent, verified candidate; do not plan, review, commit, or deliver it here.1213## Establish the change14151. Inspect repository instructions, the active goal, architecture, neighboring16 code, public surfaces, tests, and validation commands.172. Identify existing contracts and the smallest coherent change that satisfies18 the outcome.193. Follow sound repository patterns. Keep deliberate improvements internally20 consistent and leave broader convergence outside the change.214. Decide implementation details and perform necessary research independently.22 Pause only when new evidence invalidates the approved outcome or scope,23 requires unavailable authority, or creates serious irreversible risk.2425## Build code that can grow2627- Give each module clear ownership of related data, state, and behavior. Keep28 cohesion high and coupling low, explicit, and directed.29- Avoid cycles, hidden shared state, and contracts that expose private or30 third-party representations.31- Share a component only when consumers truly share semantics and lifecycle.32 Prefer composition over premature reuse or a broad common layer.33- Prefer a functional core with an imperative shell: pure transformations for34 domain logic, explicit dependencies, and narrow effectful boundaries.35- Keep public interfaces small, stable, and consumer-oriented. Export only what36 callers need and document public contracts to package-quality standards.37- Minimize change amplification. Let each function tell one coherent story and38 extract concepts, not arbitrary fragments.39- Handle errors, edge cases, and operational failure deliberately. Build the40 smallest complete solution without speculative abstractions.4142## Write durable documentation4344- Prefer expressive names, types, structure, and tests over narrated code.45- Document public behavior, inputs, outputs, errors, side effects, invariants,46 and non-obvious usage with the repository's established documentation form.47- Use inline comments only for durable rationale, constraints, invariants,48 surprising dependency behavior, or non-obvious coupling.49- Write for the code at HEAD: never address a reviewer or refer to a50 conversation, diff, temporary plan, or plan step. Link an issue only when it51 is the durable source of an external constraint and the repository expects it.52- Remove stale or redundant documentation; a false explanation is worse than53 none.5455## Test contracts, not implementation5657- Cover observable behavior, important boundaries, failure modes, and58 regressions introduced or exposed by the change.59- Test pure transformations directly. At effectful boundaries, prefer small60 fakes, in-memory implementations, or injected ports.61- Use mocks or spies only when the interaction itself is the contract or the62 boundary cannot be controlled directly. Assert behavior, not incidental call63 counts. Keep tests deterministic and resilient to sound refactoring.6465## Own the touched codebase6667Fix a pre-existing defect without asking when it is understood, bounded,68low-risk, testable, and does not change the approved outcome. Keep it separate69when combining it would obscure either change. Leave broad, risky, or independent70work outside the candidate and preserve enough context to resume it. Do not71publish external work items without authorization.7273## Finish the candidate74751. Run relevant focused and repository-wide checks.762. Inspect the complete diff for accidental scope, debug artifacts, stale77 documentation, and repository inconsistencies.783. Preserve material decisions, deviations, evidence, and refactoring pressure79 in an existing handoff; otherwise report them without creating a new artifact.804. Report the outcome, important decisions, validation, nearby defects fixed,81 and follow-ups.8283The candidate is ready when it fulfills the agreed outcome, fits the repository,84has evidence for its behavior, and can be judged by an independent reviewer85without reconstructing the implementation conversation.