> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/automation-and-merging/refine-autofixes-with-aikido-ai.md).

# Aikido AIでAutoFixを改善する

Aikidoでは、さまざまな種類の検出結果を自動的に修正できます。 **Aikido AIで微調整する** チャットパネルでは、diffビューを離れずに自然言語でAutoFixを段階的に調整できます。これは [Aikido Agent](/docs/docs-ja/aikidojento/aikido-agent.md)、同じインテリジェンスによって [Aikidoに質問](/docs/docs-ja/aikidojento/ask-aikido.md).

#### ユースケース

AutoFixで大半は対応できます。微調整が役立つのは次のような場合です:

* 修正内容は正しいが、コードベースの命名規則やパターンに合っていない
* 説明コメントを追加したい
* 単体テストを含めたい
* エラーハンドリングやログ出力の呼び出しなど、特定のロジックを導入したい
* 修正には、AIが利用できないコンテキストを考慮する必要がある
* 対象範囲を絞りたい。たとえば、サニタイズや検証の対象を制限したい

#### 修正を洗練する方法

**手順 1.** 以下からdiffモーダルを開きます `修正を表示` アクションを使って、 `Aikido AIで微調整する` 左下の項目をクリックします。

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-58b0e2d4bd1618414e96b699a1e009a90e9a0303%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**手順 2.** テキスト欄に指示を入力します。

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-cb08f67c3e7b3f381981f37c5ae05849ea8d3a55%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

**手順 3.** 洗練された修正の準備ができると、diffビューが自動的に更新されます。

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-c7f0a42e76a8f51effd6a204bbd98e4bbabc3ef6%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
送信した各指示は、その後の修正のためのコンテキストとして保持されるため、AIは最初からやり直すのではなく、前の指示を踏まえて作業します。
{% endhint %}

#### 指示を書くためのヒント

症状だけでなく、意図を具体的に伝えましょう:

* 「空のオブジェクトを返す代わりに例外を投げる」
* 「サニタイズ済み変数の名前を `safe_input` を `safeInput` "
* 「正規表現に一致したときにログを追加する」

## コンテキストを保持する

AutoFixを作成する際にAikidoに常にあなたの設定を考慮させたい場合は、 [AutoFixのカスタムコンテキスト](/docs/docs-ja/autofix-to/automation-and-merging/custom-context-for-autofixes.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/automation-and-merging/refine-autofixes-with-aikido-ai.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
