chore: add /cleanup skill for periodic maintainability passes#3392
Open
Matthew Seal (MSeal) wants to merge 1 commit into
Open
chore: add /cleanup skill for periodic maintainability passes#3392Matthew Seal (MSeal) wants to merge 1 commit into
Matthew Seal (MSeal) wants to merge 1 commit into
Conversation
Adds a project-local Claude Code skill at .claude/skills/cleanup/SKILL.md that runs non-functional cleanup passes. Identifies tech debt, hygiene, and organization issues, analyzes test coverage over the touched scope, and reviews proposed changes with the user before applying any subset. Key properties: - No behavior changes: every proposed edit must be functionally inert; anything that could shift behavior goes to a "needs-decision" bucket and is never auto-applied. - Propose before changing: findings are bucketed (Test Improvements, Must-fix, Should-fix, Consider, Needs decision) and the user picks the subset to apply. - Test coverage analysis runs before code changes; coverage gaps in the touched scope are surfaced first so tests can land before refactors. - Scope defaults: explicit path/glob > branch-diff vs main > prompt for full repo scan vs directory vs cancel. Never silently scans the whole repo. - Reads .claude/skills/cleanup/conventions.md (if present) and treats its rules as team norms alongside CLAUDE.md. The conventions doc is a hand-editable style guide; CLAUDE.md wins on conflicts. Also adds .claude/skills/cleanup/conventions.md with team-derived conventions covering style, testing, error handling, architecture, sidecar usage, and anti-patterns. Excludes the internal "learn-conventions" skill that mines team Slack/PRs to refresh this doc — that skill stays on contributors' machines via .gitignore. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new project-local Claude Code /cleanup skill to support periodic, non-functional maintainability passes, plus a companion conventions document to codify team norms that augment (but never override) CLAUDE.md.
Changes:
- Added
.claude/skills/cleanup/SKILL.mddefining a scoped, “propose-before-changing” cleanup workflow with verification steps and conventions-loading. - Added
.claude/skills/cleanup/conventions.mdas a hand-editable repository conventions reference for the cleanup skill to consult. - Updated
.gitignoreto exclude a local-only.claude/skills/learn-conventions/directory from being committed.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.gitignore |
Ignores an internal-only local Claude skill directory (learn-conventions/). |
.claude/skills/cleanup/SKILL.md |
Introduces the /cleanup skill process, scoping rules, bucketing, and verification workflow. |
.claude/skills/cleanup/conventions.md |
Adds repo-specific conventions that the cleanup skill treats as authoritative alongside CLAUDE.md. |
|
|
||
| - `git log --follow -- <file>` for files where age/ownership matters | ||
| - `grep -rn "TODO\|FIXME\|XXX\|HACK" <scope>` for self-flagged debt | ||
| - `grep -rn ": any\b\|as any\b" <scope>` for `any` usage (a CLAUDE.md violation) |
Comment on lines
+29
to
+30
| - Mocha tests must be isolated. Rely on `globalBeforeAll` to activate the extension rather than | ||
| assuming shared state from prior tests. |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary of Changes
.claude/skills/cleanup/SKILL.mdfor non-functional code cleanup, organization, and maintainability passes. The skill identifies tech debt, hygiene issues, and organization problems WITHOUT changing functionality, then reviews findings with the user and applies ONLY the subset they approve..claude/skills/cleanup/conventions.md, a hand-editable style guide that consolidates team norms for this repo.CLAUDE.mdwins on any conflict — conventions augment, they don't supersede.conventions.mdas Core Rule 7, so its rules count alongsideCLAUDE.mdwhen bucketing findings..gitignoreexcludes an internal-onlylearn-conventions/skill that mines team Slack and PRs to refreshconventions.md; contributors keep it locally.Skill design (high level)
Needs decisionbucket and is never auto-applied.Test Improvements→Must-fix→Should-fix→Consider→Needs decision; the user picks the subset to apply.main→ prompt for full-repo / directory / cancel. Never silently scans the whole repo.Click-testing instructions
Not applicable — this PR adds Claude Code skill files only; no extension behavior changes.
Optional: discovered findings from a first full-repo run
Running
/cleanupover the whole repo surfaced the items below. Not part of this PR — sharing as a follow-up roadmap for the team to triage.Hard-signal checks
src/utils/jarInspector*.ts(missing@types/yazl,@types/yauzl, implicitany)eslint-plugin-playwright(pre-existing tooling issue).onlyleft in tests: zero ✓src/viewProviders/and ~86% insrc/commands/; critical gaps insrc/webview/(~9%) andsrc/sidecar/(~44%)Test Improvements (recommended FIRST — protect refactors)
src/sidecar/sidecarHandle.tssrc/sidecar/sidecarManager.tssrc/webview/message-viewer.tssrc/sidecar/websocketManager.tsMust-fix (CLAUDE.md + conventions.md)
src/webview/comms/comms.ts:11,33,72— core message dispatch uses(type: any, body: any) => any. Replace with aMessageTypediscriminated union.src/sidecar/sidecarHandle.ts:82— sharedGraphQL response { data?: any }. Parameterize<T>orRecord<string, unknown>.src/commands/index.ts:21,38,39,40,72—registerCommandWithLogging()uses(...args: any[]). Type-narrow the context.src/models/resource.ts:46,126—isResource(value: any)andisSearchable(item: any)type-guards should useunknown.logger.error()→logError()acrosssrc/commands/{flinkUDFs,medusaCodeLens,schemas,flinkDatabaseView,docker,diffs,documents,flinkStatements,kafkaClusters}.ts,src/loaders/ccloudResourceLoader.ts,src/sidecar/websocketManager.ts,src/models/containers/resourceContainer.ts,src/utils/jarInspector.ts(~14 call sites).window.showErrorMessage()→showErrorNotificationWithButtons()insrc/commands/schemas.ts:161,src/commands/kafkaClusters.ts,src/commands/docker.ts,src/commands/medusaCodeLens.ts.src/viewProviders/resources.ts:74,105,147,264— four(element as any).constructor.namecasts. Replace with a discriminated union orinstanceofchecks.src/viewProviders/resources.ts:371,379,391— threethrow new Error()inDirectConnectionRowgetters. Wrap withlogError()and structured cause.src/commands/extra.ts(5),src/commands/diffs.ts:13,src/loaders/resourceLoaderInitialization.ts:9,src/sidecar/utils.ts(4),src/sidecar/websocketManager.ts(3),src/utils/bootstrapServers.ts,src/models/flinkAiModel.ts,src/viewProviders/resources.ts:498.Should-fix
src/loaders/ccloudResourceLoader.ts(1130 LOC) mixes GraphQL queries, REST wrappers, and model transformers. ExtractrestFlinkArtifactToModeland other transformers into co-located helpers without restructuring the loader itself.src/models/containers/resourceContainer.ts:124,136— hardcoded10000timeout. IntroduceDEFAULT_LOAD_TIMEOUT_MSat module level.Needs decision
src/viewProviders/resources.ts(940 LOC) — split tree-provider logic fromDirectConnectionRow. Touches import boundaries, possible serialization-timing impact.DisposableCollectionchain forflinkStatements,flinkDatabase,topics,schemasview providers (inherit viaParentedBaseViewProvider).Remaining lower-priority items (not shown above)
src/commands/{debugtools,schemaRegistry,providers,resources,organizations}.tsuncovered; thin coverage insrc/authn/~33%,src/chat/~29%,src/storage/~40%)src/quickpicks/,src/utils/,src/models/,src/webview/bindings/;Map<any,any>cleanup in storage; webview message-handlerbody: anyoverloads blocked on Add templates for some types of issues and discussions #1)src/sidecar/,src/loaders/; comment-refresh insrc/utils/fsWrappers.ts; TODO/FIXME density: 13 insrc/docker/, 10 insrc/commands/, 5 each insrc/sidecar/andsrc/quickpicks/)@types/yazl/@types/yauzldevDeps;WriteableTmpDirsingleton mutability; JSDoc onDisposableCollectionitself)Pull request checklist
Tests
(No tests — skill files are instructions for Claude Code, not extension code.)
Release notes
(Not user-facing — internal tooling for contributors.)
🤖 Generated with Claude Code