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.
- 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/github-operations/SKILL.md +354 -0
- 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/readme-builder/SKILL.md +270 -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 +542 -288
- 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
|
-
>
|
|
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
|
-
|
|
15
|
+
---
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
## When to Use This Skill
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Anti-Patterns in Architecture Work
|
|
38
107
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
|
|
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
|
-
##
|
|
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
|
|
196
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
49
197
|
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
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
|
|
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
|
-
>
|
|
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
|
-
##
|
|
16
|
+
## Ground Rules
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
##
|
|
27
|
-
|
|
28
|
-
### Essential Commands
|
|
25
|
+
## Essential Patterns
|
|
29
26
|
|
|
30
|
-
|
|
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
|
-
|
|
29
|
+
Every shell script should start with:
|
|
45
30
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
42
|
+
### Variable Safety
|
|
60
43
|
|
|
61
|
-
|
|
44
|
+
```bash
|
|
45
|
+
# ❌ Unsafe — if DIR is empty, this deletes /
|
|
46
|
+
rm -rf "$DIR/"
|
|
62
47
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
##
|
|
88
|
+
## Common Operations
|
|
89
|
+
|
|
90
|
+
### Find Files
|
|
100
91
|
|
|
101
92
|
```bash
|
|
102
|
-
|
|
103
|
-
|
|
93
|
+
# Files modified in last 24h
|
|
94
|
+
find . -mtime -1 -type f
|
|
104
95
|
|
|
105
|
-
#
|
|
106
|
-
|
|
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
|
-
#
|
|
111
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
-
|
|
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
|
-
|
|
121
|
+
```bash
|
|
122
|
+
# Count occurrences
|
|
123
|
+
cat file.log | grep "ERROR" | wc -l
|
|
130
124
|
|
|
131
|
-
|
|
125
|
+
# Extract column from CSV
|
|
126
|
+
cut -d',' -f2 data.csv
|
|
132
127
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
echo "Node is installed"
|
|
136
|
-
fi
|
|
128
|
+
# Unique sorted values
|
|
129
|
+
sort file.txt | uniq -c | sort -rn
|
|
137
130
|
```
|
|
138
131
|
|
|
139
|
-
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Script Structure Template
|
|
140
135
|
|
|
141
136
|
```bash
|
|
142
|
-
|
|
143
|
-
|
|
137
|
+
#!/usr/bin/env bash
|
|
138
|
+
set -euo pipefail
|
|
144
139
|
|
|
145
|
-
|
|
140
|
+
# ── Config ──────────────────────────────
|
|
141
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
142
|
+
TARGET="${1:-}"
|
|
146
143
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
144
|
+
# ── Validate ────────────────────────────
|
|
145
|
+
if [[ -z "$TARGET" ]]; then
|
|
146
|
+
echo "Usage: $(basename "$0") <target>" >&2
|
|
147
|
+
exit 1
|
|
148
|
+
fi
|
|
152
149
|
|
|
153
|
-
|
|
150
|
+
# ── Main ────────────────────────────────
|
|
151
|
+
main() {
|
|
152
|
+
echo "Processing: $TARGET"
|
|
153
|
+
# ... logic here
|
|
154
|
+
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
for file in *.js; do
|
|
157
|
-
echo "Processing $file"
|
|
158
|
-
done
|
|
156
|
+
main "$@"
|
|
159
157
|
```
|
|
160
158
|
|
|
161
159
|
---
|
|
162
160
|
|
|
163
|
-
##
|
|
161
|
+
## Platform Notes
|
|
164
162
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
##
|
|
169
|
+
## Output Format
|
|
177
170
|
|
|
178
|
-
|
|
171
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
179
172
|
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
+
```
|