# Commands

### <mark style="color:yellow;">Insert Code</mark>

Write a comment in the Xcode editor and use the ***Insert Code*** command. AutoGPT will generate the code based on the comment and insert it automatically.

### <mark style="color:yellow;">Explain Code</mark>

Select a piece of code in your Swift project and use the ***Explain Code*** command. The UI will then display, and you can view the code explanation in the response section.

### <mark style="color:yellow;">Refactor Code</mark>

Select a piece of code in your Swift project and use the ***Refactor Code*** command. AutoGPT will refactor the code for you and will show it in the response section.

### <mark style="color:yellow;">Document Code</mark>

Select a piece of code in your Swift project and use the ***Comment Code*** command. Autogpt will comment each line for you.

### <mark style="color:yellow;">Shorten Code</mark>

Select a piece of code in your Swift project and use the ***Shorten Code*** command. AutoGPT will shorten the code as much as possible.

### <mark style="color:yellow;">Unit Test</mark>

Select a piece of code in your Swift project and use the ***Unit Test*** command. AutoGPT will generate a unit test.

### <mark style="color:yellow;">Custom Command</mark>

To create your own command, go to the customization section and follow the provided instructions.

## Important

To use the commands, the app must be open and running. If the app is not open and running, the response tab will not be displayed for the following commands: Explain Code, Refactor Code, Document Code, Shorten Code, Unit Test, and Custom Command.
