Next   Previous   Space Next   0-9 Jump to slide
🚀
Presentation.exe
👤
About Me
🤖
Agent-First
📜
The Evolution
⚠️
The Challenge
Why Agent Kit
📦
What's Included
💾
Installation
⚙️
How It Works
🔍
Code Review
🤝
Compatibility
🎬
Demo
🌟
Get Involved
📋 Microsoft Azure Skillup Tamilnadu - Session 6
☁️ Azure Community Tamilnadu

🌌 Azure Cosmos DB Agent Kit

AI Skills for Coding Assistants

180 curated rules across 15+ categories

Teaching your AI pair programmer expert-level
Azure Cosmos DB best practices

Loading presentation... Click "Next" or press → to begin

👤 About Me - Sajeetharan Sinnathurai

👤 About Me

👋

Sajeetharan Sinnathurai

Principal Product Manager @ Microsoft

13+ years in software — 4 years in Product Management, 9 years as a developer specializing in cloud platforms & databases.

☁️ Azure 🗄️ Cosmos DB 🤖 AI/ML 🌐 TypeScript

🏆 Community Contributions:

  • Global Top 10 for Azure, Angular & Azure Cosmos DB on Stack Overflow
  • First Google Developer Expert & Microsoft MVP in dev technologies from Sri Lanka
  • International speaker & OSS contributor

🔗 Connect: sajeetharan.dev  |  @kokkisajee  |  github.com/sajeetharan

🤖 The Agent-First Approach

🤖 The Agent-First Approach — How AI Assistants Learn

In the Agent-First world, your AI coding assistant isn't just autocomplete — it's an intelligent agent that can be extended with knowledge and tools:

Extension Type What It Does Example
🧠 Skills Teach domain knowledge & best practices — auto-activates when relevant Cosmos DB Agent Kit, security rules
🔌 MCP Servers Give agents access to external tools & data sources via Model Context Protocol Query a database, call an API, read docs
🧩 Plugins / Extensions Add capabilities to the IDE or agent runtime GitHub Copilot Extensions, VS Code extensions
📋 Custom Instructions Static rules loaded every time (the old way) .cursorrules, CLAUDE.md, copilot-instructions.md

💡 Why Skills Win:

  • Auto-activate — loads only when your code context is relevant
  • Portable — works across Copilot, Claude, Cursor, Gemini CLI
  • Composable — install multiple skills, they don't conflict
  • Community-driven — share & install via agentskills install

🔌 MCP + Skills = Supercharged Agents

MCP gives agents hands (tools to act). Skills give agents brains (knowledge to decide). Together, your AI assistant knows what to do AND how to do it right.

📜 The Evolution - From Config Files to Agent Skills

📜 The Evolution of Developer Knowledge Sharing

How we went from sharing config files to teaching AI agents with skills:

⏳ The Old Way — Config Files

We shared .editorconfig, eslint.json, tsconfig.json — static rules that told tools what format to enforce, but never why or when.

📋 Then — README.md & Wiki Docs

Best practices lived in docs nobody read. "Follow this pattern for partition keys" — but your IDE never surfaced it at the right moment.

🤖 Recently — Custom Instructions / System Prompts

We stuffed rules into CLAUDE.md or .cursorrules — a giant blob of text loaded every time, whether relevant or not.

✨ Now — Agent Skills

Modular, auto-activating knowledge packs. Skills load only when relevant. They teach your AI assistant domain expertise — just like hiring a specialist on demand.

💡 What are Skills?

From Anthropic's official docs: "Skills extend what Claude can do. Create a SKILL.md file with instructions, and Claude adds it to its toolkit. Claude uses skills when relevant, or you can invoke one directly."

Skills follow the open Agent Skills standard — works across GitHub Copilot, Claude Code, Cursor, Gemini CLI, and more!

⚠️ The Challenge - Why We Need This

⚠️ The Challenge — Can YOU Spot the Problem?

👇 Audience Quiz! Look at this Cosmos DB code. What's wrong? (Raise your hand when you know!)

// Creating a container for an e-commerce app
const container = await database.containers.createIfNotExists({
    id: "orders",
    partitionKey: { paths: ["/id"] }  // 🤔 Hmm...
});

// Querying all orders for a customer
const query = `SELECT * FROM c WHERE c.customerId = '${customerId}'`;
// Cross-partition query! 💸 Costs 10x more RUs
💰 Why Cosmos DB Agent Kit?

💰 Why We Built the Cosmos DB Agent Kit

Let's address the elephant in the room — common misconceptions and real pain points:

🗣️ What developers say on Twitter/Reddit:

  • "Cosmos DB is too expensive!"
  • "My RU costs exploded overnight"
  • "I got a $5,000 bill for a simple CRUD app"
  • "Just use Postgres, it's cheaper"

🔍 The Real Problem — It's Not Cosmos DB, It's the Configuration:

Pain PointRoot CauseAgent Kit Fix
💸 High RU costsCross-partition queries, bad indexingRules catch these at code-time
🐌 Slow queriesMissing composite indexes, full scansAuto-suggests optimal indexes
🔥 Hot partitionsLow-cardinality partition keysWarns about poor key choices
📈 Unpredictable scalingManual throughput, no autoscaleRecommends autoscale patterns
🤯 Steep learning curveToo many knobs to tune180 rules = instant expertise

✅ The Truth: Cosmos DB is incredibly powerful — but only if configured right. The Agent Kit ensures your AI assistant guides you to the optimal setup from day one.

💡 Most "expensive" Cosmos DB deployments are just misconfigured ones.

📦 What's Included - 180 Rules

📦 What's Included

180 curated rules across 15+ categories, each prioritized by real-world impact:

Category Priority Focus Area
Data ModelingCriticalDocument structure & relationships
Partition Key DesignCriticalEffective partition key selection
Query OptimizationHighReduce RU consumption
SDK Best PracticesHighClient init, retry logic, error handling
Design PatternsHighLangGraph, change-feed, materialized views
Vector SearchHighEmbeddings, index types, similarity queries
Full-Text SearchHighFTS indexing, BM25 ranking, hybrid search
SecurityHighSecure access patterns
Indexing StrategiesMedium-HighEfficient index policies
Throughput & ScalingMediumAutoscale & capacity planning
Global DistributionMediumMulti-region writes & consistency
Developer ToolingMediumBuild validation & emulator config
Monitoring & DiagnosticsLow-MediumLogging, metrics, troubleshooting
💾 Installation - One Command Setup

💾 Installation

Install with a single command — that's it!

C:\COSMOS> npx skills add AzureCosmosDB/cosmosdb-agent-kit

Installing Azure Cosmos DB Agent Kit...
✓ Downloaded 180 rules across 15+ categories
✓ Skill installed successfully
✓ Auto-activation enabled

Ready! Your AI assistant now knows Cosmos DB best practices.

Prerequisites:

💡 Per-agent plugins also available:

Claude Code.claude-plugin/plugin.json
OpenAI Codex.codex-plugin/plugin.json
Cursor.cursor-plugin/plugin.json
Gemini CLIgemini-extension.json
GitHub CopilotSKILL.md (auto-detected)
⚙️ How It Works - Skill Structure

⚙️ How It Works

Skills activate automatically when relevant tasks are detected. Just ask naturally:

> Review my Cosmos DB data model for performance issues
> Help me choose a partition key for my orders collection  
> Optimize this query that's consuming too many RUs
> What's wrong with my Cosmos DB connection code?

📁 Skill Structure:

skills/cosmosdb-best-practices/
├── SKILL.md          # Triggers activation
├── AGENTS.md         # Compiled rules (what agents read)
├── rules/            # Individual rule files
│   ├── data-modeling.md
│   ├── partition-keys.md
│   ├── query-optimization.md
│   ├── vector-search/
│   ├── full-text-search/
│   ├── design-patterns/
│   └── ...
└── metadata.json     # Version and metadata

💡 Key insight: The AI agent automatically loads relevant rules and applies them to your context. No manual configuration needed!

🔍 Live Demo - Code Review

🔍 Code Review Example

The Agent Kit identifies 4 critical issues in this common code pattern:

❌ Before (common anti-patterns):

// Creating new client on every request ← ANTI-PATTERN!
async function getProducts(category) {
    const client = new CosmosClient({ endpoint, key });
    // Using SELECT * pulls all properties ← WASTEFUL!
    const query = `SELECT * FROM c WHERE c.category = '${category}'`;
    //                            String concatenation ← INJECTION RISK!
    const { resources } = await container.items.query(query).fetchAll();
    return resources;  // No error handling ← FRAGILE!
}

🛡️ Issues Detected:

  1. SDK Anti-pattern: New CosmosClient on every request wastes resources
  2. Query Optimization: SELECT * pulls unnecessary data, wastes RUs
  3. Security Risk: String concatenation → injection attacks
  4. Missing Error Handling: No retry logic for 429 rate limiting

✅ After (Agent Kit guided fix):

// Singleton client with retry policy
const client = new CosmosClient({
    endpoint, key,
    connectionPolicy: { retryOptions: { maxRetryAttemptCount: 5 } }
});

async function getProducts(category) {
    const query = {
        query: `SELECT c.id, c.name, c.price FROM c 
                WHERE c.category = @category`,
        parameters: [{ name: '@category', value: category }]
    };
    try {
        const { resources, requestCharge } = await container.items
            .query(query).fetchAll();
        console.log(`Query consumed ${requestCharge} RUs`);
        return resources;
    } catch (error) {
        if (error.code === 429) { /* handle rate limiting */ }
        throw error;
    }
}
🤝 Compatibility - Works Everywhere

🤝 Compatibility

Built on the Agent Skills format — works with all major AI coding assistants:

AI AssistantPlatformStatus
GitHub CopilotVS Code, Visual Studio, JetBrains✅ Supported
Claude CodeAnthropic's coding assistant✅ Supported
CursorAI-first editor✅ Supported
Gemini CLIGoogle's CLI assistant✅ Supported
OpenAI CodexOpenAI's coding agent✅ Supported

🔌 Any Agent Skills-compatible tool can use the kit — the format is open and extensible!

🎬 Live Demo - Agent Kit in Action

🎬 Demo Time — Watch the Agent Kit in Action!

Let's see how the Cosmos DB Agent Kit works live in a real coding session:

// Developer writes this code...

 

const container = database.container("users");

const { resources } = await container.items

  .query("SELECT * FROM c")

  .fetchAll();

 

// 🤖 Agent Kit activates automatically...

// ⚠️ Rule: "Avoid SELECT * — specify only needed fields"

// ⚠️ Rule: "Use .fetchNext() with pagination for large datasets"

// ⚠️ Rule: "Always handle continuation tokens"

// ✅ Suggested fix provided inline...

🎯 What to watch for in the demo:

  1. Auto-detection — Agent recognizes Cosmos DB SDK usage
  2. Contextual rules — Only relevant rules activate (not all 180!)
  3. Inline suggestions — Fix appears right where you're coding
  4. Explanation — Agent explains why the fix matters (RU savings, performance)
  5. Best practice code — Complete corrected snippet generated

💡 Demo scenarios:

  • 🔑 Partition key selection for a new container
  • ⚡ Query optimization with proper indexing
  • 🔒 Security review — connection string vs managed identity
  • 📐 Data modeling — embed vs reference decision
🌟 Get Involved - Contributing & Resources

🌟 Get Involved!

The Agent Kit is open source and actively maintained. Recent updates:

  • LangGraph patterns (May 2026) — asyncio.to_thread for async routing
  • Full-Text Search (Apr 2026) — 6 new rules: BM25, hybrid search
  • Vector Search (Jan 2026) — embeddings, index types, distance queries
  • Testing framework v2 (Mar 2026) — Automated CI harness with statistical evaluation

🤝 How to Contribute:

  1. Fork the repository
  2. Add your rule to the appropriate category
  3. Submit a pull request
  4. Help thousands of developers write better Cosmos DB code!

🔗 github.com/AzureCosmosDB/cosmosdb-agent-kit

⭐ Star us | 🍴 Fork | 📝 Contribute

CosmosDB
📋 Start Presentation
👤 About Me
🤖 Agent-First Approach
📜 The Evolution
⚠️ The Challenge
� Why Agent Kit
📦 What's Included
💾 Installation
⚙️ How It Works
🔍 Code Review Demo
🤝 Compatibility
🎬 Demo in Action
🌟 Get Involved
🌐 Open GitHub Repo
📖 Microsoft Docs
Start