---
url: /howto/integrating-with-claude-code.md
---

# How to Integrate Teamscale into Claude Code and GitHub Copilot CLI

The Teamscale Agent Plugin brings Teamscale's quality information directly into your AI coding agent.
It uses the [Claude Code](https://claude.com/claude-code) plugin format, which [GitHub Copilot CLI](https://github.com/github/copilot-cli) reads as well, so you can install the same plugin in either agent.
With the plugin, your agent can detect and fix Teamscale findings, close test gaps on a pull request, run pre-commit analysis on local changes, and run only the tests impacted by its changes.
This keeps the feedback loop short: the agent fixes quality problems while it is already working on the code, instead of you triaging them later.

The plugin is distributed through our plugin marketplace on GitHub: [github.com/teamscale/claude-code](https://github.com/teamscale/claude-code).

::: warning Beta Version
The plugin is still under active development and subject to frequent changes.
We recommend to update the plugin regularly.
:::

\[\[toc]]

## Prerequisites

The plugin talks to Teamscale through the [`teamscale-dev` command-line client](../../reference/cli/teamscale-dev/), so the setup largely matches that of `teamscale-dev`:

* A running Teamscale instance that analyzes your project.
* The [`teamscale-dev` CLI](../../reference/cli/teamscale-dev/#installation) must be installed and available on the `PATH`.
* The project must contain a [`.teamscale.toml` configuration file](../../reference/teamscale-toml/), which tells `teamscale-dev` which Teamscale server and project to use.
* Credentials must be provided via the [`TEAMSCALE_DEV_USER` and `TEAMSCALE_DEV_ACCESSKEY` environment variables](../../reference/cli/teamscale-dev/#the-teamscale-dev-user-and-teamscale-dev-accesskey-environment-variables).
* Python 3.9 or later must be installed, as the plugin's helper scripts are written in Python.

If your project does not exist in Teamscale yet, your agent can create it and the `.teamscale.toml` file for you, see [Setting Up Teamscale with Your Agent](#setting-up-teamscale-with-your-agent).

These prerequisites are the same for every agent, because all of them run the plugin's skills against the local `teamscale-dev` installation.

## Installation

### Claude Code

Run the following commands inside Claude Code:

```
/plugin marketplace add teamscale/claude-code
/plugin install teamscale@teamscale-plugins
/reload-plugins
/teamscale:check-setup
```

Alternatively, run `/plugin` and install the plugin from the **Discover** tab.

The final `/teamscale:check-setup` command verifies all prerequisites listed above and helps you correct any problems it detects, so run it once after installing and whenever the plugin misbehaves.

### GitHub Copilot CLI

Copilot CLI reads the same plugin manifest and skill layout as Claude Code, so it installs this plugin unchanged, and no separate Copilot-specific plugin is needed.
Run the following commands inside Copilot CLI:

```
/plugin marketplace add teamscale/claude-code
/plugin install teamscale@teamscale-plugins
/teamscale:check-setup
```

## Skills

The plugin provides the following skills:

| Skill | Description |
|---|---|
| `/teamscale:check-setup` | Verifies the plugin's prerequisites and helps with correcting detected problems. |
| `/teamscale:pr-fix-findings` | Fetches the findings introduced on the current branch or pull request from Teamscale and fixes them. |
| `/teamscale:pr-close-test-gaps` | Fetches test-gap information for the current branch or pull request and generates tests to close the gaps. |
| `/teamscale:issue-close-test-gaps <ticket>` | Fetches test-gap information for the given ticket from Teamscale and generates tests to close the gaps. Does not use Git, so it also works in a repository that does not contain the code under test. |
| `/teamscale:fix-findings <files>` | Fetches the findings for the given files from Teamscale and fixes them. This uses the server's analysis results, so the files must be committed and pushed. |
| `/teamscale:local-fix-findings` | Runs pre-commit analysis on the uncommitted local changes and fixes the resulting findings. |
| `/teamscale:local-select-tests` | Selects the tests most impacted by the uncommitted local changes, using Teamscale's [Test Impact Analysis](../../reference/cli/teamscale-dev/#the-fetch-impacted-tests-command), so the agent runs targeted tests instead of the whole suite. |

The prefixes indicate what a skill operates on:
skills with the `pr-` prefix work on the open pull request matching the current Git branch and fall back to comparing the branch against the repository's default branch when no pull request exists,
skills with the `issue-` prefix work on the code that Teamscale attributes to the ticket you name, independently of the current Git branch,
while skills with the `local-` prefix work on the uncommitted changes in your working directory.

You do not have to invoke the skills explicitly.
Except for `/teamscale:check-setup`, your coding agent invokes them on its own when your request matches, for example, when you ask it to "fix the Teamscale findings on my branch", to "close the test gaps for TS-1234", or to "run the tests affected by my changes".

## Setting Up Teamscale with Your Agent

Your coding agent can also set up Teamscale for your repository.

To create a Teamscale project for your repository and the `.teamscale.toml` file:

To record test coverage, upload it to Teamscale and use it for Test Gap analysis:

## Integrating With Other Coding Agents

If your coding agent does not support the Claude Code plugin format, you can integrate Teamscale via the [`teamscale-dev mcp` command](../../reference/cli/teamscale-dev/#the-mcp-command), which exposes the same functionality as Model Context Protocol (MCP) tools.
