grzmol/vibe-force/sf-integration-patterns
Claude Code and agent skill by grzmol/vibe-force
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Salesforce integration design and implementation - selecting an integration pattern (Remote Process Invocation request-reply and fire-and-forget, Batch Data Synchronisation, Remote Call-In, UI Update Based on Data Changes, Data Virtualisation), building inbound APIs (REST API, composite/composite-graph/batch/tree, sObject Collections, Bulk API 2.0, SOAP, Apex REST @RestResource, GraphQL API, Pub/Sub API, Streaming/CometD), and building outbound integrations (Apex HttpRequest callouts, Continuation, Named Credentials and External Credentials, External Services, Outbound Messages, Change Data Capture, Salesforce Connect external objects). Use this skill when a story involves callouts, webhooks, platform events, named credentials, external credentials, middleware boundaries, retry and idempotency design, callout mocking with HttpCalloutMock and Test.setMock, or probing a real org with sf api request rest. Also use it when reviewing integration code for transaction rules (no callout after DML), callout governor limits, secret handling, or dead-letter and correlation-id observability.
Install
npx vskill@latest install grzmol/vibe-force/sf-integration-patternsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as grzmol/vibe-force/sf-integration-patterns.
Salesforce Integration Patterns
Pattern selection, inbound/outbound mechanics, retry and idempotency, and the verification commands that prove an integration works. Owned in wave 1 by sf-integration-engineer (paths: namedCredentials/, externalCredentials/, externalServiceRegistrations/, platformEvents objects, integration Apex services). See skill sf-workflow-orchestration for the wave model and .vibeforce/state/contract.md conventions.
When to use
| Trigger | Use this skill for | |
|---|---|---|
| Story says "call system X", "webhook", "sync from ERP" | Pattern selection table below, then references/pattern-catalogue.md | |
| New endpoint to consume | references/named-credentials.md + references/callout-and-retry.md | |
| External system must write into Salesforce | references/inbound-apis.md (limits, idempotency, composite) | |
| Event-driven work (platform events, CDC, Pub/Sub) | Pattern 2 + 5 below, references/pattern-catalogue.md | |
| Callout code review | Anti-patterns section, references/callout-and-retry.md | |
| Tests for integration code | references/integration-testing.md, skill sf-apex-testing | |
| Verifying a deployed integration in a real org | Verification section, skill sf-post-deploy-verification |
Pattern selection
Six archetype patterns from Salesforce's Integration Patterns and Practices. Pick on latency, volume, coupling, and transactionality - not on familiarity.
| Pattern | Direction | Timing | Volume | Transactional? | Primary mechanism | |
|---|---|---|---|---|---|---|
| Remote Process Invocation - Request and Reply | SF -> remote | Synchronous | Small, real time | Response processed in the same SF transaction | External Services / Flow HTTP Callout / Apex HttpRequest (+ Continuation for slow endpoints) | |
| Remote Process Invocation - Fire and Forget | SF -> remote | Asynchronous | Small per message | No; publisher does not wait | Platform event (Flow or Apex) consumed via Pub/Sub API; Event Relay to AWS; @future/Queueable callout | |
| Batch Data Synchronisation | Both | Asynchronous, scheduled | Large (>2,000 records) | Per-batch only | ETL/MuleSoft + Bulk API 2.0; Change Data Capture for SF-as-master | |
| Remote Call-In | remote -> SF | Synchronous request-reply | Small to medium; Bulk for large | Per call; composite gives all-or-none | REST API, Composite, Composite Graph, sObject Collections, Apex REST, GraphQL API, Bulk API 2.0, SOAP API | |
| UI Update Based on Data Changes | SF -> SF UI | Near real time | Low | No | Platform event published by trigger/Flow, LWC empApi subscriber, Pub/Sub API for external UI | |
| Data Virtualisation | SF -> remote (read/write) | Synchronous | Small per page | No | Salesforce Connect external objects (OData 2.0/4.0, cross-org, Apex Connector Framework) |
Decision shortcuts:
| Question | Answer | |
|---|---|---|
| User waits for the answer? | Request and Reply. If the endpoint can be slow, use Continuation (LWC) - max 3 callouts per continuation, no DML in the continuation method. | |
| Record change must notify N unknown subscribers? | Fire and Forget with a platform event; subscribers use Pub/Sub API (gRPC/HTTP2, Avro). | |
| >2,000 records per run? | Bulk API 2.0 ingest, driven by middleware, not Apex callouts. | |
| Remote system must create/update many related records atomically? | Composite (25 subrequests, allOrNone) or Composite Graph (500 nodes per payload). | |
| Data must not be copied into Salesforce? | Data Virtualisation with Salesforce Connect. | |
| Orchestration, protocol conversion, cross-system transactions? | Middleware (MuleSoft/Informatica). Salesforce cannot participate in distributed transactions. | |
Legacy option on the table (Outbound Messaging, Streaming API/CometD, SOAP login())? | Replace: Flow + platform events, Pub/Sub API, OAuth 2.0. login() is unavailable in API v65.0+ and retires Summer '27. |
Core patterns
1. Request and reply with a Named Credential
Never hardcode a URL or a secret. The endpoint lives in a NamedCredential; the authentication lives in an ExternalCredential; users are authorised through a permission set mapped to an external credential principal. See references/named-credentials.md.
Rules enforced in review: callout: endpoint only, explicit timeout, status code checked before deserialisation, correlation id propagated, exception carries the endpoint name and status.
2. Fire and forget with a platform event
Publish behaviour matters. Publish After Commit only publishes when the transaction commits - choose it when subscribers read data written by the publisher. Publish Immediately publishes even if the transaction later fails - choose it for logging-style events.
Platform events are not rolled back by the publishing transaction and are published to the bus once; Salesforce does not retry on the publisher side. High-volume event messages are retained for 72 hours and are replayable by Replay ID. Max event message size is 1 MB.
3. Retryable subscriber with bounded retries
Apex subscribers signal "redeliver this batch" with EventBus.RetryableException. A platform event trigger runs at most 10 times for a batch sequence (1 run + 9 retries); after the 9th retry the trigger enters an error state and stops consuming new events until the trigger is re-saved.
DML performed before the RetryableException is rolled back; the whole batch is redelivered in Replay ID order. Anything that cannot be retried goes to a dead-letter object - see references/callout-and-retry.md.
4. Callouts from an asynchronous context
Callouts are forbidden after DML in the same transaction and forbidden altogether in a trigger's synchronous context. Move them to Queueable (preferred) or @future(callout=true).
System.attachFinalizer gives a retry/dead-letter hook that runs in its own transaction even when the job dies from an unhandled exception. Full engine with exponential backoff: references/callout-and-retry.md. Async limits and chaining rules: skill sf-async-apex-patterns.
5. Inbound API for a remote caller
Prefer standard REST API and composite resources over custom Apex REST. Write Apex REST only when you need multi-object transactionality or custom pre-commit logic.
Idempotency is the caller's requirement and your implementation duty: upsert on an External Id with the Unique attribute, or record the caller's Idempotency-Key and short-circuit duplicates.
6. Data virtualisation
Salesforce Connect maps external tables to external objects. Relationships to external parents use external lookup (matches the External ID standard field); external children to Salesforce parents use indirect lookup (matches a custom field flagged External ID + Unique). The 120-second callout timeout and adapter rate limits apply to every page render.
Anti-patterns
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/sf-integration-patterns/SKILL.md
Popularity
- Repository stars
- 3
- 7-day trend score
- 7
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/grzmol/vibe-force/sf-integration-patterns)