Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flaky-tests/use-mcp-server/configuration/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-cover data-type="image">Cover image</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Claude Code</strong></td><td><a href="../../../../.gitbook/assets/claude.png">claude.png</a></td><td><a href="claude-code-cli.md">claude-code-cli.md</a></td></tr><tr><td align="center"><strong>Cursor</strong></td><td><a href="../../../../.gitbook/assets/cursor.png">cursor.png</a></td><td><a href="cursor-ide.md">cursor-ide.md</a></td></tr><tr><td align="center"><strong>GitHub Copilot</strong></td><td><a href="../../../../.gitbook/assets/github copilot.png">github copilot.png</a></td><td><a href="github-copilot-ide.md">github-copilot-ide.md</a></td></tr><tr><td align="center"><strong>Gemini</strong></td><td><a href="../../../../.gitbook/assets/gemini.png">gemini.png</a></td><td><a href="gemini-cli.md">gemini-cli.md</a></td></tr></tbody></table>
<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-cover data-type="image">Cover image</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Claude Code</strong></td><td><a href="../../../../.gitbook/assets/claude.png">claude.png</a></td><td><a href="claude-code-cli.md">claude-code-cli.md</a></td></tr><tr><td align="center"><strong>Claude Code Plugin</strong></td><td><a href="../../../../.gitbook/assets/claude.png">claude.png</a></td><td><a href="claude-code-plugin.md">claude-code-plugin.md</a></td></tr><tr><td align="center"><strong>Cursor</strong></td><td><a href="../../../../.gitbook/assets/cursor.png">cursor.png</a></td><td><a href="cursor-ide.md">cursor-ide.md</a></td></tr><tr><td align="center"><strong>GitHub Copilot</strong></td><td><a href="../../../../.gitbook/assets/github copilot.png">github copilot.png</a></td><td><a href="github-copilot-ide.md">github-copilot-ide.md</a></td></tr><tr><td align="center"><strong>Gemini</strong></td><td><a href="../../../../.gitbook/assets/gemini.png">gemini.png</a></td><td><a href="gemini-cli.md">gemini-cli.md</a></td></tr></tbody></table>
73 changes: 73 additions & 0 deletions flaky-tests/use-mcp-server/configuration/claude-code-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
description: Install the Trunk plugin for Claude Code
---

# Claude Code Plugin

The Trunk plugin for Claude Code bundles the MCP server connection, slash commands, and skills into a single install. This is the recommended way to connect Trunk to Claude Code.

## Install the Plugin

```bash
/plugin install trunk@https://github.com/trunk-io/claude-code-plugin
```

This adds the Trunk MCP server and gives you access to slash commands and skills that activate automatically.

You can also install directly from the repo without waiting for directory approval:

## Authentication

After installing, Claude Code will prompt you to authenticate with Trunk on first use.

1. Run any Trunk command (e.g., `/trunk:fix-flaky`) or trigger an MCP tool call
2. Claude Code will open a browser window for OAuth login
3. Log in with your Trunk account and authorize the connection
4. You'll see `Authentication successful. Connected to trunk.` back in the terminal

## Slash Commands

| Command | What it does |
|---|---|
| `/trunk:fix-flaky <test_name>` | Retrieves root cause analysis for a flaky test and offers to apply the fix |
| `/trunk:why-flaky <test_name>` | Explains why a test is flaky without making changes — good for triage |
| `/trunk:setup-uploads` | Detects your test framework and CI provider, then generates the upload configuration |

### Fix a flaky test

```
/trunk:fix-flaky test_user_login
```

Trunk analyzes the test, explains the root cause (race condition, shared state, time dependency, etc.), and shows a proposed fix with a diff. Say yes to apply the changes directly.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

"Say yes" is more casual than the rest of the document's tone. Consider something like:

Suggested change
Trunk analyzes the test, explains the root cause (race condition, shared state, time dependency, etc.), and shows a proposed fix with a diff. Say yes to apply the changes directly.
Trunk analyzes the test, explains the root cause (race condition, shared state, time dependency, etc.), and shows a proposed fix with a diff. Confirm to apply the changes directly.


### Understand why a test is flaky

```
/trunk:why-flaky test_payment_processing
```

Same analysis as `fix-flaky`, but read-only. Useful when you want to understand the problem before deciding how to handle it — especially for tests you didn't write.

### Set up test uploads

```
/trunk:setup-uploads
```

Walks through configuring your repo to upload test results to Trunk. The plugin detects your CI provider and test framework automatically, then generates ready-to-paste config snippets.

## Skills

The plugin includes two skills that activate automatically based on context:

**Flaky test patterns** — activates when you're debugging or writing tests. Provides common flaky test patterns and proven fixes so Claude Code can reference them without you asking.

**Trunk CI setup** — activates when you're editing CI configuration files (`.github/workflows/`, `.circleci/config.yml`, etc.). Provides best practices for test upload configuration.

## Also Available For

- [Cursor](cursor-ide.md) (one-click install)
- [GitHub Copilot](github-copilot-ide.md) (one-click install)
- [Gemini CLI](gemini-cli.md)
- [Any MCP client](https://github.com/trunk-io/mcp-server) — manual configuration
1 change: 1 addition & 0 deletions summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
* [Cursor (IDE)](flaky-tests/use-mcp-server/configuration/cursor-ide.md)
* [GitHub Copilot (IDE)](flaky-tests/use-mcp-server/configuration/github-copilot-ide.md)
* [Claude Code (CLI)](flaky-tests/use-mcp-server/configuration/claude-code-cli.md)
* [Claude Code Plugin](flaky-tests/use-mcp-server/configuration/claude-code-plugin.md)
* [Gemini (CLI)](flaky-tests/use-mcp-server/configuration/gemini-cli.md)
* [MCP Tool Reference](flaky-tests/use-mcp-server/mcp-tool-reference/README.md)
* [Get root cause analysis](flaky-tests/use-mcp-server/mcp-tool-reference/get-root-cause-analysis.md)
Expand Down
Loading