home / skills / abdullahbeam / nexus-design-abdullah / add-integration

This skill converts API documentation into a production-ready Nexus integration, including endpoint discovery, planning, and project creation.

npx playbooks add skill abdullahbeam/nexus-design-abdullah --skill add-integration

Review the files below or copy the command above to add this skill to your agents.

Files (19)
SKILL.md
17.8 KB
---
name: add-integration
description: Build a new API integration for Nexus. Load when user mentions "add integration", "new integration", "integrate with", "connect to [service]", or "build [service] integration". Interactive workflow that discovers API endpoints, plans the integration, and creates a project for implementation.
---

## šŸŽÆ Onboarding Awareness (CHECK BEFORE STARTING)

**Before building an integration, AI MUST check `stats.pending_onboarding` for `learn_integrations`:**

### Pre-Flight Check (RECOMMENDED)

Check if `learn_integrations` is in `stats.pending_onboarding`. If present:

```
šŸ’” Before building your first integration, would you like a quick 10-minute
tutorial on how Nexus integrations work? It covers:
- What MCP (Model Context Protocol) is
- Available integration patterns
- When to use integrations vs other approaches

Say 'learn integrations' to start the tutorial, or 'skip' to build directly.
```

**If user says 'skip':** Proceed with integration building but add this note at the end:
```
šŸ’” Tip: Run 'learn integrations' later to understand the integration ecosystem.
```

**If `learn_integrations` NOT in `pending_onboarding`:** Proceed normally without suggestion.

### Context Awareness

If user mentions connecting to external tools but `learn_integrations` is pending:
- Gently suggest learning first if they seem unfamiliar with MCP concepts
- Skip suggestion if they clearly know what they're doing (e.g., mention specific API endpoints)

---

# Add Integration

Build complete API integrations following the master/connect/specialized pattern.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
āš ļø CRITICAL: MUST LOAD create-project SKILL āš ļø

**MANDATORY**: In Step 4, load the create-project skill:

```bash
python 00-system/core/nexus-loader.py --skill create-project
```

Then follow its workflow to create the integration project.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

## Purpose

The `add-integration` skill transforms API documentation into a complete, production-ready integration. It:

1. **Discovers** available API endpoints via web search
2. **Presents** endpoints for user selection
3. **Plans** the integration architecture
4. **Creates a project** for implementation (via create-project skill)

**Architecture Pattern**: See [references/integration-architecture.md](references/integration-architecture.md)

**Time Estimate**: 15-25 minutes (planning phase)

---

## Workflow Overview

```
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                   ADD INTEGRATION                        │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  Step 1: Initialize TodoList                            │
│  Step 2: Ask which service to integrate                 │
│  Step 3: Web search for API documentation               │
│  Step 4: Create integration project (saves progress)    │
│  Step 5: Parse and present available endpoints          │
│  Step 6: User selects endpoints to implement            │
│  Step 7: Gather authentication details & finalize       │
│  Step 8: Prompt user to close session & start project   │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
```

---

## Workflow

### Step 1: Initialize TodoList

Create TodoWrite with all workflow steps:
```
- [ ] Ask which service to integrate
- [ ] Search for API documentation
- [ ] Create integration project
- [ ] Parse and present endpoints
- [ ] User selects endpoints
- [ ] Gather authentication details & finalize
- [ ] Prompt close session
```

**Mark tasks complete as you finish each step.**

---

### Step 2: Interactive Service Selection

Display:
```
Let's build a new integration! šŸ”Œ

Which service would you like to integrate?

Examples:
• HubSpot (CRM, marketing automation)
• Stripe (payments, subscriptions)
• Twilio (SMS, voice, messaging)
• Airtable (databases, spreadsheets)
• Slack (messaging, notifications)
• GitHub (repos, issues, PRs)
• Linear (issue tracking)
• Notion (notes, databases)
• Or any service with a REST API

Tell me the service name:
```

**Wait for user response.**

**Capture and normalize**:
- Store service name (e.g., "HubSpot")
- Generate slug (e.g., "hubspot")
- Note any specific features mentioned

---

### Step 3: Web Search for API Documentation

**CRITICAL: Use WebSearch to find current API documentation**

```
AI Action:
1. WebSearch: "{service_name} REST API documentation endpoints"
2. WebSearch: "{service_name} API reference authentication"
3. Identify official API docs URL
4. Use WebFetch on official docs to get endpoint details
```

**Search targets**:
- Official API documentation
- Authentication methods
- Available endpoints by category
- Rate limits and requirements

**Display progress**:
```
Searching for {Service} API documentation...

Found:
• Official docs: {url}
• API version: {version}
• Auth type: {oauth2/api_key/bearer}
```

---

### Step 4: Create Integration Project

**Create project immediately after discovering API docs** to save progress.

**Load the create-project skill:**
```bash
python 00-system/core/nexus-loader.py --skill create-project
```

**Follow its workflow** with project name: "{Service Name} Integration"

This creates:
```
02-projects/{next_id}-{service_slug}-integration/
ā”œā”€ā”€ 01-planning/
│   ā”œā”€ā”€ overview.md          # Project metadata (template)
│   ā”œā”€ā”€ plan.md              # Approach and decisions (template)
│   └── steps.md             # Implementation checklist (template)
ā”œā”€ā”€ 02-resources/            # For integration-config.json
ā”œā”€ā”€ 03-working/
└── 04-outputs/
```

**After project is created**, update the generated files with integration-specific content.

**Initial overview.md**:
```yaml
---
id: {next_id}-{service_slug}-integration
name: {Service Name} Integration
status: PLANNING
description: Load when user mentions '{service_slug} integration', 'implement {service_slug}', 'build {service_slug} skills'
created: {today}
---

# {Service Name} Integration

Build complete {Service Name} integration following the master/connect/specialized pattern.

## Discovery

- **Service**: {Service Name}
- **API Docs**: {api_docs_url}
- **Auth Type**: {detected_auth_type}
- **Base URL**: {detected_base_url}

## Status

Endpoints: Pending selection
Configuration: In progress

## References

- Pattern: See 00-system/skills/system/add-integration/references/integration-architecture.md
```

**Initial integration-config.json** (partial, will be updated):
```json
{
  "service_name": "{Service Name}",
  "service_slug": "{service_slug}",
  "base_url": "{detected_base_url}",
  "auth_type": "{detected_auth_type}",
  "api_docs_url": "{api_docs_url}",
  "endpoints": [],
  "status": "planning",
  "created": "{timestamp}",
  "created_by": "add-integration skill"
}
```

**Display**:
```
Project created: 02-projects/{id}-{service_slug}-integration/

Your progress is now being saved. Let's continue with endpoint selection...
```

---

### Step 5: Parse and Present Endpoints

After fetching API docs, categorize and present.

**Save discovered endpoints to project** (`02-resources/discovered-endpoints.json`):
```json
{
  "discovered_at": "{timestamp}",
  "source": "{api_docs_url}",
  "categories": [
    {
      "name": "Authentication",
      "endpoints": [...]
    },
    {
      "name": "Contacts",
      "endpoints": [...]
    }
  ],
  "total_count": {N}
}
```

**Display to user**:
```
I found {N} API endpoints for {Service}:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
AUTHENTICATION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  [1] POST /oauth/token - Get access token
  [2] POST /oauth/refresh - Refresh token

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{CATEGORY 1} (e.g., CONTACTS)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  [3] GET /contacts - List all contacts
  [4] GET /contacts/{id} - Get contact by ID
  [5] POST /contacts - Create contact
  [6] PATCH /contacts/{id} - Update contact
  [7] DELETE /contacts/{id} - Delete contact

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
{CATEGORY 2} (e.g., DEALS)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  [8] GET /deals - List deals
  [9] POST /deals - Create deal
  ...

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Which endpoints do you want to implement?

Options:
• "all" - Implement everything ({N} endpoints)
• "1,3,5,8" - Select by number
• "contacts, deals" - Select by category
• "core" - Essential CRUD operations only
```

**Wait for user response.**

---

### Step 6: User Selects Endpoints

**Process user selection**:
- "all" → Select all endpoints
- "1,3,5,8" → Select by number
- "contacts, deals" → Select by category name
- "core" → Select GET/POST for main resources

**Update integration-config.json** with selected endpoints:
```json
{
  "endpoints": [
    {
      "name": "List Contacts",
      "slug": "list-contacts",
      "method": "GET",
      "path": "/contacts",
      "description": "Retrieve all contacts",
      "triggers": ["list contacts", "get contacts", "show contacts"]
    },
    ...
  ]
}
```

**Display confirmation**:
```
Selected {N} endpoints for implementation:
• List Contacts (GET /contacts)
• Create Contact (POST /contacts)
• ...

Saved to project. Now let's confirm the authentication setup...
```

---

### Step 7: Gather Authentication Details & Finalize Project

Based on API docs discovered:

```
Authentication Setup
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

{Service} uses {auth_type} authentication.

To set up:
{auth_instructions from API docs}

I'll need this info for the integration config:

1. API Base URL: {detected_base_url}
   Is this correct? (or provide alternative)

2. Auth type: {oauth2/api_key/bearer}
   Confirm or correct

3. Environment variable name suggestion:
   {SERVICE_SLUG}_API_KEY

   Okay? Or suggest different name
```

**Wait for user confirmation/corrections.**

**Finalize project files**:

1. **Update integration-config.json** with confirmed values:
```json
{
  "service_name": "{Service Name}",
  "service_slug": "{service_slug}",
  "base_url": "{confirmed_base_url}",
  "auth_type": "{confirmed_auth_type}",
  "env_key": "{ENV_KEY}",
  "api_docs_url": "{api_docs_url}",
  "endpoints": [...],
  "status": "ready",
  "created": "{timestamp}",
  "created_by": "add-integration skill"
}
```

2. **Update overview.md** with final scope:
```yaml
---
id: {next_id}-{service_slug}-integration
name: {Service Name} Integration
status: PLANNING
description: Load when user mentions '{service_slug} integration', 'implement {service_slug}', 'build {service_slug} skills'
created: {today}
---

# {Service Name} Integration

Build complete {Service Name} integration following the master/connect/specialized pattern.

## Scope

- **Service**: {Service Name}
- **Base URL**: {base_url}
- **Auth Type**: {auth_type}
- **Endpoints**: {count} selected

## Architecture

Will create:
- `{service_slug}-master/` - Shared resources
- `{service_slug}-connect/` - Meta-skill entry point
- `{service_slug}-{operation}/` - One skill per endpoint

## References

- API Docs: {api_docs_url}
- Pattern: See 00-system/skills/system/add-integration/references/integration-architecture.md
```

3. **Generate steps.md** with implementation checklist:
```markdown
# Implementation Steps

## Phase 1: Setup Master Skill
- [ ] Create {service_slug}-master/ directory structure
- [ ] Generate {service_slug}_client.py from template
- [ ] Generate check_{service_slug}_config.py
- [ ] Generate setup_{service_slug}.py wizard
- [ ] Create references/setup-guide.md
- [ ] Create references/api-reference.md
- [ ] Create references/error-handling.md
- [ ] Create references/authentication.md

## Phase 2: Setup Connect Skill
- [ ] Create {service_slug}-connect/ directory
- [ ] Generate SKILL.md with routing table
- [ ] Map workflows to endpoints

## Phase 3: Create Operation Skills
{for each selected endpoint:}
- [ ] Create {service_slug}-{endpoint_slug}/ skill
- [ ] Generate SKILL.md with API reference
- [ ] Generate {endpoint_slug}.py script

## Phase 4: Test & Validate
- [ ] Run config check script
- [ ] Test authentication flow
- [ ] Test each endpoint script
- [ ] Verify error handling

## Phase 5: Documentation
- [ ] Update master SKILL.md with all skills
- [ ] Document any service-specific quirks
- [ ] Add usage examples
```

**Display confirmation**:
```
Project Finalized!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

šŸ“ 02-projects/{id}-{service_slug}-integration/

This project contains:
• Full implementation plan in steps.md
• Configuration saved in integration-config.json
• {N} endpoints ready to implement

The implementation will create:
• {service_slug}-master/ (shared resources)
• {service_slug}-connect/ (meta-skill)
• {count} operation skills

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

---

### Step 8: Prompt Close Session & Start Implementation

**Final message**:
```
Integration planning complete! šŸŽ‰

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
NEXT STEPS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. Say "done" to close this session
   (This saves your planning work)

2. Start a new session

3. Say "work on {service_slug} integration"
   (This will execute the implementation project)

The project will guide you through:
• Creating all skill folders
• Generating scripts from templates
• Setting up authentication
• Testing each endpoint

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Ready to close this session? Say "done"
```

**Wait for user to say "done"** → Triggers close-session skill

---

## Project Execution Notes

When the user returns and says "work on {service} integration", the `execute-project` skill will:

1. **Load** the integration-config.json
2. **Run** scaffold_integration.py with the config:
   ```bash
   python 00-system/skills/system/add-integration/scripts/scaffold_integration.py \
     --config 02-projects/{id}-{service_slug}-integration/02-resources/integration-config.json
   ```
3. **Check off** steps.md tasks as completed
4. **Guide** through testing and validation

---

## Templates & Scripts

### Templates (in templates/)
- `master-skill.md.template` - Master SKILL.md
- `connect-skill.md.template` - Connect SKILL.md
- `operation-skill.md.template` - Operation SKILL.md
- `api-client.py.template` - API client class
- `config-check.py.template` - Config validator
- `setup-wizard.py.template` - Setup wizard
- `operation-script.py.template` - Operation script
- `references/*.template` - Reference documents

### Scripts (in scripts/)
- `scaffold_integration.py` - Main scaffolding script

---

## Error Handling

### Web Search Fails
```
I couldn't find official API documentation for {Service}.

Options:
1. Provide the API docs URL directly
2. Tell me the base URL and auth type manually
3. Try a different service name

What would you like to do?
```

### No Endpoints Found
```
I found {Service} docs but couldn't parse specific endpoints.

Let me try:
1. Fetching a different docs page
2. You provide endpoint list manually

Which approach?
```

### User Cancels
```
No problem! Integration planning cancelled.

Your progress was not saved. Run "add integration"
again when you're ready.
```

---

## Notes

**Why projects?**
- Integration implementation is multi-step work (project)
- Planning is reusable (skill handles discovery)
- Separates planning from execution

**Why web search?**
- APIs change frequently
- Ensures current endpoint info
- Discovers auth requirements automatically

**Pattern consistency**:
- All integrations follow same architecture
- Matches existing Beam integration
- Templates ensure quality

---

## References

- [Integration Architecture](references/integration-architecture.md) - The pattern explained
- [MCP Introduction](references/mcp-introduction.md) - What MCP is
- [MCP Setup Guide](references/mcp-setup-guide.md) - Manual MCP setup
- [Troubleshooting](references/troubleshooting-guide.md) - Common issues
- [Integration Ideas](references/integration-ideas.md) - Use cases

---

**Version**: 2.0
**Updated**: 2025-12-11
**Major change**: Now creates projects for implementation instead of doing everything in one session

Overview

This skill guides you through building a new API integration for Nexus from discovery to a saved project. It interactively finds API docs, presents endpoints for selection, plans architecture, and creates a project scaffold for implementation. The planning phase typically takes 15–25 minutes and saves progress immediately so work can resume later.

How this skill works

The skill first checks onboarding state and optionally offers a short tutorial on integrations if needed. It searches the web for the service's official API documentation, fetches endpoint and authentication details, and asks you to select endpoints to implement. After discovery it loads the create-project workflow to create a project folder and populates planning files and an integration-config.json with the chosen scope and auth settings.

When to use it

  • When you want to add a production-ready API integration for a third-party service.
  • When you need an interactive discovery workflow to find API endpoints and authentication requirements.
  • When you want a saved project scaffold that documents scope, architecture, and implementation steps.
  • When you plan to generate one skill per endpoint and a master/connect pattern for reuse.
  • When you need a repeatable checklist and config to hand off to engineers or to resume later.

Best practices

  • If prompted, run the 10-minute 'learn integrations' tutorial before building your first integration.
  • Provide a service name and any specific features or endpoints you want to prioritize to shorten discovery.
  • Confirm base URL and auth type during the authentication step to avoid misconfigured clients.
  • Select core CRUD endpoints first (core) to establish the master/connect pattern before expanding.
  • Use environment variable naming suggestions provided and keep secrets out of project files.

Example use cases

  • Add a Stripe integration to handle payments: discover payment, customer, and subscription endpoints and scaffold the project.
  • Connect to HubSpot to sync contacts and deals: find auth flow, select contacts endpoints, and generate operation skills.
  • Integrate with Twilio to send SMS: locate messaging endpoints and create a focused operation skill for sending messages.
  • Build a GitHub integration to list repos and create issues: detect OAuth flow and scaffold master/connect structure.
  • Create an Airtable connector to read and write tables: discover REST endpoints and produce a step-by-step implementation plan.

FAQ

Do I need to run anything before starting?

The skill checks if you have pending onboarding for integrations and offers a brief tutorial; you can skip it and continue. If you skip, a tip to run the tutorial later is saved.

When is the create-project workflow invoked?

Immediately after API docs are discovered. The skill will load the create-project workflow (python 00-system/core/nexus-loader.py --skill create-project) to create the project and persist planning files.