Agent skill
add-command
Create new VS Code commands with all required boilerplate
Install this agent skill to your Project
npx add-skill https://github.com/gitkraken/vscode-gitlens/tree/main/.claude/skills/add-command
SKILL.md
/add-command - Create New Command
Scaffold a new VS Code command with all required boilerplate.
Usage
/add-command [name]
Information Needed
- Command ID — e.g.,
myNewFeature(becomesgitlens.myNewFeature) - Label — Display name in command palette
- Base class:
GlCommandBase— No editor required (opening panels, showing pickers)ActiveEditorCommand— Requires active editorActiveEditorCachedCommand— Like ActiveEditorCommand with "repeat last command" support
- Variants (optional):
:views,:graph,:scmsuffixes for context menus
Files to Create/Modify
1. Command File: src/commands/{commandName}.ts
import type { TextEditor, Uri } from 'vscode';
import type { Container } from '../container.js';
import { command } from '../system/-webview/command.js';
import { {BaseClass} } from './commandBase.js';
export interface {CommandName}CommandArgs {
// Define args if needed
}
@command()
export class {CommandName}Command extends {BaseClass} {
constructor(private readonly container: Container) {
super([
'gitlens.{commandId}',
// Add variants here
]);
}
async execute(editor?: TextEditor, uri?: Uri, args?: {CommandName}CommandArgs): Promise<void> {
// TODO: Implement
}
}
2. Import in src/commands.ts
import './commands/{commandName}.js';
3. Add to contributions.json
Under "commands" key:
"gitlens.{commandId}": {
"label": "{Label}",
"category": "GitLens",
"commandPalette": "gitlens:enabled"
}
For :views variant:
"gitlens.{commandId}:views": {
"label": "{Label}",
"icon": "$(icon-name)",
"menus": {
"view/item/context": [{
"when": "viewItem =~ /gitlens:/ && gitlens:enabled",
"group": "1_gitlens"
}]
}
}
4. Run Generation
pnpm run generate:contributions && pnpm run generate:commandTypes
Common when Clauses
gitlens:enabled— Extension is enabled!gitlens:readonly— Not in readonly mode!gitlens:untrusted— Workspace is trustedgitlens:plus— Pro features availableviewItem =~ /gitlens:commit/— On a commit nodeviewItem =~ /gitlens:branch/— On a branch node
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
investigate
Structured investigation of a bug or unexpected behavior before implementing a fix
commit
Create well-formatted git commits following GitLens conventions
analyze
Deep design and implementation analysis with devil's advocate evaluation
add-icon
Add new icons to the GitLens GL Icons font
deep-planning
Use when formulating the best technical approach for a task — before writing implementation plans or code. Triggers on architecture decisions, complex features, refactors, or when the user asks how to approach something. Investigates current codebase, questions existing patterns, researches alternatives, and presents approaches with trade-offs.
review
Code review against GitLens standards with optional impact completeness audit
Didn't find tool you were looking for?