mindtickle-sdk-patterns
Sdk Patterns for MindTickle. Trigger: "mindtickle sdk patterns".
What this skill does
# MindTickle SDK Patterns
## Overview
MindTickle's REST API serves sales enablement workflows including course management, quiz administration, user progress tracking, SCIM user provisioning, and coaching analytics. A structured SDK client is critical because MindTickle uses compound API keys with org-scoped tokens, returns progress data as nested completion trees with module-level granularity, and enforces strict SCIM schema compliance for user sync. These patterns provide org-aware authentication, typed models for training content hierarchies, progress query builders, and mock factories for sales readiness test scenarios.
## Prerequisites
- Node.js 18+, TypeScript 5+
- `MINDTICKLE_API_KEY` environment variable (generated in Admin > Integrations > API Keys)
- `MINDTICKLE_ORG_ID` for multi-org deployments
- `axios` or `node-fetch` for HTTP transport
## Singleton Client
```typescript
interface MindTickleConfig {
apiKey: string;
orgId: string;
baseUrl?: string;
timeout?: number;
}
let client: MindTickleClient | null = null;
export function getMindTickleClient(overrides?: Partial<MindTickleConfig>): MindTickleClient {
if (!client) {
const config: MindTickleConfig = {
apiKey: process.env.MINDTICKLE_API_KEY ?? '',
orgId: process.env.MINDTICKLE_ORG_ID ?? '',
baseUrl: 'https://api.mindtickle.com/v2',
timeout: 15_000,
...overrides,
};
if (!config.apiKey || !config.orgId) throw new Error('MINDTICKLE_API_KEY and MINDTICKLE_ORG_ID are required');
client = new MindTickleClient(config);
}
return client;
}
```
## Error Wrapper
```typescript
interface MindTickleError { statusCode: number; errorType: string; description: string; requestId: string; }
async function safeMindTickle<T>(fn: () => Promise<T>): Promise<T> {
try { return await fn(); }
catch (err: any) {
const parsed: MindTickleError = {
statusCode: err.response?.status ?? 500,
errorType: err.response?.data?.error?.type ?? 'INTERNAL_ERROR',
description: err.response?.data?.error?.description ?? err.message,
requestId: err.response?.headers?.['x-request-id'] ?? 'unknown',
};
if (parsed.statusCode === 429) {
const retryMs = parseInt(err.response?.headers?.['retry-after-ms'] ?? '3000', 10);
await new Promise(r => setTimeout(r, retryMs));
return fn();
}
if (parsed.errorType === 'SCIM_CONFLICT') throw new Error(`User already provisioned (req: ${parsed.requestId})`);
if (parsed.statusCode === 403) throw new Error(`Org ${process.env.MINDTICKLE_ORG_ID} lacks permission: ${parsed.description}`);
throw new Error(`MindTickle ${parsed.errorType} (${parsed.statusCode}): ${parsed.description} [${parsed.requestId}]`);
}
}
```
## Request Builder
```typescript
class ProgressQueryBuilder {
private params: Record<string, string> = {};
forUser(userId: string) { this.params.user_id = userId; return this; }
inCourse(courseId: string) { this.params.series_id = courseId; return this; }
completedAfter(date: string) { this.params.completed_after = date; return this; }
status(s: 'not_started' | 'in_progress' | 'completed') { this.params.status = s; return this; }
page(n: number) { this.params.page = String(n); return this; }
pageSize(n: number) { this.params.page_size = String(Math.min(n, 50)); return this; }
build(): URLSearchParams { return new URLSearchParams(this.params); }
}
```
## Response Types
```typescript
interface Course { id: string; title: string; moduleCount: number; status: 'draft' | 'published' | 'archived'; createdAt: string; }
interface QuizResult { quizId: string; userId: string; score: number; passingScore: number; passed: boolean; attemptNumber: number; completedAt: string; }
interface UserProgress { userId: string; courseId: string; completedModules: number; totalModules: number; percentComplete: number; lastActivityAt: string; }
interface ScimUser { id: string; userName: string; displayName: string; emails: { value: string; primary: boolean }[]; active: boolean; groups: string[]; }
```
## Middleware Pattern
```typescript
type Middleware = (req: RequestInit, next: () => Promise<Response>) => Promise<Response>;
const orgScopeMiddleware = (orgId: string): Middleware => (req, next) => {
req.headers = { ...req.headers as Record<string, string>, 'X-MindTickle-Org': orgId, Authorization: `Bearer ${process.env.MINDTICKLE_API_KEY}` };
return next();
};
const metricsMiddleware: Middleware = async (req, next) => {
const start = Date.now();
const res = await next();
const endpoint = new URL(req.url as string).pathname;
console.log(`[mindtickle] ${req.method} ${endpoint} ${res.status} ${Date.now() - start}ms`);
return res;
};
```
## Testing Utilities
```typescript
function mockCourse(overrides?: Partial<Course>): Course {
return { id: 'series_abc', title: 'Q3 Product Training', moduleCount: 8, status: 'published', createdAt: '2025-07-01T00:00:00Z', ...overrides };
}
function mockProgress(userId: string, courseId: string): UserProgress {
return { userId, courseId, completedModules: 5, totalModules: 8, percentComplete: 62.5, lastActivityAt: '2025-07-15T14:30:00Z' };
}
function mockScimUser(overrides?: Partial<ScimUser>): ScimUser {
return { id: 'usr_test_001', userName: '[email protected]', displayName: 'Jane Smith', emails: [{ value: '[email protected]', primary: true }], active: true, groups: ['sales-east'], ...overrides };
}
```
## Error Handling
| Pattern | When to Use | Example |
|---------|-------------|---------|
| Retry with header delay | 429 on progress or analytics endpoints | Parse `Retry-After-Ms` header, wait exact duration, retry once |
| SCIM conflict resolution | 409 when provisioning existing user | Fetch existing user by email, update instead of create |
| Org scope validation | 403 on cross-org resource access | Verify `MINDTICKLE_ORG_ID` matches target course owner |
| Completion tree unwrap | Nested module progress with null leaves | Flatten tree, filter nulls, compute rollup percentage |
| Bulk operation chunking | Enrolling 500+ users in a course | Batch into groups of 50, sequential with rate limit pauses |
## Resources
- [MindTickle API Reference](https://www.mindtickle.com/platform/integrations/)
## Next Steps
Apply in `mindtickle-core-workflow-a`.
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.