powershell-windows
यह क्या करती है
यह गाइड सिखाती है कि Windows PowerShell scripts को सही और सुरक्षित तरीके से कैसे लिखा जाए। इसमें ऐसे ज़रूरी नियम बताए गए हैं जिनसे आम गलतियों से बचा जा सके, जैसे parentheses का सही इस्तेमाल, खास characters से बचना, और किसी चीज़ का इस्तेमाल करने से पहले जाँच लेना कि वह मौजूद है।
कब इस्तेमाल करें
- ✓जब आप PowerShell scripts लिखना सीख रहे हों।
- ✓अगर आपकी scripts में अनपेक्षित errors आ रहे हों।
- ✓यह सुनिश्चित करने के लिए कि आपकी scripts अलग-अलग कंप्यूटरों पर ठीक से चलें।
Skill का लिंक
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/powershell-windows/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“PowerShell script में 'or' के साथ parentheses का सही इस्तेमाल कैसे करूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह गाइड PowerShell के नियम समझाती है, जैसे कुछ स्थितियों में parentheses की ज़रूरत और केवल सरल (ASCII) characters इस्तेमाल करने का महत्व। यह यह भी दिखाती है कि variable का इस्तेमाल करने से पहले जाँचा कैसे जाए कि उसमें कोई value है या नहीं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
PowerShell Windows Patterns
Critical patterns and pitfalls for Windows PowerShell.
1. Operator Syntax Rules
CRITICAL: Parentheses Required
| ❌ Wrong | ✅ Correct |
|---|---|
if (Test-Path "a" -or Test-Path "b") |
if ((Test-Path "a") -or (Test-Path "b")) |
if (Get-Item $x -and $y -eq 5) |
if ((Get-Item $x) -and ($y -eq 5)) |
Rule: Each cmdlet call MUST be in parentheses when using logical operators.
2. Unicode/Emoji Restriction
CRITICAL: No Unicode in Scripts
| Purpose | ❌ Don't Use | ✅ Use |
|---|---|---|
| Success | ✅ ✓ | [OK] [+] |
| Error | ❌ ✗ 🔴 | [!] [X] |
| Warning | ⚠️ 🟡 | [*] [WARN] |
| Info | ℹ️ 🔵 | [i] [INFO] |
| Progress | ⏳ | [...] |
Rule: Use ASCII characters only in PowerShell scripts.
3. Null Check Patterns
Always Check Before Access
| ❌ Wrong | ✅ Correct |
|---|---|
$array.Count -gt 0 |
$array -and $array.Count -gt 0 |
$text.Length |
if ($text) { $text.Length } |
4. String Interpolation
Complex Expressions
| ❌ Wrong | ✅ Correct |
|---|---|
"Value: $($obj.prop.sub)" |
Store in variable first |
Pattern:
$value = $obj.prop.sub
Write-Output "Value: $value"
5. Error Handling
ErrorActionPreference
| Value | Use |
|---|---|
| Stop | Development (fail fast) |
| Continue | Production scripts |
| SilentlyContinue | When errors expected |
Try/Catch Pattern
- Don't return inside try block
- Use finally for cleanup
- Return after try/catch
6. File Paths
Windows Path Rules
| Pattern | Use |
|---|---|
| Literal path | C:\Users\User\file.txt |
| Variable path | Join-Path $env:USERPROFILE "file.txt" |
| Relative | Join-Path $ScriptDir "data" |
Rule: Use Join-Path for cross-platform safety.
7. Array Operations
Correct Patterns
| Operation | Syntax |
|---|---|
| Empty array | $array = @() |
| Add item | $array += $item |
| ArrayList add | `$list.Add($item) |
8. JSON Operations
CRITICAL: Depth Parameter
| ❌ Wrong | ✅ Correct |
|---|---|
ConvertTo-Json |
ConvertTo-Json -Depth 10 |
Rule: Always specify -Depth for nested objects.
File Operations
| Operation | Pattern |
|---|---|
| Read | `Get-Content "file.json" -Raw |
| Write | `$data |
9. Common Errors
| Error Message | Cause | Fix |
|---|---|---|
| "parameter 'or'" | Missing parentheses | Wrap cmdlets in () |
| "Unexpected token" | Unicode character | Use ASCII only |
| "Cannot find property" | Null object | Check null first |
| "Cannot convert" | Type mismatch | Use .ToString() |
10. Script Template
# Strict mode
Set-StrictMode -Version Latest
$ErrorActionPreference = "Continue"
# Paths
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# Main
try {
# Logic here
Write-Output "[OK] Done"
exit 0
}
catch {
Write-Warning "Error: $_"
exit 1
}
Remember: PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
अक्सर पूछे जाने वाले सवाल
मैं scripts में emoji या खास characters क्यों नहीं इस्तेमाल कर सकता?
PowerShell scripts को अंग्रेज़ी के बुनियादी अक्षरों (ASCII) से अलग characters समझने में दिक्कत हो सकती है। केवल ASCII characters इस्तेमाल करने से आपकी script किसी भी कंप्यूटर पर बिना अजीब errors के चलती है।
'null checking' क्या है और यह क्यों ज़रूरी है?
यह ऐसा है जैसे किसी डिब्बे से कुछ निकालने से पहले देख लेना कि वह खाली तो नहीं है। अगर आप ऐसी चीज़ इस्तेमाल करते हैं जो मौजूद ही नहीं है (यानी 'null' है), तो आपकी script टूट सकती है। पहले जाँच लेने से ये errors रुक जाते हैं।
PowerShell errors को कैसे संभालता है?
आप PowerShell को बता सकते हैं कि कोई error आने पर सब कुछ रोक दे ('Stop'), error के बावजूद चलता रहे ('Continue'), या जिन errors की उम्मीद है उन्हें नज़रअंदाज़ कर दे ('SilentlyContinue')। इसके अलावा 'Try/Catch' का तरीका भी है, जिसमें कोई चीज़ चलाकर देखी जाती है और error आने पर उसे पकड़ लिया जाता है।
जानकारी
लेखक का मूल विवरण
PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
लोकप्रियता
- GitHub स्टार
- 48k
- रैंकिंग में स्थान
- #5482
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
00-andruia-consultant
48kआपके एजेंट को AI प्रोजेक्ट शुरू करने या उन्हें बेहतर बनाने में मदद करता है। यह code का विश्लेषण करता है, tools सुझाता है और स्पेनिश भाषा में action plan बनाता है।
007
48kआपका एजेंट security audit और threat modeling करता है। यह प्रोजेक्ट को हमलों और कमजोरियों से बचाने में काम आता है।
10-andruia-skill-smith
48kआपके एजेंट को AI tools बनाने या उन्हें बेहतर करने में मदद करता है। यह तय करता है कि tools कैसे काम करेंगे, documentation लिखता है और structure की जांच करता है।
20-andruia-niche-intelligence
48kआपका एजेंट किसी खास industry का summary बनाता है। भरोसेमंद स्रोतों की मदद से यह प्रोजेक्ट का संदर्भ, नियम, इस्तेमाल के तरीके और जोखिम समझने में मदद करता है।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।