Thank you for your interest in contributing. This guide covers the plugin itself: agents, hooks, MCP configuration, and tooling. For contributing skills, see the cockroachdb-skills CONTRIBUTING.md instead; skills are maintained upstream and synced here automatically.
- VS Code with GitHub Copilot (agent mode), or the Copilot CLI
- MCP Toolbox for Databases v1.0.0+ (
brew install mcp-toolbox) - Python 3 (for hook scripts, no external dependencies)
- A running CockroachDB instance (local or cloud)
git clone --recurse-submodules https://github.com/cockroachdb/copilot-plugin.git
cd copilot-pluginSet your connection environment variables:
export COCKROACHDB_HOST=localhost
export COCKROACHDB_PORT=26257
export COCKROACHDB_USER=root
export COCKROACHDB_PASSWORD=
export COCKROACHDB_DATABASE=defaultdb
export COCKROACHDB_SSLMODE=disableTest the plugin locally by opening the repo in VS Code (Copilot reads .github/skills, .github/agents, .github/hooks, and .vscode/mcp.json directly), or install it from source with Chat: Install Plugin From Source.
plugin.json # Plugin manifest (version managed by Release Please)
.mcp.json # MCP server definitions for plugin installs (mcpServers)
.vscode/mcp.json # MCP server definitions for workspace use (servers)
tools.yaml # MCP Toolbox source and tool definitions
.github/
plugin/marketplace.json # Marketplace catalog entry
agents/ # Agent files (*.agent.md)
hooks/cockroachdb.json # Hook triggers
skills/ # Flattened from cockroachdb-skills submodule (do not edit directly)
scripts/
validate-sql.py # PreToolUse: blocks dangerous SQL patterns
check-sql-files.py # PostToolUse: lints files for anti-patterns
sync-skills.sh # Flattens skills into the Copilot layout
submodules/
cockroachdb-skills/ # Upstream skills submodule
| Area | Examples |
|---|---|
| Agents | New agent personas, improved prompts |
| Hooks | New safety checks, additional SQL anti-pattern detection |
| MCP config | New backend integrations, connection improvements |
| Tools | New tool definitions in tools.yaml |
| Bug fixes | Path handling, env var defaults, config issues |
| Documentation | README improvements, inline comments |
- New skills go to the cockroachdb-skills repo
- Toolbox bugs go to the MCP Toolbox repo
-
Create a feature branch:
git checkout -b fix/describe-your-change
-
Make your changes, matching the existing code style.
-
Test hook scripts (if modified). VS Code passes camelCase tool inputs while Claude Code uses snake_case, so test both:
echo '{"tool_input":{"sql":"SELECT 1"}}' | python3 scripts/validate-sql.py echo '{"tool_input":{"file_path":"test.sql"}}' | python3 scripts/check-sql-files.py echo '{"tool_input":{"filePath":"test.sql"}}' | python3 scripts/check-sql-files.py
-
Commit using Conventional Commits and open a Pull Request against
main.
This repo uses Release Please for automated versioning and changelogs.
| Prefix | Effect | Example |
|---|---|---|
fix: |
Patch release (0.1.x) | fix: handle empty SQL in validate hook |
feat: |
Minor release (0.x.0) | feat: add index validation hook |
docs: |
No release | docs: update README with new backend |
chore: |
No release | chore: update submodule reference |
Never bump the version in plugin.json or .release-please-manifest.json manually; Release Please owns these files.
- Agent files live in
.github/agents/and use the.agent.mdextension. - Use YAML frontmatter with
nameanddescription; Copilot selects an agent based on its description and task context. - Avoid pinning a Claude-only
modelvalue so the user's selected Copilot model applies.
- Hook scripts must be Python 3 with no external dependencies (stdlib only).
- Read JSON from stdin, write JSON to stdout. PreToolUse blocks a tool with
hookSpecificOutput.permissionDecisionset todeny. - VS Code ignores hook matchers (hooks run on every tool invocation), so scripts must exit early when the input is not relevant. VS Code also passes camelCase tool inputs (
filePath) where Claude uses snake_case (file_path); accept both. - Load hook scripts through the long-path-safe bootstrap below instead of passing the script path straight to
python3. The plugin root can resolve to a deeply nested cache path that exceeds the 260-characterMAX_PATHlimit on Windows; passing the path directly makes Python fail to open the script. The bootstrap loads the script withrunpy, prefixes the path with the\\?\long-path escape on Windows, keeps it inside single quotes so paths with spaces still work, and uses; exit 0so a failed bootstrap never disrupts editing:"command": "python3 -c 'import sys, os, runpy; p = os.path.normpath(r\"${CLAUDE_PLUGIN_ROOT}/scripts/your-script.py\"); p = (\"\\\\?\\\\\" + p) if os.name == \"nt\" else p; runpy.run_path(p, run_name=\"__main__\")'; exit 0"
.mcp.json(top-levelmcpServers) is used by plugin installs;.vscode/mcp.json(top-levelservers) is used in workspaces. Keep both in sync when adding a backend.- Use
${ENV_VAR}syntax for environment variable references. - The
tools.yamlfile uses Toolbox v1.1.0 map-based format with${VAR:default}syntax for defaults.
Skills are synced from the upstream cockroachdb-skills submodule by a weekly CI workflow, then flattened into .github/skills/ by scripts/sync-skills.sh. Do not edit files under .github/skills/ directly; contribute new skills to the upstream repo instead.
- Use GitHub Issues for bugs and feature requests.
- Include your plugin version (
plugin.json->version), VS Code and Copilot versions, and OS. - For connection issues, include the MCP backend you are using (Toolbox or Cloud MCP).
By contributing, you agree that your contributions will be licensed under the Apache-2.0 License.