#### Integrations

# Deeplinks

Deeplinks allow you to share prompts, commands, and rules with others, enabling collaboration and knowledge sharing across teams and communities.

Links can also be opened via [cursor.com](https://cursor.com). Append the path and url params to the end of the url, for example: [cursor.com/link/prompt?text=...](https://cursor.com/link/prompt?text=Research+and+find+one+bug+in+this+codebase)

> [!NOTE]
>
> Always review your prompts and commands before sharing to ensure they don't contain sensitive information like API keys, passwords, or proprietary code.

> [!NOTE]
> Deeplinks keep the \`cursor://\` scheme
>
> Grok Build registers the `cursor://` URL scheme, and the handler id is `anysphere.cursor-deeplink`. Both are identifiers the installed application claims with the operating system, not product names, so they are unchanged by the rename: a link written as `grok://` opens nothing. Keep `cursor://anysphere.cursor-deeplink/...` exactly as written here.

## Prompts

Share prompts that others can use to get started quickly with specific tasks or workflows. When someone clicks a prompt deeplink, it opens Grok Build with the prompt pre-filled in the chat. The user must review and confirm the prompt before it gets executed. Deeplinks never trigger automatic execution.

```text
Research and find one bug in this codebase
```

[Open in Grok Build](cursor://anysphere.cursor-deeplink/prompt?text=Research%20and%20find%20one%20bug%20in%20this%20codebase)

**TypeScript**

```typescript
const IS_WEB = false; // Set to true for web format

function generatePromptDeeplink(promptText: string): string {
  const baseUrl = IS_WEB
    ? 'https://cursor.com/link/prompt'
    : 'cursor://anysphere.cursor-deeplink/prompt';
  const url = new URL(baseUrl);
  url.searchParams.set('text', promptText);
  return url.toString();
}

const deeplink = generatePromptDeeplink("Create a React component for user authentication");
console.log(deeplink);
```

**Python**

```python customLanguage="pythonWithoutSDK"
from urllib.parse import urlencode, urlparse, urlunparse

IS_WEB = False  # Set to True for web format

def generate_prompt_deeplink(prompt_text: str) -> str:
    base_url = "https://cursor.com/link/prompt" if IS_WEB else "cursor://anysphere.cursor-deeplink/prompt"
    params = {"text": prompt_text}
    query_string = urlencode(params)
    return f"{base_url}?{query_string}"

deeplink = generate_prompt_deeplink("Create a React component for user authentication")
print(deeplink)
```

## Commands

Share commands that others can execute directly in their Grok Build environment. Command deeplinks allow you to share custom commands defined in your `.cursor/commands` directory. When someone clicks a command deeplink, it opens Grok Build and creates a new command with the specified name and content. The user must review and confirm the command before it gets executed.

```text
Add console.log statements to debug API responses
```

[Open in Grok Build](cursor://anysphere.cursor-deeplink/command?name=debug-api\&text=Add%20console.log%20statements%20to%20debug%20API%20responses)

**TypeScript**

```typescript
const IS_WEB = false; // Set to true for web format

function generateCommandDeeplink(commandName: string, commandContent: string): string {
  const baseUrl = IS_WEB
    ? 'https://cursor.com/link/command'
    : 'cursor://anysphere.cursor-deeplink/command';
  const url = new URL(baseUrl);
  url.searchParams.set('name', commandName);
  url.searchParams.set('text', commandContent);
  return url.toString();
}

const deeplink = generateCommandDeeplink("debug-api", "Add console.log statements to debug API responses");
console.log(deeplink);
```

**Python**

```python customLanguage="pythonWithoutSDK"
from urllib.parse import urlencode, urlparse, urlunparse

IS_WEB = False  # Set to True for web format

def generate_command_deeplink(command_name: str, command_content: str) -> str:
    base_url = "https://cursor.com/link/command" if IS_WEB else "cursor://anysphere.cursor-deeplink/command"
    params = {"name": command_name, "text": command_content}
    query_string = urlencode(params)
    return f"{base_url}?{query_string}"

deeplink = generate_command_deeplink("debug-api", "Add console.log statements to debug API responses")
print(deeplink)
```

## Rules

Share rules that others can add to their Grok Build environment. Rule deeplinks allow you to share custom rules defined in your `.cursor/rules` directory. When someone clicks a rule deeplink, it opens Grok Build and creates a new rule with the specified name and content. The user must review and confirm the rule before it gets added.

```text
Always use strict TypeScript types and avoid 'any'
```

[Open in Grok Build](cursor://anysphere.cursor-deeplink/rule?name=typescript-strict\&text=Always%20use%20strict%20TypeScript%20types%20and%20avoid%20%27any%27)

**TypeScript**

```typescript
const IS_WEB = false; // Set to true for web format

function generateRuleDeeplink(ruleName: string, ruleContent: string): string {
  const baseUrl = IS_WEB
    ? 'https://cursor.com/link/rule'
    : 'cursor://anysphere.cursor-deeplink/rule';
  const url = new URL(baseUrl);
  url.searchParams.set('name', ruleName);
  url.searchParams.set('text', ruleContent);
  return url.toString();
}

const deeplink = generateRuleDeeplink("typescript-strict", "Always use strict TypeScript types and avoid 'any'");
console.log(deeplink);
```

**Python**

```python customLanguage="pythonWithoutSDK"
from urllib.parse import urlencode, urlparse, urlunparse

IS_WEB = False  # Set to True for web format

def generate_rule_deeplink(rule_name: str, rule_content: str) -> str:
    base_url = "https://cursor.com/link/rule" if IS_WEB else "cursor://anysphere.cursor-deeplink/rule"
    params = {"name": rule_name, "text": rule_content}
    query_string = urlencode(params)
    return f"{base_url}?{query_string}"

deeplink = generate_rule_deeplink("typescript-strict", "Always use strict TypeScript types and avoid 'any'")
print(deeplink)
```

## FAQ

**What is the maximum length for deeplink URLs?**

Deeplink URLs have a maximum length of 10,000 characters. When generating deeplinks programmatically, ensure your content doesn't exceed this limit when URL-encoded. The interactive generators above will show you the current URL length and remaining characters as you type.

**How do I use deeplinks on the web instead of in the Grok Build app?**

You can swap the deeplink protocol for web links by changing the base URL from `cursor://anysphere.cursor-deeplink/` to `https://cursor.com/link/`. For example:

```text
cursor://anysphere.cursor-deeplink/prompt?text=Hello%20world
```

```text
https://cursor.com/link/prompt?text=Hello%20world
```

Web links will redirect users to cursor.com where they can open the deeplink in their browser or copy it to use in Grok Build.
