Skip to content

Commit 981370a

Browse files
committed
feat(integrations): claude skills to add integrations, lemlist trigger + tools, remove test webhook url
1 parent b6cbee2 commit 981370a

File tree

42 files changed

+3900
-899
lines changed

Some content is hidden

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

42 files changed

+3900
-899
lines changed

.claude/commands/add-block.md

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

.claude/commands/add-integration.md

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

.claude/commands/add-tools.md

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
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+
}),
91+
},
92+
93+
transformResponse: async (response: Response) => {
94+
const data = await response.json()
95+
return {
96+
success: true,
97+
output: {
98+
// Map API response to output
99+
// Use ?? null for nullable fields
100+
// Use ?? [] for optional arrays
101+
},
102+
}
103+
},
104+
105+
outputs: {
106+
// Define each output field
107+
},
108+
}
109+
```
110+
111+
## Critical Rules for Parameters
112+
113+
### Visibility Options
114+
- `'hidden'` - System-injected (OAuth tokens, internal params). User never sees.
115+
- `'user-only'` - User must provide (credentials, account-specific IDs)
116+
- `'user-or-llm'` - User provides OR LLM can compute (search queries, content, filters)
117+
118+
### Parameter Types
119+
- `'string'` - Text values
120+
- `'number'` - Numeric values
121+
- `'boolean'` - True/false
122+
- `'json'` - Complex objects (NOT 'object', use 'json')
123+
- `'file'` - Single file
124+
- `'file[]'` - Multiple files
125+
126+
### Required vs Optional
127+
- Always explicitly set `required: true` or `required: false`
128+
- Optional params should have `required: false`
129+
130+
## Critical Rules for Outputs
131+
132+
### Output Types
133+
- `'string'`, `'number'`, `'boolean'` - Primitives
134+
- `'json'` - Complex objects (use this, NOT 'object')
135+
- `'array'` - Arrays with `items` property
136+
- `'object'` - Objects with `properties` property
137+
138+
### Optional Outputs
139+
Add `optional: true` for fields that may not exist in the response:
140+
```typescript
141+
closedAt: {
142+
type: 'string',
143+
description: 'When the issue was closed',
144+
optional: true,
145+
},
146+
```
147+
148+
### Nested Properties
149+
For complex outputs, define nested structure:
150+
```typescript
151+
metadata: {
152+
type: 'json',
153+
description: 'Response metadata',
154+
properties: {
155+
id: { type: 'string', description: 'Unique ID' },
156+
status: { type: 'string', description: 'Current status' },
157+
count: { type: 'number', description: 'Total count' },
158+
},
159+
},
160+
161+
items: {
162+
type: 'array',
163+
description: 'List of items',
164+
items: {
165+
type: 'object',
166+
properties: {
167+
id: { type: 'string', description: 'Item ID' },
168+
name: { type: 'string', description: 'Item name' },
169+
},
170+
},
171+
},
172+
```
173+
174+
## Critical Rules for transformResponse
175+
176+
### Handle Nullable Fields
177+
ALWAYS use `?? null` for fields that may be undefined:
178+
```typescript
179+
transformResponse: async (response: Response) => {
180+
const data = await response.json()
181+
return {
182+
success: true,
183+
output: {
184+
id: data.id,
185+
title: data.title,
186+
body: data.body ?? null, // May be undefined
187+
assignee: data.assignee ?? null, // May be undefined
188+
labels: data.labels ?? [], // Default to empty array
189+
closedAt: data.closed_at ?? null, // May be undefined
190+
},
191+
}
192+
}
193+
```
194+
195+
### Never Output Raw JSON Dumps
196+
DON'T do this:
197+
```typescript
198+
output: {
199+
data: data, // BAD - raw JSON dump
200+
}
201+
```
202+
203+
DO this instead - extract meaningful fields:
204+
```typescript
205+
output: {
206+
id: data.id,
207+
name: data.name,
208+
status: data.status,
209+
metadata: {
210+
createdAt: data.created_at,
211+
updatedAt: data.updated_at,
212+
},
213+
}
214+
```
215+
216+
## Types File Pattern
217+
218+
Create `types.ts` with interfaces for all params and responses:
219+
220+
```typescript
221+
import type { ToolResponse } from '@/tools/types'
222+
223+
// Parameter interfaces
224+
export interface {Service}{Action}Params {
225+
accessToken: string
226+
requiredField: string
227+
optionalField?: string
228+
}
229+
230+
// Response interfaces (extend ToolResponse)
231+
export interface {Service}{Action}Response extends ToolResponse {
232+
output: {
233+
field1: string
234+
field2: number
235+
optionalField?: string | null
236+
}
237+
}
238+
```
239+
240+
## Index.ts Barrel Export Pattern
241+
242+
```typescript
243+
// Export all tools
244+
export { serviceTool1 } from './{action1}'
245+
export { serviceTool2 } from './{action2}'
246+
247+
// Export types
248+
export * from './types'
249+
```
250+
251+
## Registering Tools
252+
253+
After creating tools, remind the user to:
254+
1. Import tools in `apps/sim/tools/registry.ts`
255+
2. Add to the `tools` object with snake_case keys:
256+
```typescript
257+
import { serviceActionTool } from '@/tools/{service}'
258+
259+
export const tools = {
260+
// ... existing tools ...
261+
{service}_{action}: serviceActionTool,
262+
}
263+
```
264+
265+
## V2 Tool Pattern
266+
267+
If creating V2 tools (API-aligned outputs), use `_v2` suffix:
268+
- Tool ID: `{service}_{action}_v2`
269+
- Variable name: `{action}V2Tool`
270+
- Version: `'2.0.0'`
271+
- Outputs: Flat, API-aligned (no content/metadata wrapper)
272+
273+
## Checklist Before Finishing
274+
275+
- [ ] All params have explicit `required: true` or `required: false`
276+
- [ ] All params have appropriate `visibility`
277+
- [ ] All nullable response fields use `?? null`
278+
- [ ] All optional outputs have `optional: true`
279+
- [ ] No raw JSON dumps in outputs
280+
- [ ] Types file has all interfaces
281+
- [ ] Index.ts exports all tools
282+
- [ ] Tool IDs use snake_case

0 commit comments

Comments
 (0)