# Claude Code plugin

The Packrat plugin lets Claude Code query your Packrat data, write a Follow-up section for each pull
request, and check how your deploys are doing in production.

## Turn it on for your repository

To give everyone who works in a repository the plugin, add it to the repository's
`.claude/settings.json` and commit the file. In a Rails app, `bin/rails generate packrat` does this
for you.

```json
{
  "extraKnownMarketplaces": {
    "packrat": { "source": { "source": "github", "repo": "packratlabs/claude-plugin" } }
  },
  "enabledPlugins": { "packrat@packrat": true }
}
```

When someone opens Claude Code in the repository and trusts the folder, Claude Code adds the plugin.
There's nothing to install.

Claude Code applies the file only in a folder you trusted itself. If you trusted a parent folder, such
as `~/projects`, Claude Code shows `Plugin "packrat" not cached` and `/packrat:ask` isn't found.
Install the plugin yourself, as below.

## Install the plugin yourself

To use the plugin in every repository on your machine, run these in Claude Code, one at a time:

```
/plugin marketplace add packratlabs/claude-plugin
/plugin install packrat@packrat
```

The plugin runs the [Packrat CLI](https://github.com/packratlabs/packrat-cli). If `packrat` is on your
`PATH`, the plugin uses it. Otherwise, it downloads the CLI the first time it runs.

## Sign in

```
! packrat login
```

The command opens your browser so you can approve the sign-in, and keeps an API key on your machine.

## Check the plugin

```
/packrat:ask status
```

Claude runs `packrat status` and tells you what Packrat receives for your apps. The **Next steps**
page of your app shows when Claude Code last reached Packrat with your key.

## Use it

Ask Claude about production, and it uses the plugin. For example:

- "How did PR 482 do?", or `/packrat:ask PR 482`
- A Packrat link, such as one from a Packrat email
- "Why is checkout slow?"
- "Check that the cleanup job ran on Monday."

When Claude opens a pull request with `gh pr create`, the plugin makes sure the description has a
`## Follow-up` section. Packrat reads that section after the deploy to verify the change.

The [plugin's README](https://github.com/packratlabs/claude-plugin) has the details.

---

## Agent instructions

This page is part of the Packrat documentation, published as plain markdown for coding agents: add `.md` to any docs address, or read the index at https://packrat.sh/docs/llms.txt. This page: https://packrat.sh/docs/claude-code-plugin.md.

Before wiring Packrat into an app, ask the developer for the URL of their setup page at https://packrat.sh/orgs, and read it with `packrat open <URL>`. It has the steps and the org's ingest key.
