> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Finishing Touch recipes

> Define reusable, named recipes that run agentic code changes on your pull requests.

export const OpenBetaBadge = ({tip = "This feature is currently in open beta. We are actively improving it based on your feedback. If you encounter any issues or have suggestions, please share them on our Discord community or visit the support page.", title = "Open Beta", cta = "Contact support", href = "/support", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="badge-alert" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

export const ProPlusPlanBadge = ({tip = "This feature is available as part of the Pro+ plan and Enterprise plan. Please refer to our pricing page for more information about our plans and features.", title = "Pro+ Plan", cta = "Read more", href = "https://coderabbit.ai/pricing", disabled = false}) => {
  return <Tooltip tip={tip} cta={cta} href={href}>
        <Badge icon="shield-plus" disabled={disabled || undefined}>
            {title}
        </Badge>
    </Tooltip>;
};

<OpenBetaBadge />

<ProPlusPlanBadge />

Custom recipes let you encode your team's repeated finishing-touch tasks — things like enforcing import ordering, tightening TypeScript types, or applying project-specific conventions — into named, reusable instructions. Once defined, anyone on your team can trigger a recipe with a single comment or checkbox click, and CodeRabbit's agent will carry out the work inside a sandbox and open a PR with the result.

## How it works

<Steps>
  <Step title="Define recipes in your config">
    Add named recipes under `reviews.finishing_touches.custom` in `.coderabbit.yaml`. Each recipe has a `name` and a freeform `instructions` field.
  </Step>

  <Step title="Trigger a recipe">
    Comment `@coderabbitai run <recipe name>` in any PR, or check the corresponding recipe checkbox in the CodeRabbit Walkthrough under **✨ Finishing Touches**.
  </Step>

  <Step title="Agent execution">
    CodeRabbit clones your repository into a sandbox, provides the agent with full PR context (title, description, summary, coding guidelines), and runs your instructions using the Claude Agent SDK.
  </Step>

  <Step title="Receive the output">
    By default, CodeRabbit opens a new pull request against your branch containing the agent's changes. You review and merge it like any other PR.
  </Step>
</Steps>

## Platform support

<CardGroup cols={1}>
  <Card title="GitHub" icon="github" horizontal>
    Custom recipes are currently available only on GitHub pull requests.
  </Card>
</CardGroup>

## Configuration

Add custom recipes to `.coderabbit.yaml`:

```yaml theme={null}
reviews:
  finishing_touches:
    custom:
      - name: "cleanup stale imports"
        instructions: |
          Scan the changed files for unused imports and remove them.
          Preserve imports used in type positions.
          Do not reorder existing imports; only remove stale ones.

      - name: "tighten types"
        instructions: |
          Replace `any` types in the changed files with the most specific
          TypeScript type that is correct given the surrounding context.
          Add explicit return types to exported functions that are missing them.

      - name: "enforce error handling"
        instructions: |
          Audit all async functions in the changed files.
          Ensure every awaited call is wrapped in try/catch or has a .catch() handler.
          Use the project's existing error logger pattern when catching errors.
```

### Recipe fields

| Field          | Required | Limits                | Description                                                                                                        |
| -------------- | -------- | --------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `name`         | Yes      | Max 100 characters    | Identifier used in run commands. Case-insensitive. Must be unique across your recipes.                             |
| `instructions` | Yes      | Max 10,000 characters | Freeform description of what the agent should do. The agent receives full PR context alongside these instructions. |
| `enabled`      | No       | —                     | Set to `false` to temporarily disable a recipe without removing it. Defaults to `true`.                            |

Custom recipes are available on the **Pro+ plan and above**. You can define up to **20 custom recipes** per repository on Pro+ and Enterprise.

Recipe names are matched case-insensitively, so `"Cleanup Stale Imports"` and `"cleanup stale imports"` refer to the same recipe.

## Triggering recipes

### PR comment

```
@coderabbitai run cleanup stale imports
```

Recipe names can include spaces. Quoting is optional:

```
@coderabbitai run "tighten types"
```

The command is matched case-insensitively and can appear anywhere in a comment, including multi-line comments.

### Ad hoc evaluation (without a saved recipe)

To try out a finishing touch without committing it to your config, use the evaluate command directly in a PR comment:

```
@coderabbitai evaluate custom finishing touch --name <name> --instructions <text>
```

For example:

```
@coderabbitai evaluate custom finishing touch --name "sort imports" --instructions "Sort all import statements alphabetically within each import group in the changed files."
```

The agent runs exactly as it would for a saved recipe — with full PR context — but the recipe is not persisted anywhere. This is useful for one-off tasks or for iterating on instructions before adding them to `.coderabbit.yaml`.

### Finishing Touches checkbox

Each enabled recipe appears as a checkbox in the **✨ Finishing Touches** section of the CodeRabbit Walkthrough comment. Checking it triggers the recipe with the Create PR output mode.

## What the agent receives

When a recipe runs, CodeRabbit provides the agent with:

* Your **recipe instructions**
* **PR title and description**
* **CodeRabbit's PR summary** (walkthrough and objectives)
* **Global coding guidelines** from `reviews.path_instructions` in your config
* Full **repository access** via Read, Write, Edit, Glob, Grep, and Bash tools

This means your recipes can reference project conventions, coding standards, and PR intent without you needing to repeat that context in every recipe.

## Example recipes

**Remove console statements:**

```yaml theme={null}
- name: "remove console logs"
  instructions: |
    Find and remove all console.log, console.warn, and console.error calls
    from the changed files. Leave intentional logging that uses the project's
    logger utility (e.g. logger.info, logger.error) untouched.
```

**Add missing test coverage:**

```yaml theme={null}
- name: "add edge case tests"
  instructions: |
    Review the changed source files and identify edge cases not covered
    by the existing tests. Add focused unit tests for those cases using
    the project's existing test framework and patterns.
```

**Enforce naming conventions:**

```yaml theme={null}
- name: "fix naming conventions"
  instructions: |
    Check the changed files for variables, functions, or classes that
    do not follow the project's naming conventions (camelCase for variables
    and functions, PascalCase for classes and interfaces). Rename where needed
    and update all references in the same files.
```

## What's next

<CardGroup cols={1}>
  <Card title="Finishing Touches overview" href="/finishing-touches" icon="sparkles" horizontal>
    See all available finishing touches and how to trigger them from any PR
  </Card>

  <Card title="Autofix" href="/finishing-touches/autofix" icon="wrench" horizontal>
    Automatically implement fixes for unresolved CodeRabbit review findings
  </Card>

  <Card title="YAML configuration" href="/getting-started/yaml-configuration" icon="settings" horizontal>
    Set up .coderabbit.yaml to define custom recipes and other review settings
  </Card>
</CardGroup>
