Skip to content

Commit 61638d0

Browse files
alchemistklkclaude
andcommitted
fix(perplexity): update execution instructions and fix common errors
- Simplify workflow to match simplified Perplexity workflow (removed batch queries) - Replace broken toolcalls approach with reliable workflow result method - Add clear 5-step execution guide with explanations - Add Key Concepts table explaining workflowId, runId, resultId - Add Common Mistakes section warning against .output.preview approach - Fix JSON path for extracting runId (.payload.runs[0].runId) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c4527b5 commit 61638d0

1 file changed

Lines changed: 71 additions & 24 deletions

File tree

skills/perplexity/SKILL.md

Lines changed: 71 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: perplexity
3-
description: "AI-powered search and chat with Perplexity. Use when you need to: (1) get AI responses with real-time web search, (2) perform batch research queries, or (3) answer questions with up-to-date information."
3+
description: "AI-powered search and chat with Perplexity. Use when you need to: (1) get AI responses with real-time web search, or (2) answer questions with up-to-date information."
44
version: 1.0.0
55
skillId: skp-rkmnjbtpxxpidhck89q60yvt
66
workflowId: c-xz42o3itzw4bdnnhoovb16dv
@@ -10,52 +10,99 @@ category: text-data
1010

1111
# Perplexity
1212

13-
AI-powered search and chat with Perplexity. Use when you need to: (1) get AI responses with real-time web search, (2) perform batch research queries, or (3) answer questions with up-to-date information.
13+
AI-powered search and chat with Perplexity. Use when you need to: (1) get AI responses with real-time web search, or (2) answer questions with up-to-date information.
1414

1515
## Input
1616

1717
Provide input as JSON:
1818

1919
```json
2020
{
21-
"query": "Search query or chat message for single query processing",
22-
"queries": "Array of queries for batch search (comma-separated or JSON array format)"
21+
"query": "Your search query or question"
2322
}
2423
```
2524

26-
## Execution (Pattern B: Text/Data)
25+
## Execution
2726

28-
### Step 1: Run the Skill and Get Run ID
27+
### Step 1: Run the Skill
2928

3029
```bash
31-
RESULT=$(refly skill run --id skpi-sww12wxvy9zbfr1wwx35gybm --input '{
32-
"query": "What are the latest AI trends in 2024?"
33-
}')
34-
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
35-
# RUN_ID is we-xxx format, use this for workflow commands
30+
refly skill run --id skpi-sww12wxvy9zbfr1wwx35gybm --input '{
31+
"query": "Your question here"
32+
}'
3633
```
3734

38-
### Step 2: Open Workflow in Browser and Wait for Completion
35+
### Step 2: Wait for Completion
3936

4037
```bash
41-
open "https://refly.ai/workflow/c-xz42o3itzw4bdnnhoovb16dv"
42-
refly workflow status "$RUN_ID" --watch --interval 30000
38+
refly workflow status c-xz42o3itzw4bdnnhoovb16dv --watch --interval 10000
4339
```
4440

45-
### Step 3: Extract Text Content
41+
### Step 3: Get the Run ID
4642

4743
```bash
48-
# Get text content from toolcalls
49-
CONTENT=$(refly workflow toolcalls "$RUN_ID" --files --latest | jq -r '.payload.nodes[].content')
50-
echo "$CONTENT"
44+
refly workflow runs c-xz42o3itzw4bdnnhoovb16dv --limit 1
5145
```
5246

53-
## Expected Output
47+
Look for `runId` in the output (format: `we-xxx`).
5448

55-
- **Type**: Text content
56-
- **Format**: AI-generated response with real-time web search results and citations
57-
- **Action**: Display content to user
49+
### Step 4: Get the Result ID
50+
51+
```bash
52+
refly workflow detail <RUN_ID>
53+
```
54+
55+
Look for `resultId` in the `skillResponse` node (format: `ar-xxx`).
56+
57+
### Step 5: Extract the Content
58+
59+
```bash
60+
refly workflow result <RESULT_ID> --include-messages --raw
61+
```
62+
63+
The AI response is in `.payload.messages[]` where `type` is `"ai"`. Extract with:
64+
65+
```bash
66+
refly workflow result <RESULT_ID> --include-messages --raw | jq -r '.payload.messages[] | select(.type=="ai") | .content'
67+
```
5868

59-
## Rules
69+
### Alternative: One-liner (after Step 2)
6070

61-
Follow base skill workflow: `~/.claude/skills/refly/SKILL.md`
71+
```bash
72+
RUN_ID=$(refly workflow runs c-xz42o3itzw4bdnnhoovb16dv --limit 1 | jq -r '.payload.runs[0].runId') && \
73+
RESULT_ID=$(refly workflow detail "$RUN_ID" | jq -r '.payload.nodes[] | select(.nodeType=="skillResponse") | .resultId') && \
74+
refly workflow result "$RESULT_ID" --include-messages --raw | jq -r '.payload.messages[] | select(.type=="ai") | .content'
75+
```
76+
77+
## Key Concepts
78+
79+
| ID Type | Format | How to Get | Used For |
80+
|---------|--------|------------|----------|
81+
| workflowId | `c-xxx` | In SKILL.md frontmatter | `workflow status`, `workflow runs` |
82+
| runId | `we-xxx` | From `workflow runs` or `workflow status` output | `workflow detail`, `workflow toolcalls` |
83+
| resultId | `ar-xxx` | From `workflow detail` → nodes[].resultId | `workflow result` |
84+
85+
## Common Mistakes to Avoid
86+
87+
### Do NOT use `toolcalls` with `.output.preview`
88+
89+
```bash
90+
# WRONG - This will fail!
91+
refly workflow toolcalls <RUN_ID> --latest | jq -r '.payload.toolCalls[-1].output.preview | fromjson | .data.response'
92+
```
93+
94+
**Why it fails:**
95+
- `.output.preview` may be `null` → jq error: `null (null) only strings can be parsed`
96+
- `.output.preview` may be truncated → jq error: `Unfinished string at EOF`
97+
- The preview field is not guaranteed to exist
98+
99+
**Always use this instead:**
100+
```bash
101+
refly workflow result <RESULT_ID> --include-messages --raw | jq -r '.payload.messages[] | select(.type=="ai") | .content'
102+
```
103+
104+
## Expected Output
105+
106+
- **Type**: Text content with citations
107+
- **Format**: AI-generated response from Perplexity with web search results
108+
- **Action**: Display content to user

0 commit comments

Comments
 (0)