> For the complete documentation index, see [llms.txt](https://docs.skydeck.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skydeck.ai/zh-cn/genstudio-workspace/tools/pair-programmer/how-to-use.md).

# 如何使用

要开始使用 Pair Programmer，您需要指定您正在使用或想要使用的编程语言。默认情况下，该字段设置为 Python。

一旦您提交了您的编程语言，您将收到一条类似于以下内容的消息（尽管确切的措辞可能会有所不同），该消息详细说明了 Pair Programmer 提供的内容，并提供了一些有用的命令：

<figure><img src="/files/yD4DxsT0mhMXxEe5qOJd" alt="pair programmer example"><figcaption></figcaption></figure>

如果一切看起来正确，您可以在提示区域中写下您的编程问题。

### /change

`/change` 命令允许您在与 Pair Programmer 交互时修改您的偏好设置。目前，它支持两个选项：

* **编程语言** – 切换编程语言。例如，输入 `/change language=Java` 切换到 Java。
* **交互语言** – 更改沟通语言。例如，输入 `/change language=Spanish` 切换到西班牙语。

### /implement

`/implement` 指令用于创建新的程序。它遵循五步流程以确保彻底的处理：

例如，你可以输入 `/implement task=TaskDescription` 。请将 `TaskDescription` 替换为你想要实现的任务的描述。

#### 示例

假设你想实现一个程序，用于计算列表中所有元素的总和。

{% code overflow="wrap" %}

```
/实现 任务=创建一个Python函数，用于计算列表中所有元素的和。该函数应接收一个整数列表作为输入，并返回一个整数作为输出。
```

{% endcode %}

### /modify

`/modify`命令用于需要对现有程序进行更改或调整。输入`/modify code=ProgramCode modifications=ProgramModification`。请将`ProgramCode`替换为你希望修改的程序，将`ProgramModification`替换为你希望改变的内容的描述。

#### 示例

例如，假设你有一个Python函数，可以计算矩形的面积，但你想修改它来计算圆的面积。

{% code overflow="wrap" %}

```
/modify code=
def rectangle_area(length, width):
    return length * width

modifications=
将函数改为计算圆的面积，使用公式 `pi * radius^2`。函数应该接受一个表示半径的参数。
```

{% endcode %}

### /test

`/test` 命令用于当你希望我为给定程序创建测试用例时使用。请输入 `/test code=ProgramCode description=ProgramDescription`。请将 `ProgramCode` 替换为你要测试的程序，并将 `ProgramDescription` 替换为该程序的功能描述。

#### 示例

假设你有一个用于计算阶乘的 Python 函数，你想为它创建测试用例

{% code overflow="wrap" %}

```
/test code=
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

description=
这个函数用于计算给定数字的阶乘。一个数n的阶乘是小于或等于n的所有正整数的乘积。
```

{% endcode %}


---

# 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:

```
GET https://docs.skydeck.ai/zh-cn/genstudio-workspace/tools/pair-programmer/how-to-use.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
