home / skills / nweii / agent-stuff / raycast-extensions

raycast-extensions skill

/skills/raycast-extensions

This skill helps you create Raycast extensions with React and TypeScript, guiding UI primitives, data fetching, and AI integration for productive workflows.

npx playbooks add skill nweii/agent-stuff --skill raycast-extensions

Review the files below or copy the command above to add this skill to your agents.

Files (13)
SKILL.md
3.3 KB
---
name: raycast-extensions
description: "Build Raycast extensions using React and Node.js. Use for creating commands, UI components (List, Form, Grid), hooks (useFetch), AI integration, and manifest configuration."
metadata:
  author: nweii
  version: "1.0.0"
---

# Raycast Extension Development

Build Raycast extensions using React, TypeScript, and Node.js.

## Quick Start

1. **Create extension**: Run "Create Extension" command in Raycast
2. **Install & develop**: `npm install && npm run dev`
3. **Edit**: Modify `src/index.tsx`, changes hot-reload automatically
4. **Test**: Extension appears at top of Raycast root search

## Choosing a UI Primitive

| Need | Component |
|------|-----------|
| Searchable list of items | `List` |
| Image gallery/grid | `Grid` |
| User input collection | `Form` |
| Rich content display | `Detail` |
| Status bar presence | `MenuBarExtra` |

### Decision Tree

1. **Displaying items the user searches/filters?**
   - Text-focused → `List`
   - Image-focused → `Grid`

2. **Collecting user input?** → `Form`

3. **Showing detailed content?** → `Detail` (supports markdown + metadata)

4. **Always-visible status bar?** → `MenuBarExtra`

## Core Patterns

### List with ActionPanel

```tsx
import { ActionPanel, Action, List } from "@raycast/api";

export default function Command() {
  return (
    <List>
      <List.Item
        title="Item"
        actions={
          <ActionPanel>
            <Action.CopyToClipboard content="Copied!" />
            <Action.OpenInBrowser url="https://raycast.com" />
          </ActionPanel>
        }
      />
    </List>
  );
}
```

### Data Fetching

```tsx
import { List } from "@raycast/api";
import { useFetch } from "@raycast/utils";

export default function Command() {
  const { data, isLoading } = useFetch<Item[]>("https://api.example.com/items");
  
  return (
    <List isLoading={isLoading}>
      {data?.map((item) => <List.Item key={item.id} title={item.name} />)}
    </List>
  );
}
```

### AI Integration

```tsx
import { AI, Clipboard } from "@raycast/api";

export default async function Command() {
  const answer = await AI.ask("Summarize this text");
  await Clipboard.copy(answer);
}
```

> [!NOTE]
> AI requires Raycast Pro. Check access with `environment.canAccess(AI)`.

## References

For detailed documentation, see:

- **UI Components**: [references/ui-components.md](references/ui-components.md) - List, Detail, Form, Grid, ActionPanel, MenuBarExtra
- **Hooks & Utilities**: [references/hooks-utilities.md](references/hooks-utilities.md) - useFetch, LocalStorage, Clipboard, OAuth, runAppleScript
- **AI API**: [references/ai-api.md](references/ai-api.md) - AI.ask, useAI, model selection, streaming
- **Package Structure**: [references/package-structure.md](references/package-structure.md) - manifest, commands, preferences

## Examples

Runnable examples in `examples/`:

| File | Pattern |
|------|---------|
| `list-with-actions.tsx` | List + ActionPanel basics |
| `list-with-detail.tsx` | List with detail panel |
| `form-with-validation.tsx` | Form + useForm validation |
| `detail-with-metadata.tsx` | Detail markdown + metadata |
| `grid-with-images.tsx` | Grid layout |
| `data-fetching.tsx` | useFetch patterns |
| `ai-integration.tsx` | AI.ask with streaming |
| `menubar-extra.tsx` | MenuBarExtra interactions |

Overview

This skill teaches how to build Raycast extensions using React, TypeScript, and Node.js. It guides you through choosing UI primitives (List, Grid, Form, Detail, MenuBarExtra), wiring data fetching and hooks, and integrating Raycast AI and utilities. Practical examples and patterns speed up creating commands, UI, and manifest configuration.

How this skill works

The skill inspects common extension patterns and provides runnable examples that demonstrate component choices, data fetching with useFetch, action wiring with ActionPanel, and AI calls via AI.ask. It explains how to structure commands, use hooks (useFetch, useForm), and configure the manifest so extensions appear in Raycast. Examples include List, Grid, Form, Detail, and MenuBarExtra implementations plus AI and clipboard interactions.

When to use it

  • You need a searchable, filterable UI for items — use List.
  • You want an image gallery or tiled layout — use Grid.
  • You must collect structured user input or validate forms — use Form and useForm.
  • You need rich, markdown-based content with metadata — use Detail.
  • You want always-on status or quick interactions — use MenuBarExtra.

Best practices

  • Start with the UI primitive that matches your user flow (List vs Grid vs Form) to keep UX simple.
  • Keep side effects in hooks: useFetch for data, runAppleScript or OAuth in effects or commands.
  • Use ActionPanel to expose copy, open, and custom actions for each List or Grid item.
  • Guard AI usage with environment.canAccess(AI) and provide fallbacks for non-Pro users.
  • Keep manifest organized: group commands, set keywords, and configure permissions early.

Example use cases

  • A searchable list of tasks with copy, open, and custom actions wired via ActionPanel.
  • An image browser implemented with Grid that opens details and supports quick sharing.
  • A multi-field Form that validates input, submits to an API, and shows a Result Detail.
  • A menubar utility that shows status and quick commands via MenuBarExtra.
  • An AI-powered summarizer command that calls AI.ask and copies results to the clipboard.

FAQ

Do I need Raycast Pro to use AI features?

Yes. AI features require Raycast Pro; check access programmatically with environment.canAccess(AI) and provide alternate flows if unavailable.

Which component should I choose for search vs images?

Use List for text-focused, searchable items and Grid for image-focused galleries or tiled layouts.