/db-cosmosdb:cosmosdb-frameworksfrom db-cosmosdb
Use when implementing Azure Cosmos DB code with SDKs — enforces patterns for .NET SDK (CosmosClient, LINQ, bulk), Node.js SDK (@azure/cosmos), Python SDK (azure-cosmos), and custom versioned migration scripts
Ships in db-cosmosdb. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ConnectionMode.Direct for lowest latencyAllowBulkExecution for batch operationsCosmosPropertyNamingPolicy.CamelCase for JSON serializationRequestCharge on responses for RU monitoringPartitionKey explicitly — never rely on auto-extractionCosmosClient at application shutdown, not per request (singleton)// Create database and container
await client.CreateDatabaseIfNotExistsAsync("orderdb");
await database.CreateContainerIfNotExistsAsync(
new ContainerProperties("orders", "/customerId")
{
DefaultTimeToLive = -1, // TTL enabled, no default expiry
IndexingPolicy = new IndexingPolicy
{
CompositeIndexes = {
new Collection<CompositePath> {
new CompositePath { Path = "/status", Order = CompositePathSortOrder.Ascending },
new CompositePath { Path = "/createdAt", Order = CompositePathSortOrder.Descending }
}
}
}
},
throughput: 400);
fetchAll() for small result sets, fetchNext() for paginationrequestCharge on all responsesconst operations = orders.map(order => ({
operationType: "Create",
resourceBody: order,
}));
const response = await container.items.batch(operations, partitionKey);
enable_cross_partition_query=True only when necessary (expensive)partition_key parameter to scope queries to single partitionmax_item_count for pagination controlCosmosHttpResponseError for retry logicpublic class CosmosDbMigrationRunner
{
private readonly Container _container;
private readonly Container _migrationContainer;
public async Task RunMigrationsAsync(IEnumerable<ICosmosDbMigration> migrations)
{
var applied = await GetAppliedMigrationsAsync();
foreach (var migration in migrations.OrderBy(m => m.Version))
{
if (applied.Contains(migration.Version)) continue;
await migration.UpAsync(_container);
await RecordMigrationAsync(migration);
}
}
}
// Update indexing policy via SDK
var containerResponse = await container.ReadContainerAsync();
var properties = containerResponse.Resource;
properties.IndexingPolicy.ExcludedPaths.Add(new ExcludedPath { Path = "/largeField/?" });
await container.ReplaceContainerAsync(properties);
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gagandeepp/software-agent-teams --plugin db-cosmosdb4 skills in this plugin
/cosmosdb-codingUse when writing or reviewing Azure Cosmos DB code — enforces partition key design, document modeling, RU estimation, TTL, change feed patterns, stored procedures (JavaScript), and cross-partition query avoidance/cosmosdb-project-structureUse when scaffolding or reviewing Azure Cosmos DB project layout — container definition files, custom migration layout, model organization, and partition key documentation/cosmosdb-testingUse when writing tests for Azure Cosmos DB code — Cosmos DB Emulator for integration tests, xUnit/.NET patterns, Jest/Node.js patterns, mock strategies, and RU budget validation