powershell-expert
Microsoft推奨のベストプラクティスに沿って、PowerShellスクリプトやGUIなどの開発を支援し、モジュールやコマンドレットの選定、エラー処理、GUI作成パターンまで、幅広いPowerShell開発をサポートするSkill。
📜 元の英語説明(参考)
Develop PowerShell scripts, tools, modules, and GUIs following Microsoft best practices. Use when writing PowerShell code, creating Windows Forms/WPF interfaces, working with PowerShell Gallery modules, or needing cmdlet/module recommendations. Covers script development, parameter design, pipeline handling, error management, and GUI creation patterns. Verifies module availability and cmdlet syntax against live documentation when accuracy is critical.
🇯🇵 日本人クリエイター向け解説
Microsoft推奨のベストプラクティスに沿って、PowerShellスクリプトやGUIなどの開発を支援し、モジュールやコマンドレットの選定、エラー処理、GUI作成パターンまで、幅広いPowerShell開発をサポートするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o powershell-expert.zip https://jpskill.com/download/19210.zip && unzip -o powershell-expert.zip && rm powershell-expert.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/19210.zip -OutFile "$d\powershell-expert.zip"; Expand-Archive "$d\powershell-expert.zip" -DestinationPath $d -Force; ri "$d\powershell-expert.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
powershell-expert.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
powershell-expertフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 5
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
PowerShell Expert
Microsoft のベストプラクティスと PowerShell エコシステムを活用して、プロダクション品質の PowerShell スクリプト、ツール、GUI を開発します。
クイックリファレンス
スクリプトの構造
#Requires -Version 5.1
<#
.SYNOPSIS
簡単な説明。
.DESCRIPTION
詳細な説明。
.PARAMETER Name
パラメーターの説明。
.EXAMPLE
Example-Usage -Name 'Value'
#>
[CmdletBinding()]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[string[]]$Name,
[switch]$Force
)
begin {
# 1回限りのセットアップ
}
process {
foreach ($item in $Name) {
# アイテムごとの処理
}
}
end {
# クリーンアップ
}
関数のテンプレート
function Verb-Noun {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0)]
[string]$Name,
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('CN')]
[string]$ComputerName = $env:COMPUTERNAME,
[switch]$PassThru
)
process {
if ($PSCmdlet.ShouldProcess($Name, 'Action')) {
# 実装
if ($PassThru) { Write-Output $result }
}
}
}
ワークフロー
1. スクリプト開発
命名規則とパラメーター規則に従ってください。
- 承認された動詞 (
Get-Verb) を使用した Verb-Noun 形式 - 検証属性を使用した 厳密な型付け
ValueFromPipelineを介した パイプラインサポート- 破壊的な操作に対する -WhatIf/-Confirm
完全なガイドラインについては、best-practices.md を参照してください。
2. GUI 開発
シンプルなダイアログには Windows Forms を、複雑なインターフェースには WPF/XAML を使用します。
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object System.Windows.Forms.Form -Property @{
Text = 'Title'
Size = New-Object System.Drawing.Size(400, 300)
StartPosition = 'CenterScreen'
}
コントロール、イベント、テンプレートについては、gui-development.md を参照してください。
3. PowerShell Gallery 統合
PSResourceGet を使用してモジュールを検索およびインストールします。
# ギャラリーを検索
Find-PSResource -Name 'ModuleName' -Repository PSGallery
# モジュールをインストール
Install-PSResource -Name 'ModuleName' -Scope CurrentUser -TrustRepository
強化された検索には、scripts/Search-Gallery.ps1 を使用してください。
完全なコマンドレットリファレンスについては、powershellget.md を参照してください。
主要なパターン
エラー処理
try {
$result = Get-Content -Path $Path -ErrorAction Stop
}
catch [System.IO.FileNotFoundException] {
Write-Error "File not found: $Path"
return
}
catch {
throw
}
可読性のためのスプラッティング
$params = @{
Path = $sourcePath
Destination = $destPath
Recurse = $true
Force = $true
}
Copy-Item @params
パイプラインのベストプラクティス
# 出力を即座にストリーム
foreach ($item in $collection) {
Process-Item $item | Write-Output
}
# パイプライン入力を受け入れる
param(
[Parameter(ValueFromPipeline)]
[string[]]$InputObject
)
process {
foreach ($obj in $InputObject) {
# 各項目を処理
}
}
モジュールの推奨事項
モジュールを推奨する際は、PowerShell Gallery を検索してください。
| カテゴリ | 人気のモジュール |
|---|---|
| Azure | Az, Az.Compute, Az.Storage |
| テスト | Pester, PSScriptAnalyzer |
| コンソール | PSReadLine, Terminal-Icons |
| シークレット | Microsoft.PowerShell.SecretManagement |
| Web | Pode (Web サーバー), PoshRSJob (非同期) |
| GUI | WPFBot3000, PSGUI |
ライブ検証
正確性が重要である場合、情報はライブソースに対して検証しなければなりません。モジュールの可用性やコマンドレットの構文について、トレーニングデータのみに依存しないでください。
使用するツール:
- WebFetch: 特定のドキュメント URL (PowerShell Gallery ページ、Microsoft Docs) を取得して解析します。
- WebSearch: 正確なパスが不明な場合やモジュールの存在を確認する場合に、正しい URL を見つけます。
検証が必要な場合
| シナリオ | アクション |
|---|---|
| ユーザーが「モジュール X は存在しますか?」と尋ねる | PowerShell Gallery を介して検証しなければなりません |
| 特定のモジュールを推奨する | 存在し、非推奨ではないことを検証しなければなりません |
| 正確なコマンドレット構文を提供する | Microsoft Docs に対して検証すべきです |
| モジュールのバージョン要件 | ギャラリーで現在のバージョンを確認しなければなりません |
| 一般的なベストプラクティス | 静的参照で十分です |
ステップ 1: PowerShell Gallery でモジュールを検証する
モジュールを推奨または確認する際は、WebFetch ツールを使用してそのモジュールが存在するかどうかを検証します。
WebFetch の呼び出し:
- URL:
https://www.powershellgallery.com/packages/{ModuleName} - プロンプト:
抽出: モジュール名、最新バージョン、最終更新日、総ダウンロード数、および非推奨の警告または「非公開」ステータスが表示されているかどうか
WebFetch が 404 またはエラーを返した場合: モジュールは存在しない可能性が高いです。WebSearch ツールを使用して確認します。
- クエリ:
{ModuleName} PowerShell module site:powershellgallery.com
ステップ 2: コマンドレットの構文を検証する (必要な場合)
Microsoft Docs の URL はモジュールによって異なります。正しいドキュメントページを見つけるには、WebSearch ツールを使用します。
WebSearch の呼び出し:
- クエリ:
{Cmdlet-Name} cmdlet site:learn.microsoft.com/en-us/powershell
次に、返された URL で WebFetch を使用し、プロンプトを指定します。
- プロンプト:
完全なコマンドレット構文、必須パラメーターとオプションパラメーター、および PowerShell のバージョン要件を抽出します
ステップ 3: フォールバック戦略
WebFetch または WebSearch ツールが利用できない場合、またはエラーを返した場合:
-
モジュールの検証の場合: このスキルから
Search-Gallery.ps1を実行します。~/.claude/skills/powershell-expert/scripts/Search-Gallery.ps1 -Name 'ModuleName' -
コマンドレットの構文の場合: ユーザーにローカルで実行するように提案します。
Get-Help Cmdlet-Name -Full Get-Command Cmdlet-Name -Syntax -
不確実性を明確に述べる: 検証に失敗した場合は、ユーザーに伝えます。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
PowerShell Expert
Develop production-quality PowerShell scripts, tools, and GUIs using Microsoft best practices and the PowerShell ecosystem.
Quick Reference
Script Structure
#Requires -Version 5.1
<#
.SYNOPSIS
Brief description.
.DESCRIPTION
Detailed description.
.PARAMETER Name
Parameter description.
.EXAMPLE
Example-Usage -Name 'Value'
#>
[CmdletBinding()]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[string[]]$Name,
[switch]$Force
)
begin {
# One-time setup
}
process {
foreach ($item in $Name) {
# Per-item processing
}
}
end {
# Cleanup
}
Function Template
function Verb-Noun {
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory, Position = 0)]
[string]$Name,
[Parameter(ValueFromPipelineByPropertyName)]
[Alias('CN')]
[string]$ComputerName = $env:COMPUTERNAME,
[switch]$PassThru
)
process {
if ($PSCmdlet.ShouldProcess($Name, 'Action')) {
# Implementation
if ($PassThru) { Write-Output $result }
}
}
}
Workflow
1. Script Development
Follow naming and parameter conventions:
- Verb-Noun format with approved verbs (
Get-Verb) - Strong typing with validation attributes
- Pipeline support via
ValueFromPipeline - -WhatIf/-Confirm for destructive operations
See best-practices.md for complete guidelines.
2. GUI Development
Windows Forms for simple dialogs, WPF/XAML for complex interfaces:
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$form = New-Object System.Windows.Forms.Form -Property @{
Text = 'Title'
Size = New-Object System.Drawing.Size(400, 300)
StartPosition = 'CenterScreen'
}
See gui-development.md for controls, events, and templates.
3. PowerShell Gallery Integration
Search and install modules using PSResourceGet:
# Search gallery
Find-PSResource -Name 'ModuleName' -Repository PSGallery
# Install module
Install-PSResource -Name 'ModuleName' -Scope CurrentUser -TrustRepository
Use scripts/Search-Gallery.ps1 for enhanced search.
See powershellget.md for full cmdlet reference.
Key Patterns
Error Handling
try {
$result = Get-Content -Path $Path -ErrorAction Stop
}
catch [System.IO.FileNotFoundException] {
Write-Error "File not found: $Path"
return
}
catch {
throw
}
Splatting for Readability
$params = @{
Path = $sourcePath
Destination = $destPath
Recurse = $true
Force = $true
}
Copy-Item @params
Pipeline Best Practices
# Stream output immediately
foreach ($item in $collection) {
Process-Item $item | Write-Output
}
# Accept pipeline input
param(
[Parameter(ValueFromPipeline)]
[string[]]$InputObject
)
process {
foreach ($obj in $InputObject) {
# Process each
}
}
Module Recommendations
When recommending modules, search the PowerShell Gallery:
| Category | Popular Modules |
|---|---|
| Azure | Az, Az.Compute, Az.Storage |
| Testing | Pester, PSScriptAnalyzer |
| Console | PSReadLine, Terminal-Icons |
| Secrets | Microsoft.PowerShell.SecretManagement |
| Web | Pode (web server), PoshRSJob (async) |
| GUI | WPFBot3000, PSGUI |
Live Verification
You MUST verify information against live sources when accuracy is critical. Do not rely solely on training data for module availability or cmdlet syntax.
Tools to use:
- WebFetch: Retrieve and parse specific documentation URLs (PowerShell Gallery pages, Microsoft Docs)
- WebSearch: Find correct URLs when the exact path is unknown or to verify module existence
When Verification is Required
| Scenario | Action |
|---|---|
| User asks "does module X exist?" | MUST verify via PowerShell Gallery |
| Recommending a specific module | MUST verify it exists and isn't deprecated |
| Providing exact cmdlet syntax | SHOULD verify against Microsoft Docs |
| Module version requirements | MUST check gallery for current version |
| General best practices | Static references are sufficient |
Step 1: Verify Module on PowerShell Gallery
When recommending or checking a module, use the WebFetch tool to verify it exists:
WebFetch call:
- URL:
https://www.powershellgallery.com/packages/{ModuleName} - Prompt:
Extract: module name, latest version, last updated date, total downloads, and whether it shows any deprecation warning or 'unlisted' status
If WebFetch returns 404 or error: The module likely doesn't exist. Use the WebSearch tool to confirm:
- Query:
{ModuleName} PowerShell module site:powershellgallery.com
Step 2: Verify Cmdlet Syntax (When Needed)
Microsoft Docs URLs vary by module. Use the WebSearch tool to find the correct documentation page:
WebSearch call:
- Query:
{Cmdlet-Name} cmdlet site:learn.microsoft.com/en-us/powershell
Then use WebFetch on the returned URL with prompt:
- Prompt:
Extract the complete cmdlet syntax, required vs optional parameters, and PowerShell version requirements
Step 3: Fallback Strategies
If the WebFetch or WebSearch tools are unavailable or return errors:
-
For module verification: Execute
Search-Gallery.ps1from this skill:~/.claude/skills/powershell-expert/scripts/Search-Gallery.ps1 -Name 'ModuleName' -
For cmdlet syntax: Suggest the user run locally:
Get-Help Cmdlet-Name -Full Get-Command Cmdlet-Name -Syntax -
Clearly state uncertainty: If verification fails, tell the user:
"I wasn't able to verify this against live documentation. Please confirm the module exists by running:
Find-PSResource -Name 'ModuleName'"
Verification Examples
Good (verified with live data):
"The ImportExcel module (v7.8.10, updated Oct 2024, 17M+ downloads) provides Export-Excel for creating spreadsheets without Excel installed."
Bad (unverified claim):
"Use the Excel-Tools module to export data." ← May not exist!
Documentation Resources
- PowerShell Docs: https://learn.microsoft.com/en-us/powershell/
- Module Browser: https://learn.microsoft.com/en-us/powershell/module/
- PowerShell Gallery: https://www.powershellgallery.com
- GitHub Docs: https://github.com/MicrosoftDocs/PowerShell-Docs
References
- best-practices.md - Naming, parameters, pipeline, error handling, code style
- gui-development.md - Windows Forms, WPF, controls, events, templates
- powershellget.md - Find, install, update, publish modules
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (7,590 bytes)
- 📎 references/best-practices.md (6,678 bytes)
- 📎 references/gui-development.md (13,368 bytes)
- 📎 references/powershellget.md (7,791 bytes)
- 📎 scripts/Search-Gallery.ps1 (3,890 bytes)