# Build Your First Command

Slapdash works great in the browser, but for the best development experience, we recommend using the [Slapdash desktop app](https://slapdash.com/download).

There are [two types of commands](/command-bar-101/commands.md#local-vs-cloud-commands): **Local Commands**, which are scripts that run on your computer, and **Cloud Commands**, which are commands that are hosted on the web. Developing is easier and faster with files on your computer, so that's the type of command we'll be writing here.

This example command will be written in JavaScript, but in practice, you can use [whatever language](/command-bar-101/local-commands.md#language-support) you are comfortable with.

### Create Command

* Create an empty file with a `.js` extension (for example: `ahoy-world.js`)
* Run **Create New Command** in the Command Bar and choose **Local Script**
* Choose the file you created by clicking the **Select File button.**
* Give the command a name, for example, "Run Demo"

### Do Something with the Command

For the Command to do something or show something in the Command Bar, it just needs to print some text. Specifically, the text needs to be JSON that matches the shape of the [Command Response Specification](/reference/command-response.md).

The most basic thing a command can do is return an Action as the [Command Response](/reference/command-response.md). An Action just tells the Command Bar to do some operation and exit. The simplest one is to just open a URL.

#### **Make Your Command Open a URL**

```javascript
const response = {
  action: {
    type: "open-url",
    url: "https://slapdash.com/"
  }
}

// Print the response as JSON string
console.log(JSON.stringify(response));
```

Another type of Action is to add something to your clipboard. You can see other Actions in the [Command Response Reference](/reference/command-response-action.md).

#### **Make Your Command Add Some Text to Your Clipboard**

```javascript
const response = {
  action: {
    type: "copy",
    value: "Ahoy world!"
  }
}

// Print the response as JSON string
console.log(JSON.stringify(response));
```


---

# 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://platform.slapdash.com/command-bar-101/setup-your-first-command.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.
