salesforce-sdk-patterns

Featured

Apply production-ready Salesforce jsforce patterns for TypeScript and Python. Use when implementing Salesforce integrations, refactoring SDK usage, or establishing team coding standards for Salesforce. Trigger with phrases like "salesforce SDK patterns", "jsforce best practices", "salesforce code patterns", "idiomatic salesforce", "salesforce typescript".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Salesforce SDK Patterns ## Overview Production-ready patterns for jsforce (Node.js) and simple-salesforce (Python) — singleton connections, typed queries, error handling, and token refresh. ## Prerequisites - Completed `salesforce-install-auth` setup - Familiarity with async/await and TypeScript generics - Understanding of Salesforce sObject model ## Instructions ### Step 1: Singleton Connection with Auto-Refresh ```typescript // src/salesforce/connection.ts import jsforce from 'jsforce'; let conn: jsforce.Connection | null = null; export async function getConnection(): Promise<jsforce.Connection> { if (conn?.accessToken) { // Test if token is still valid try { await conn.identity(); return conn; } catch { conn = null; // Token expired, reconnect } } conn = new jsforce.Connection({ loginUrl: process.env.SF_LOGIN_URL || 'https://login.salesforce.com', version: '59.0', // Pin API version for stability }); await conn.login( process.env.SF_USERNAME!, process.env.SF_PASSWORD! + process.env.SF_SECURITY_TOKEN! ); return conn; } ``` ### Step 2: Typed sObject Interfaces ```typescript // src/salesforce/types.ts /** Standard Salesforce sObject base fields */ interface SObjectBase { Id: string; CreatedDate: string; LastModifiedDate: string; SystemModstamp: string; IsDeleted: boolean; } export interface Account extends SObjectBase { Name: string; Industry?: string; AnnualRevenue?: number; Num...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category