Integration Patterns
Reference documentation for building Prismatic Code Native Integrations (CNI).
<disallowed-tools> Do NOT use these MCP tools — they return incomplete data that causes broken scaffolds and missing connections downstream. A hook will deny them, but avoid the wasted round trip.mcp__prism__prism_components_list— Userun.ts find-components <keyword>insteadmcp__prism__prism_components_init— Userun.ts scaffold-componentinsteadmcp__prism__prism_components_publish— Userun.ts publish-componentinsteadmcp__prism__prism_components_generate_manifest— Manifests are auto-generated during scaffoldingmcp__prism__prism_install_component_manifest— Handled byrun.ts scaffold-project --componentsmcp__prism__prism_install_legacy_component_manifest— Handled byrun.ts scaffold-project --components</disallowed-tools>
Architecture Patterns
Standard Integration Pattern
- Components accessed via manifests and componentRegistry
- Standard connection configuration
- Any component/manifest combination
Component Manifest Pattern
All components are accessed via manifests:
- Install:
npx cni-component-manifest <component-key> - Register in componentRegistry.ts with
componentManifests() - Import actions and call
.perform():import slackActions from "./manifests/slack/actions"; await slackActions.postMessage.perform({...})
- See
references/manifest-pattern.md
Config Mantra
Every config element MUST use wrapper functions:
configVar()for simple valuesconnectionConfigVar()for connectionsdataSourceConfigVar()for data sources- See
references/cni-examples/config-patterns-correct-vs-incorrect.md
Phase: Inline API Research
When the DAG emits status: "inline_task" for API research, perform the research directly (no sub-agent). Key strategies:
- Start broad: First WebFetch fetches the entry-point URL with a comprehensive prompt extracting auth, base URL, endpoints, webhooks, and rate limits in one pass
- Anchor deduplication: Many APIs publish all docs on a single page with
#anchorlinks. Strip fragments before fetching —https://docs.example.com/api#postsis the same page ashttps://docs.example.com/api - Follow-up fetches: Only for genuinely different URL paths (e.g.,
/api/authenticationvs/api) - Max 10 WebFetch calls: If docs are insufficient after 10 fetches, note gaps and move on
- Official docs only: Stay on the documentation domain. No third-party sources (Zapier, Make, Stack Overflow)
- Auth priority: OAuth2 > API Key > Bearer Token > Basic Auth
- Output format: Structured JSON with
authentication,baseUrl,resources,webhooks,rateLimiting - See
references/cni-examples/component-auth-patterns.mdfor connection setup patterns
Phase-Specific References
Load only the references relevant to your current workflow phase. This keeps context focused and avoids attention budget waste.
All Phases: Voice & Narration
references/narration-guide.md- Orby's voice, personality traits, explanation depth rules, and phase milestone templates. Load at session start.
Phase 2: Requirements Gathering
- Spec items now carry
agent_context(narration backbone),implications(per-option consequence maps), anddocs(Prismatic doc URLs). The agent uses these inline — no external references needed for most questions. Docs are fetched on demand only when agent_context is insufficient or the user asks a follow-up beyond what the curated content covers.
Phase 3: Credential Collection
references/auth-setup.md- Authentication setup
Phase 4: Scaffold
references/manifest-pattern.md- Component manifest usage patternsreferences/spectral-quickstart.md- Spectral SDK basicsreferences/spectral-types.md- SDK type reference — authoritative source for flow, errorConfig, retryConfig, queueConfig, configVar types. When the YAML spec and these types disagree, the types win.
Phase 5: Code Generation (PRIMARY PHASE)
See the <spec-loading> block in cni-builder.md for progressive disclosure rules.
The references below are the full set available — load per the agent's guidance.
references/answer-to-code-cookbook.md- LOAD FIRST — Maps integration.yaml answers directly to TypeScript code snippets. Spec items withcookbook_sectionfields point to specific headings in this file — Grep for those headings to find exact patterns, especially after context compaction.references/spectral-types.md- SDK type reference — validate generated code against actual typesreferences/code-generation-guide.md- File generation patterns and context objectreferences/code-anti-patterns.md- Common mistakes — wrong/right examples for config pages, flow callbacks, imports, component usage, trigger configuration. Consult when prismatic-tools validate-phase returns guidance items.references/documentation-style.md- Writing style rules for generateddocumentation.mdfiles (no second-person pronouns, no product name, active voice)references/cni-examples/config-patterns-correct-vs-incorrect.md- Config wrapper functions (CRITICAL)references/cni-examples/using-components.md- Component usage patternsreferences/trigger-metadata-spec.md- Test data structure requirements- Templates:
${CLAUDE_PLUGIN_ROOT}/templates/integration/- Structural templates for all source files
Conditional references for Phase 5 (load based on requirements):
- If webhook trigger:
references/cni-examples/webhook-patterns.md,references/cni-examples/webhook-payload-access.md - If lifecycle hooks needed:
references/cni-examples/lifecycle-events.md - If state persistence needed:
references/cni-examples/state-persistence.md - If OAuth connection:
references/cni-examples/oauth-connection.md - If multi-flow:
references/cni-examples/multi-flow.md - If data sources:
references/cni-examples/data-sources.md - If JSON forms:
references/cni-examples/json-forms.md - If integration-agnostic connections:
references/cni-examples/integration-agnostic-connections.md - If templated connections:
references/cni-examples/templated-connections.md - If no component exists for source/destination:
references/cni-examples/direct-http-patterns.md - After code generation, run
prismatic-tools verify-codeto confirm requirements were transcribed into generated code
Phase 6-7: Build, Deploy & Test
references/troubleshooting-errors.md- Common errors and fixesreferences/cni-examples/testing-debugging.md- Test and debug patternsreferences/cni-examples/error-handling.md- Error handling patterns
Phase 8: Iterate
references/network-configuration.md- Network setup (if connectivity issues)
All References
Full reference list for manual lookup:
references/narration-guide.md- Orby voice, personality, explanation depth, phase milestonesreferences/answer-to-code-cookbook.md- Maps integration.yaml answers → TypeScript codereferences/code-anti-patterns.md- Common code generation mistakes with wrong/right examplesreferences/documentation-style.md- Writing style rules for generated documentation.mdreferences/workflow-phases.md- Complete phase-by-phase workflowreferences/workflow-guide.md- Workflow overviewreferences/code-generation-guide.md- File generation patterns and context objectreferences/manifest-pattern.md- Component manifest usage patternsreferences/auth-setup.md- Authentication setupreferences/network-configuration.md- Network setupreferences/spectral-quickstart.md- Spectral SDK basicsreferences/trigger-metadata-spec.md- Test data structure requirementsreferences/troubleshooting-errors.md- Common errors and fixesreferences/cni-examples/basic-api-to-slack.md- Simple integrationreferences/cni-examples/webhook-patterns.md- Webhook handling- `references/cni-examples/webhook-