home / skills / ntaksh42 / agents / azure-repos-helper

azure-repos-helper skill

/.claude/skills/azure-repos-helper

This skill helps you manage Azure Repos by handling branches, PRs, reviews, and policy enforcement for efficient repository operations.

npx playbooks add skill ntaksh42/agents --skill azure-repos-helper

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.2 KB
---
name: azure-repos-helper
description: Manage Azure Repos including branches, pull requests, and code reviews. Use when working with Azure Repos or managing repository operations.
---

# Azure Repos Helper Skill

Azure Reposでのリポジトリ管理を支援するスキルです。

## 主な機能

- **リポジトリ操作**: クローン、プッシュ、プル
- **ブランチポリシー**: PR必須、レビュー必須
- **コードレビュー**: PR作成、レビュー
- **ブランチ管理**: ブランチ戦略
- **Git操作**: Azure DevOps特有の操作

## ブランチポリシー設定

### main ブランチ保護

```json
{
  "isEnabled": true,
  "isBlocking": true,
  "type": {
    "id": "fa4e907d-c16b-4a4c-9dfa-4906e5d171dd"
  },
  "settings": {
    "minimumApproverCount": 2,
    "creatorVoteCounts": false,
    "allowDownvotes": false,
    "resetOnSourcePush": true,
    "requireVoteOnLastIteration": true,
    "blockLastPusherVote": true
  }
}
```

### ビルド検証

```json
{
  "isEnabled": true,
  "isBlocking": true,
  "type": {
    "id": "0609b952-1397-4640-95ec-e00a01b2c241"
  },
  "settings": {
    "buildDefinitionId": 123,
    "displayName": "PR Build Validation",
    "validDuration": 720,
    "queueOnSourceUpdateOnly": true
  }
}
```

## PR作成(Azure CLI)

```bash
# PR作成
az repos pr create \
  --repository MyRepo \
  --source-branch feature/new-feature \
  --target-branch main \
  --title "新機能: ユーザー認証" \
  --description "JWT認証を実装しました" \
  --reviewers [email protected] [email protected] \
  --work-items 123 456

# PRリスト取得
az repos pr list \
  --repository MyRepo \
  --status active

# PR承認
az repos pr update \
  --id 123 \
  --status approved

# PRマージ
az repos pr update \
  --id 123 \
  --status completed \
  --merge-commit-message "Merged PR 123: Add user authentication"
```

## .gitattributes

```
# Auto detect text files and perform LF normalization
* text=auto

# Source code
*.cs     text diff=csharp
*.java   text diff=java
*.py     text diff=python
*.js     text
*.ts     text

# Binary files
*.png    binary
*.jpg    binary
*.dll    binary
*.exe    binary
```

## バージョン情報
- Version: 1.0.0

Overview

This skill helps manage Azure Repos operations including branches, pull requests, and code reviews. It provides guidance and examples for branch policies, PR workflows, Git attributes, and Azure CLI commands. Use it to standardize repo protection, automate validation, and streamline reviewer workflows.

How this skill works

The skill inspects common repo management tasks and provides configuration snippets and CLI examples for Azure Repos. It shows branch policy settings (approvals, build validation), sample .gitattributes for normalization, and az repos commands for creating, listing, approving, and merging PRs. Apply the provided JSON and CLI patterns directly to enforce policies and automate PR operations.

When to use it

  • Setting up branch protection and approval requirements for main or release branches
  • Automating PR creation, approval, and merge workflows with Azure CLI
  • Configuring build validation as part of PR gating
  • Standardizing .gitattributes to ensure consistent EOL and diff behavior
  • Defining branch strategies and reviewer assignment rules

Best practices

  • Require a minimum number of approvers and disable creator self-approval to improve review quality
  • Enable build validation as a blocking policy to prevent merges with failing checks
  • Reset approvals on source pushes to ensure reviews reflect latest changes
  • Use explicit reviewer lists and link work items to PRs for traceability
  • Keep .gitattributes to normalize line endings and mark binaries to avoid noisy diffs

Example use cases

  • Protect the main branch by enforcing 2 approvers, disallowing downvotes, and blocking merges until build validation passes
  • Create a PR from feature/new-feature into main using az repos pr create with reviewers and work item links
  • List active PRs for a repository to track outstanding reviews and pending merges
  • Approve and complete a PR via az repos pr update to automate merge workflows after approvals
  • Apply .gitattributes to a repository to ensure consistent line endings and proper diff behavior for source files

FAQ

Can I enforce build validation only for PRs?

Yes. Configure a build validation policy with queueOnSourceUpdateOnly and isBlocking true so the build runs and blocks merges only for PR updates.

How do I prevent the PR author from counting as an approver?

Set creatorVoteCounts to false in the branch policy to ensure the author’s vote does not satisfy approval requirements.

What happens when source branch is pushed after approval?

Enable resetOnSourcePush to invalidate previous approvals so reviewers must re-evaluate changes after new commits.