MCP & Claude Skills, Part 2: How to Turn Discovery into Reusable Actions

by Jerod Johnson | December 19, 2025

blog MCP & Claude Skills Part 2

In Part 1, we showed that combining Claude Skills with Model Context Protocol (MCP) can reduce token usage by up to 65%. But here’s the question we now get most often: How do I go from an exploratory MCP query to a Claude Skill my agent can use repeatedly inside Claude Code?

In this guide, we’ll walk through the full workflow:

  • Use Connect AI's MCP server to explore and construct a working query

  • Package the query as a Claude Skill for reuse

  • See how Claude uses that Skill directly inside Claude Code

  • Optimize the output for token efficiency

No cron jobs. No third-party automation. Just Claude Code and Connect AI, working together in real time.

By the end, you’ll be able to turn any MCP-powered query into a Claude Skill that Claude can discover, run, and interpret efficiently and automatically.

The real-world scenario

Let’s say your team wants to answer this question:

“Which of our top 10 revenue-generating accounts have the most open Zendesk support tickets?”

This is a multi-source query. It requires access to Salesforce for revenue data, and Zendesk for support data. Perfect for Connect AI’s unified interface. And the answer isn’t just a report—it’s a snapshot of customer health.

Let’s build it from scratch using MCP and Claude Code.

Phase 1: Discover your data using MCP

First, launch Claude Code and start a new conversation. You can begin with:

"What Salesforce data do I have access to?"

Claude will invoke MCP tools under the hood to inspect your connected catalogs, schemas, and tables. You'll likely see a response like:

"You have access to a Salesforce connection called Salesforce_Integraite. It includes tables such as Account, Contact, Opportunity, and more."

Next, you can ask:

"Show me the top 10 accounts by revenue, and include their open Zendesk ticket counts."

Claude will inspect your Zendesk schema using MCP, identify join keys, and construct a valid SQL query:

SELECT
    a.Name AS AccountName,
    a.AnnualRevenue,
    COUNT(t.Id) AS OpenTickets
FROM Salesforce_Integraite.Salesforce.Account a
LEFT JOIN Zendesk_Integraite.Zendesk.Tickets t
    ON a.Id = t.AccountId
    AND t.Status IN ('new', 'open', 'pending')
WHERE a.AnnualRevenue IS NOT NULL
GROUP BY a.Name, a.AnnualRevenue
ORDER BY a.AnnualRevenue DESC
LIMIT 10

Claude runs the query via the MCP server and returns a JSON-formatted response.

  • Token usage: ~2,750 tokens

  • Time to result: < 30 seconds

  • Repeatability: Not yet automated

Now that you have a working query, it’s time to extract it into a Skill.

Phase 2: Build a Claude Skill from your query

Step 1: Set up the Skill folder in Claude Code

Claude Skills must live inside a specific directory in Claude Code:

mkdir .claude/skills/top-accounts-with-tickets

Create the following structure:top-accounts-with-tickets/
├── SKILL.md
├── scripts/
│   └── query_accounts.py
├── requirements.txt
└── .env.example

Step 2: Write the SKILL.md metadata

This file tells Claude when and how to use the Skill:

---
name: top-accounts-with-tickets
description: Query top revenue accounts with their open Zendesk ticket counts. Use this for customer health or support questions.
allowed-tools: Bash
---


# Top Accounts with Open Tickets

Run this when the user asks about top customers, support ticket load, or cross-system Salesforce-Zendesk metrics.

## Run using:
```bash
python3 scripts/query_accounts.py

Claude uses this metadata to determine when the Skill is relevant to a prompt and how to invoke it.

Step 3: Add the query implementation

Create scripts/query_accounts.py (full code below):

python
import os
import json
import base64
import requests

def get_auth():
    email = os.getenv("CONNECT_AI_EMAIL")
    token = os.getenv("CONNECT_AI_TOKEN")
    if not email or not token:
        raise ValueError("CONNECT_AI_EMAIL and CONNECT_AI_TOKEN must be set")
    return email, token

def run_query():
    query = """
        SELECT
            a.Name AS AccountName,
            a.AnnualRevenue,
            COUNT(t.Id) AS OpenTickets
        FROM Salesforce_Integraite.Salesforce.Account a
        LEFT JOIN Zendesk_Integraite.Zendesk.Tickets t
            ON a.Id = t.AccountId
            AND t.Status IN ('new', 'open', 'pending')
        WHERE a.AnnualRevenue IS NOT NULL
        GROUP BY a.Name, a.AnnualRevenue
        ORDER BY a.AnnualRevenue DESC
        LIMIT 10
    """
    email, token = get_auth()
    auth = base64.b64encode(f"{email}:{token}".encode()).decode()
    headers = {
        "Authorization": f"Basic {auth}",
        "Content-Type": "application/json"
    }
    body = {
        "query": query,
        "schemaOnly": False,
        "parameters": {}
    }

    res = requests.post("https://cloud.cdata.com/api/query", headers=headers, json=body)
    res.raise_for_status()
    data = res.json()["results"][0]

    columns = [col["columnName"] for col in data["schema"]]
    rows = [dict(zip(columns, row)) for row in data["rows"]]

    print(json.dumps(rows, indent=2))

if name == "__main__":
    run_query()
 

This script performs three things:

  • Authenticates with Connect AI

  • Executes your SQL

  • Returns clean, compact JSON

Step 4: Add dependencies and environment template

Create requirements.txt:

requests>=2.31.0

Create .env.example:

[email protected]
CONNECT_AI_TOKEN=your-token

Phase 3: Use the Skill inside Claude Code

Now that the Skill is complete, Claude can discover and run it directly from your project.

Here’s what it looks like in action:

You or an agent (in Claude Code) ask the question, "Which of our top accounts have the most open support tickets?"

Behind the scenes, Claude detects trigger phrases from SKILL.md. From there, it finds and matches the top-accounts-with-tickets Skill and runs the script in the terminal:

> python3 scripts/query_accounts.py

After receiving the JSON output, Claude responds (in natural language):

Your top accounts by revenue with open Zendesk tickets:

  1. Platinum Investment Partners – $185B – 1 open ticket

  2. Global Energy Corporation – $175B – 0 open tickets

Why this workflow matters

This is the power of pairing Claude Skills with Connect AI:

  • The MCP server handles exploration: Helps the model understand your schema, relationships, and business questions.

  • Skills handle execution: Reuses pre-written logic and avoids re-parsing schemas or generating SQL each time.

  • Claude handles coordination: Uses metadata to decide what to run and how to format results.

  • Connect AI handles connectivity, security, and governance: Manages external data connectivity in a unified platform, enabling LLM and direct access to data.

This pattern brings clarity, consistency, and performance to your agent workflows—without needing external schedulers or manual review.

Build enterprise-ready Skills with Claude and Connect AI

You’ve just seen how to build and invoke a Claude Skill based on a real MCP session inside Claude Code. This workflow turns single-use prompts into reusable building blocks your AI can run with confidence. It starts with a trial of Connect AI. Once you're connected to your enterprise data, you're ready to start building Skills.

Try it now:

  1. Launch Claude Code

  2. Ask a business question that spans systems

  3. Let MCP generate the SQL

  4. Package the query into a Skill

  5. Ask the same question again—and watch Claude use your Skill

By combining Connect AI’s connectivity with the structure of Claude Skills, you’ll not only save tokens—you’ll build smarter, more reliable agents.

Be sure to stayed tuned for Part 3, where we'll show you how to build the functionality of Skills directly into Connect AI, enabling this level of efficiency with complex queries across all your LLM clients, tools, and frameworks.

Ready to follow along? Sign up for a free trial of Connect AI.

Explore CData Connect AI today

See how Connect AI excels at streamlining business processes for real-time insights.

Get the trial