Reviews code changes in azure-ai-ml package for quality, Azure SDK compliance, and best practices. Use when reviewing code, checking pull requests, or when user asks to review changes or check code quality in azure-ai-ml.
npx skills add https://github.com/Azure/azure-sdk-for-python --skill do-code-review
Reviews uncommitted changes (staged and unstaged files) in the azure-ai-ml package, focusing on Azure SDK Python design guidelines, type safety, testing patterns, and API consistency.
Unless otherwise specified, review all uncommitted changes in the current branch (staged and unstaged files) within sdk/ml/azure-ai-ml/. This includes new files, modified files, and any pending changes that haven't been committed yet.
create_or_update not create_or_replace)def get_job(name, subscription_id) should be def get_job(name, **kwargs)Key Patterns:
begin_* for LROs, list_* for paginatorsOptional, Union, TYPE_CHECKINGAny without justification, bare dict/listdef process_data(data) should be def process_data(data: Dict[str, Any]) -> ProcessedDataCommon Fixes:
# Bad
def get_config(name):
return config
# Good
def get_config(name: str) -> Optional[Dict[str, Any]]:
return config
Watch for:
client-method-should-not-use-static-methodmissing-client-constructor-parameter-credentialclient-method-has-more-than-5-positional-arguments_async modulesasync with for clients, awaiting coroutines correctlyawait, sync code in async modulesself._client.get() in async should be await self._client.get()Pattern:
# In azure/ai/ml/aio/operations/
async def create_or_update(
self,
entity: Job,
**kwargs: Any
) -> Job:
async with self._lock:
result = await self._service_client.create_or_update(...)
return result
HttpResponseError, ResourceNotFoundError, proper validationexcept:, catching Exception without re-raising, missing validationPattern:
from azure.core.exceptions import ResourceNotFoundError, HttpResponseError
try:
result = self._operation.get(name)
except ResourceNotFoundError:
raise ResourceNotFoundError(f"Job '{name}' not found")
except HttpResponseError as e:
raise HttpResponseError(f"Failed to retrieve job: {e.message}")
Structure:
azure/ai/ml/
├── operations/ # Sync operations
│ ├── job_operations.py
│ └── model_operations.py
└── aio/operations/ # Async operations (mirror structure)
├── job_operations.py
└── model_operations.py
Entity Pattern:
@dataclass
class Job(Resource):
"""Job entity."""
name: str
experiment_name: Optional[str] = None
def _to_rest_object(self) -> RestJob:
"""Convert to REST representation."""
...
@classmethod
def _from_rest_object(cls, obj: RestJob) -> "Job":
"""Create from REST representation."""
...
pytest, proper test isolation, fixture usageTest Structure:
class TestJobOperations:
"""Test job operations."""
def test_create_job(self, client: MLClient, mock_workspace: Mock) -> None:
"""Test job creation."""
job = Job(name="test-job")
result = client.jobs.create_or_update(job)
assert result.name == "test-job"
@pytest.mark.recorded
def test_get_job_recorded(self, client: MLClient) -> None:
"""Test getting job with recording."""
...
Docstring Pattern:
def create_or_update(
self,
job: Job,
**kwargs: Any
) -> Job:
"""Create or update a job.
:param job: The job entity to create or update.
:type job: ~azure.ai.ml.entities.Job
:keyword bool skip_validation: Skip validation of the job.
:return: The created or updated job.
:rtype: ~azure.ai.ml.entities.Job
:raises ~azure.core.exceptions.HttpResponseError: If the request fails.
.. admonition:: Example:
.. code-block:: python
from azure.ai.ml.entities import Job
job = Job(name="my-job")
result = ml_client.jobs.create_or_update(job)
"""
Deprecation Pattern:
import warnings
def old_method(self, param: str) -> None:
"""Deprecated method.
.. deprecated:: 1.2.0
Use :meth:`new_method` instead.
"""
warnings.warn(
"old_method is deprecated, use new_method instead",
DeprecationWarning,
stacklevel=2
)
self.new_method(param)
TokenCredential, proper token refresh, sanitized loggingPattern:
from azure.core.credentials import TokenCredential
class MLClient:
def __init__(
self,
credential: TokenCredential,
subscription_id: str,
**kwargs: Any
):
self._credential = credential # Store, don't log
# Never log credential or tokens
Pagination Pattern:
def list(self, **kwargs: Any) -> Iterable[Job]:
"""List jobs with pagination.
:return: An iterable of jobs.
:rtype: ~azure.core.paging.ItemPaged[~azure.ai.ml.entities.Job]
"""
return self._operation.list(...) # Returns ItemPaged
sdk/ml/azure-ai-ml/Organize findings by priority and category:
Good patterns worth highlighting
For each issue:
Focus on issues that impact SDK quality, user experience, backwards compatibility, and Azure SDK guideline compliance.
Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
Comprehensive GitHub code review with AI-powered swarm coordination
Create high-quality git commits: review/stage intended changes, split into logical commits, and write clear commit messages (including Conventional Commits). Use when the user asks to commit, craft a commit message, stage changes, or split work into multiple commits.
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
GitHub CLI (gh) comprehensive reference for repositories, issues, pull requests, Actions, projects, releases, gists, codespaces, organizations, extensions, and all GitHub operations from the command line.
GitHub CLI - manage repositories, issues, pull requests, actions, releases, and more from the command line.
You are a code refactoring expert specializing in clean code principles, SOLID design patterns, and modern software engineering best practices. Analyze and refactor the provided code to improve its quality, maintainability, and performance.
You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti
Take azure/do-code-review from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.