clickup-sdk-patterns
Production-ready ClickUp API v2 client patterns with typed wrappers, error handling, caching, and multi-tenant support. Trigger: "clickup client wrapper", "clickup SDK patterns", "clickup best practices", "clickup typescript client", "clickup API wrapper", "production clickup code".
What this skill does
# ClickUp SDK Patterns
## Overview
ClickUp has no official SDK. Build a typed REST client wrapper around `https://api.clickup.com/api/v2/`. These patterns provide singleton clients, typed responses, error boundaries, and multi-tenant support.
## Typed Client Wrapper
```typescript
// src/clickup/client.ts
const CLICKUP_BASE = 'https://api.clickup.com/api/v2';
interface ClickUpClientConfig {
token: string;
timeout?: number;
onRateLimit?: (waitMs: number) => void;
}
class ClickUpClient {
private token: string;
private timeout: number;
private rateLimitRemaining = 100;
private rateLimitReset = 0;
constructor(config: ClickUpClientConfig) {
this.token = config.token;
this.timeout = config.timeout ?? 30000;
}
async request<T>(path: string, options: RequestInit = {}): Promise<T> {
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), this.timeout);
try {
const response = await fetch(`${CLICKUP_BASE}${path}`, {
...options,
signal: controller.signal,
headers: {
'Authorization': this.token,
'Content-Type': 'application/json',
...options.headers,
},
});
// Track rate limit state from response headers
this.rateLimitRemaining = parseInt(
response.headers.get('X-RateLimit-Remaining') ?? '100'
);
this.rateLimitReset = parseInt(
response.headers.get('X-RateLimit-Reset') ?? '0'
) * 1000;
if (!response.ok) {
const body = await response.json().catch(() => ({}));
throw new ClickUpApiError(response.status, body.err, body.ECODE);
}
return response.json();
} finally {
clearTimeout(timer);
}
}
// Convenience methods
async getUser(): Promise<ClickUpUser> {
const data = await this.request<{ user: ClickUpUser }>('/user');
return data.user;
}
async getTeams(): Promise<ClickUpTeam[]> {
const data = await this.request<{ teams: ClickUpTeam[] }>('/team');
return data.teams;
}
async getSpaces(teamId: string): Promise<ClickUpSpace[]> {
const data = await this.request<{ spaces: ClickUpSpace[] }>(
`/team/${teamId}/space?archived=false`
);
return data.spaces;
}
async createTask(listId: string, task: CreateTaskInput): Promise<ClickUpTask> {
return this.request<ClickUpTask>(`/list/${listId}/task`, {
method: 'POST',
body: JSON.stringify(task),
});
}
async getTask(taskId: string): Promise<ClickUpTask> {
return this.request<ClickUpTask>(`/task/${taskId}`);
}
async updateTask(taskId: string, updates: Partial<CreateTaskInput>): Promise<ClickUpTask> {
return this.request<ClickUpTask>(`/task/${taskId}`, {
method: 'PUT',
body: JSON.stringify(updates),
});
}
isRateLimited(): boolean {
return this.rateLimitRemaining < 5 && Date.now() < this.rateLimitReset;
}
}
```
## TypeScript Types
```typescript
// src/clickup/types.ts
interface ClickUpUser {
id: number;
username: string;
email: string;
color: string;
profilePicture: string | null;
}
interface ClickUpTeam {
id: string;
name: string;
color: string;
members: Array<{ user: ClickUpUser; role: number }>;
}
interface ClickUpSpace {
id: string;
name: string;
private: boolean;
statuses: Array<{ status: string; color: string; type: string }>;
features: Record<string, { enabled: boolean }>;
}
interface ClickUpTask {
id: string;
custom_id: string | null;
name: string;
description: string;
status: { status: string; color: string; type: string };
priority: { id: string; priority: string; color: string } | null;
date_created: string;
date_updated: string;
due_date: string | null;
assignees: ClickUpUser[];
tags: Array<{ name: string }>;
url: string;
list: { id: string; name: string };
folder: { id: string; name: string };
space: { id: string };
custom_fields: ClickUpCustomFieldValue[];
}
interface CreateTaskInput {
name: string;
description?: string;
markdown_description?: string;
assignees?: number[];
priority?: 1 | 2 | 3 | 4 | null;
status?: string;
due_date?: number;
due_date_time?: boolean;
parent?: string;
tags?: string[];
custom_fields?: Array<{ id: string; value: any }>;
}
interface ClickUpCustomFieldValue {
id: string;
name: string;
type: string;
value: any;
}
class ClickUpApiError extends Error {
constructor(
public readonly status: number,
public readonly err: string,
public readonly ecode?: string,
) {
super(`ClickUp API ${status}: ${err}${ecode ? ` (${ecode})` : ''}`);
}
get isRateLimited(): boolean { return this.status === 429; }
get isAuthError(): boolean { return this.status === 401; }
get isNotFound(): boolean { return this.status === 404; }
get isRetryable(): boolean { return this.status === 429 || this.status >= 500; }
}
```
## Singleton Pattern
```typescript
// src/clickup/index.ts
let defaultClient: ClickUpClient | null = null;
export function getClickUpClient(): ClickUpClient {
if (!defaultClient) {
const token = process.env.CLICKUP_API_TOKEN;
if (!token) throw new Error('CLICKUP_API_TOKEN not set');
defaultClient = new ClickUpClient({ token });
}
return defaultClient;
}
```
## Multi-Tenant Factory
```typescript
const tenantClients = new Map<string, ClickUpClient>();
function getClientForTenant(tenantId: string, token: string): ClickUpClient {
if (!tenantClients.has(tenantId)) {
tenantClients.set(tenantId, new ClickUpClient({ token }));
}
return tenantClients.get(tenantId)!;
}
```
## Zod Response Validation
```typescript
import { z } from 'zod';
const TaskSchema = z.object({
id: z.string(),
name: z.string(),
status: z.object({ status: z.string(), color: z.string() }),
priority: z.object({ priority: z.string() }).nullable(),
url: z.string().url(),
});
async function getValidatedTask(taskId: string) {
const raw = await getClickUpClient().getTask(taskId);
return TaskSchema.parse(raw);
}
```
## Error Handling
| Pattern | Use Case | Benefit |
|---------|----------|---------|
| Typed error class | All API calls | Type-safe error discrimination |
| Singleton | Single-tenant apps | Shared rate limit tracking |
| Factory | Multi-tenant SaaS | Per-tenant isolation |
| Zod validation | Response parsing | Catches API contract changes |
## Resources
- [ClickUp API Reference](https://developer.clickup.com/)
- [Zod Documentation](https://zod.dev/)
## Next Steps
Apply patterns in `clickup-core-workflow-a` for task management.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.