Skip to content

Add a write-code skill for code conventions - #1517

Merged
cristianrgreco merged 5 commits into
mainfrom
claude/add-code-style-skill-b3f208
Oct 13, 2026
Merged

cristianrgreco merged 5 commits into
mainfrom
claude/add-code-style-skill-b3f208

Conversation

@cristianrgreco

@cristianrgreco cristianrgreco commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds a write-code skill for the review finding a linter can't catch: new code that repeats something the project already has. It tells the agent to look for existing code first, to refactor shared code instead of copying it, and to use core's building blocks.

AGENTS.md ("Code"), review-pr and add-module each get a one-line pointer that only names the skill. The skill names no module, file or method, so it does not go stale as they change.

Lint-style conventions are left to Biome. #1585 and #1590 enable function length, cognitive complexity, ??, no console, no shadowing, block statements, no useless else and readonly. An earlier version of this skill also listed layout, typing and naming conventions. They were removed because Biome has a rule for them, or they were too minor to be worth a rule.

What remains, with the evidence for it (survey of the 191 non-test source files, taken on main before #1514 merged):

Rule Evidence
Look for existing code first, and refactor it rather than copy it "apply the startup timeout, then waitForContainer" appears 5 times across core, Kafka and Redpanda; the two module hooks repeat the same 10-line block. #364
Where shared code goes: a helper in the file, a function in the package, core for anything two modules need modules import only testcontainers (enforced by Biome), so cross-module reuse has to live in core
Helper defined below its first caller 77 after, 29 before. 14 of the 29 were in couchbase-container.ts
with* methods rather than createOpts or hostConfig 2 direct assignments in modules. #1155
Wait with a WaitStrategy through waitForContainer Kafka and Redpanda do. Couchbase calls waitUntilReady directly and is the only module that polls with IntervalRetry. #723
Post-start waits share what is left of the startup timeout Couchbase since #1514. #1584 proposes a core StartupDeadline for it

When #1584 merges, the timeout bullet should name the argument it adds to containerStarted.

Verification

  • npx biome check .: no fixes applied.
  • npm run knip: no findings.

The change is Markdown plus the .claude/skills/write-code symlink, so there are no tests to run.

Not breaking

Agent guidance only. No package code or manifests change.

Writes down the conventions that Biome, knip and tsc don't check: class and helper layout, function size, waits and startup timeouts in modules, and reusing core. AGENTS.md, review-pr and add-module point to it.
@cristianrgreco cristianrgreco added maintenance Improvements that do not change functionality patch Backward compatible bug fix labels Oct 12, 2026
The pointers in AGENTS.md, review-pr and add-module now only name the skill. The skill defines what a helper is and covers duplication within a file, across a package and across modules.
Follows #1514, where Couchbase gives each wait in containerStarted what is left of the startup timeout.
Lint-style conventions are left to Biome. The skill keeps what a linter can't see: look for existing code first, refactor instead of copying, and use core's building blocks.
@cristianrgreco
cristianrgreco merged commit 17316db into main Oct 13, 2026
15 checks passed
@cristianrgreco
cristianrgreco deleted the claude/add-code-style-skill-b3f208 branch October 13, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Improvements that do not change functionality patch Backward compatible bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant