Initialize local dev environment from Azure DevOps by cloning all project repositories. Use when user asks to "initialize Azure project", "clone Azure repos", "setup Azure project locally", or wants to download all repositories from an Azure DevOps project.
Initialize a local development environment from an Azure DevOps project by cloning all repositories.
This skill helps users quickly set up a local development environment by:
When invoked, parse the arguments as follows:
Follow these steps when this skill is activated.
Copy this checklist to track progress:
Azure DevOps Initialization Progress:
- [ ] Step 0: Verify prerequisites (Git, Azure CLI/MCP)
- [ ] Step 1: Parse arguments
- [ ] Step 2: Find the project
- [ ] Step 3: List repositories
- [ ] Step 4: Determine target directory
- [ ] Step 5: Create directory structure
- [ ] Step 6: Clone repositories
- [ ] Step 7: Verify and report
- [ ] Step 8: Handle any failures
CRITICAL FIRST STEP: Before proceeding, verify required tools are available:
Check Git:
git --version to verify git is installedCheck Azure DevOps Access (Azure CLI preferred, MCP fallback):
Try Azure CLI first:
az is available: az --version 2>/dev/nullaz extension show -n azure-devops 2>/dev/nullaz extension add -n azure-devopsaz devops configure --list | grep organizationaz devops configure --defaults organization=https://dev.azure.com/{user-provided-org}az devops project list 2>&1az login (READ references/az-cli-installation.md)Fall back to MCP if Azure CLI not available:
mcp_ado_core_list_projects (no parameters)Extract the project identifier and optional target directory from the args string:
If using Azure CLI mode:
az devops project list --output jsonIf using MCP mode:
mcp_ado_core_list_projectsCommon handling:
If using Azure CLI mode:
az repos list --project "PROJECT-NAME" --output jsonIf using MCP mode:
mcp_ado_repo_list_repos_by_project with project IDCommon handling:
If target directory was provided in args:
If NOT provided, detect base directory:
Detect current working directory and check if it matches recognized code directory patterns:
~/code/, ~/git/, ~/projects/, ~/src/, ~/dev/, ~/repos/pwd to get current directorypwd returns /Users/you/git/some-project, use ~/git/ as baseIf no recognized pattern found, ask user where to clone using AskUserQuestion:
$(pwd)~/code/Now determine structure based on repository namespacing:
Check if repositories are properly namespaced:
. or -) and has 2+ segmentsAcme.Platform.Frontend (3 segments with .)Contoso.DataHub (2 segments with .)Fabrikam-Api (2 segments with -)Frontend (single word)Api (single word)Infrastructure (single word)Decision logic:
{base-dir}/{sanitized-repo-name}{base-dir}/{sanitized-project-name}/{sanitized-repo-name}Sanitization rules (apply to all directory names):
Based on the namespacing decision from step 4:
{base-dir}/{sanitized-project-name}/mkdir -p to create parent directories as neededInform the user of the decision:
Repository naming analysis:
✓ Repositories are properly namespaced (e.g., Acme.Platform.Api)
→ Placing directly in {base-dir}/
or
Repository naming analysis:
⚠ Repositories are not namespaced (e.g., Api, Frontend)
→ Organizing in project folder: {base-dir}/platform-services/
For each repository:
Build SSH URL: [email protected]:v3/{organization}/{project-name}/{repo-name}
%20[email protected]:v3/acmecorp/Platform%20Services/My%20RepoSanitize directory name:
Determine full clone path:
{base-dir}/{sanitized-repo-name}{base-dir}/{sanitized-project-name}/{sanitized-repo-name}Check if directory already exists:
.git folder: skip with message "Already cloned".git folder: warn user and ask whether to remove and re-clone or skipClone the repository:
git clone {ssh-url} "{full-clone-path}"Error handling for clone failures:
Rate limiting:
ls -lh on the appropriate directoryIf the process exits early (MCP issues, SSH failures, network errors), inform the user of the current state:
Partial clone scenario (non-namespaced repos):
Clone process incomplete. Current state:
- Successfully cloned: 3 repositories
- Failed/Skipped: 5 repositories
- Location: {base-dir}/platform-services
Options:
1. Fix the issue (SSH keys, network) and run /azure-init again
- Already cloned repos will be skipped automatically
2. Remove partial setup: rm -rf {base-dir}/platform-services
3. Continue manually: cd {base-dir}/platform-services and clone remaining repos
Partial clone scenario (namespaced repos):
Clone process incomplete. Current state:
- Successfully cloned: 2 repositories
- Failed/Skipped: 3 repositories
- Location: {base-dir} (acme.platform.api, acme.platform.frontend)
Options:
1. Fix the issue (SSH keys, network) and run /azure-init again
- Already cloned repos will be skipped automatically
2. Remove partial clones: rm -rf {base-dir}/acme.platform.*
3. Continue manually: clone remaining repos to {base-dir}
Always provide clear next steps so users know how to proceed or clean up.
When parsing arguments, support an optional --dry-run flag:
/azure-init "Platform Services" --dry-run
/azure-init "Platform Services" ~/projects/platform --dry-run
Dry run behavior:
This lets users preview what will happen before committing to large clones.
/azure-init "Platform Services"
# Auto-detects base directory from current location (~/code/, ~/git/, ~/projects/, etc.)
# If repos are NOT namespaced (Api, Frontend, etc.):
# → Clones to {base-dir}/platform-services/api, {base-dir}/platform-services/frontend, etc.
# If repos ARE namespaced (Acme.Platform.Api, Acme.Platform.Frontend, etc.):
# → Clones to {base-dir}/acme.platform.api, {base-dir}/acme.platform.frontend, etc.
/azure-init "Platform Services" ~/projects/platform
# Clones to ~/projects/platform/ (overrides automatic directory detection)
/azure-init 0d1e562b-95af-4c55-a8ce-8f26508d50ed
# Uses project ID directly, applies same namespacing logic with auto-detected base dir
/azure-init "Platform Services" --dry-run
# Preview what would be cloned without actually cloning
See references/examples.md for detailed example outputs showing both namespaced and non-namespaced repository scenarios.
Handle common errors gracefully. For detailed error messages and setup instructions, see references/troubleshooting.md.
Common error scenarios:
az extension add -n azure-devopsaz login or configure PATRequired:
azure-devops extension OR Azure DevOps MCP serverAutomatic verification happens in step 0
Setup guides:
When needed during execution, READ these guides:
Azure CLI setup: references/az-cli-installation.md
MCP setup: references/mcp-installation.md
Troubleshooting: references/troubleshooting.md
Examples: references/examples.md
Directory detection:
Namespacing logic:
. or - separator with 2+ segments (e.g., Acme.Platform.Api, Contoso-DataHub){base-dir}/{repo-name} (flat structure){base-dir}/{project-name}/{repo-name} (nested structure)General behavior:
.git folder) will be skipped (not re-cloned)