Skip to content

Commit a05003a

Browse files
feat(integrations): claude skills to add integrations, lemlist trigger + tools, remove test webhook url (#2785)
* feat(integrations): claude skills to add integrations, lemlist trigger + tools, remove test webhook url * fix tests * fix tools * add more details to skill * more details * address greptile comments
1 parent 46417dd commit a05003a

File tree

43 files changed

+3789
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3789
-959
lines changed

.claude/commands/add-block.md

Lines changed: 591 additions & 0 deletions
Large diffs are not rendered by default.

.claude/commands/add-integration.md

Lines changed: 450 additions & 0 deletions
Large diffs are not rendered by default.

.claude/commands/add-tools.md

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
---
2+
description: Create tool configurations for a Sim Studio integration by reading API docs
3+
argument-hint: <service-name> [api-docs-url]
4+
---
5+
6+
# Add Tools Skill
7+
8+
You are an expert at creating tool configurations for Sim Studio integrations. Your job is to read API documentation and create properly structured tool files.
9+
10+
## Your Task
11+
12+
When the user asks you to create tools for a service:
13+
1. Use Context7 or WebFetch to read the service's API documentation
14+
2. Create the tools directory structure
15+
3. Generate properly typed tool configurations
16+
17+
## Directory Structure
18+
19+
Create files in `apps/sim/tools/{service}/`:
20+
```
21+
tools/{service}/
22+
├── index.ts # Barrel export
23+
├── types.ts # Parameter & response types
24+
└── {action}.ts # Individual tool files (one per operation)
25+
```
26+
27+
## Tool Configuration Structure
28+
29+
Every tool MUST follow this exact structure:
30+
31+
```typescript
32+
import type { {ServiceName}{Action}Params } from '@/tools/{service}/types'
33+
import type { ToolConfig } from '@/tools/types'
34+
35+
interface {ServiceName}{Action}Response {
36+
success: boolean
37+
output: {
38+
// Define output structure here
39+
}
40+
}
41+
42+
export const {serviceName}{Action}Tool: ToolConfig<
43+
{ServiceName}{Action}Params,
44+
{ServiceName}{Action}Response
45+
> = {
46+
id: '{service}_{action}', // snake_case, matches tool name
47+
name: '{Service} {Action}', // Human readable
48+
description: 'Brief description', // One sentence
49+
version: '1.0.0',
50+
51+
// OAuth config (if service uses OAuth)
52+
oauth: {
53+
required: true,
54+
provider: '{service}', // Must match OAuth provider ID
55+
},
56+
57+
params: {
58+
// Hidden params (system-injected)
59+
accessToken: {
60+
type: 'string',
61+
required: true,
62+
visibility: 'hidden',
63+
description: 'OAuth access token',
64+
},
65+
// User-only params (credentials, IDs user must provide)
66+
someId: {
67+
type: 'string',
68+
required: true,
69+
visibility: 'user-only',
70+
description: 'The ID of the resource',
71+
},
72+
// User-or-LLM params (can be provided by user OR computed by LLM)
73+
query: {
74+
type: 'string',
75+
required: false, // Use false for optional
76+
visibility: 'user-or-llm',
77+
description: 'Search query',
78+
},
79+
},
80+
81+
request: {
82+
url: (params) => `https://api.service.com/v1/resource/${params.id}`,
83+
method: 'POST',
84+
headers: (params) => ({
85+
Authorization: `Bearer ${params.accessToken}`,
86+
'Content-Type': 'application/json',
87+
}),
88+
body: (params) => ({
89+
// Request body - only for POST/PUT/PATCH
90+
// Trim ID fields to prevent copy-paste whitespace errors:
91+
// userId: params.userId?.trim(),
92+
}),
93+
},
94+
95+
transformResponse: async (response: Response) => {
96+
const data = await response.json()
97+
return {
98+
success: true,
99+
output: {
100+
// Map API response to output
101+
// Use ?? null for nullable fields
102+
// Use ?? [] for optional arrays
103+
},
104+
}
105+
},
106+
107+
outputs: {
108+
// Define each output field
109+
},
110+
}
111+
```
112+
113+
## Critical Rules for Parameters
114+
115+
### Visibility Options
116+
- `'hidden'` - System-injected (OAuth tokens, internal params). User never sees.
117+
- `'user-only'` - User must provide (credentials, account-specific IDs)
118+
- `'user-or-llm'` - User provides OR LLM can compute (search queries, content, filters)
119+
120+
### Parameter Types
121+
- `'string'` - Text values
122+
- `'number'` - Numeric values
123+
- `'boolean'` - True/false
124+
- `'json'` - Complex objects (NOT 'object', use 'json')
125+
- `'file'` - Single file
126+
- `'file[]'` - Multiple files
127+
128+
### Required vs Optional
129+
- Always explicitly set `required: true` or `required: false`
130+
- Optional params should have `required: false`
131+
132+
## Critical Rules for Outputs
133+
134+
### Output Types
135+
- `'string'`, `'number'`, `'boolean'` - Primitives
136+
- `'json'` - Complex objects (use this, NOT 'object')
137+
- `'array'` - Arrays with `items` property
138+
- `'object'` - Objects with `properties` property
139+
140+
### Optional Outputs
141+
Add `optional: true` for fields that may not exist in the response:
142+
```typescript
143+
closedAt: {
144+
type: 'string',
145+
description: 'When the issue was closed',
146+
optional: true,
147+
},
148+
```
149+
150+
### Nested Properties
151+
For complex outputs, define nested structure:
152+
```typescript
153+
metadata: {
154+
type: 'json',
155+
description: 'Response metadata',
156+
properties: {
157+
id: { type: 'string', description: 'Unique ID' },
158+
status: { type: 'string', description: 'Current status' },
159+
count: { type: 'number', description: 'Total count' },
160+
},
161+
},
162+
163+
items: {
164+
type: 'array',
165+
description: 'List of items',
166+
items: {
167+
type: 'object',
168+
properties: {
169+
id: { type: 'string', description: 'Item ID' },
170+
name: { type: 'string', description: 'Item name' },
171+
},
172+
},
173+
},
174+
```
175+
176+
## Critical Rules for transformResponse
177+
178+
### Handle Nullable Fields
179+
ALWAYS use `?? null` for fields that may be undefined:
180+
```typescript
181+
transformResponse: async (response: Response) => {
182+
const data = await response.json()
183+
return {
184+
success: true,
185+
output: {
186+
id: data.id,
187+
title: data.title,
188+
body: data.body ?? null, // May be undefined
189+
assignee: data.assignee ?? null, // May be undefined
190+
labels: data.labels ?? [], // Default to empty array
191+
closedAt: data.closed_at ?? null, // May be undefined
192+
},
193+
}
194+
}
195+
```
196+
197+
### Never Output Raw JSON Dumps
198+
DON'T do this:
199+
```typescript
200+
output: {
201+
data: data, // BAD - raw JSON dump
202+
}
203+
```
204+
205+
DO this instead - extract meaningful fields:
206+
```typescript
207+
output: {
208+
id: data.id,
209+
name: data.name,
210+
status: data.status,
211+
metadata: {
212+
createdAt: data.created_at,
213+
updatedAt: data.updated_at,
214+
},
215+
}
216+
```
217+
218+
## Types File Pattern
219+
220+
Create `types.ts` with interfaces for all params and responses:
221+
222+
```typescript
223+
import type { ToolResponse } from '@/tools/types'
224+
225+
// Parameter interfaces
226+
export interface {Service}{Action}Params {
227+
accessToken: string
228+
requiredField: string
229+
optionalField?: string
230+
}
231+
232+
// Response interfaces (extend ToolResponse)
233+
export interface {Service}{Action}Response extends ToolResponse {
234+
output: {
235+
field1: string
236+
field2: number
237+
optionalField?: string | null
238+
}
239+
}
240+
```
241+
242+
## Index.ts Barrel Export Pattern
243+
244+
```typescript
245+
// Export all tools
246+
export { serviceTool1 } from './{action1}'
247+
export { serviceTool2 } from './{action2}'
248+
249+
// Export types
250+
export * from './types'
251+
```
252+
253+
## Registering Tools
254+
255+
After creating tools, remind the user to:
256+
1. Import tools in `apps/sim/tools/registry.ts`
257+
2. Add to the `tools` object with snake_case keys:
258+
```typescript
259+
import { serviceActionTool } from '@/tools/{service}'
260+
261+
export const tools = {
262+
// ... existing tools ...
263+
{service}_{action}: serviceActionTool,
264+
}
265+
```
266+
267+
## V2 Tool Pattern
268+
269+
If creating V2 tools (API-aligned outputs), use `_v2` suffix:
270+
- Tool ID: `{service}_{action}_v2`
271+
- Variable name: `{action}V2Tool`
272+
- Version: `'2.0.0'`
273+
- Outputs: Flat, API-aligned (no content/metadata wrapper)
274+
275+
## Checklist Before Finishing
276+
277+
- [ ] All params have explicit `required: true` or `required: false`
278+
- [ ] All params have appropriate `visibility`
279+
- [ ] All nullable response fields use `?? null`
280+
- [ ] All optional outputs have `optional: true`
281+
- [ ] No raw JSON dumps in outputs
282+
- [ ] Types file has all interfaces
283+
- [ ] Index.ts exports all tools
284+
- [ ] Tool IDs use snake_case

0 commit comments

Comments
 (0)