Habilidades @azure/cosmos (TypeScript/JavaScript)
📦

@azure/cosmos (TypeScript/JavaScript)

Seguro

Build Cosmos DB applications with TypeScript

Developers need to perform CRUD operations on Azure Cosmos DB documents efficiently. This skill provides TypeScript patterns for queries, bulk operations, and proper authentication.

Soporta: Claude Codex Code(CC)
🥉 72 Bronce
1

Descargar el ZIP de la skill

2

Subir en Claude

Ve a Configuración → Capacidades → Skills → Subir skill

3

Activa y empieza a usar

Pruébalo

Usando "@azure/cosmos (TypeScript/JavaScript)". Create a product document with name 'Laptop', price 999.99, category 'electronics'

Resultado esperado:

Successfully created document with id 'prod-8a7b2c' in container 'products'. Request charge: 5.21 RUs.

Usando "@azure/cosmos (TypeScript/JavaScript)". Query products where price < 1000 and category = 'electronics'

Resultado esperado:

Retrieved 15 products matching criteria. Total request charge: 3.47 RUs. Results include: Laptop, Tablet, Wireless Mouse, USB Hub...

Auditoría de seguridad

Seguro
v1 • 2/24/2026

Prompt-only instructional skill containing documentation for Azure Cosmos DB SDK usage. Static analysis scanned 0 files with 0 findings and risk score 0/100. No executable code, network access, or security concerns detected. The skill teaches proper security practices including AAD authentication and parameterized queries.

0
Archivos escaneados
0
Líneas analizadas
0
hallazgos
1
Auditorías totales
No se encontraron problemas de seguridad
Auditado por: claude

Puntuación de calidad

38
Arquitectura
100
Mantenibilidad
87
Contenido
50
Comunidad
100
Seguridad
74
Cumplimiento de la especificación

Lo que puedes crear

Backend developer building a SaaS application

Implement a multi-tenant data layer using hierarchical partition keys to isolate customer data while maintaining query performance.

Data engineer processing high-volume transactions

Use bulk operations to efficiently insert, update, and delete thousands of documents per second with proper error handling.

Full-stack developer creating real-time applications

Build change feed processors and implement optimistic concurrency to handle concurrent updates from multiple clients.

Prueba estos prompts

Basic document creation
Create a TypeScript function that inserts a new product document into Azure Cosmos DB. The product should have id, name, price, and category fields. Use DefaultAzureCredential for authentication and include proper error handling for duplicate documents.
Parameterized query implementation
Write a TypeScript service method that queries Cosmos DB for products within a price range. Use SqlQuerySpec with named parameters to prevent injection attacks. Include pagination support with continuation tokens.
Bulk operation for data migration
Implement a bulk import function that processes an array of 1000+ documents using executeBulkOperations. Handle partial failures by logging failed operations with their status codes while continuing successful ones.
Optimistic concurrency with ETags
Create an update function that uses ETags to prevent lost updates when multiple users modify the same document. Return a specific error when the ETag precondition fails so the client can refresh and retry.

Mejores prácticas

  • Use DefaultAzureCredential for authentication instead of account keys in production environments
  • Always use parameterized queries with SqlQuerySpec to prevent injection and improve query plan caching
  • Specify partition key values in all point operations to avoid cross-partition query overhead

Evitar

  • Using account keys directly in code instead of environment variables or managed identity
  • Executing SELECT * queries without WHERE clauses on large containers
  • Ignoring 429 rate limit errors instead of implementing exponential backoff retry logic

Preguntas frecuentes

What authentication method should I use for Cosmos DB?
Use DefaultAzureCredential with Azure AD authentication for production. It supports managed identity, CLI credentials, and environment variables. Only use account keys for local development.
How do I choose a good partition key?
Select a property with high cardinality and even distribution. Common choices include customerId, tenantId, or a synthetic key. Avoid properties with low cardinality like status or boolean values.
What is the difference between create, upsert, and replace?
Create fails if the document exists. Upsert creates or updates based on id. Replace requires the document to exist and replaces the entire document. Use patch for partial updates.
How do I handle rate limiting (429 errors)?
The SDK includes built-in retry logic. For custom handling, catch ErrorResponse with code 429 and use the retryAfterInMs property to implement exponential backoff.
Can I use this skill with Cosmos DB MongoDB API?
No. This skill is for the NoSQL (SQL) API only. For MongoDB API, use the official MongoDB drivers or the Azure Cosmos DB MongoDB driver.
How do I optimize query performance?
Use selective projections instead of SELECT *, filter with WHERE clauses on indexed properties, specify partitionKey in FeedOptions, and enable cross-partition queries only when necessary.

Detalles del desarrollador

Estructura de archivos

📄 SKILL.md