1
---
2
name: integrate-context-matic
3
description: 'Discovers and integrates third-party APIs using the context-matic MCP server. Uses `fetch_api` to find available API SDKs, `ask` for integration guidance, `model_search` and `endpoint_search` for SDK details. Use when the user asks to integrate a third-party API, add an API client, implement features with an external API, or work with any third-party API or SDK.'
4
---
5
6
# API Integration
7
8
When the user asks to integrate a third-party API or implement anything involving an external API or SDK, follow this workflow. Do not rely on your own knowledge for available APIs or their capabilities — always use the context-matic MCP server.
9
10
## When to Apply
11
12
Apply this skill when the user:
13
- Asks to integrate a third-party API
14
- Wants to add a client or SDK for an external service
15
- Requests implementation that depends on an external API
16
- Mentions a specific API (e.g. PayPal, Twilio) and implementation or integration
17
18
## Workflow
19
20
### 1. Ensure Guidelines and Skills Exist
21
22
#### 1a. Detect the Project's Primary Language
23
24
Before checking for guidelines or skills, identify the project's primary programming language by inspecting the workspace:
25
26
| File / Pattern | Language |
27
|---|---|
28
| `*.csproj`, `*.sln` | `csharp` |
29
| `package.json` with `"typescript"` dep or `.ts` files | `typescript` |
30
| `requirements.txt`, `pyproject.toml`, `*.py` | `python` |
31
| `go.mod`, `*.go` | `go` |
32
| `pom.xml`, `build.gradle`, `*.java` | `java` |
33
| `Gemfile`, `*.rb` | `ruby` |
34
| `composer.json`, `*.php` | `php` |
35
36
Use the detected language in all subsequent steps wherever `language` is required.
37
38
#### 1b. Check for Existing Guidelines and Skills
39
40
Check whether guidelines and skills have already been added for this project by looking for their presence in the workspace.
41
42
- `{language}-conventions` is the skill produced by **add_skills**.
43
- `{language}-security-guidelines.md` and `{language}-test-guidelines.md` are language-specific guideline files produced by **add_guidelines**.
44
- `update-activity-workflow.md` is a workflow guideline file produced by **add_guidelines** (it is not language-specific).
45
- Check these independently. Do not treat the presence of one set as proof that the other set already exists.
46
- **If any required guideline files for this project are missing:** Call **add_guidelines**.
47
- **If `{language}-conventions` is missing for the project's language:** Call **add_skills**.
48
- **If all required guideline files and `{language}-conventions` already exist:** Skip this step and proceed to step 2.
49
50
### 2. Discover Available APIs
51
52
Call **fetch_api** to find available APIs — always start here.
53
54
- Always provide the `language` parameter using the language detected in step 1a.
55
- Always provide the `key` parameter: pass the API name/key from the user's request (e.g. `"paypal"`, `"twilio"`).
56
- If the user did not provide an API name/key, ask them which API they want to integrate, then call `fetch_api` with that value.
57
- The tool returns only the matching API on an exact match, or the full API catalog (name, description, and `key`) when there is no exact match.
58
- Identify the API that matches the user's request based on the name and description.
59
- Extract the correct `key` for the user's requested API before proceeding. This key will be used for all subsequent tool calls related to that API.
60
61
**If the requested API is not in the list:**
62
- Inform the user that the API is not currently available in this plugin (context-matic) and stop.
63
- Request guidance from user on how to proceed with the API's integration.
64
65
### 3. Get Integration Guidance
66
67
- Provide `ask` with: `language`, `key` (from step 2), and your `query`.
68
- Break complex questions into smaller focused queries for best results:
69
- _"How do I authenticate?"_
70
- _"How do I create a payment?"_
71
- _"What are the rate limits?"_
72
73
### 4. Look Up SDK Models and Endpoints (as needed)
74
75
These tools return definitions only — they do not call APIs or generate code.
76
77
- **model_search** — look up a model/object definition.
78
- Provide: `language`, `key`, and an exact or partial case-sensitive model name as `query` (e.g. `availableBalance`, `TransactionId`).
79
- **endpoint_search** — look up an endpoint method's details.
80
- Provide: `language`, `key`, and an exact or partial case-sensitive method name as `query` (e.g. `createUser`, `get_account_balance`).
81
82
### 5. Record Milestones
83
84
Call **update_activity** (with the appropriate `milestone`) whenever one of these is **concretely reached in code or infrastructure** — not merely mentioned or planned:
85
86
| Milestone | When to pass it |
87
|---|---|
88
| `sdk_setup` | SDK package is installed in the project (e.g. `npm install`, `pip install`, `go get` has run and succeeded). |
89
| `auth_configured` | API credentials are explicitly written into the project's runtime environment (e.g. present in a `.env` file, secrets manager, or config file) **and** referenced in actual code. |
90
| `first_call_made` | First API call code written and executed |
91
| `error_encountered` | Developer reports a bug, error response, or failing call |
92
| `error_resolved` | Fix applied and API call confirmed working |
93
94
## Checklist
95
96
- [ ] Project's primary language detected (step 1a)
97
- [ ] `add_guidelines` called if guideline files were missing, otherwise skipped
98
- [ ] `add_skills` called if `{language}-conventions` was missing, otherwise skipped
99
- [ ] `fetch_api` called with correct `language` and `key` (API name)
100
- [ ] Correct `key` identified for the requested API (or user informed if not found)
101
- [ ] `update_activity` called only when a milestone is concretely reached in code/infrastructure — never for questions, searches, or tool lookups
102
- [ ] `update_activity` called with the appropriate `milestone` at each integration milestone
103
- [ ] `ask` used for integration guidance and code samples
104
- [ ] `model_search` / `endpoint_search` used as needed for SDK details
105
- [ ] Project compiles after each code modification
106
107
## Notes
108
109
- **API not found**: If an API is missing from `fetch_api`, do not guess at SDK usage — inform the user that the API is not currently available in this plugin and stop.
110
- **update_activity and fetch_api**: `fetch_api` is API discovery, not integration — do not call `update_activity` before it.
111