# Command K

## FEATURES

### Command K

Command K lets you edit and write code with the AI. To edit, try selecting some code, click "Edit," and describe how the code should be changed. To generate completely new code, just type Command K without selecting anything.

<figure><img src="/files/D6MeU2T7qviTGcL4kmh1" alt=""><figcaption></figcaption></figure>

**Tip:** Editing with Command K works best with selections between 1 and 50 lines. Edits also see the lint errors in your selection, so you can say "fix."


---

# Agent Instructions: 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://metaverse-imagen.gitbook.io/ai-tools-research/ai-tools-main-categories/programming-and-code/code-generators/cursor-ide/command-k.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.
