tribunal-kit 1.0.0 → 2.4.2

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 (127) hide show
  1. package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
  2. package/.agent/ARCHITECTURE.md +205 -10
  3. package/.agent/GEMINI.md +37 -7
  4. package/.agent/agents/accessibility-reviewer.md +134 -0
  5. package/.agent/agents/ai-code-reviewer.md +129 -0
  6. package/.agent/agents/frontend-specialist.md +3 -0
  7. package/.agent/agents/game-developer.md +21 -21
  8. package/.agent/agents/logic-reviewer.md +12 -0
  9. package/.agent/agents/mobile-reviewer.md +79 -0
  10. package/.agent/agents/orchestrator.md +56 -26
  11. package/.agent/agents/performance-reviewer.md +36 -0
  12. package/.agent/agents/supervisor-agent.md +156 -0
  13. package/.agent/agents/swarm-worker-contracts.md +166 -0
  14. package/.agent/agents/swarm-worker-registry.md +92 -0
  15. package/.agent/rules/GEMINI.md +134 -5
  16. package/.agent/scripts/bundle_analyzer.py +259 -0
  17. package/.agent/scripts/dependency_analyzer.py +247 -0
  18. package/.agent/scripts/lint_runner.py +188 -0
  19. package/.agent/scripts/patch_skills_meta.py +177 -0
  20. package/.agent/scripts/patch_skills_output.py +285 -0
  21. package/.agent/scripts/schema_validator.py +279 -0
  22. package/.agent/scripts/security_scan.py +224 -0
  23. package/.agent/scripts/session_manager.py +144 -3
  24. package/.agent/scripts/skill_integrator.py +234 -0
  25. package/.agent/scripts/strengthen_skills.py +220 -0
  26. package/.agent/scripts/swarm_dispatcher.py +317 -0
  27. package/.agent/scripts/test_runner.py +192 -0
  28. package/.agent/scripts/test_swarm_dispatcher.py +163 -0
  29. package/.agent/skills/agent-organizer/SKILL.md +132 -0
  30. package/.agent/skills/agentic-patterns/SKILL.md +335 -0
  31. package/.agent/skills/api-patterns/SKILL.md +226 -50
  32. package/.agent/skills/app-builder/SKILL.md +215 -52
  33. package/.agent/skills/architecture/SKILL.md +176 -31
  34. package/.agent/skills/bash-linux/SKILL.md +150 -134
  35. package/.agent/skills/behavioral-modes/SKILL.md +152 -160
  36. package/.agent/skills/brainstorming/SKILL.md +148 -101
  37. package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
  38. package/.agent/skills/clean-code/SKILL.md +139 -134
  39. package/.agent/skills/code-review-checklist/SKILL.md +177 -80
  40. package/.agent/skills/config-validator/SKILL.md +165 -0
  41. package/.agent/skills/csharp-developer/SKILL.md +107 -0
  42. package/.agent/skills/database-design/SKILL.md +252 -29
  43. package/.agent/skills/deployment-procedures/SKILL.md +122 -175
  44. package/.agent/skills/devops-engineer/SKILL.md +134 -0
  45. package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
  46. package/.agent/skills/documentation-templates/SKILL.md +175 -121
  47. package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
  48. package/.agent/skills/edge-computing/SKILL.md +213 -0
  49. package/.agent/skills/frontend-design/SKILL.md +76 -0
  50. package/.agent/skills/frontend-design/color-system.md +18 -0
  51. package/.agent/skills/frontend-design/typography-system.md +18 -0
  52. package/.agent/skills/game-development/SKILL.md +69 -0
  53. package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
  54. package/.agent/skills/github-operations/SKILL.md +354 -0
  55. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  56. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  57. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  58. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  59. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  60. package/.agent/skills/local-first/SKILL.md +203 -0
  61. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  62. package/.agent/skills/mobile-design/SKILL.md +102 -282
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  65. package/.agent/skills/observability/SKILL.md +285 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  67. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  68. package/.agent/skills/plan-writing/SKILL.md +133 -97
  69. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  70. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  71. package/.agent/skills/python-patterns/SKILL.md +149 -361
  72. package/.agent/skills/python-pro/SKILL.md +114 -0
  73. package/.agent/skills/react-specialist/SKILL.md +107 -0
  74. package/.agent/skills/readme-builder/SKILL.md +270 -0
  75. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  76. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  77. package/.agent/skills/rust-pro/SKILL.md +237 -173
  78. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  79. package/.agent/skills/server-management/SKILL.md +155 -104
  80. package/.agent/skills/sql-pro/SKILL.md +104 -0
  81. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  82. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  83. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  84. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  85. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  86. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  87. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  88. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  89. package/.agent/skills/vue-expert/SKILL.md +118 -0
  90. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  91. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  92. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  93. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  95. package/.agent/workflows/api-tester.md +279 -0
  96. package/.agent/workflows/audit.md +168 -0
  97. package/.agent/workflows/brainstorm.md +65 -19
  98. package/.agent/workflows/changelog.md +144 -0
  99. package/.agent/workflows/create.md +67 -14
  100. package/.agent/workflows/debug.md +122 -30
  101. package/.agent/workflows/deploy.md +82 -31
  102. package/.agent/workflows/enhance.md +59 -27
  103. package/.agent/workflows/fix.md +143 -0
  104. package/.agent/workflows/generate.md +84 -20
  105. package/.agent/workflows/migrate.md +163 -0
  106. package/.agent/workflows/orchestrate.md +66 -17
  107. package/.agent/workflows/performance-benchmarker.md +305 -0
  108. package/.agent/workflows/plan.md +76 -33
  109. package/.agent/workflows/preview.md +73 -17
  110. package/.agent/workflows/refactor.md +153 -0
  111. package/.agent/workflows/review-ai.md +140 -0
  112. package/.agent/workflows/review.md +83 -16
  113. package/.agent/workflows/session.md +154 -0
  114. package/.agent/workflows/status.md +74 -18
  115. package/.agent/workflows/strengthen-skills.md +99 -0
  116. package/.agent/workflows/swarm.md +194 -0
  117. package/.agent/workflows/test.md +80 -31
  118. package/.agent/workflows/tribunal-backend.md +55 -13
  119. package/.agent/workflows/tribunal-database.md +62 -18
  120. package/.agent/workflows/tribunal-frontend.md +58 -12
  121. package/.agent/workflows/tribunal-full.md +70 -11
  122. package/.agent/workflows/tribunal-mobile.md +123 -0
  123. package/.agent/workflows/tribunal-performance.md +152 -0
  124. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  125. package/README.md +117 -62
  126. package/bin/tribunal-kit.js +542 -288
  127. package/package.json +10 -6
@@ -1,55 +1,200 @@
1
1
  ---
2
2
  name: architecture
3
3
  description: Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design.
4
- allowed-tools: Read, 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
10
  # Architecture Decision Framework
8
11
 
9
- > "Requirements drive architecture. Trade-offs inform decisions. ADRs capture rationale."
12
+ > An architecture decision is only good until the constraints change.
13
+ > Document the decision AND the reasoning — future teams need both.
10
14
 
11
- ## 🎯 Selective Reading Rule
15
+ ---
12
16
 
13
- **Read ONLY files relevant to the request!** Check the content map, find what you need.
17
+ ## When to Use This Skill
14
18
 
15
- | File | Description | When to Read |
16
- |------|-------------|--------------|
17
- | `context-discovery.md` | Questions to ask, project classification | Starting architecture design |
18
- | `trade-off-analysis.md` | ADR templates, trade-off framework | Documenting decisions |
19
- | `pattern-selection.md` | Decision trees, anti-patterns | Choosing patterns |
20
- | `examples.md` | MVP, SaaS, Enterprise examples | Reference implementations |
21
- | `patterns-reference.md` | Quick lookup for patterns | Pattern comparison |
19
+ - A new system, service, or major feature is being designed
20
+ - An existing architecture is being evaluated for scaling, cost, or maintainability problems
21
+ - A team disagrees on technical direction and needs a structured decision process
22
+ - A decision needs to be documented so future engineers understand the "why"
22
23
 
23
24
  ---
24
25
 
25
- ## 🔗 Related Skills
26
+ ## The Decision Process
27
+
28
+ Good architecture decisions follow a sequence. Skipping steps creates decisions that look good in a diagram and fail in production.
29
+
30
+ ### Phase 1 — Understand the Forces
31
+
32
+ Before proposing anything, map what actually constrains the design:
33
+
34
+ ```
35
+ Requirements: What must this system do?
36
+ Quality attributes: Speed, reliability, security, cost, maintainability — rank them
37
+ Constraints: Team size, existing tech, regulatory, budget
38
+ Team context: What does the team already know? What can they operate?
39
+ ```
40
+
41
+ **The trap:** Jumping to technology before understanding quality attributes.
42
+ If the top priority is "cheap to run" — that's a different answer than "sub-100ms response time."
43
+
44
+ ### Phase 2 — Generate Options
45
+
46
+ Produce at least 2 real alternates. "We could do X, or we could not" is not a comparison.
47
+
48
+ For each option document:
49
+ - How it satisfies the top quality attributes
50
+ - Where it falls short
51
+ - Long-term operational cost (not just build cost)
52
+ - Risk to the team given their current knowledge
53
+
54
+ ### Phase 3 — Evaluate Trade-offs
55
+
56
+ Use a table:
57
+
58
+ | Quality Attribute | Option A | Option B | Option C |
59
+ |---|---|---|---|
60
+ | Time to first delivery | ★★★ | ★★ | ★★★★ |
61
+ | Operational complexity | Low | High | Medium |
62
+ | Cost at 10x scale | $ | $$$ | $$ |
63
+
64
+ The option with the most stars doesn't always win. **The one that best fits the top-priority attributes wins.**
26
65
 
27
- | Skill | Use For |
28
- |-------|---------|
29
- | `@[skills/database-design]` | Database schema design |
30
- | `@[skills/api-patterns]` | API design patterns |
31
- | `@[skills/deployment-procedures]` | Deployment architecture |
66
+ ### Phase 4 Document the Decision (ADR)
67
+
68
+ Every significant architecture decision gets an ADR (Architecture Decision Record).
69
+
70
+ ```markdown
71
+ # ADR-NNN: [Short title]
72
+
73
+ ## Status
74
+ Accepted / Proposed / Deprecated / Superseded by ADR-NNN
75
+
76
+ ## Context
77
+ [What situation or problem prompted this decision?]
78
+
79
+ ## Options Considered
80
+ [Brief description of each option]
81
+
82
+ ## Decision
83
+ [What was chosen and why]
84
+
85
+ ## Trade-offs Accepted
86
+ [What downsides are being consciously accepted?]
87
+
88
+ ## Consequences
89
+ [What becomes easier? What becomes harder?]
90
+ ```
32
91
 
33
92
  ---
34
93
 
35
- ## Core Principle
94
+ ## File Index
95
+
96
+ | File | Covers | When to Load |
97
+ |---|---|---|
98
+ | `context-discovery.md` | Questions to map requirements and constraints | Early in design |
99
+ | `pattern-selection.md` | Monolith vs microservices, event-driven, CQRS, etc. | Choosing structural patterns |
100
+ | `patterns-reference.md` | Reference descriptions of common patterns | Evaluating patterns |
101
+ | `trade-off-analysis.md` | Scoring and comparison frameworks | Decision phase |
102
+ | `examples.md` | Worked architecture examples | Concrete reference |
36
103
 
37
- **"Simplicity is the ultimate sophistication."**
104
+ ---
105
+
106
+ ## Anti-Patterns in Architecture Work
38
107
 
39
- - Start simple
40
- - Add complexity ONLY when proven necessary
41
- - You can always add patterns later
42
- - Removing complexity is MUCH harder than adding it
108
+ | Pattern | Problem |
109
+ |---|---|
110
+ | Resume-driven architecture | Choosing tech because it's interesting, not because it fits |
111
+ | Premature microservices | Splitting a monolith before the domain boundaries are known |
112
+ | Ignoring operational cost | Systems that are brilliant to build and terrible to run |
113
+ | No ADR | Decision rationale lost — future engineers repeat the same debates |
114
+ | One option considered | Not an evaluation, just a justification |
43
115
 
44
116
  ---
45
117
 
46
- ## Validation Checklist
118
+ ## Output Format
119
+
120
+ When this skill produces a recommendation or design decision, structure your output as:
121
+
122
+ ```
123
+ ━━━ Architecture Recommendation ━━━━━━━━━━━━━━━━
124
+ Decision: [what was chosen / proposed]
125
+ Rationale: [why — one concise line]
126
+ Trade-offs: [what is consciously accepted]
127
+ Next action: [concrete next step for the user]
128
+ ─────────────────────────────────────────────────
129
+ Pre-Flight: ✅ All checks passed
130
+ or ❌ [blocking item that must be resolved first]
131
+ ```
132
+
133
+
134
+ ---
135
+
136
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
137
+
138
+ **Slash command: `/brainstorm` or `/plan`**
139
+ **Active reviewers: `project-planner` · `logic-reviewer`**
140
+
141
+ ### ❌ Forbidden AI Tropes in Architecture
142
+
143
+ 1. **Defaulting to Microservices** — never recommend Microservices for a new or small project without explicit scale requirements. Monolith first.
144
+ 2. **Over-engineering with CQRS/Event Sourcing** — do not suggest complex distributed patterns unless the domain demands it.
145
+ 3. **Assuming AWS/Cloud Provider** — ask where the user deploys, do not hallucinate AWS services as the default solution.
146
+ 4. **Ignoring Operational Cost** — do not recommend architectures that require dedicated DevOps teams if the user is a solo developer.
147
+ 5. **Failing to Document Trade-offs** — every architecture decision has a downside. Never present a "perfect" solution.
148
+
149
+ ### ✅ Pre-Flight Self-Audit
150
+
151
+ Review these questions before proposing an architecture:
152
+ ```
153
+ ✅ Did I start with the simplest architecture that satisfies the constraints?
154
+ ✅ Did I explicitly document the downsides (cost, complexity, maintainability) of my proposal?
155
+ ✅ Is my proposal grounded in the user's actual constraints (team size, budget, timeline)?
156
+ ✅ Did I ask about the read/write ratio and data shape before choosing a database?
157
+ ✅ Is my solution resilient to partial failures?
158
+ ```
159
+
160
+
161
+ ---
162
+
163
+ ## 🤖 LLM-Specific Traps
164
+
165
+ AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
166
+
167
+ 1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
168
+ 2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
169
+ 3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
170
+ 4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
171
+ 5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
172
+
173
+ ---
174
+
175
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
176
+
177
+ **Slash command: `/review` or `/tribunal-full`**
178
+ **Active reviewers: `logic-reviewer` · `security-auditor`**
179
+
180
+ ### ❌ Forbidden AI Tropes
181
+
182
+ 1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
183
+ 2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
184
+ 3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
185
+
186
+ ### ✅ Pre-Flight Self-Audit
187
+
188
+ Review these questions before confirming output:
189
+ ```
190
+ ✅ Did I rely ONLY on real, verified tools and methods?
191
+ ✅ Is this solution appropriately scoped to the user's constraints?
192
+ ✅ Did I handle potential failure modes and edge cases?
193
+ ✅ Have I avoided generic boilerplate that doesn't add value?
194
+ ```
47
195
 
48
- Before finalizing architecture:
196
+ ### 🛑 Verification-Before-Completion (VBC) Protocol
49
197
 
50
- - [ ] Requirements clearly understood
51
- - [ ] Constraints identified
52
- - [ ] Each decision has trade-off analysis
53
- - [ ] Simpler alternatives considered
54
- - [ ] ADRs written for significant decisions
55
- - [ ] Team expertise matches chosen patterns
198
+ **CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
199
+ - **Forbidden:** Declaring a task complete because the output "looks correct."
200
+ - **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,199 +1,215 @@
1
1
  ---
2
2
  name: bash-linux
3
3
  description: Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
4
- allowed-tools: Read, Write, Edit, Glob, Grep, Bash
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
- # Bash Linux Patterns
10
+ # Bash & Linux Shell Patterns
8
11
 
9
- > Essential patterns for Bash on Linux/macOS.
12
+ > The terminal is a tool, not a magic box. Understand what a command does before you run it with elevated privileges.
10
13
 
11
14
  ---
12
15
 
13
- ## 1. Operator Syntax
16
+ ## Ground Rules
14
17
 
15
- ### Chaining Commands
16
-
17
- | Operator | Meaning | Example |
18
- |----------|---------|---------|
19
- | `;` | Run sequentially | `cmd1; cmd2` |
20
- | `&&` | Run if previous succeeded | `npm install && npm run dev` |
21
- | `\|\|` | Run if previous failed | `npm test \|\| echo "Tests failed"` |
22
- | `\|` | Pipe output | `ls \| grep ".js"` |
18
+ 1. **Never suggest `sudo` without explaining why it's necessary**
19
+ 2. **Test destructive commands with `--dry-run` or `echo` first**
20
+ 3. **`rm -rf` on a variable that might be empty = disaster** — guard it
21
+ 4. **Pipe chains fail silently unless you use `set -euo pipefail`**
23
22
 
24
23
  ---
25
24
 
26
- ## 2. File Operations
27
-
28
- ### Essential Commands
25
+ ## Essential Patterns
29
26
 
30
- | Task | Command |
31
- |------|---------|
32
- | List all | `ls -la` |
33
- | Find files | `find . -name "*.js" -type f` |
34
- | File content | `cat file.txt` |
35
- | First N lines | `head -n 20 file.txt` |
36
- | Last N lines | `tail -n 20 file.txt` |
37
- | Follow log | `tail -f log.txt` |
38
- | Search in files | `grep -r "pattern" --include="*.js"` |
39
- | File size | `du -sh *` |
40
- | Disk usage | `df -h` |
41
-
42
- ---
27
+ ### Safe Script Header
43
28
 
44
- ## 3. Process Management
29
+ Every shell script should start with:
45
30
 
46
- | Task | Command |
47
- |------|---------|
48
- | List processes | `ps aux` |
49
- | Find by name | `ps aux \| grep node` |
50
- | Kill by PID | `kill -9 <PID>` |
51
- | Find port user | `lsof -i :3000` |
52
- | Kill port | `kill -9 $(lsof -t -i :3000)` |
53
- | Background | `npm run dev &` |
54
- | Jobs | `jobs -l` |
55
- | Bring to front | `fg %1` |
31
+ ```bash
32
+ #!/usr/bin/env bash
33
+ set -euo pipefail
34
+ IFS=$'\n\t'
35
+ ```
56
36
 
57
- ---
37
+ - `set -e` — exit on any error
38
+ - `set -u` — exit on undefined variable
39
+ - `set -o pipefail` — fail if any command in a pipe fails
40
+ - `IFS` — safer word splitting
58
41
 
59
- ## 4. Text Processing
42
+ ### Variable Safety
60
43
 
61
- ### Core Tools
44
+ ```bash
45
+ # ❌ Unsafe — if DIR is empty, this deletes /
46
+ rm -rf "$DIR/"
62
47
 
63
- | Tool | Purpose | Example |
64
- |------|---------|---------|
65
- | `grep` | Search | `grep -rn "TODO" src/` |
66
- | `sed` | Replace | `sed -i 's/old/new/g' file.txt` |
67
- | `awk` | Extract columns | `awk '{print $1}' file.txt` |
68
- | `cut` | Cut fields | `cut -d',' -f1 data.csv` |
69
- | `sort` | Sort lines | `sort -u file.txt` |
70
- | `uniq` | Unique lines | `sort file.txt \| uniq -c` |
71
- | `wc` | Count | `wc -l file.txt` |
48
+ # Safe guard before destructive operation
49
+ if [[ -z "$DIR" ]]; then
50
+ echo "Error: DIR is not set" >&2
51
+ exit 1
52
+ fi
53
+ rm -rf "$DIR/"
54
+ ```
72
55
 
73
- ---
56
+ ### Testing Conditions
74
57
 
75
- ## 5. Environment Variables
58
+ ```bash
59
+ # File/directory checks
60
+ [[ -f "$file" ]] # exists and is a regular file
61
+ [[ -d "$dir" ]] # exists and is a directory
62
+ [[ -z "$var" ]] # string is empty
63
+ [[ -n "$var" ]] # string is not empty
64
+
65
+ # Numeric comparison (use (( )) for integers)
66
+ (( count > 0 ))
67
+ (( $? == 0 ))
68
+ ```
76
69
 
77
- | Task | Command |
78
- |------|---------|
79
- | View all | `env` or `printenv` |
80
- | View one | `echo $PATH` |
81
- | Set temporary | `export VAR="value"` |
82
- | Set in script | `VAR="value" command` |
83
- | Add to PATH | `export PATH="$PATH:/new/path"` |
70
+ ### Error Handling
84
71
 
85
- ---
72
+ ```bash
73
+ # Trap errors and print context
74
+ trap 'echo "Error on line $LINENO" >&2' ERR
86
75
 
87
- ## 6. Network
76
+ # Run a command and handle failure explicitly
77
+ if ! command_that_might_fail; then
78
+ echo "Command failed — aborting" >&2
79
+ exit 1
80
+ fi
88
81
 
89
- | Task | Command |
90
- |------|---------|
91
- | Download | `curl -O https://example.com/file` |
92
- | API request | `curl -X GET https://api.example.com` |
93
- | POST JSON | `curl -X POST -H "Content-Type: application/json" -d '{"key":"value"}' URL` |
94
- | Check port | `nc -zv localhost 3000` |
95
- | Network info | `ifconfig` or `ip addr` |
82
+ # Or with ||
83
+ do_something || { echo "Failed"; exit 1; }
84
+ ```
96
85
 
97
86
  ---
98
87
 
99
- ## 7. Script Template
88
+ ## Common Operations
89
+
90
+ ### Find Files
100
91
 
101
92
  ```bash
102
- #!/bin/bash
103
- set -euo pipefail # Exit on error, undefined var, pipe fail
93
+ # Files modified in last 24h
94
+ find . -mtime -1 -type f
104
95
 
105
- # Colors (optional)
106
- RED='\033[0;31m'
107
- GREEN='\033[0;32m'
108
- NC='\033[0m'
96
+ # Files matching pattern, excluding directories
97
+ find . -name "*.log" -not -path "*/node_modules/*"
109
98
 
110
- # Script directory
111
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
99
+ # Search contents
100
+ grep -r "pattern" . --include="*.ts" -l # list files
101
+ grep -r "pattern" . --include="*.ts" -n # with line numbers
102
+ ```
112
103
 
113
- # Functions
114
- log_info() { echo -e "${GREEN}[INFO]${NC} $1"; }
115
- log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
104
+ ### Process & Resource Management
116
105
 
117
- # Main
118
- main() {
119
- log_info "Starting..."
120
- # Your logic here
121
- log_info "Done!"
122
- }
106
+ ```bash
107
+ # Find process using a port
108
+ lsof -i :3000
109
+ ss -tlnp | grep :3000 # on Linux
123
110
 
124
- main "$@"
111
+ # Kill by port
112
+ kill -9 $(lsof -ti :3000)
113
+
114
+ # Background + disown
115
+ long_running_command &
116
+ disown $!
125
117
  ```
126
118
 
127
- ---
119
+ ### Text Processing Pipeline
128
120
 
129
- ## 8. Common Patterns
121
+ ```bash
122
+ # Count occurrences
123
+ cat file.log | grep "ERROR" | wc -l
130
124
 
131
- ### Check if command exists
125
+ # Extract column from CSV
126
+ cut -d',' -f2 data.csv
132
127
 
133
- ```bash
134
- if command -v node &> /dev/null; then
135
- echo "Node is installed"
136
- fi
128
+ # Unique sorted values
129
+ sort file.txt | uniq -c | sort -rn
137
130
  ```
138
131
 
139
- ### Default variable value
132
+ ---
133
+
134
+ ## Script Structure Template
140
135
 
141
136
  ```bash
142
- NAME=${1:-"default_value"}
143
- ```
137
+ #!/usr/bin/env bash
138
+ set -euo pipefail
144
139
 
145
- ### Read file line by line
140
+ # ── Config ──────────────────────────────
141
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
142
+ TARGET="${1:-}"
146
143
 
147
- ```bash
148
- while IFS= read -r line; do
149
- echo "$line"
150
- done < file.txt
151
- ```
144
+ # ── Validate ────────────────────────────
145
+ if [[ -z "$TARGET" ]]; then
146
+ echo "Usage: $(basename "$0") <target>" >&2
147
+ exit 1
148
+ fi
152
149
 
153
- ### Loop over files
150
+ # ── Main ────────────────────────────────
151
+ main() {
152
+ echo "Processing: $TARGET"
153
+ # ... logic here
154
+ }
154
155
 
155
- ```bash
156
- for file in *.js; do
157
- echo "Processing $file"
158
- done
156
+ main "$@"
159
157
  ```
160
158
 
161
159
  ---
162
160
 
163
- ## 9. Differences from PowerShell
161
+ ## Platform Notes
164
162
 
165
- | Task | PowerShell | Bash |
166
- |------|------------|------|
167
- | List files | `Get-ChildItem` | `ls -la` |
168
- | Find files | `Get-ChildItem -Recurse` | `find . -type f` |
169
- | Environment | `$env:VAR` | `$VAR` |
170
- | String concat | `"$a$b"` | `"$a$b"` (same) |
171
- | Null check | `if ($x)` | `if [ -n "$x" ]` |
172
- | Pipeline | Object-based | Text-based |
163
+ - `date` syntax differs between macOS BSD and Linux GNU — use `python3 -c "..."` for portable date math
164
+ - `sed -i` needs an empty string argument on macOS: `sed -i '' 's/old/new/' file`
165
+ - Prefer `#!/usr/bin/env bash` over `#!/bin/bash` for portability
173
166
 
174
167
  ---
175
168
 
176
- ## 10. Error Handling
169
+ ## Output Format
177
170
 
178
- ### Set options
171
+ When this skill produces or reviews code, structure your output as follows:
179
172
 
180
- ```bash
181
- set -e # Exit on error
182
- set -u # Exit on undefined variable
183
- set -o pipefail # Exit on pipe failure
184
- set -x # Debug: print commands
173
+ ```
174
+ ━━━ Bash Linux Report ━━━━━━━━━━━━━━━━━━━━━━━━
175
+ Skill: Bash Linux
176
+ Language: [detected language / framework]
177
+ Scope: [N files · N functions]
178
+ ─────────────────────────────────────────────────
179
+ ✅ Passed: [checks that passed, or "All clean"]
180
+ ⚠️ Warnings: [non-blocking issues, or "None"]
181
+ ❌ Blocked: [blocking issues requiring fix, or "None"]
182
+ ─────────────────────────────────────────────────
183
+ VBC status: PENDING → VERIFIED
184
+ Evidence: [test output / lint pass / compile success]
185
185
  ```
186
186
 
187
- ### Trap for cleanup
187
+ **VBC (Verification-Before-Completion) is mandatory.**
188
+ Do not mark status as VERIFIED until concrete terminal evidence is provided.
188
189
 
189
- ```bash
190
- cleanup() {
191
- echo "Cleaning up..."
192
- rm -f /tmp/tempfile
193
- }
194
- trap cleanup EXIT
195
- ```
196
190
 
197
191
  ---
198
192
 
199
- > **Remember:** Bash is text-based. Use `&&` for success chains, `set -e` for safety, and quote your variables!
193
+ ## 🏛️ Tribunal Integration (Anti-Hallucination)
194
+
195
+ **Slash command: `/audit` or `/review`**
196
+ **Active reviewers: `logic` · `security` · `devops`**
197
+
198
+ ### ❌ Forbidden AI Tropes in Bash/Linux
199
+
200
+ 1. **Unjustified `sudo`** — hallucinating `sudo` for scripts or directories owned by the local user.
201
+ 2. **Unquoted variables** — using `$CMD` instead of `"$CMD"`, leading to word splitting and globbing disasters.
202
+ 3. **Unguarded `rm -rf`** — deleting variables without checking if they are empty first (`[[ -z "$DIR" ]]`).
203
+ 4. **Pipe chains without `pipefail`** — writing `cat file | grep X | cut -d` without `set -o pipefail`, hiding failures.
204
+ 5. **Parsing `ls`** — scraping `ls` output instead of using `find` or globbing.
205
+
206
+ ### ✅ Pre-Flight Self-Audit
207
+
208
+ Review these questions before generating Bash scripts or commands:
209
+ ```
210
+ ✅ Does the script start with `set -euo pipefail`?
211
+ ✅ Are all variable expansions wrapped in double quotes to prevent splitting?
212
+ ✅ Did I verify that `sudo` is absolutely required for this operation?
213
+ ✅ Are destructive operations (`rm`, `mv`) properly guarded with condition checks?
214
+ ✅ Did I use the most robust tool (e.g., `find` instead of `ls`) for the job?
215
+ ```