Skip to content

break out file-/directory-specific guidance into .claude/rules/**/*.md files and simplify CLAUDE.md [ci skip]#3327

Draft
Dave Shoup (shouples) wants to merge 2 commits intomainfrom
djs/claude-rules
Draft

break out file-/directory-specific guidance into .claude/rules/**/*.md files and simplify CLAUDE.md [ci skip]#3327
Dave Shoup (shouples) wants to merge 2 commits intomainfrom
djs/claude-rules

Conversation

@shouples
Copy link
Contributor

@shouples Dave Shoup (shouples) commented Mar 10, 2026

Our CLAUDE.md had some sections that were file- or subdirectory-specific, which is not always relevant for all Claude sessions (e.g. working on E2E tests, updating webviews, etc). Claude rules make more sense to use here, since they are automatically brought in as context depending on the file(s) referenced based on their path patterns.

This PR moves a lot of those specific instructions into new .claude/rules/**/*.md files, which can then reduce the size of CLAUDE.md from ~2400 tokens to ~1000 tokens.

Copilot AI review requested due to automatic review settings March 10, 2026 19:11
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Claude Code guidance for this VS Code extension by condensing CLAUDE.md into high-signal rules and moving detailed architecture/testing guidance into scoped .claude/rules/* documents that apply by path.

Changes:

  • Simplifies and restructures CLAUDE.md around “Golden Rules”, core commands, and pointers to .claude/rules/.
  • Adds path-scoped testing guidance for unit, functional (webview), and E2E tests.
  • Adds path-scoped architecture guidance for sidecar pattern, view providers, resource loaders, settings, connection types, and client codegen.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
CLAUDE.md Consolidates key dev rules/commands and points to detailed .claude/rules/ docs.
.claude/rules/testing/unit-tests.md Adds unit testing conventions (Mocha + Sinon) and stubbing guidance.
.claude/rules/testing/functional-tests.md Adds Playwright webview “functional test” guidance.
.claude/rules/testing/e2e-tests.md Adds Playwright + Electron E2E conventions (POM, tags/filtering).
.claude/rules/architecture/webview-architecture.md Documents webview templates, bindings, comms, styling, and toolkit deprecation.
.claude/rules/architecture/view-providers.md Documents tree/panel provider base classes and registration steps.
.claude/rules/architecture/sidecar-pattern.md Documents sidecar components and short-lived handle pattern.
.claude/rules/architecture/resource-loaders.md Documents loader hierarchy, caching, and registry pattern.
.claude/rules/architecture/extension-settings.md Documents ExtensionSetting<T> pattern and where to add settings.
.claude/rules/architecture/connection-types.md Documents CCLOUD/LOCAL/DIRECT connection types and related code locations.
.claude/rules/architecture/client-codegen.md Documents OpenAPI/GraphQL codegen workflow and directories.

CLAUDE.md Outdated
);
this.disposables.push(vscode.workspace.onDidChangeConfiguration(...));
}
// .dispose() is automatically handled by DisposableCollection
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snippet/comment implies .dispose() is “automatically handled” once you extend DisposableCollection, but DisposableCollection only implements dispose()—it still needs to be invoked (e.g., by pushing the instance into context.subscriptions or disposing it manually). Suggest rewording to avoid implying disposal happens without registration.

Suggested change
// .dispose() is automatically handled by DisposableCollection
// DisposableCollection implements .dispose() to clean up this.disposables
// Remember to register MyClass for disposal (e.g. in context.subscriptions)

Copilot uses AI. Check for mistakes.
CLAUDE.md Outdated
Comment on lines 65 to 67
- `src/clients/` — generated from OpenAPI specs via `npx gulp apigen`
- `src/graphql/sidecarGraphQL.d.ts` — generated from `src/graphql/sidecar.graphql`

Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/clients/ isn’t entirely auto-generated (it also contains the OpenAPI sources that apigen consumes, e.g. src/clients/docker.openapi.yaml, src/clients/medusa-openapi-spec/, and src/clients/sidecar-openapi-specs/). This section should distinguish “generated client code under src/clients/<service>/” from the editable spec/patch sources to avoid discouraging necessary edits.

Suggested change
- `src/clients/` — generated from OpenAPI specs via `npx gulp apigen`
- `src/graphql/sidecarGraphQL.d.ts` — generated from `src/graphql/sidecar.graphql`
- Generated client code under `src/clients/<service>/` — produced from OpenAPI specs via `npx gulp apigen`
- `src/graphql/sidecarGraphQL.d.ts` — generated from `src/graphql/sidecar.graphql`
## Editable API Specs (Do Edit)
- `src/clients/docker.openapi.yaml`
- `src/clients/medusa-openapi-spec/`
- `src/clients/sidecar-openapi-specs/` (and `src/clients/sidecar-openapi-specs/patches/`)

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +19
**NEVER manually edit files in `src/clients/`** — all auto-generated from OpenAPI specs.

## OpenAPI (REST) Clients

To modify client code:

1. Update the OpenAPI spec in `src/clients/sidecar-openapi-specs/`
2. Run `npx gulp apigen`
3. Commit both the spec changes AND a `.patch` file to `src/clients/sidecar-openapi-specs/patches/`
so subsequent generations apply cleanly

Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rule says “NEVER manually edit files in src/clients/ — all auto-generated”, but this repo keeps editable OpenAPI specs under src/clients/ as well (e.g. docker.openapi.yaml, medusa-openapi-spec/openapi.yaml, and sidecar-openapi-specs/*.yaml). Please narrow this to the generated output directories (like src/clients/sidecar/, src/clients/docker/, etc.) and explicitly call out the spec/patch locations as safe/expected to edit.

Suggested change
**NEVER manually edit files in `src/clients/`** — all auto-generated from OpenAPI specs.
## OpenAPI (REST) Clients
To modify client code:
1. Update the OpenAPI spec in `src/clients/sidecar-openapi-specs/`
2. Run `npx gulp apigen`
3. Commit both the spec changes AND a `.patch` file to `src/clients/sidecar-openapi-specs/patches/`
so subsequent generations apply cleanly
**NEVER manually edit generated client code under the auto-generated directories listed below**. These clients are produced from OpenAPI specs and should only be changed via spec/patch updates and regeneration.
## OpenAPI (REST) Clients
To modify client code:
1. Update the relevant OpenAPI spec (for example:
- `src/clients/sidecar-openapi-specs/**/*.yaml`
- `src/clients/docker.openapi.yaml`
- `src/clients/medusa-openapi-spec/openapi.yaml`
)
2. Run `npx gulp apigen`
3. Commit both the spec changes AND any `.patch` files to `src/clients/sidecar-openapi-specs/patches/`
so subsequent generations apply cleanly
OpenAPI spec and patch files under the paths above are **expected and safe to edit**; only the generated client code under the directories listed in “Auto-Generated Directories and Files (never edit)” must not be modified by hand.

Copilot uses AI. Check for mistakes.
@sonarqube-confluent
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

- `src/graphql/sidecarGraphQL.d.ts` — generated from `src/graphql/sidecar.graphql`

1. **CCLOUD**: Confluent Cloud via OAuth authentication
OpenAPI specs under `src/clients/` typically come from upstream services — don't edit them directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might not need this note? since we have client-codegen.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants