cp-toolkit 2.2.3 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/package.json +1 -1
  2. package/src/commands/add.js +23 -16
  3. package/src/commands/doctor.js +15 -10
  4. package/src/commands/init.js +147 -21
  5. package/templates/AGENTS.md +47 -0
  6. package/templates/ARCHITECTURE.md +42 -0
  7. package/templates/agents/backend-specialist.md +1 -0
  8. package/templates/agents/code-archaeologist.md +116 -106
  9. package/templates/agents/database-architect.md +1 -0
  10. package/templates/agents/debugger.md +1 -0
  11. package/templates/agents/devops-engineer.md +1 -0
  12. package/templates/agents/documentation-writer.md +1 -0
  13. package/templates/agents/explorer-agent.md +83 -73
  14. package/templates/agents/frontend-specialist.md +1 -0
  15. package/templates/agents/game-developer.md +1 -0
  16. package/templates/agents/mobile-developer.md +1 -0
  17. package/templates/agents/orchestrator.md +426 -416
  18. package/templates/agents/penetration-tester.md +1 -0
  19. package/templates/agents/performance-optimizer.md +1 -0
  20. package/templates/agents/product-manager.md +122 -112
  21. package/templates/agents/product-owner.md +105 -95
  22. package/templates/agents/project-planner.md +416 -406
  23. package/templates/agents/qa-automation-engineer.md +113 -103
  24. package/templates/agents/security-auditor.md +1 -0
  25. package/templates/agents/seo-specialist.md +1 -0
  26. package/templates/agents/test-engineer.md +1 -0
  27. package/templates/skills/core/behavioral-modes/SKILL.md +244 -242
  28. package/templates/skills/core/brainstorming/SKILL.md +166 -163
  29. package/templates/skills/core/mcp-builder/SKILL.md +178 -176
  30. package/templates/skills/core/parallel-agents/SKILL.md +187 -175
  31. package/templates/skills/core/plan-writing/SKILL.md +154 -152
  32. package/templates/skills/optional/api-patterns/SKILL.md +83 -81
  33. package/templates/skills/optional/app-builder/SKILL.md +78 -75
  34. package/templates/skills/optional/app-builder/templates/SKILL.md +41 -39
  35. package/templates/skills/optional/architecture/SKILL.md +58 -55
  36. package/templates/skills/optional/bash-linux/SKILL.md +201 -199
  37. package/templates/skills/optional/code-review-checklist/SKILL.md +110 -109
  38. package/templates/skills/optional/database-design/SKILL.md +54 -52
  39. package/templates/skills/optional/deployment-procedures/SKILL.md +243 -241
  40. package/templates/skills/optional/documentation-templates/SKILL.md +196 -194
  41. package/templates/skills/optional/frontend-design/SKILL.md +421 -418
  42. package/templates/skills/optional/game-development/2d-games/SKILL.md +120 -119
  43. package/templates/skills/optional/game-development/3d-games/SKILL.md +136 -135
  44. package/templates/skills/optional/game-development/SKILL.md +169 -167
  45. package/templates/skills/optional/game-development/game-art/SKILL.md +187 -185
  46. package/templates/skills/optional/game-development/game-audio/SKILL.md +192 -190
  47. package/templates/skills/optional/game-development/game-design/SKILL.md +131 -129
  48. package/templates/skills/optional/game-development/mobile-games/SKILL.md +110 -108
  49. package/templates/skills/optional/game-development/multiplayer/SKILL.md +133 -132
  50. package/templates/skills/optional/game-development/pc-games/SKILL.md +146 -144
  51. package/templates/skills/optional/game-development/vr-ar/SKILL.md +124 -123
  52. package/templates/skills/optional/game-development/web-games/SKILL.md +152 -150
  53. package/templates/skills/optional/geo-fundamentals/SKILL.md +158 -156
  54. package/templates/skills/optional/i18n-localization/SKILL.md +156 -154
  55. package/templates/skills/optional/lint-and-validate/SKILL.md +48 -45
  56. package/templates/skills/optional/mobile-design/SKILL.md +397 -394
  57. package/templates/skills/optional/nextjs-react-expert/SKILL.md +271 -267
  58. package/templates/skills/optional/nodejs-best-practices/SKILL.md +335 -333
  59. package/templates/skills/optional/performance-profiling/SKILL.md +145 -143
  60. package/templates/skills/optional/powershell-windows/SKILL.md +169 -167
  61. package/templates/skills/optional/python-patterns/SKILL.md +443 -441
  62. package/templates/skills/optional/red-team-tactics/SKILL.md +201 -199
  63. package/templates/skills/optional/seo-fundamentals/SKILL.md +130 -129
  64. package/templates/skills/optional/server-management/SKILL.md +163 -161
  65. package/templates/skills/optional/systematic-debugging/SKILL.md +111 -109
  66. package/templates/skills/optional/tailwind-patterns/SKILL.md +271 -269
  67. package/templates/skills/optional/tdd-workflow/SKILL.md +150 -149
  68. package/templates/skills/optional/testing-patterns/SKILL.md +179 -178
  69. package/templates/skills/optional/vulnerability-scanner/SKILL.md +278 -276
  70. package/templates/skills/optional/web-design-guidelines/SKILL.md +60 -57
  71. package/templates/skills/optional/webapp-testing/SKILL.md +188 -187
@@ -1,143 +1,145 @@
1
- ---
2
- name: performance-profiling
3
- description: Performance profiling principles. Measurement, analysis, and optimization techniques.
4
- allowed-tools: Read, Glob, Grep, Bash
5
- ---
6
-
7
- # Performance Profiling
8
-
9
- > Measure, analyze, optimize - in that order.
10
-
11
- ## 🔧 Runtime Scripts
12
-
13
- **Execute these for automated profiling:**
14
-
15
- | Script | Purpose | Usage |
16
- |--------|---------|-------|
17
- | `scripts/lighthouse_audit.py` | Lighthouse performance audit | `python scripts/lighthouse_audit.py https://example.com` |
18
-
19
- ---
20
-
21
- ## 1. Core Web Vitals
22
-
23
- ### Targets
24
-
25
- | Metric | Good | Poor | Measures |
26
- |--------|------|------|----------|
27
- | **LCP** | < 2.5s | > 4.0s | Loading |
28
- | **INP** | < 200ms | > 500ms | Interactivity |
29
- | **CLS** | < 0.1 | > 0.25 | Stability |
30
-
31
- ### When to Measure
32
-
33
- | Stage | Tool |
34
- |-------|------|
35
- | Development | Local Lighthouse |
36
- | CI/CD | Lighthouse CI |
37
- | Production | RUM (Real User Monitoring) |
38
-
39
- ---
40
-
41
- ## 2. Profiling Workflow
42
-
43
- ### The 4-Step Process
44
-
45
- ```
46
- 1. BASELINE → Measure current state
47
- 2. IDENTIFY → Find the bottleneck
48
- 3. FIX → Make targeted change
49
- 4. VALIDATE → Confirm improvement
50
- ```
51
-
52
- ### Profiling Tool Selection
53
-
54
- | Problem | Tool |
55
- |---------|------|
56
- | Page load | Lighthouse |
57
- | Bundle size | Bundle analyzer |
58
- | Runtime | DevTools Performance |
59
- | Memory | DevTools Memory |
60
- | Network | DevTools Network |
61
-
62
- ---
63
-
64
- ## 3. Bundle Analysis
65
-
66
- ### What to Look For
67
-
68
- | Issue | Indicator |
69
- |-------|-----------|
70
- | Large dependencies | Top of bundle |
71
- | Duplicate code | Multiple chunks |
72
- | Unused code | Low coverage |
73
- | Missing splits | Single large chunk |
74
-
75
- ### Optimization Actions
76
-
77
- | Finding | Action |
78
- |---------|--------|
79
- | Big library | Import specific modules |
80
- | Duplicate deps | Dedupe, update versions |
81
- | Route in main | Code split |
82
- | Unused exports | Tree shake |
83
-
84
- ---
85
-
86
- ## 4. Runtime Profiling
87
-
88
- ### Performance Tab Analysis
89
-
90
- | Pattern | Meaning |
91
- |---------|---------|
92
- | Long tasks (>50ms) | UI blocking |
93
- | Many small tasks | Possible batching opportunity |
94
- | Layout/paint | Rendering bottleneck |
95
- | Script | JavaScript execution |
96
-
97
- ### Memory Tab Analysis
98
-
99
- | Pattern | Meaning |
100
- |---------|---------|
101
- | Growing heap | Possible leak |
102
- | Large retained | Check references |
103
- | Detached DOM | Not cleaned up |
104
-
105
- ---
106
-
107
- ## 5. Common Bottlenecks
108
-
109
- ### By Symptom
110
-
111
- | Symptom | Likely Cause |
112
- |---------|--------------|
113
- | Slow initial load | Large JS, render blocking |
114
- | Slow interactions | Heavy event handlers |
115
- | Jank during scroll | Layout thrashing |
116
- | Growing memory | Leaks, retained refs |
117
-
118
- ---
119
-
120
- ## 6. Quick Win Priorities
121
-
122
- | Priority | Action | Impact |
123
- |----------|--------|--------|
124
- | 1 | Enable compression | High |
125
- | 2 | Lazy load images | High |
126
- | 3 | Code split routes | High |
127
- | 4 | Cache static assets | Medium |
128
- | 5 | Optimize images | Medium |
129
-
130
- ---
131
-
132
- ## 7. Anti-Patterns
133
-
134
- | ❌ Don't | ✅ Do |
135
- |----------|-------|
136
- | Guess at problems | Profile first |
137
- | Micro-optimize | Fix biggest issue |
138
- | Optimize early | Optimize when needed |
139
- | Ignore real users | Use RUM data |
140
-
141
- ---
142
-
143
- > **Remember:** The fastest code is code that doesn't run. Remove before optimizing.
1
+ ---
2
+ name: performance-profiling
3
+ description: Performance profiling principles. Measurement, analysis, and optimization
4
+ techniques.
5
+ allowed-tools: Read, Glob, Grep, Bash
6
+ version: '1.0'
7
+ ---
8
+
9
+ # Performance Profiling
10
+
11
+ > Measure, analyze, optimize - in that order.
12
+
13
+ ## 🔧 Runtime Scripts
14
+
15
+ **Execute these for automated profiling:**
16
+
17
+ | Script | Purpose | Usage |
18
+ |--------|---------|-------|
19
+ | `scripts/lighthouse_audit.py` | Lighthouse performance audit | `python scripts/lighthouse_audit.py https://example.com` |
20
+
21
+ ---
22
+
23
+ ## 1. Core Web Vitals
24
+
25
+ ### Targets
26
+
27
+ | Metric | Good | Poor | Measures |
28
+ |--------|------|------|----------|
29
+ | **LCP** | < 2.5s | > 4.0s | Loading |
30
+ | **INP** | < 200ms | > 500ms | Interactivity |
31
+ | **CLS** | < 0.1 | > 0.25 | Stability |
32
+
33
+ ### When to Measure
34
+
35
+ | Stage | Tool |
36
+ |-------|------|
37
+ | Development | Local Lighthouse |
38
+ | CI/CD | Lighthouse CI |
39
+ | Production | RUM (Real User Monitoring) |
40
+
41
+ ---
42
+
43
+ ## 2. Profiling Workflow
44
+
45
+ ### The 4-Step Process
46
+
47
+ ```
48
+ 1. BASELINE → Measure current state
49
+ 2. IDENTIFY → Find the bottleneck
50
+ 3. FIX → Make targeted change
51
+ 4. VALIDATE → Confirm improvement
52
+ ```
53
+
54
+ ### Profiling Tool Selection
55
+
56
+ | Problem | Tool |
57
+ |---------|------|
58
+ | Page load | Lighthouse |
59
+ | Bundle size | Bundle analyzer |
60
+ | Runtime | DevTools Performance |
61
+ | Memory | DevTools Memory |
62
+ | Network | DevTools Network |
63
+
64
+ ---
65
+
66
+ ## 3. Bundle Analysis
67
+
68
+ ### What to Look For
69
+
70
+ | Issue | Indicator |
71
+ |-------|-----------|
72
+ | Large dependencies | Top of bundle |
73
+ | Duplicate code | Multiple chunks |
74
+ | Unused code | Low coverage |
75
+ | Missing splits | Single large chunk |
76
+
77
+ ### Optimization Actions
78
+
79
+ | Finding | Action |
80
+ |---------|--------|
81
+ | Big library | Import specific modules |
82
+ | Duplicate deps | Dedupe, update versions |
83
+ | Route in main | Code split |
84
+ | Unused exports | Tree shake |
85
+
86
+ ---
87
+
88
+ ## 4. Runtime Profiling
89
+
90
+ ### Performance Tab Analysis
91
+
92
+ | Pattern | Meaning |
93
+ |---------|---------|
94
+ | Long tasks (>50ms) | UI blocking |
95
+ | Many small tasks | Possible batching opportunity |
96
+ | Layout/paint | Rendering bottleneck |
97
+ | Script | JavaScript execution |
98
+
99
+ ### Memory Tab Analysis
100
+
101
+ | Pattern | Meaning |
102
+ |---------|---------|
103
+ | Growing heap | Possible leak |
104
+ | Large retained | Check references |
105
+ | Detached DOM | Not cleaned up |
106
+
107
+ ---
108
+
109
+ ## 5. Common Bottlenecks
110
+
111
+ ### By Symptom
112
+
113
+ | Symptom | Likely Cause |
114
+ |---------|--------------|
115
+ | Slow initial load | Large JS, render blocking |
116
+ | Slow interactions | Heavy event handlers |
117
+ | Jank during scroll | Layout thrashing |
118
+ | Growing memory | Leaks, retained refs |
119
+
120
+ ---
121
+
122
+ ## 6. Quick Win Priorities
123
+
124
+ | Priority | Action | Impact |
125
+ |----------|--------|--------|
126
+ | 1 | Enable compression | High |
127
+ | 2 | Lazy load images | High |
128
+ | 3 | Code split routes | High |
129
+ | 4 | Cache static assets | Medium |
130
+ | 5 | Optimize images | Medium |
131
+
132
+ ---
133
+
134
+ ## 7. Anti-Patterns
135
+
136
+ | ❌ Don't | ✅ Do |
137
+ |----------|-------|
138
+ | Guess at problems | Profile first |
139
+ | Micro-optimize | Fix biggest issue |
140
+ | Optimize early | Optimize when needed |
141
+ | Ignore real users | Use RUM data |
142
+
143
+ ---
144
+
145
+ > **Remember:** The fastest code is code that doesn't run. Remove before optimizing.
@@ -1,167 +1,169 @@
1
- ---
2
- name: powershell-windows
3
- description: PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
5
- ---
6
-
7
- # PowerShell Windows Patterns
8
-
9
- > Critical patterns and pitfalls for Windows PowerShell.
10
-
11
- ---
12
-
13
- ## 1. Operator Syntax Rules
14
-
15
- ### CRITICAL: Parentheses Required
16
-
17
- | ❌ Wrong | ✅ Correct |
18
- |----------|-----------|
19
- | `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` |
20
- | `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |
21
-
22
- **Rule:** Each cmdlet call MUST be in parentheses when using logical operators.
23
-
24
- ---
25
-
26
- ## 2. Unicode/Emoji Restriction
27
-
28
- ### CRITICAL: No Unicode in Scripts
29
-
30
- | Purpose | ❌ Don't Use | ✅ Use |
31
- |---------|-------------|--------|
32
- | Success | ✅ ✓ | [OK] [+] |
33
- | Error | ❌ ✗ 🔴 | [!] [X] |
34
- | Warning | âš ī¸ 🟡 | [*] [WARN] |
35
- | Info | â„šī¸ đŸ”ĩ | [i] [INFO] |
36
- | Progress | âŗ | [...] |
37
-
38
- **Rule:** Use ASCII characters only in PowerShell scripts.
39
-
40
- ---
41
-
42
- ## 3. Null Check Patterns
43
-
44
- ### Always Check Before Access
45
-
46
- | ❌ Wrong | ✅ Correct |
47
- |----------|-----------|
48
- | `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |
49
- | `$text.Length` | `if ($text) { $text.Length }` |
50
-
51
- ---
52
-
53
- ## 4. String Interpolation
54
-
55
- ### Complex Expressions
56
-
57
- | ❌ Wrong | ✅ Correct |
58
- |----------|-----------|
59
- | `"Value: $($obj.prop.sub)"` | Store in variable first |
60
-
61
- **Pattern:**
62
- ```
63
- $value = $obj.prop.sub
64
- Write-Output "Value: $value"
65
- ```
66
-
67
- ---
68
-
69
- ## 5. Error Handling
70
-
71
- ### ErrorActionPreference
72
-
73
- | Value | Use |
74
- |-------|-----|
75
- | Stop | Development (fail fast) |
76
- | Continue | Production scripts |
77
- | SilentlyContinue | When errors expected |
78
-
79
- ### Try/Catch Pattern
80
-
81
- - Don't return inside try block
82
- - Use finally for cleanup
83
- - Return after try/catch
84
-
85
- ---
86
-
87
- ## 6. File Paths
88
-
89
- ### Windows Path Rules
90
-
91
- | Pattern | Use |
92
- |---------|-----|
93
- | Literal path | `C:\Users\User\file.txt` |
94
- | Variable path | `Join-Path $env:USERPROFILE "file.txt"` |
95
- | Relative | `Join-Path $ScriptDir "data"` |
96
-
97
- **Rule:** Use Join-Path for cross-platform safety.
98
-
99
- ---
100
-
101
- ## 7. Array Operations
102
-
103
- ### Correct Patterns
104
-
105
- | Operation | Syntax |
106
- |-----------|--------|
107
- | Empty array | `$array = @()` |
108
- | Add item | `$array += $item` |
109
- | ArrayList add | `$list.Add($item) | Out-Null` |
110
-
111
- ---
112
-
113
- ## 8. JSON Operations
114
-
115
- ### CRITICAL: Depth Parameter
116
-
117
- | ❌ Wrong | ✅ Correct |
118
- |----------|-----------|
119
- | `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |
120
-
121
- **Rule:** Always specify `-Depth` for nested objects.
122
-
123
- ### File Operations
124
-
125
- | Operation | Pattern |
126
- |-----------|---------|
127
- | Read | `Get-Content "file.json" -Raw | ConvertFrom-Json` |
128
- | Write | `$data | ConvertTo-Json -Depth 10 | Out-File "file.json" -Encoding UTF8` |
129
-
130
- ---
131
-
132
- ## 9. Common Errors
133
-
134
- | Error Message | Cause | Fix |
135
- |---------------|-------|-----|
136
- | "parameter 'or'" | Missing parentheses | Wrap cmdlets in () |
137
- | "Unexpected token" | Unicode character | Use ASCII only |
138
- | "Cannot find property" | Null object | Check null first |
139
- | "Cannot convert" | Type mismatch | Use .ToString() |
140
-
141
- ---
142
-
143
- ## 10. Script Template
144
-
145
- ```powershell
146
- # Strict mode
147
- Set-StrictMode -Version Latest
148
- $ErrorActionPreference = "Continue"
149
-
150
- # Paths
151
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
152
-
153
- # Main
154
- try {
155
- # Logic here
156
- Write-Output "[OK] Done"
157
- exit 0
158
- }
159
- catch {
160
- Write-Warning "Error: $_"
161
- exit 1
162
- }
163
- ```
164
-
165
- ---
166
-
167
- > **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.
1
+ ---
2
+ name: powershell-windows
3
+ description: PowerShell Windows patterns. Critical pitfalls, operator syntax, error
4
+ handling.
5
+ allowed-tools: Read, Write, Edit, Glob, Grep, Bash
6
+ version: '1.0'
7
+ ---
8
+
9
+ # PowerShell Windows Patterns
10
+
11
+ > Critical patterns and pitfalls for Windows PowerShell.
12
+
13
+ ---
14
+
15
+ ## 1. Operator Syntax Rules
16
+
17
+ ### CRITICAL: Parentheses Required
18
+
19
+ | ❌ Wrong | ✅ Correct |
20
+ |----------|-----------|
21
+ | `if (Test-Path "a" -or Test-Path "b")` | `if ((Test-Path "a") -or (Test-Path "b"))` |
22
+ | `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |
23
+
24
+ **Rule:** Each cmdlet call MUST be in parentheses when using logical operators.
25
+
26
+ ---
27
+
28
+ ## 2. Unicode/Emoji Restriction
29
+
30
+ ### CRITICAL: No Unicode in Scripts
31
+
32
+ | Purpose | ❌ Don't Use | ✅ Use |
33
+ |---------|-------------|--------|
34
+ | Success | ✅ ✓ | [OK] [+] |
35
+ | Error | ❌ ✗ 🔴 | [!] [X] |
36
+ | Warning | âš ī¸ 🟡 | [*] [WARN] |
37
+ | Info | â„šī¸ đŸ”ĩ | [i] [INFO] |
38
+ | Progress | âŗ | [...] |
39
+
40
+ **Rule:** Use ASCII characters only in PowerShell scripts.
41
+
42
+ ---
43
+
44
+ ## 3. Null Check Patterns
45
+
46
+ ### Always Check Before Access
47
+
48
+ | ❌ Wrong | ✅ Correct |
49
+ |----------|-----------|
50
+ | `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |
51
+ | `$text.Length` | `if ($text) { $text.Length }` |
52
+
53
+ ---
54
+
55
+ ## 4. String Interpolation
56
+
57
+ ### Complex Expressions
58
+
59
+ | ❌ Wrong | ✅ Correct |
60
+ |----------|-----------|
61
+ | `"Value: $($obj.prop.sub)"` | Store in variable first |
62
+
63
+ **Pattern:**
64
+ ```
65
+ $value = $obj.prop.sub
66
+ Write-Output "Value: $value"
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 5. Error Handling
72
+
73
+ ### ErrorActionPreference
74
+
75
+ | Value | Use |
76
+ |-------|-----|
77
+ | Stop | Development (fail fast) |
78
+ | Continue | Production scripts |
79
+ | SilentlyContinue | When errors expected |
80
+
81
+ ### Try/Catch Pattern
82
+
83
+ - Don't return inside try block
84
+ - Use finally for cleanup
85
+ - Return after try/catch
86
+
87
+ ---
88
+
89
+ ## 6. File Paths
90
+
91
+ ### Windows Path Rules
92
+
93
+ | Pattern | Use |
94
+ |---------|-----|
95
+ | Literal path | `C:\Users\User\file.txt` |
96
+ | Variable path | `Join-Path $env:USERPROFILE "file.txt"` |
97
+ | Relative | `Join-Path $ScriptDir "data"` |
98
+
99
+ **Rule:** Use Join-Path for cross-platform safety.
100
+
101
+ ---
102
+
103
+ ## 7. Array Operations
104
+
105
+ ### Correct Patterns
106
+
107
+ | Operation | Syntax |
108
+ |-----------|--------|
109
+ | Empty array | `$array = @()` |
110
+ | Add item | `$array += $item` |
111
+ | ArrayList add | `$list.Add($item) | Out-Null` |
112
+
113
+ ---
114
+
115
+ ## 8. JSON Operations
116
+
117
+ ### CRITICAL: Depth Parameter
118
+
119
+ | ❌ Wrong | ✅ Correct |
120
+ |----------|-----------|
121
+ | `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |
122
+
123
+ **Rule:** Always specify `-Depth` for nested objects.
124
+
125
+ ### File Operations
126
+
127
+ | Operation | Pattern |
128
+ |-----------|---------|
129
+ | Read | `Get-Content "file.json" -Raw | ConvertFrom-Json` |
130
+ | Write | `$data | ConvertTo-Json -Depth 10 | Out-File "file.json" -Encoding UTF8` |
131
+
132
+ ---
133
+
134
+ ## 9. Common Errors
135
+
136
+ | Error Message | Cause | Fix |
137
+ |---------------|-------|-----|
138
+ | "parameter 'or'" | Missing parentheses | Wrap cmdlets in () |
139
+ | "Unexpected token" | Unicode character | Use ASCII only |
140
+ | "Cannot find property" | Null object | Check null first |
141
+ | "Cannot convert" | Type mismatch | Use .ToString() |
142
+
143
+ ---
144
+
145
+ ## 10. Script Template
146
+
147
+ ```powershell
148
+ # Strict mode
149
+ Set-StrictMode -Version Latest
150
+ $ErrorActionPreference = "Continue"
151
+
152
+ # Paths
153
+ $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
154
+
155
+ # Main
156
+ try {
157
+ # Logic here
158
+ Write-Output "[OK] Done"
159
+ exit 0
160
+ }
161
+ catch {
162
+ Write-Warning "Error: $_"
163
+ exit 1
164
+ }
165
+ ```
166
+
167
+ ---
168
+
169
+ > **Remember:** PowerShell has unique syntax rules. Parentheses, ASCII-only, and null checks are non-negotiable.