Search This Blog

Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

Wednesday, July 22, 2026

Understanding Text Embeddings: The Foundation of Semantic Search and RAG

 

Understanding Text Embeddings: The Foundation of Semantic Search and RAG

Why every AI engineer should understand embeddings before building Retrieval-Augmented Generation (RAG), AI Agents, or Semantic Search systems.


Introduction

One of the biggest misconceptions about Large Language Models (LLMs) is that they "understand" language the way humans do. In reality, computers don't understand words—they understand numbers.

When you ask an AI:

"How do I deploy an Node application?"

the model cannot process this sentence directly. Before any reasoning or retrieval happens, the text must first be transformed into a mathematical representation that a computer can work with.

This representation is called a text embedding.

Text embeddings are the foundation of nearly every modern AI application, including:

  • Semantic Search

  • Retrieval-Augmented Generation (RAG)

  • AI Chatbots

  • Recommendation Engines

  • Document Classification

  • AI Agents

  • Knowledge Management Systems

If you've ever wondered how ChatGPT finds relevant information from your documents or how a vector database retrieves similar content in milliseconds, text embeddings are the answer.


What is a Text Embedding?

A text embedding is a numerical representation of text that captures its semantic meaning.

Instead of storing text as words, an embedding model converts the text into a vector—a list of floating-point numbers.

For example:

"I love dogs"

↓

[0.23, -0.18, 0.91, ..., 0.44]

Similarly,

"Dogs are my favorite pets"

↓

[0.21, -0.15, 0.89, ..., 0.41]

Although these two sentences use different words, their vectors are very close because they express nearly the same meaning.

Now consider:

"How to bake a chocolate cake"

↓

[-0.72, 0.61, -0.35, ..., 0.08]

This vector will be much farther away because its meaning is unrelated.

The key idea is simple:

Similar meanings produce similar vectors.


Why Do We Need Embeddings?

Traditional keyword-based search looks for exact word matches.

Imagine searching for:

Affordable car

But your document contains:

Cheap automobile

A keyword search may fail because none of the words match exactly.

Humans immediately understand that:

  • Affordable ≈ Cheap

  • Car ≈ Automobile

Embedding models capture this semantic relationship. Instead of comparing words, they compare meanings.

This is what makes semantic search so powerful.


The Evolution of Text Representation

Natural Language Processing has evolved significantly over the years.

1. One-Hot Encoding

Each word is represented as a unique binary vector.

Dog   → [0,0,1,0,0]
Cat   → [0,1,0,0,0]
Car   → [1,0,0,0,0]

Problems:

  • Huge vectors

  • No understanding of meaning

  • Dog and Puppy are completely unrelated


2. Word Embeddings

Models like Word2Vec and GloVe introduced dense vector representations.

Dog → [0.41, -0.21, 0.83]
Cat → [0.38, -0.17, 0.80]
Car → [-0.62, 0.91, -0.11]

Now:

  • Dog and Cat become close.

  • Dog and Car remain far apart.

A major improvement—but there was still one limitation.

Every word had only one meaning.

For example:

Apple

was always represented by the same vector.


3. Contextual Embeddings

Transformer models changed everything.

Now the meaning of a word depends on its surrounding words.

Sentence 1:

Apple released a new MacBook.

Embedding:

Apple = Technology Company

Sentence 2:

Apple tastes delicious.

Embedding:

Apple = Fruit

The embedding changes depending on the context.

This is one of the biggest breakthroughs in modern AI.


How Text Embeddings Are Generated

Let's walk through the complete process.

Step 1 — Input Text

What is Node App?

Step 2 — Tokenization

The sentence is broken into smaller pieces called tokens.

What

is

Node

App

?

Every token receives a unique identifier.


Step 3 — Initial Token Embeddings

Each token is mapped to a dense vector.

Node

↓

[0.12, 0.55, -0.81, ...]

Initially these vectors are learned during model training.


Step 4 — Transformer Processing

This is where the magic happens.

Every token interacts with every other token using self-attention.

The model learns relationships like:

  • subject

  • object

  • intent

  • context

  • domain knowledge

Instead of understanding words independently, the model understands the entire sentence.


Step 5 — Pooling

The transformer generates one vector per token.

These token vectors are combined into a single vector representing the entire sentence.

Common pooling strategies include:

  • CLS Token

  • Mean Pooling

  • Max Pooling

The result is one embedding for the whole sentence.


Measuring Similarity

Once we have vectors, how do we compare them?

The most common metric is Cosine Similarity.

Imagine two arrows.

If both arrows point in nearly the same direction,

their cosine similarity approaches 1.0.

Typical values:

1.00

Exactly identical

0.95

Extremely similar

0.85

Related

0.50

Weak similarity

0

No relation

Instead of comparing words, AI systems compare vectors mathematically.


Semantic Search

Suppose our knowledge base contains four documents.

Node App Overview

Python Programming

Pizza Recipes

Node App Development

Each document is converted into an embedding.

Now the user asks:

How do I deploy a Node application?

The query is also embedded.

The search engine compares the query vector against every document vector.

The most similar documents might be:

Node App Development

Similarity: 0.96

Node App Overview

Similarity: 0.82

Python Programming

Similarity: 0.23

The system retrieves the first two documents.

Notice that it doesn't matter whether the exact words appear—it retrieves content based on meaning.


Where Are Embeddings Stored?

Embeddings are typically stored inside a vector database.

Each record contains:

  • Original text

  • Embedding vector

  • Metadata

For example:

{
  "id": "doc001",
  "text": "Node App Development Guide",
  "embedding": [0.23, -0.41, ...],
  "metadata": {
      "product": "Node App",
      "version": "8.0"
  }
}

Popular vector databases include:

  • PostgreSQL + pgvector

  • Qdrant

  • Pinecone

  • Chroma

  • Weaviate

  • Milvus

  • FAISS

These systems are optimized to search millions—or even billions—of vectors efficiently.


Embeddings in Retrieval-Augmented Generation (RAG)

RAG combines vector search with large language models.

The workflow looks like this:

  1. Documents are split into smaller chunks.

  2. Each chunk is converted into an embedding.

  3. Embeddings are stored in a vector database.

  4. A user's question is embedded.

  5. Similar chunks are retrieved.

  6. Retrieved content is provided as context to the LLM.

  7. The LLM generates an informed response.

Without embeddings, RAG would not be able to retrieve relevant information efficiently.


Real-World Applications

Text embeddings power a wide range of AI systems:

  • Enterprise Knowledge Search

  • AI Customer Support

  • Code Search

  • Document Recommendations

  • Fraud Detection

  • Similar Case Retrieval

  • Resume Matching

  • Product Recommendations

  • Medical Record Search

  • Legal Document Analysis

Anywhere we need to compare the meaning of text rather than its exact wording, embeddings play a critical role.


Key Takeaways

  • Text embeddings convert text into numerical vectors.

  • They capture semantic meaning rather than exact words.

  • Similar texts produce vectors that are close together.

  • Modern embeddings are generated using Transformer-based language models.

  • Similarity is measured mathematically using metrics such as cosine similarity.

  • Vector databases enable fast retrieval of semantically similar content.

  • Embeddings form the foundation of semantic search, RAG, AI agents, and many modern AI-powered applications.


Conclusion

Text embeddings are one of the most important building blocks in modern Artificial Intelligence. While Large Language Models often receive the spotlight, embeddings quietly power the retrieval, search, and contextual understanding that make those models truly useful.

Whether you're building an enterprise knowledge assistant, an AI-powered search engine, or a multi-agent system, understanding how text embeddings work will help you design systems that are faster, more accurate, and capable of reasoning over vast amounts of information.

In future articles, we'll dive deeper into related topics such as vector databases, cosine similarity, embedding model selection, chunking strategies, and building a complete RAG application from scratch using Node.js.

Monday, July 6, 2026

Skills vs. Prompts: Understanding the Building Blocks of Modern AI Applications

 

Skills vs. Prompts: Understanding the Building Blocks of Modern AI Applications

Introduction

As Generative AI evolves, the terminology around it is evolving just as quickly. Two terms that are often used interchangeably—but represent very different concepts—are prompts and skills.

Many developers ask questions like:

  • Is a skill just a prompt?

  • Are skills replacing prompts?

  • How do AI agents use skills?

  • When should I create a prompt versus a skill?

The short answer is:

A prompt tells an AI model what to do for a single interaction, while a skill packages everything needed to perform a task repeatedly, reliably, and consistently.

Understanding this distinction is essential when building production-grade AI applications.


What Is a Prompt?

A prompt is the instruction given to an AI model during an interaction.

It provides context, guidance, and the expected output.

Example

Summarize this research paper in five bullet points suitable for executives.

Or

Write a professional email declining a meeting invitation.

A prompt is typically:

  • One-time

  • Task-specific

  • Text-based

  • Stateless (unless conversation history is supplied)

  • Easy to modify

Think of a prompt as asking an expert a single question.


What Is a Skill?

A skill is a reusable capability designed to accomplish a specific business or technical task.

Rather than containing only a prompt, a skill combines multiple components that work together.

A skill may include:

  • System instructions

  • Prompt templates

  • Business rules

  • Workflow logic

  • External tools

  • APIs

  • Database access

  • Validation rules

  • Output formatting

  • Security guardrails

  • Optional memory or context

Instead of simply telling the model what to do, a skill defines how the task should be completed every time.


A Better Definition

A skill is a reusable, packaged capability that combines prompts, instructions, workflows, tools, business logic, and guardrails to perform a specific task consistently.

This definition captures how modern AI platforms implement reusable functionality.


Visualizing the Difference

Prompt

"Summarize this PDF."

Skill

Contract Review Skill

├── Understand user request
├── Read uploaded PDF
├── Extract contract clauses
├── Identify risks
├── Compare with company policies
├── Highlight missing information
├── Generate executive summary
└── Export structured report

Notice that the prompt is only one component of the overall capability.


Skills Are More Than Prompts

Many people describe skills as "packaged prompts."

While this isn't entirely wrong, it is incomplete.

A better way to think about it is:

Skill
│
├── Prompt(s)
├── Instructions
├── Workflow
├── Tool Access
├── APIs
├── Knowledge Sources
├── Validation
├── Memory
├── Output Templates
└── Guardrails

The prompt is only one building block.


Prompt vs Skill Comparison

FeaturePromptSkill
PurposeOne instructionReusable capability
ScopeSingle interactionComplete workflow
ReusabilityLowHigh
Includes promptsYesYes
Includes toolsNoYes
Uses APIsNoOften
Workflow logicMinimalExtensive
Business rulesUsually absentIncluded
Output formattingManualStandardized
ValidationRareCommon
MemoryOptional conversation historyMay include persistent context
Ideal forSimple requestsEnterprise automation

Software Engineering Analogy

For software engineers, the distinction becomes much clearer with familiar concepts.

Software DevelopmentAI
Function callPrompt
LibraryCollection of prompts
ModuleSkill
ApplicationAI Agent
MicroserviceSpecialized Skill

A prompt is similar to calling a single function.

A skill resembles an entire software module that encapsulates implementation details behind a clean interface.


Real-World Example

Suppose you want AI to analyze invoices.

Using Only a Prompt

Extract invoice number, vendor name, total amount, and due date.

This works—but only for one interaction.


Using an Invoice Processing Skill

The skill might perform the following:

  1. Accept PDF or image uploads.

  2. Run OCR if needed.

  3. Detect invoice layout.

  4. Extract structured fields.

  5. Validate mandatory fields.

  6. Check against ERP records.

  7. Detect duplicate invoices.

  8. Flag anomalies.

  9. Generate JSON output.

  10. Store results in a database.

The prompt is only one step in a much larger workflow.


Why Enterprises Build Skills

Organizations rarely deploy raw prompts directly into production.

Instead, they package expertise into reusable skills because they provide:

Consistency

Every user receives standardized output.

Reusability

Multiple applications can invoke the same capability.

Maintainability

Updates are made in one place rather than across many prompts.

Governance

Business rules remain centralized.

Security

Skills can enforce authentication, authorization, and data protection.

Tool Integration

Skills can call databases, APIs, enterprise systems, and search services.


Skills Enable AI Agents

An AI agent rarely performs every task itself.

Instead, it orchestrates multiple skills.

Customer Support Agent

        │
        ├── Search Knowledge Skill
        ├── Order Lookup Skill
        ├── Refund Processing Skill
        ├── Email Drafting Skill
        ├── CRM Update Skill
        └── Escalation Skill

The agent decides which skill should execute.

Each skill internally uses prompts, tools, and workflows.


A Practical Example

Imagine asking:

"My order hasn't arrived. Can you help?"

The AI agent might:

  1. Understand the intent.

  2. Invoke the Order Lookup Skill.

  3. Retrieve shipment details.

  4. Invoke the Refund Eligibility Skill.

  5. Generate a personalized response.

  6. Update the CRM.

  7. Send a confirmation email.

The user experiences a single conversation, while multiple skills work together behind the scenes.


When Should You Use a Prompt?

A prompt is ideal when:

  • Experimenting with ideas.

  • Writing content.

  • Asking questions.

  • Summarizing documents.

  • Brainstorming.

  • Learning.

  • Rapid prototyping.

Prompts are fast, flexible, and easy to iterate.


When Should You Build a Skill?

A skill becomes valuable when:

  • The task is repeated frequently.

  • Multiple users need the same capability.

  • External systems are involved.

  • Business rules must be enforced.

  • Outputs require standardization.

  • Compliance and governance matter.

  • Reliability is critical.

Skills transform experimental AI into production-ready functionality.


The Evolution of AI Development

Many AI projects follow a natural progression:

Prompt

↓

Prompt Template

↓

Reusable Prompt Library

↓

Skill

↓

Collection of Skills

↓

AI Agent

↓

Enterprise AI Platform

Each stage adds greater structure, automation, and reliability.


Key Takeaways

  • A prompt is an instruction for a single interaction.

  • A skill is a reusable capability built around prompts.

  • Skills combine prompts, workflows, tools, APIs, business rules, and guardrails.

  • AI agents orchestrate multiple skills to complete complex tasks.

  • Prompts are excellent for experimentation, while skills are designed for production systems.

The most successful AI solutions don't eliminate prompts—they build on them. Prompts remain the foundation, but skills package that intelligence into reusable, scalable capabilities that organizations can trust and deploy across teams.

As AI continues to mature, understanding the relationship between prompts, skills, and agents will become a core competency for software engineers, architects, and AI solution designers.

Tuesday, May 12, 2026

Skills vs MCP: Understanding the Difference in Modern AI Agents

 

Skills vs MCP: Understanding the Difference in Modern AI Agents

Artificial Intelligence agents are evolving rapidly. As teams build more capable AI systems, two concepts appear repeatedly in discussions, frameworks, and architectures:

  • Skills

  • MCP (Model Context Protocol)

They are related, but they solve very different problems.

If you are building AI assistants, autonomous agents, internal copilots, or workflow automation systems, understanding the distinction is essential.


The Short Version

Here’s the simplest way to think about it:

ConceptWhat It Means
SkillsWhat the AI can do
MCPHow the AI connects to tools and data

Or even more simply:

Skills provide intelligence and workflows.

MCP provides connectivity and interoperability.


What Are Skills?

A Skill is a reusable capability or behavior that an AI agent can perform.

Think of Skills as specialized expertise modules.

Examples include:

  • Summarizing documents

  • Writing SQL queries

  • Reviewing code

  • Creating Jira tickets

  • Generating reports

  • Customer support workflows

  • Security incident analysis

A Skill typically includes:

  • Instructions or prompts

  • Logic and workflows

  • Tool usage rules

  • Context handling

  • Decision-making behavior

  • Sometimes executable code

Skills are generally:

  • Task-oriented

  • Domain-specific

  • Reusable

  • Workflow-driven


Example of a Skill

Imagine a Customer Support Skill.

This Skill might:

  1. Read incoming Zendesk tickets

  2. Search the knowledge base

  3. Identify customer sentiment

  4. Draft a reply

  5. Escalate complex issues to humans

The AI assistant invokes this Skill whenever support-related tasks appear.

The Skill defines behavior.


What Is MCP?

MCP (Model Context Protocol) is a standardized protocol that allows AI models and external systems to communicate in a structured way.

Introduced by entity["organization","Anthropic","AI company"], MCP aims to create a common language between AI assistants and tools.

MCP defines:

  • Tool discovery

  • Context exchange

  • Structured tool calls

  • Permissions and capabilities

  • Standard communication schemas

You can think of MCP as infrastructure for AI integrations.


Why MCP Matters

Before MCP, every AI integration was often custom-built.

That created problems:

  • Different APIs everywhere

  • Inconsistent tool definitions

  • Hard-to-maintain integrations

  • Vendor lock-in

  • Duplicate engineering effort

MCP standardizes the connection layer.

Just like:

  • HTTP standardized web communication

  • USB standardized hardware connectivity

  • ODBC standardized database access

MCP standardizes AI-to-tool communication.


The Core Difference

SkillsMCP
A capabilityA protocol
Defines behaviorDefines communication
Focuses on workflowsFocuses on integrations
Business logic orientedInfrastructure oriented
Tells the AI what to doTells the AI how to connect

This distinction is extremely important.

Many people confuse Skills and MCP because both are involved in AI tooling.

But they operate at different layers.


A Real-World Analogy

Imagine building a smart office assistant.

Skills are like applications

Examples:

  • Calendar assistant

  • Meeting summarizer

  • Expense reporting workflow

  • IT helpdesk automation

These define functionality.

MCP is like USB-C or HTTP

It defines how systems connect:

  • Slack integration

  • GitHub integration

  • Database access

  • CRM connectivity

MCP is not the workflow itself.

It is the standardized bridge.


How Skills and MCP Work Together

The most powerful AI systems use both.

A Skill often depends on multiple external tools.

Instead of building custom integrations every time, the Skill accesses those tools through MCP.

Example architecture:

AI Assistant
   ↓
Skill: Research Analyst
   ↓
Uses MCP tools:
   - GitHub MCP server
   - Slack MCP server
   - Database MCP server

In this setup:

  • The Skill handles reasoning and orchestration

  • MCP handles standardized tool access


When Should You Use Skills?

Use Skills when you need:

1. Reusable Workflows

Examples:

  • Invoice processing

  • HR onboarding

  • Compliance review

  • Security operations

2. Domain Expertise

Examples:

  • Legal analysis

  • Medical coding

  • Financial reporting

  • Software architecture reviews

3. Multi-Step Agent Logic

Examples:

  • Gather information

  • Analyze data

  • Generate output

  • Notify stakeholders

4. Business-Specific Behavior

Examples:

  • Company tone guidelines

  • Escalation rules

  • Approval workflows

  • Internal policy enforcement

Skills are ideal for encoding operational intelligence.


When Should You Use MCP?

Use MCP when you need:

1. Standardized Integrations

Examples:

  • Connecting to Slack

  • Connecting to GitHub

  • Accessing databases

  • Integrating CRMs and internal systems

2. Tool Portability

One MCP-compatible tool can work across many AI platforms.

3. Reduced Integration Complexity

Instead of custom connectors everywhere, systems speak the same protocol.

4. Shared Tool Ecosystems

Multiple agents can reuse the same MCP servers and integrations.

MCP is ideal for scalable AI infrastructure.


Typical Modern AI Agent Stack

Most advanced AI systems are moving toward an architecture like this:

User
 ↓
AI Agent
 ↓
Skills Layer
 ↓
MCP Client
 ↓
MCP Servers
 ↓
External Tools & Data

This creates:

  • Modular design

  • Easier maintenance

  • Better interoperability

  • Faster integration development

  • Reusable capabilities


Common Misunderstandings

“MCP replaces Skills”

No.

MCP standardizes connectivity.

You still need Skills for reasoning, workflows, and business behavior.


“Skills are just prompts”

Not necessarily.

Modern Skills can include:

  • Decision logic

  • Tool orchestration

  • State handling

  • Validation rules

  • Multi-agent coordination

  • Custom execution flows

They are often much more sophisticated than simple prompting.


“MCP is only for AI agents”

Primarily yes, but the bigger idea is standardized machine-tool communication.

The ecosystem is still evolving.


Which One Should You Build First?

That depends on your goal.

Build Skills first if:

  • You are solving business workflows

  • You want task automation

  • You need specialized agent behavior

  • You are experimenting with AI use cases

Build MCP integrations first if:

  • You need scalable infrastructure

  • You support multiple agents/tools

  • You want interoperability

  • You are building a platform ecosystem

In practice, mature systems eventually use both.


The Future of AI Systems

The industry is moving toward:

  • Modular AI architectures

  • Shared tool ecosystems

  • Standardized protocols

  • Reusable agent capabilities

In that future:

  • Skills become the intelligence layer

  • MCP becomes the interoperability layer

This separation is likely to become a foundational design pattern for enterprise AI systems.


Final Takeaway

Here’s the easiest way to remember the difference:

SkillsMCP
IntelligenceConnectivity
WorkflowsIntegrations
BehaviorCommunication
What the AI doesHow the AI reaches tools

Or in one sentence:

Skills tell the AI what to do.

MCP tells the AI how to access tools and data.

Understanding both concepts is essential for designing scalable, maintainable, and powerful AI agents.

How to Add an MCP Server to Claude in VS Code

If you’re using Claude with Visual Studio Code and want to connect external tools like GitHub, databases, Notion, Slack, or your local filesystem, MCP (Model Context Protocol) is the feature you need.

This guide walks through how to add an MCP server to Claude inside VS Code step by step.

What is MCP?
MCP (Model Context Protocol) allows Claude to connect with external tools and services.

With MCP servers, Claude can:

- Read and edit files
- Access GitHub repositories
- Query databases
- Interact with APIs
- Connect to productivity tools
- Automate browser tasks

Prerequisites:

Before starting, make sure you have:
- Node.js installed
- Visual Studio Code installed
- Claude Code CLI access

Step 1: Install Claude Code

Open your terminal and install Claude Code globally:

npm install -g @anthropic-ai/claude-code

After installation, launch Claude once with following command:

claude

Step 2: Add an MCP Server

To add a Local Filesystem MCP Server, run:

claude mcp add filesystem npx @modelcontextprotocol/server-filesystem .

To add an HTTP MCP Server, run:

claude mcp add --transport http myserver https://example.com/mcp

Step 3: Verify MCP Servers

To see all configured MCP servers, run following:

claude mcp list

Inside Claude Code, you can also type:

/mcp

Step 4: Open VS Code

Navigate to your project:

code .

Inside the VS Code terminal, launch Claude:

claude

Step 5: Create a Shared .mcp.json Configuration
Create a file named .mcp.json with the following:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "@modelcontextprotocol/server-filesystem",
        "."
      ]
    }
  }
}

Popular MCP Servers Developers Use

- Filesystem
- GitHub
- PostgreSQL
- Notion
- Slack
- Puppeteer
- Docker
- Jira


Example: Add GitHub MCP Server

claude mcp add github npx @modelcontextprotocol/server-github

Troubleshooting

If MCP servers are not showing, restart Claude:

exit
claude

Then verify again:

claude mcp list

Final Thoughts

MCP transforms Claude from a standalone AI assistant into a fully integrated development companion. Once connected, Claude can work directly with your files, repositories, databases, and developer tools — all from inside VS Code.


Cheers,
Kapil

Popular Posts