Learn-skills.dev raycast
Best practices and workflows for developing and modifying Raycast Extensions (React/Node). Use when the user asks to create, update, or troubleshoot a Raycast extension, whether it interfaces with external APIs (Notion, Spotify) or executes local scripts (AppleScript, Keyboard Maestro).
git clone https://github.com/NeverSight/learn-skills.dev
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/adriangrantdotorg/raycast-skill/raycast" ~/.claude/skills/neversight-learn-skills-dev-raycast && rm -rf "$T"
data/skills-md/adriangrantdotorg/raycast-skill/raycast/SKILL.mdRaycast Extension Development
This skill defines the preferred workflow and best practices for building, modifying, and troubleshooting custom Raycast extensions.
1. Scaffolding & Setup
- Preferred Method (Duplication): The fastest way to start a new extension is often duplicating the folder of an existing extension. If you do this, you must carefully update the
:package.json"name""title""description""author"
array (update"commands"
,name
, andtitle
).description
- Standard Method: If not duplicating, use
.npx @raycast/api@latest create - Local Dev: After creating/duplicating, run
followed bynpm install
. This automatically installs the extension in the user's Raycast app locally and starts the build watcher.npm run dev
2. General UI & UX Requirements
When modifying or creating forms and commands, adhere to these standards:
- Clean Inputs: Do not set
with placeholder characters (e.g.,defaultValue
for bullet points) unless explicitly requested.- - Auto-Close on Success: After successfully completing an action (like adding a Notion page, running a system script, etc.), the extension should disappear and return the user to the root Raycast search, rather than retaining the form on-screen.
- Import:
import { popToRoot } from "@raycast/api"; - Execute:
await popToRoot({ clearSearchBar: true });
- Import:
- Icon Changes: If an extension's icon is modified (e.g.,
), the Raycast app must be fully restarted to reflect the change. Always explicitly alert the user to "Restart Raycast" when you modify an icon.extension-icon.png
3. Data Fetching & State
- Use
: For dynamic data fetching (e.g., loading dropdown options from a Notion database, or fetching Spotify tracks), rely on@raycast/utils
from theuseCachedPromise
library. This ensures fast initial loads and proper caching.@raycast/utils - Dynamic Forms: For fields like Notion's
,select
, or integrations with existing playlists, dynamicmulti_select
orForm.TagPicker
components should be populated viaForm.Dropdown
rather than hardcoding.useCachedPromise
4. Automation & Local Execution
When an extension requires triggering local MacOS functionality (where external APIs fall short or aren't applicable):
- AppleScript & Keyboard Maestro: Use Node's
to runchild_process.exec
.osascript- Example:
exec('osascript -e \'tell application "Keyboard Maestro Engine" to do script "MACRO_ID"\'')
- Example:
- Clipboard Operations: Always use the native
utilities fromClipboard
(e.g.,@raycast/api
) rather than custom bash scripts.Clipboard.copy(text)
5. Preferences & Authentication
When building an extension that requires an external API (like Notion or Spotify):
-
Add the required secrets/tokens to the
array inpreferences
.package.json -
User Instructions: You must proactively remind the user to configure the token when they first load the extension. For example, provide a short snippet:
⚠️ Integration Required You need to provide this extension with an API Token.
- Go to [Link to API dashboard]
- Create a new token.
- Open Raycast, run this new command, and paste the Token in the preferences when prompted.