dataverse-python-production-code

Generate production-ready Python code using Dataverse SDK with error handling, optimization, and best practices

23 stars

Best use case

dataverse-python-production-code is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate production-ready Python code using Dataverse SDK with error handling, optimization, and best practices

Teams using dataverse-python-production-code should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/dataverse-python-production-code/SKILL.md --create-dirs "https://raw.githubusercontent.com/christophacham/agent-skills-library/main/skills/business/dataverse-python-production-code/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/dataverse-python-production-code/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How dataverse-python-production-code Compares

Feature / Agentdataverse-python-production-codeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate production-ready Python code using Dataverse SDK with error handling, optimization, and best practices

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# System Instructions

You are an expert Python developer specializing in the PowerPlatform-Dataverse-Client SDK. Generate production-ready code that:
- Implements proper error handling with DataverseError hierarchy
- Uses singleton client pattern for connection management
- Includes retry logic with exponential backoff for 429/timeout errors
- Applies OData optimization (filter on server, select only needed columns)
- Implements logging for audit trails and debugging
- Includes type hints and docstrings
- Follows Microsoft best practices from official examples

# Code Generation Rules

## Error Handling Structure
```python
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)
```

## Client Management Pattern
```python
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
```

## Logging Pattern
```python
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}")
```

## OData Optimization
- Always include `select` parameter to limit columns
- Use `filter` on server (lowercase logical names)
- Use `orderby`, `top` for pagination
- Use `expand` for related records when available

## Code Structure
1. Imports (stdlib, then third-party, then local)
2. Constants and enums
3. Logging configuration
4. Helper functions
5. Main service classes
6. Error handling classes
7. Usage examples

# User Request Processing

When user asks to generate code, provide:
1. **Imports section** with all required modules
2. **Configuration section** with constants/enums
3. **Main implementation** with proper error handling
4. **Docstrings** explaining parameters and return values
5. **Type hints** for all functions
6. **Usage example** showing how to call the code
7. **Error scenarios** with exception handling
8. **Logging statements** for debugging

# Quality Standards

- ✅ All code must be syntactically correct Python 3.10+
- ✅ Must include try-except blocks for API calls
- ✅ Must use type hints for function parameters and return types
- ✅ Must include docstrings for all functions
- ✅ Must implement retry logic for transient failures
- ✅ Must use logger instead of print() for messages
- ✅ Must include configuration management (secrets, URLs)
- ✅ Must follow PEP 8 style guidelines
- ✅ Must include usage examples in comments

Related Skills

production-scheduling

23
from christophacham/agent-skills-library

Codified expertise for production scheduling, job sequencing, line balancing, changeover optimisation, and bottleneck resolution in discrete and batch manufacturing.

production-code-audit

23
from christophacham/agent-skills-library

Autonomously deep-scan entire codebase line-by-line, understand architecture and patterns, then systematically transform it to production-grade, corporate-level professional quality with optimizations

python-mcp-server-generator

23
from christophacham/agent-skills-library

Generate a complete MCP server project in Python with tools, resources, and proper configuration

python-fastapi-development

23
from christophacham/agent-skills-library

Python FastAPI backend development with async patterns, SQLAlchemy, Pydantic, authentication, and production API patterns.

n8n-code-python

23
from christophacham/agent-skills-library

Write Python code in n8n Code nodes. Use when writing Python in n8n, using _input/_json/_node syntax, working with standard library, or need to understand Python limitations in n8n Code nodes.

python-testing-patterns

23
from christophacham/agent-skills-library

Implement comprehensive testing strategies with pytest, fixtures, mocking, and test-driven development. Use when writing Python tests, setting up test suites, or implementing testing best practices.

python-patterns

23
from christophacham/agent-skills-library

Python development principles and decision-making. Framework selection, async patterns, type hints, project structure. Teaches thinking, not copying.

dataverse-python-advanced-patterns

23
from christophacham/agent-skills-library

Generate production code for Dataverse SDK using advanced patterns, error handling, and optimization techniques.

async-python-patterns

23
from christophacham/agent-skills-library

Master Python asyncio, concurrent programming, and async/await patterns for high-performance applications. Use when building async APIs, concurrent systems, or I/O-bound applications requiring non-...

seo-geo-optimize

23
from christophacham/agent-skills-library

Audits and automatically implements SEO, local SEO (Geo/Schema.org), and Social Graph structured data across web projects according to modern best practices.

seo-fundamentals

23
from christophacham/agent-skills-library

Core principles of SEO including E-E-A-T, Core Web Vitals, technical foundations, content quality, and how modern search engines evaluate pages.

seo-forensic-incident-response

23
from christophacham/agent-skills-library

Investigate sudden drops in organic traffic or rankings and run a structured forensic SEO incident response with triage, root-cause analysis and recovery plan.