---
metadata:
  - name: generator
    content: Diplodoc Platform v5.57.3
alternate:
  - https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/generate-description.md
  - https://sourcecraft.dev/portal/docs/ru/sourcecraft/operations/generate-description.md
  - href: en/sourcecraft/operations/generate-description.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# Generating a description for a pull request

<!-- source: en/_includes/sourcecraft/ai-gen-desc-intro.md -->
With [Code Assistant](https://sourcecraft.dev/portal/docs/en/sourcecraft/concepts/code-assistant.md), you can automatically generate descriptions for new pull requests, as well as add and replace descriptions in previously created ones.
<!-- endsource: en/_includes/sourcecraft/ai-gen-desc-intro.md -->

<!-- source: en/_includes/sourcecraft/agents-md-tip.md -->
{% note tip %}

You can [set](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/generate-description.md#rules) the rules Code Assistant will follow to generate descriptions in the `AGENTS.md` file at the repository root.

{% endnote %}
<!-- endsource: en/_includes/sourcecraft/agents-md-tip.md -->

<iframe width="640" height="360" src="https://runtime.strm.yandex.ru/player/video/vplvmeamk7nt3ksceios?autoplay=0&mute=0" allow="autoplay; fullscreen; picture-in-picture; encrypted-media" frameborder="0" scrolling="no"></iframe>

## Generating a description when creating a pull request {#during-creation}

When [creating](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/pr-create.md) a pull request, under **Description**, select ![image](../../_assets/console-icons/sparkles-fill.svg)</svg> **Generate with AI**.

Code Assistant will add the description after creating your pull request.

<!-- source: en/_includes/sourcecraft/ai-gen-desc-time.md -->
Description generation may take a while.
<!-- endsource: en/_includes/sourcecraft/ai-gen-desc-time.md -->


## Generating a description in an existing pull request {#generate-in-created}

1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. On the ![image](../../_assets/console-icons/house.svg) **Home** tab, under ![image](../../_assets/console-icons/layout-tabs.svg) **Your craftspace**, navigate to ![image](../../_assets/console-icons/archive.svg) **Repositories**.
1. Select a repository.
1. Under ![image](../../_assets/console-icons/code.svg) **Code** on the repository page, go to ![image](../../_assets/console-icons/code-pull-request.svg) **Pull requests**.
1. Select a pull request.
1. Under **Description**, click ![image](../../_assets/console-icons/sparkles-fill.svg)</svg> **Generate with AI**.


## Updating a description in an existing pull request {#update-in-created}

1. Open the SourceCraft [home page](https://sourcecraft.dev).
1. On the ![image](../../_assets/console-icons/house.svg) **Home** tab, under ![image](../../_assets/console-icons/layout-tabs.svg) **Your craftspace**, navigate to ![image](../../_assets/console-icons/archive.svg) **Repositories**.
1. Select a repository.
1. Under ![image](../../_assets/console-icons/code.svg) **Code** on the repository page, go to ![image](../../_assets/console-icons/code-pull-request.svg) **Pull requests**.
1. Select a pull request.
1. Under **Description**, click ![image](../../_assets/console-icons/arrow-rotate-left.svg) → **Regenerate**.


## Configuring rules for descriptions {#rules}

1. [Add](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/add-file-repo.md) `AGENTS.md` to the repository root directory.

    If the file already exists, open it and click ![image](../../_assets/console-icons/pencil.svg) **Edit**.

1. In `AGENTS.md`, define the requirements for Code Assistant, like this:

    ```text
    When creating a PR description, use this phrase: _What a wonderful code_.
    ```

1. Click **Commit changes**.
1. In the window that opens, configure the settings and confirm your changes.