/dataverse-sdk-for-python:dataverse-python-production-codefrom dataverse-sdk-for-python
Generates production-ready Python 3.10+ code for the PowerPlatform-Dataverse-Client SDK with DataverseError handling, singleton client management, retry with exponential backoff for 429/timeout failures, OData optimization, audit logging, type hints, docstrings, configuration handling, and usage examples.
Ships in dataverse-sdk-for-python. 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.
Generate production-ready Python for the PowerPlatform-Dataverse-Client SDK by using typed service classes, singleton client management, Dataverse exception handling, retryable transient errors, server-side OData filtering, and structured logging instead of throwaway snippets.
| Area | Required rule |
|---|---|
| Python version | Code must be syntactically correct Python 3.10+. |
| Imports | Order stdlib, third-party, then local imports. |
| Error handling | Catch DataverseError, ValidationError, MetadataError, and HttpError with try-except blocks where appropriate. |
| Retry | Retry transient 429 or timeout errors with exponential backoff; default max_retries=3. |
| Client management | Use a singleton service class so connection management is centralized. |
| OData | Filter on the server, select only needed columns, use lowercase logical names, and apply orderby, top, and expand when appropriate. |
| Logging | Use logger, not print(), with enough context for audit trails and debugging. |
| Types and docs | Include type hints and docstrings for all public functions. |
| Configuration | Keep secrets, URLs, and credentials in configuration; do not hardcode them. |
| Style | Follow PEP 8 and Microsoft best practices from official examples. |
from PowerPlatform.Dataverse.core.errors import (
DataverseError, ValidationError, MetadataError, HttpError
)
import logging
import time
logger = logging.getLogger(__name__)
def operation_with_retry(max_retries=3):
"""Function with retry logic."""
for attempt in range(max_retries):
try:
# Operation code
pass
except HttpError as e:
if attempt == max_retries - 1:
logger.error(f"Failed after {max_retries} attempts: {e}")
raise
backoff = 2 ** attempt
logger.warning(f"Attempt {attempt + 1} failed. Retrying in {backoff}s")
time.sleep(backoff)
class DataverseService:
_instance = None
_client = None
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
def __init__(self, org_url, credential):
if self._client is None:
self._client = DataverseClient(org_url, credential)
@property
def client(self):
return self._client
import logging
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
logger.info(f"Created {count} records")
logger.warning(f"Record {id} not found")
logger.error(f"Operation failed: {error}")
| Rule | Reason |
|---|---|
Always include select | Avoid transferring unused columns. |
Use filter on server | Do not fetch broad records and filter in Python. |
| Use lowercase logical names | Dataverse logical names are lowercase and differ from display names. |
Use orderby and top | Make pagination and result order deterministic. |
Use expand for related records when available | Avoid manual follow-up calls when supported. |
| Log query intent, not secrets | Audit behavior without leaking tokens or PII. |
When generating code, include these sections:
constants/enums.## Dataverse Python implementation
**Status:** generated | needs details | blocked
**SDK:** `PowerPlatform-Dataverse-Client`
**Python:** `3.10+`
### Code
```python
from PowerPlatform.Dataverse.core.errors import DataverseError, ValidationError, MetadataError, HttpError
# stdlib imports, configuration, logging, singleton DataverseService,
# OData-optimized operation, retry handling, usage example
```
### Error scenarios
| Scenario | Exception | Handling |
| --- | --- | --- |
| Validation failure | `ValidationError` | fail fast with clear message |
| Metadata issue | `MetadataError` | log and raise |
| HTTP 429/timeout | `HttpError` | retry with exponential backoff |
| Other Dataverse failure | `DataverseError` | log with context and raise |
### OData query choices
- `select`: <columns>
- `filter`: <server-side filter>
- `orderby`: <ordering>
- `top`: <limit>
- `expand`: <related records if used>
DataverseError, ValidationError, MetadataError, and HttpError where applicable.429 and timeout errors.DataverseService pattern.select, server-side filter, lowercase logical names, and orderby/top/expand when appropriate.logger and never print() for operational messages.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub gbb-acelerators/awesome-harness-primitives --plugin dataverse-sdk-for-python4 skills in this plugin
/dataverse-python-advanced-patternsGenerate production-ready Microsoft Dataverse SDK for Python code using advanced error handling, retries, batch operations, optimized OData queries, metadata management, timeouts, cache invalidation, file upload, and pandas workflows. Use when the user asks for production Dataverse Python patterns beyond quickstart CRUD./dataverse-python-quickstartGenerate concise Microsoft Dataverse SDK for Python preview setup, authentication, CRUD, bulk create/update, paging, and optional File column upload snippets using official patterns. Use when the user asks for Dataverse Python quickstart code, SDK setup, InteractiveBrowserCredential, retrieve-multiple paging, or basic CRUD examples./dataverse-python-usecase-builderGenerate complete Python solutions for Microsoft Dataverse SDK business use cases, including architecture, table design, CRUD, batch, query, file, scheduled, or real-time patterns. Use this skill when the user describes a Dataverse business need and asks for production-ready Python code, PowerPlatform-Dataverse-Client guidance, or Dataverse solution architecture.Other plugins' skills for the same job