| name | adobe-sdk-patterns |
| description | Apply production-ready patterns for Adobe Firefly Services SDK, PDF Services SDK,
and raw REST API usage in TypeScript and Python.
Use when implementing Adobe integrations, refactoring SDK usage,
or establishing team coding standards for Adobe APIs.
Trigger with phrases like "adobe SDK patterns", "adobe best practices",
"adobe code patterns", "idiomatic adobe", "adobe typescript".
|
| allowed-tools | Read, Write, Edit |
| version | 1.6.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","design","adobe"] |
| compatibility | Designed for Claude Code |
Adobe SDK Patterns
Overview
Production-ready patterns for Adobe SDK usage across Firefly Services (@adobe/firefly-apis, @adobe/photoshop-apis, @adobe/lightroom-apis), PDF Services (@adobe/pdfservices-node-sdk), and direct REST API calls.
Prerequisites
- Completed
adobe-install-auth setup
- Familiarity with async/await patterns
- Understanding of the Adobe API you are integrating
Instructions
Pattern 1: Singleton Auth Client with Token Caching
import { ServicePrincipalCredentials, PDFServices } from '@adobe/pdfservices-node-sdk';
let pdfServicesInstance: PDFServices | null = null;
let tokenCache: { token: string; expiresAt: number } | null = null;
export function getPDFServices(): PDFServices {
if (!pdfServicesInstance) {
const credentials = new ServicePrincipalCredentials({
clientId: process.env.ADOBE_CLIENT_ID!,
clientSecret: process.env.ADOBE_CLIENT_SECRET!,
});
pdfServicesInstance = new PDFServices({ credentials });
}
return pdfServicesInstance;
}
(): <> {
(tokenCache && tokenCache. > .() + ) {
tokenCache.;
}
res = (, {
: ,
: { : },
: ({
: process..!,
: process..!,
: ,
: process..!,
}),
});
(!res.) ();
data = res.();
tokenCache = { : data., : .() + data. * };
tokenCache.;
}