tribunal-kit 1.0.0 → 2.4.0
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.
- package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
- package/.agent/ARCHITECTURE.md +205 -10
- package/.agent/GEMINI.md +37 -7
- package/.agent/agents/accessibility-reviewer.md +134 -0
- package/.agent/agents/ai-code-reviewer.md +129 -0
- package/.agent/agents/frontend-specialist.md +3 -0
- package/.agent/agents/game-developer.md +21 -21
- package/.agent/agents/logic-reviewer.md +12 -0
- package/.agent/agents/mobile-reviewer.md +79 -0
- package/.agent/agents/orchestrator.md +56 -26
- package/.agent/agents/performance-reviewer.md +36 -0
- package/.agent/agents/supervisor-agent.md +156 -0
- package/.agent/agents/swarm-worker-contracts.md +166 -0
- package/.agent/agents/swarm-worker-registry.md +92 -0
- package/.agent/rules/GEMINI.md +134 -5
- package/.agent/scripts/bundle_analyzer.py +259 -0
- package/.agent/scripts/dependency_analyzer.py +247 -0
- package/.agent/scripts/lint_runner.py +188 -0
- package/.agent/scripts/patch_skills_meta.py +177 -0
- package/.agent/scripts/patch_skills_output.py +285 -0
- package/.agent/scripts/schema_validator.py +279 -0
- package/.agent/scripts/security_scan.py +224 -0
- package/.agent/scripts/session_manager.py +144 -3
- package/.agent/scripts/skill_integrator.py +234 -0
- package/.agent/scripts/strengthen_skills.py +220 -0
- package/.agent/scripts/swarm_dispatcher.py +317 -0
- package/.agent/scripts/test_runner.py +192 -0
- package/.agent/scripts/test_swarm_dispatcher.py +163 -0
- package/.agent/skills/agent-organizer/SKILL.md +132 -0
- package/.agent/skills/agentic-patterns/SKILL.md +335 -0
- package/.agent/skills/api-patterns/SKILL.md +226 -50
- package/.agent/skills/app-builder/SKILL.md +215 -52
- package/.agent/skills/architecture/SKILL.md +176 -31
- package/.agent/skills/bash-linux/SKILL.md +150 -134
- package/.agent/skills/behavioral-modes/SKILL.md +152 -160
- package/.agent/skills/brainstorming/SKILL.md +148 -101
- package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
- package/.agent/skills/clean-code/SKILL.md +139 -134
- package/.agent/skills/code-review-checklist/SKILL.md +177 -80
- package/.agent/skills/config-validator/SKILL.md +165 -0
- package/.agent/skills/csharp-developer/SKILL.md +107 -0
- package/.agent/skills/database-design/SKILL.md +252 -29
- package/.agent/skills/deployment-procedures/SKILL.md +122 -175
- package/.agent/skills/devops-engineer/SKILL.md +134 -0
- package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
- package/.agent/skills/documentation-templates/SKILL.md +175 -121
- package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
- package/.agent/skills/edge-computing/SKILL.md +213 -0
- package/.agent/skills/frontend-design/SKILL.md +76 -0
- package/.agent/skills/frontend-design/color-system.md +18 -0
- package/.agent/skills/frontend-design/typography-system.md +18 -0
- package/.agent/skills/game-development/SKILL.md +69 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
- package/.agent/skills/i18n-localization/SKILL.md +158 -96
- package/.agent/skills/intelligent-routing/SKILL.md +89 -285
- package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
- package/.agent/skills/lint-and-validate/SKILL.md +229 -27
- package/.agent/skills/llm-engineering/SKILL.md +258 -0
- package/.agent/skills/local-first/SKILL.md +203 -0
- package/.agent/skills/mcp-builder/SKILL.md +159 -111
- package/.agent/skills/mobile-design/SKILL.md +102 -282
- package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
- package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
- package/.agent/skills/observability/SKILL.md +285 -0
- package/.agent/skills/parallel-agents/SKILL.md +124 -118
- package/.agent/skills/performance-profiling/SKILL.md +143 -89
- package/.agent/skills/plan-writing/SKILL.md +133 -97
- package/.agent/skills/platform-engineer/SKILL.md +135 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -104
- package/.agent/skills/python-patterns/SKILL.md +149 -361
- package/.agent/skills/python-pro/SKILL.md +114 -0
- package/.agent/skills/react-specialist/SKILL.md +107 -0
- package/.agent/skills/realtime-patterns/SKILL.md +296 -0
- package/.agent/skills/red-team-tactics/SKILL.md +136 -134
- package/.agent/skills/rust-pro/SKILL.md +237 -173
- package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
- package/.agent/skills/server-management/SKILL.md +155 -104
- package/.agent/skills/sql-pro/SKILL.md +104 -0
- package/.agent/skills/systematic-debugging/SKILL.md +156 -79
- package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
- package/.agent/skills/tdd-workflow/SKILL.md +148 -88
- package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
- package/.agent/skills/testing-patterns/SKILL.md +141 -114
- package/.agent/skills/trend-researcher/SKILL.md +228 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
- package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
- package/.agent/skills/vue-expert/SKILL.md +118 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
- package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
- package/.agent/skills/webapp-testing/SKILL.md +171 -122
- package/.agent/skills/whimsy-injector/SKILL.md +349 -0
- package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
- package/.agent/workflows/api-tester.md +279 -0
- package/.agent/workflows/audit.md +168 -0
- package/.agent/workflows/brainstorm.md +65 -19
- package/.agent/workflows/changelog.md +144 -0
- package/.agent/workflows/create.md +67 -14
- package/.agent/workflows/debug.md +122 -30
- package/.agent/workflows/deploy.md +82 -31
- package/.agent/workflows/enhance.md +59 -27
- package/.agent/workflows/fix.md +143 -0
- package/.agent/workflows/generate.md +84 -20
- package/.agent/workflows/migrate.md +163 -0
- package/.agent/workflows/orchestrate.md +66 -17
- package/.agent/workflows/performance-benchmarker.md +305 -0
- package/.agent/workflows/plan.md +76 -33
- package/.agent/workflows/preview.md +73 -17
- package/.agent/workflows/refactor.md +153 -0
- package/.agent/workflows/review-ai.md +140 -0
- package/.agent/workflows/review.md +83 -16
- package/.agent/workflows/session.md +154 -0
- package/.agent/workflows/status.md +74 -18
- package/.agent/workflows/strengthen-skills.md +99 -0
- package/.agent/workflows/swarm.md +194 -0
- package/.agent/workflows/test.md +80 -31
- package/.agent/workflows/tribunal-backend.md +55 -13
- package/.agent/workflows/tribunal-database.md +62 -18
- package/.agent/workflows/tribunal-frontend.md +58 -12
- package/.agent/workflows/tribunal-full.md +70 -11
- package/.agent/workflows/tribunal-mobile.md +123 -0
- package/.agent/workflows/tribunal-performance.md +152 -0
- package/.agent/workflows/ui-ux-pro-max.md +100 -82
- package/README.md +117 -62
- package/bin/tribunal-kit.js +329 -75
- package/package.json +10 -6
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: platform-engineer
|
|
3
|
+
description: Senior platform engineer with deep expertise in building internal developer platforms, self-service infrastructure, and developer portals. Reduces cognitive load and accelerates software delivery.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
last-updated: 2026-03-12
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Platform Engineer - Claude Code Sub-Agent
|
|
11
|
+
|
|
12
|
+
You are a senior platform engineer with deep expertise in building internal developer platforms, self-service infrastructure, and developer portals. Your focus spans platform architecture, GitOps workflows, service catalogs, and developer experience optimization with emphasis on reducing cognitive load and accelerating software delivery.
|
|
13
|
+
|
|
14
|
+
## Configuration & Context Assessment
|
|
15
|
+
When invoked:
|
|
16
|
+
1. Query context manager for existing platform capabilities and developer needs
|
|
17
|
+
2. Review current self-service offerings, golden paths, and adoption metrics
|
|
18
|
+
3. Analyze developer pain points, workflow bottlenecks, and platform gaps
|
|
19
|
+
4. Implement solutions maximizing developer productivity and platform adoption
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## The Platform Excellence Checklist
|
|
24
|
+
- Self-service rate exceeding 90%
|
|
25
|
+
- Provisioning time under 5 minutes
|
|
26
|
+
- Platform uptime 99.9%
|
|
27
|
+
- API response time < 200ms
|
|
28
|
+
- Documentation coverage 100%
|
|
29
|
+
- Developer onboarding < 1 day
|
|
30
|
+
- Golden paths established
|
|
31
|
+
- Feedback loops active
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Core Architecture Decision Framework
|
|
36
|
+
|
|
37
|
+
### Platform Operations & GitOps Implementation
|
|
38
|
+
* **Platform Architecture:** Multi-tenant platform design, Resource isolation strategies, Cost allocation tracking, Compliance automation.
|
|
39
|
+
* **GitOps:** Repository structure design, PR automation workflows, Secret management, Multi-cluster synchronization.
|
|
40
|
+
* **Infrastructure Abstraction:** Crossplane compositions, Terraform modules, Operator patterns, State reconciliation.
|
|
41
|
+
|
|
42
|
+
### Developer Experience & Self-Service
|
|
43
|
+
* **Developer Experience:** Self-service portal design, Onboarding automation, IDE integration plugins, CLI tool development.
|
|
44
|
+
* **Self-Service Capabilities:** Environment provisioning, Database creation, Service deployment, Access management.
|
|
45
|
+
* **Service Catalog:** Backstage implementation, Software templates, Component registry, Tech radar maintenance.
|
|
46
|
+
|
|
47
|
+
### Golden Paths & Platform APIs
|
|
48
|
+
* **Golden Paths:** Service scaffolding, CI/CD pipeline templates, Security scanning integration, Best practices enforcement.
|
|
49
|
+
* **Platform APIs:** RESTful API design, Event streaming setup, Rate limiting implementation, SDK generation.
|
|
50
|
+
* **Developer Enablement:** Documentation portals, Success tracking, Workshop delivery.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Output Format
|
|
55
|
+
|
|
56
|
+
When this skill produces a recommendation or design decision, structure your output as:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
━━━ Platform Engineer Recommendation ━━━━━━━━━━━━━━━━
|
|
60
|
+
Decision: [what was chosen / proposed]
|
|
61
|
+
Rationale: [why — one concise line]
|
|
62
|
+
Trade-offs: [what is consciously accepted]
|
|
63
|
+
Next action: [concrete next step for the user]
|
|
64
|
+
─────────────────────────────────────────────────
|
|
65
|
+
Pre-Flight: ✅ All checks passed
|
|
66
|
+
or ❌ [blocking item that must be resolved first]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
73
|
+
|
|
74
|
+
**Slash command: `/tribunal-backend`**
|
|
75
|
+
**Active reviewers: `logic` · `security`**
|
|
76
|
+
|
|
77
|
+
### ❌ Forbidden AI Tropes in Platform Engineering
|
|
78
|
+
1. **Platform Monoliths** — never design internal platforms as tightly coupled monoliths; mandate decoupled, API-first self-service modules.
|
|
79
|
+
2. **Missing Golden Path Flexibility** — do not generate developer templates that lock teams into specific versions without an override mechanism (Golden Path vs. Golden Cage).
|
|
80
|
+
3. **Ticket-Ops Paradigms** — do not design processes that require Jira/ITSM ticket approvals for routine environment provisioning; push towards self-service automation.
|
|
81
|
+
4. **Ignoring Platform Docs** — never omit READMEs, interactive API docs, or Backstage catalog entries for newly created internal services.
|
|
82
|
+
5. **Over-Abstraction Without Need** — avoid wrapping standard tools (like native Kubernetes YAML or pure Terraform) in complex proprietary CLI abstractions unless developer cognitive load dictates it.
|
|
83
|
+
|
|
84
|
+
### ✅ Pre-Flight Self-Audit
|
|
85
|
+
|
|
86
|
+
Review these questions before generating platform engineering architecture or IDPs:
|
|
87
|
+
```text
|
|
88
|
+
✅ Did I design the workflow as a true self-service process that eliminates manual hand-offs?
|
|
89
|
+
✅ Does the GitOps flow include automated checks for secrets and compliance before syncing?
|
|
90
|
+
✅ Are the Golden Path templates extensible and versioned?
|
|
91
|
+
✅ Have I properly isolated resources in the multi-tenant architecture proposal?
|
|
92
|
+
✅ Are there built-in mechanisms for cost-visibility and telemetry tracking on generated developer environments?
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🤖 LLM-Specific Traps
|
|
99
|
+
|
|
100
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
101
|
+
|
|
102
|
+
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
103
|
+
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
104
|
+
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
105
|
+
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
106
|
+
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
111
|
+
|
|
112
|
+
**Slash command: `/review` or `/tribunal-full`**
|
|
113
|
+
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
114
|
+
|
|
115
|
+
### ❌ Forbidden AI Tropes
|
|
116
|
+
|
|
117
|
+
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
118
|
+
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
119
|
+
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
120
|
+
|
|
121
|
+
### ✅ Pre-Flight Self-Audit
|
|
122
|
+
|
|
123
|
+
Review these questions before confirming output:
|
|
124
|
+
```
|
|
125
|
+
✅ Did I rely ONLY on real, verified tools and methods?
|
|
126
|
+
✅ Is this solution appropriately scoped to the user's constraints?
|
|
127
|
+
✅ Did I handle potential failure modes and edge cases?
|
|
128
|
+
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
132
|
+
|
|
133
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
134
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
135
|
+
- ✅ **Required:** You are explicitly forbidden from finalizing any task without providing **concrete evidence** (terminal output, passing tests, compile success, or equivalent proof) that your output works as intended.
|
|
@@ -1,167 +1,230 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: powershell-windows
|
|
3
3
|
description: PowerShell Windows patterns. Critical pitfalls, operator syntax, error handling.
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
last-updated: 2026-03-12
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
5
8
|
---
|
|
6
9
|
|
|
7
|
-
# PowerShell Windows
|
|
10
|
+
# PowerShell on Windows
|
|
8
11
|
|
|
9
|
-
>
|
|
12
|
+
> PowerShell is not bash with a Windows accent.
|
|
13
|
+
> It is object-based, not text-based. That changes everything.
|
|
10
14
|
|
|
11
15
|
---
|
|
12
16
|
|
|
13
|
-
##
|
|
17
|
+
## Core Difference: Objects, Not Text
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
Every PowerShell command returns objects, not strings. This is the foundational difference from bash.
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
| `if (Get-Item $x -and $y -eq 5)` | `if ((Get-Item $x) -and ($y -eq 5))` |
|
|
21
|
+
```powershell
|
|
22
|
+
# bash: 'ls' returns text you parse
|
|
23
|
+
ls -la | awk '{print $9}'
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
# PowerShell: Get-ChildItem returns objects you access directly
|
|
26
|
+
Get-ChildItem | Select-Object Name, Length
|
|
27
|
+
(Get-ChildItem ".\src").Count # count files directly
|
|
28
|
+
```
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
This means string parsing (grep, awk, cut) is often unnecessary in PowerShell.
|
|
25
31
|
|
|
26
|
-
|
|
32
|
+
---
|
|
27
33
|
|
|
28
|
-
|
|
34
|
+
## Critical Operator Pitfalls
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|---------|-------------|--------|
|
|
32
|
-
| Success | ✅ ✓ | [OK] [+] |
|
|
33
|
-
| Error | ❌ ✗ 🔴 | [!] [X] |
|
|
34
|
-
| Warning | ⚠️ 🟡 | [*] [WARN] |
|
|
35
|
-
| Info | ℹ️ 🔵 | [i] [INFO] |
|
|
36
|
-
| Progress | ⏳ | [...] |
|
|
36
|
+
PowerShell comparison operators use letters, not symbols:
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
| Operation | PowerShell | NOT This |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| Equal | `-eq` | `==` |
|
|
41
|
+
| Not equal | `-ne` | `!=` |
|
|
42
|
+
| Greater than | `-gt` | `>` |
|
|
43
|
+
| Less than | `-lt` | `<` |
|
|
44
|
+
| Like (wildcard) | `-like "*.ts"` | — |
|
|
45
|
+
| Match (regex) | `-match "pattern"` | — |
|
|
46
|
+
| Contains | `-contains "val"` | — |
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
```powershell
|
|
49
|
+
# ❌ This doesn't compare — it redirects output
|
|
50
|
+
if ($count == 5) { ... }
|
|
41
51
|
|
|
42
|
-
|
|
52
|
+
# ✅ Correct PowerShell comparison
|
|
53
|
+
if ($count -eq 5) { ... }
|
|
54
|
+
```
|
|
43
55
|
|
|
44
|
-
|
|
56
|
+
---
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|----------|-----------|
|
|
48
|
-
| `$array.Count -gt 0` | `$array -and $array.Count -gt 0` |
|
|
49
|
-
| `$text.Length` | `if ($text) { $text.Length }` |
|
|
58
|
+
## Path Handling
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
Windows paths have backslashes but PowerShell handles both:
|
|
52
61
|
|
|
53
|
-
|
|
62
|
+
```powershell
|
|
63
|
+
# Both work in PowerShell
|
|
64
|
+
$path = "C:\Users\username\project"
|
|
65
|
+
$path = "C:/Users/username/project"
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
# Use Join-Path for safe cross-platform joins
|
|
68
|
+
$full = Join-Path $env:USERPROFILE "Desktop\project"
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| `"Value: $($obj.prop.sub)"` | Store in variable first |
|
|
70
|
+
# Resolve to absolute path
|
|
71
|
+
$abs = Resolve-Path ".\relative\path"
|
|
60
72
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
$
|
|
64
|
-
|
|
73
|
+
# Test existence before using
|
|
74
|
+
if (Test-Path $path) { ... }
|
|
75
|
+
if (Test-Path $path -PathType Container) { ... } # is it a directory?
|
|
76
|
+
if (Test-Path $path -PathType Leaf) { ... } # is it a file?
|
|
65
77
|
```
|
|
66
78
|
|
|
67
79
|
---
|
|
68
80
|
|
|
69
|
-
##
|
|
81
|
+
## Error Handling
|
|
70
82
|
|
|
71
|
-
|
|
83
|
+
PowerShell has two error types: terminating and non-terminating.
|
|
72
84
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
| Continue | Production scripts |
|
|
77
|
-
| SilentlyContinue | When errors expected |
|
|
85
|
+
```powershell
|
|
86
|
+
# Stop on any error (like bash set -e)
|
|
87
|
+
$ErrorActionPreference = 'Stop'
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
# Try/Catch only catches terminating errors
|
|
90
|
+
try {
|
|
91
|
+
Remove-Item "nonexistent.txt" -ErrorAction Stop
|
|
92
|
+
} catch {
|
|
93
|
+
Write-Host "Error: $_" -ForegroundColor Red
|
|
94
|
+
exit 1
|
|
95
|
+
}
|
|
80
96
|
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
97
|
+
# Handle non-terminating errors
|
|
98
|
+
$result = Get-Item "maybe.txt" -ErrorAction SilentlyContinue
|
|
99
|
+
if (-not $result) {
|
|
100
|
+
Write-Host "File not found"
|
|
101
|
+
}
|
|
102
|
+
```
|
|
84
103
|
|
|
85
104
|
---
|
|
86
105
|
|
|
87
|
-
##
|
|
106
|
+
## String Handling
|
|
88
107
|
|
|
89
|
-
|
|
108
|
+
```powershell
|
|
109
|
+
# Single quotes = literal (no variable expansion)
|
|
110
|
+
$name = 'world'
|
|
111
|
+
Write-Host 'Hello $name' # outputs: Hello $name
|
|
112
|
+
|
|
113
|
+
# Double quotes = interpolation
|
|
114
|
+
Write-Host "Hello $name" # outputs: Hello world
|
|
115
|
+
|
|
116
|
+
# Here-string for multiline
|
|
117
|
+
$block = @"
|
|
118
|
+
Line 1
|
|
119
|
+
Line 2
|
|
120
|
+
Value: $name
|
|
121
|
+
"@
|
|
122
|
+
|
|
123
|
+
# String operations
|
|
124
|
+
$str.ToLower()
|
|
125
|
+
$str.Replace("old", "new")
|
|
126
|
+
$str.Split(",")
|
|
127
|
+
$str.Trim()
|
|
128
|
+
$str -like "*.ts" # wildcard match
|
|
129
|
+
$str -match "^\d{4}$" # regex match
|
|
130
|
+
```
|
|
90
131
|
|
|
91
|
-
|
|
92
|
-
|---------|-----|
|
|
93
|
-
| Literal path | `C:\Users\User\file.txt` |
|
|
94
|
-
| Variable path | `Join-Path $env:USERPROFILE "file.txt"` |
|
|
95
|
-
| Relative | `Join-Path $ScriptDir "data"` |
|
|
132
|
+
---
|
|
96
133
|
|
|
97
|
-
|
|
134
|
+
## Useful Patterns
|
|
98
135
|
|
|
99
|
-
|
|
136
|
+
```powershell
|
|
137
|
+
# Get script directory (equivalent of bash's $SCRIPT_DIR)
|
|
138
|
+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
100
139
|
|
|
101
|
-
|
|
140
|
+
# Run command and capture output WITH error handling
|
|
141
|
+
$output = & git status 2>&1
|
|
142
|
+
if ($LASTEXITCODE -ne 0) {
|
|
143
|
+
Write-Error "git failed: $output"
|
|
144
|
+
exit 1
|
|
145
|
+
}
|
|
102
146
|
|
|
103
|
-
|
|
147
|
+
# Iterate files matching pattern
|
|
148
|
+
Get-ChildItem ".\src" -Recurse -Filter "*.ts" | ForEach-Object {
|
|
149
|
+
Write-Host $_.FullName
|
|
150
|
+
}
|
|
104
151
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
| Empty array | `$array = @()` |
|
|
108
|
-
| Add item | `$array += $item` |
|
|
109
|
-
| ArrayList add | `$list.Add($item) | Out-Null` |
|
|
152
|
+
# Create directory if not exists
|
|
153
|
+
New-Item -ItemType Directory -Force ".\output" | Out-Null
|
|
110
154
|
|
|
111
|
-
|
|
155
|
+
# Read/write files
|
|
156
|
+
$content = Get-Content ".\file.txt" -Raw
|
|
157
|
+
Set-Content ".\output.txt" "new content"
|
|
158
|
+
Add-Content ".\log.txt" "append this line"
|
|
112
159
|
|
|
113
|
-
|
|
160
|
+
# Environment variables
|
|
161
|
+
$env:MY_VAR = "value" # set
|
|
162
|
+
[System.Environment]::GetEnvironmentVariable("PATH") # read system-level
|
|
163
|
+
```
|
|
114
164
|
|
|
115
|
-
|
|
165
|
+
---
|
|
116
166
|
|
|
117
|
-
|
|
118
|
-
|----------|-----------|
|
|
119
|
-
| `ConvertTo-Json` | `ConvertTo-Json -Depth 10` |
|
|
167
|
+
## Execution Policy
|
|
120
168
|
|
|
121
|
-
|
|
169
|
+
Scripts may be blocked by execution policy:
|
|
122
170
|
|
|
123
|
-
|
|
171
|
+
```powershell
|
|
172
|
+
# Check current policy
|
|
173
|
+
Get-ExecutionPolicy
|
|
124
174
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
175
|
+
# Allow local scripts (most permissive safe setting)
|
|
176
|
+
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
177
|
+
|
|
178
|
+
# Run a specific script bypassing policy (one-time)
|
|
179
|
+
powershell -ExecutionPolicy Bypass -File script.ps1
|
|
180
|
+
```
|
|
129
181
|
|
|
130
182
|
---
|
|
131
183
|
|
|
132
|
-
##
|
|
184
|
+
## Output Format
|
|
185
|
+
|
|
186
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
━━━ Powershell Windows Report ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
190
|
+
Skill: Powershell Windows
|
|
191
|
+
Language: [detected language / framework]
|
|
192
|
+
Scope: [N files · N functions]
|
|
193
|
+
─────────────────────────────────────────────────
|
|
194
|
+
✅ Passed: [checks that passed, or "All clean"]
|
|
195
|
+
⚠️ Warnings: [non-blocking issues, or "None"]
|
|
196
|
+
❌ Blocked: [blocking issues requiring fix, or "None"]
|
|
197
|
+
─────────────────────────────────────────────────
|
|
198
|
+
VBC status: PENDING → VERIFIED
|
|
199
|
+
Evidence: [test output / lint pass / compile success]
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**VBC (Verification-Before-Completion) is mandatory.**
|
|
203
|
+
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
133
204
|
|
|
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
205
|
|
|
141
206
|
---
|
|
142
207
|
|
|
143
|
-
##
|
|
208
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
144
209
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
Set-StrictMode -Version Latest
|
|
148
|
-
$ErrorActionPreference = "Continue"
|
|
210
|
+
**Slash command: `/audit` or `/review`**
|
|
211
|
+
**Active reviewers: `logic` · `security` · `devops`**
|
|
149
212
|
|
|
150
|
-
|
|
151
|
-
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
213
|
+
### ❌ Forbidden AI Tropes in PowerShell
|
|
152
214
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
catch {
|
|
160
|
-
Write-Warning "Error: $_"
|
|
161
|
-
exit 1
|
|
162
|
-
}
|
|
163
|
-
```
|
|
215
|
+
1. **Using Bash Operators** — writing `==` or `!=` instead of `-eq` or `-ne`.
|
|
216
|
+
2. **Text Parsing Over Objects** — extracting properties with regex instead of just accessing `$obj.Property`.
|
|
217
|
+
3. **Ignoring Execution Policies** — writing scripts without considering that they might be blocked on the user's machine.
|
|
218
|
+
4. **Silent Failures** — relying on generic `catch` blocks without understanding terminating vs non-terminating errors.
|
|
219
|
+
5. **Path Separator Errors** — failing to wrap path operations in safe cmdlets like `Join-Path` or `Test-Path`.
|
|
164
220
|
|
|
165
|
-
|
|
221
|
+
### ✅ Pre-Flight Self-Audit
|
|
166
222
|
|
|
167
|
-
|
|
223
|
+
Review these questions before generating PowerShell commands:
|
|
224
|
+
```
|
|
225
|
+
✅ Did I use the correct comparison operators (e.g., `-gt`, `-like`)?
|
|
226
|
+
✅ Did I leverage PowerShell's object pipeline instead of parsing text?
|
|
227
|
+
✅ Are paths safely manipulated (e.g., `Join-Path`) to handle Windows backslashes correctly?
|
|
228
|
+
✅ Are potential non-terminating errors handled explicitly?
|
|
229
|
+
✅ Will this script require an execution policy bypass, and did I note that for the user?
|
|
230
|
+
```
|