Add Claude Code conventions to CLAUDE.md and .claude/rules/#295
Add Claude Code conventions to CLAUDE.md and .claude/rules/#295yoannmoinet merged 2 commits intomasterfrom
Conversation
e823664 to
47edb4b
Compare
|
|
||
| .claude/* | ||
| !.claude/commands/* | ||
| !.claude/rules/ |
There was a problem hiding this comment.
Apparently you need to add to add this line if the rules folder was previously gitignored.
CLAUDE.md
Outdated
| - HTTP requests: `doRequest` from `@dd/core/helpers/request` (not raw `fetch`) | ||
| - File operations: `rm` from `@dd/core/helpers/fs` (not `fs/promises` directly) | ||
| - Types: `@dd/core/types` for shared types like `GlobalContext`, `Logger`, etc. | ||
| - Test mocks: `getMockLogger` and other helpers from `packages/tests/src/_jest/helpers/mocks` |
There was a problem hiding this comment.
These special pointers seem super helpful. Maybe it'd also help to more broadly point to certain directories where these helpers exist. Such as:
@dd/core/helpers- and
packages/tests/src/*/helpers - I'll let @yoannmoinet give a better picture of what other helpers exist if any
Or perhaps Claude is smart enough to figure it out.
There was a problem hiding this comment.
The trade-off that went through my head was, if we add too much detail then the CLAUDE.md could become out of sync with the code. I wasn't quite sure what the right level of resolution was to include. I'm happy update this though.
There was a problem hiding this comment.
Yep, that's one reason to more broadly point to directories rather than specific helpers.
There was a problem hiding this comment.
I'd suggest to not use suggestions for a single one, having two + etc. sounds good, but when we only use one like getMockLogger or rm without suggesting that there may be more, would make Claude not consider it for its usage/research.
CLAUDE.md
Outdated
| - **No TypeScript suppression comments**: Don't use `@ts-ignore`, `@ts-expect-error`, or `@ts-nocheck` to suppress type errors. Fix the underlying type issue instead. | ||
| - **Use existing repo utilities**: Before writing new helpers, check what already exists: | ||
| - HTTP requests: `doRequest` from `@dd/core/helpers/request` (not raw `fetch`) | ||
| - File operations: `rm` from `@dd/core/helpers/fs` (not `fs/promises` directly) |
There was a problem hiding this comment.
I'm worried that if we precise rm only here, it won't take it into consideration for other fs functions.
There was a problem hiding this comment.
That makes sense. I'll remove the reference to rm. That should hopefully generalize it to all file operations.
CLAUDE.md
Outdated
| - HTTP requests: `doRequest` from `@dd/core/helpers/request` (not raw `fetch`) | ||
| - File operations: `rm` from `@dd/core/helpers/fs` (not `fs/promises` directly) | ||
| - Types: `@dd/core/types` for shared types like `GlobalContext`, `Logger`, etc. | ||
| - Test mocks: `getMockLogger` and other helpers from `packages/tests/src/_jest/helpers/mocks` |
There was a problem hiding this comment.
I'd suggest to not use suggestions for a single one, having two + etc. sounds good, but when we only use one like getMockLogger or rm without suggesting that there may be more, would make Claude not consider it for its usage/research.
…ies instead of specific functions
|
/merge |
|
View all feedbacks in Devflow UI.
This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
This pull request was merged directly. |

Motivation
Recurring PR feedback on recent build-plugins contributions revealed patterns that should be codified so they're caught earlier by Claude Code rather than surfacing in reviews. These conventions were distilled from reviewer comments across PRs #289-292.
Changes
Three additions:
1.
CLAUDE.md— new Code Conventions section covering:any/asescape hatches (with concrete repo-specific alternatives)doRequest,@dd/core/helpers/fs, test mock helpers)2.
.claude/rules/testing.md(auto-applies to**/*.test.ts):cases+test.eachpattern3.
.claude/rules/plugin-development.md(auto-applies topackages/plugins/**):getVitePlugin())Also un-gitignored
.claude/rules/so these rules are shared with the team (same as.claude/commands/).QA Instructions
.claude/rules/testing.mdand.claude/rules/plugin-development.mdare present and trackedCLAUDE.mdCode Conventions section reads correctly.gitignoreallows.claude/rules/while still ignoring other.claude/filesBlast Radius
Claude Code configuration only — no runtime code changes. Affects how Claude Code generates code in this repo.