tribunal-kit 2.4.5 → 3.0.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/agents/accessibility-reviewer.md +220 -134
- package/.agent/agents/ai-code-reviewer.md +233 -129
- package/.agent/agents/backend-specialist.md +238 -178
- package/.agent/agents/code-archaeologist.md +181 -119
- package/.agent/agents/database-architect.md +207 -164
- package/.agent/agents/debugger.md +218 -151
- package/.agent/agents/dependency-reviewer.md +136 -55
- package/.agent/agents/devops-engineer.md +238 -175
- package/.agent/agents/documentation-writer.md +221 -137
- package/.agent/agents/explorer-agent.md +180 -142
- package/.agent/agents/frontend-reviewer.md +194 -80
- package/.agent/agents/frontend-specialist.md +237 -188
- package/.agent/agents/game-developer.md +52 -184
- package/.agent/agents/logic-reviewer.md +149 -78
- package/.agent/agents/mobile-developer.md +223 -152
- package/.agent/agents/mobile-reviewer.md +195 -79
- package/.agent/agents/orchestrator.md +211 -170
- package/.agent/agents/penetration-tester.md +174 -131
- package/.agent/agents/performance-optimizer.md +203 -139
- package/.agent/agents/performance-reviewer.md +211 -108
- package/.agent/agents/product-manager.md +162 -108
- package/.agent/agents/project-planner.md +162 -142
- package/.agent/agents/qa-automation-engineer.md +242 -138
- package/.agent/agents/security-auditor.md +194 -170
- package/.agent/agents/seo-specialist.md +213 -132
- package/.agent/agents/sql-reviewer.md +194 -73
- package/.agent/agents/supervisor-agent.md +203 -156
- package/.agent/agents/test-coverage-reviewer.md +193 -81
- package/.agent/agents/type-safety-reviewer.md +208 -65
- package/.agent/scripts/__pycache__/auto_preview.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/bundle_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/checklist.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/dependency_analyzer.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/security_scan.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/session_manager.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/skill_integrator.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/swarm_dispatcher.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/test_runner.cpython-311.pyc +0 -0
- package/.agent/scripts/__pycache__/verify_all.cpython-311.pyc +0 -0
- package/.agent/skills/agent-organizer/SKILL.md +126 -132
- package/.agent/skills/ai-prompt-injection-defense/SKILL.md +160 -0
- package/.agent/skills/api-patterns/SKILL.md +289 -257
- package/.agent/skills/api-security-auditor/SKILL.md +177 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +1 -1
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +1 -1
- package/.agent/skills/appflow-wireframe/SKILL.md +107 -58
- package/.agent/skills/architecture/SKILL.md +331 -200
- package/.agent/skills/authentication-best-practices/SKILL.md +173 -0
- package/.agent/skills/bash-linux/SKILL.md +154 -215
- package/.agent/skills/brainstorming/SKILL.md +104 -210
- package/.agent/skills/building-native-ui/SKILL.md +174 -0
- package/.agent/skills/clean-code/SKILL.md +360 -206
- package/.agent/skills/config-validator/SKILL.md +141 -165
- package/.agent/skills/csharp-developer/SKILL.md +528 -107
- package/.agent/skills/database-design/SKILL.md +455 -275
- package/.agent/skills/deployment-procedures/SKILL.md +145 -188
- package/.agent/skills/devops-engineer/SKILL.md +332 -134
- package/.agent/skills/devops-incident-responder/SKILL.md +113 -98
- package/.agent/skills/edge-computing/SKILL.md +157 -213
- package/.agent/skills/extract-design-system/SKILL.md +134 -0
- package/.agent/skills/framer-motion-expert/SKILL.md +939 -0
- package/.agent/skills/game-design-expert/SKILL.md +105 -0
- package/.agent/skills/game-engineering-expert/SKILL.md +122 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +124 -215
- package/.agent/skills/github-operations/SKILL.md +314 -354
- package/.agent/skills/gsap-expert/SKILL.md +901 -0
- package/.agent/skills/i18n-localization/SKILL.md +138 -216
- package/.agent/skills/intelligent-routing/SKILL.md +127 -139
- package/.agent/skills/llm-engineering/SKILL.md +357 -258
- package/.agent/skills/local-first/SKILL.md +154 -203
- package/.agent/skills/mcp-builder/SKILL.md +118 -224
- package/.agent/skills/nextjs-react-expert/SKILL.md +783 -203
- package/.agent/skills/nodejs-best-practices/SKILL.md +559 -280
- package/.agent/skills/observability/SKILL.md +330 -285
- package/.agent/skills/parallel-agents/SKILL.md +122 -181
- package/.agent/skills/performance-profiling/SKILL.md +254 -197
- package/.agent/skills/plan-writing/SKILL.md +118 -188
- package/.agent/skills/platform-engineer/SKILL.md +123 -135
- package/.agent/skills/playwright-best-practices/SKILL.md +162 -0
- package/.agent/skills/powershell-windows/SKILL.md +146 -230
- package/.agent/skills/python-pro/SKILL.md +879 -114
- package/.agent/skills/react-specialist/SKILL.md +931 -108
- package/.agent/skills/readme-builder/SKILL.md +42 -0
- package/.agent/skills/realtime-patterns/SKILL.md +304 -296
- package/.agent/skills/rust-pro/SKILL.md +701 -240
- package/.agent/skills/seo-fundamentals/SKILL.md +154 -181
- package/.agent/skills/server-management/SKILL.md +190 -212
- package/.agent/skills/shadcn-ui-expert/SKILL.md +206 -0
- package/.agent/skills/skill-creator/SKILL.md +68 -0
- package/.agent/skills/sql-pro/SKILL.md +633 -104
- package/.agent/skills/supabase-postgres-best-practices/SKILL.md +78 -0
- package/.agent/skills/swiftui-expert/SKILL.md +176 -0
- package/.agent/skills/systematic-debugging/SKILL.md +118 -186
- package/.agent/skills/tailwind-patterns/SKILL.md +576 -232
- package/.agent/skills/tdd-workflow/SKILL.md +137 -209
- package/.agent/skills/testing-patterns/SKILL.md +573 -205
- package/.agent/skills/vue-expert/SKILL.md +964 -119
- package/.agent/skills/vulnerability-scanner/SKILL.md +269 -316
- package/.agent/skills/web-accessibility-auditor/SKILL.md +193 -0
- package/.agent/skills/webapp-testing/SKILL.md +145 -236
- package/.agent/workflows/api-tester.md +151 -279
- package/.agent/workflows/audit.md +138 -168
- package/.agent/workflows/brainstorm.md +110 -146
- package/.agent/workflows/changelog.md +112 -144
- package/.agent/workflows/create.md +124 -139
- package/.agent/workflows/debug.md +189 -196
- package/.agent/workflows/deploy.md +189 -153
- package/.agent/workflows/enhance.md +151 -139
- package/.agent/workflows/fix.md +135 -143
- package/.agent/workflows/generate.md +157 -164
- package/.agent/workflows/migrate.md +160 -163
- package/.agent/workflows/orchestrate.md +168 -151
- package/.agent/workflows/performance-benchmarker.md +123 -305
- package/.agent/workflows/plan.md +173 -151
- package/.agent/workflows/preview.md +80 -137
- package/.agent/workflows/refactor.md +183 -153
- package/.agent/workflows/review-ai.md +129 -140
- package/.agent/workflows/review.md +116 -155
- package/.agent/workflows/session.md +94 -154
- package/.agent/workflows/status.md +79 -125
- package/.agent/workflows/strengthen-skills.md +139 -99
- package/.agent/workflows/swarm.md +179 -194
- package/.agent/workflows/test.md +211 -166
- package/.agent/workflows/tribunal-backend.md +113 -111
- package/.agent/workflows/tribunal-database.md +115 -132
- package/.agent/workflows/tribunal-frontend.md +118 -115
- package/.agent/workflows/tribunal-full.md +133 -136
- package/.agent/workflows/tribunal-mobile.md +119 -123
- package/.agent/workflows/tribunal-performance.md +133 -152
- package/.agent/workflows/ui-ux-pro-max.md +143 -171
- package/README.md +11 -15
- package/package.json +1 -1
- package/.agent/skills/dotnet-core-expert/SKILL.md +0 -103
- package/.agent/skills/game-development/2d-games/SKILL.md +0 -119
- package/.agent/skills/game-development/3d-games/SKILL.md +0 -135
- package/.agent/skills/game-development/SKILL.md +0 -236
- package/.agent/skills/game-development/game-art/SKILL.md +0 -185
- package/.agent/skills/game-development/game-audio/SKILL.md +0 -190
- package/.agent/skills/game-development/game-design/SKILL.md +0 -129
- package/.agent/skills/game-development/mobile-games/SKILL.md +0 -108
- package/.agent/skills/game-development/multiplayer/SKILL.md +0 -132
- package/.agent/skills/game-development/pc-games/SKILL.md +0 -144
- package/.agent/skills/game-development/vr-ar/SKILL.md +0 -123
- package/.agent/skills/game-development/web-games/SKILL.md +0 -150
|
@@ -1,212 +1,190 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: server-management
|
|
3
|
-
description:
|
|
4
|
-
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
-
version:
|
|
6
|
-
last-updated: 2026-
|
|
7
|
-
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Server Management
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
## Process
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
### ❌ Forbidden AI Tropes
|
|
193
|
-
|
|
194
|
-
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
195
|
-
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
196
|
-
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
197
|
-
|
|
198
|
-
### ✅ Pre-Flight Self-Audit
|
|
199
|
-
|
|
200
|
-
Review these questions before confirming output:
|
|
201
|
-
```
|
|
202
|
-
✅ Did I rely ONLY on real, verified tools and methods?
|
|
203
|
-
✅ Is this solution appropriately scoped to the user's constraints?
|
|
204
|
-
✅ Did I handle potential failure modes and edge cases?
|
|
205
|
-
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
209
|
-
|
|
210
|
-
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
211
|
-
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
212
|
-
- ✅ **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
|
+
---
|
|
2
|
+
name: server-management
|
|
3
|
+
description: Production Linux server administration mastery. Systemd services, Nginx reverse proxy architecture, UFW firewalls, SSH key security, cron scheduling, log rotation, and server hardening. Use when configuring bare-metal, VPS instances, or reviewing deployment architecture.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Server Management — Production Linux Mastery
|
|
11
|
+
|
|
12
|
+
> Never run a web server as root. Never expose raw ports securely.
|
|
13
|
+
> A naked Node/Python process dies silently. A systemd service acts as its immortal guardian.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Systemd Service Architecture (Process Guard)
|
|
18
|
+
|
|
19
|
+
Do not use `pm2`, `forever`, or custom `screen` sessions attached to SSH panels for server orchestration. Linux provides an enterprise-grade init system natively: systemd.
|
|
20
|
+
|
|
21
|
+
```ini
|
|
22
|
+
# /etc/systemd/system/myapp.service
|
|
23
|
+
|
|
24
|
+
[Unit]
|
|
25
|
+
Description=My Application Node.js Server
|
|
26
|
+
Documentation=https://example.com/docs
|
|
27
|
+
After=network.target postgresql.service # Ensure DB and Network start first
|
|
28
|
+
|
|
29
|
+
[Service]
|
|
30
|
+
Type=simple
|
|
31
|
+
User=appuser # NEVER run as root
|
|
32
|
+
Group=appuser
|
|
33
|
+
WorkingDirectory=/var/www/myapp
|
|
34
|
+
|
|
35
|
+
# Explicitly declare environment limits and variables
|
|
36
|
+
Environment=NODE_ENV=production
|
|
37
|
+
Environment=PORT=3000
|
|
38
|
+
EnvironmentFile=/var/www/myapp/.env
|
|
39
|
+
|
|
40
|
+
# The execution target
|
|
41
|
+
ExecStart=/usr/bin/node /var/www/myapp/build/index.js
|
|
42
|
+
|
|
43
|
+
# Immortal behavior: Restart strictly on failure
|
|
44
|
+
Restart=on-failure
|
|
45
|
+
RestartSec=5
|
|
46
|
+
|
|
47
|
+
# Security Hardening
|
|
48
|
+
NoNewPrivileges=yes
|
|
49
|
+
PrivateTmp=yes
|
|
50
|
+
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
|
51
|
+
|
|
52
|
+
[Install]
|
|
53
|
+
WantedBy=multi-user.target
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Commands:**
|
|
57
|
+
`sudo systemctl daemon-reload`
|
|
58
|
+
`sudo systemctl enable myapp`
|
|
59
|
+
`sudo systemctl start myapp`
|
|
60
|
+
`journalctl -u myapp -f` (Follow logs seamlessly)
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 2. Nginx Reverse Proxy Architecture
|
|
65
|
+
|
|
66
|
+
You must shield your internal application framework (Node/Python/Ruby) behind Nginx. Nginx handles SSL termination, static file caching, and DDOS mitigation.
|
|
67
|
+
|
|
68
|
+
```nginx
|
|
69
|
+
# /etc/nginx/sites-available/myapp.com
|
|
70
|
+
|
|
71
|
+
server {
|
|
72
|
+
listen 80;
|
|
73
|
+
server_name api.myapp.com;
|
|
74
|
+
|
|
75
|
+
# Force SSL Redirect
|
|
76
|
+
return 301 https://$host$request_uri;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
server {
|
|
80
|
+
listen 443 ssl http2;
|
|
81
|
+
server_name api.myapp.com;
|
|
82
|
+
|
|
83
|
+
# SSL Certs (Let's Encrypt / Certbot)
|
|
84
|
+
ssl_certificate /etc/letsencrypt/live/api.myapp.com/fullchain.pem;
|
|
85
|
+
ssl_certificate_key /etc/letsencrypt/live/api.myapp.com/privkey.pem;
|
|
86
|
+
|
|
87
|
+
# Modern Security Headers
|
|
88
|
+
add_header Strict-Transport-Security "max-age=63072000" always;
|
|
89
|
+
add_header X-Content-Type-Options nosniff;
|
|
90
|
+
add_header X-Frame-Options DENY;
|
|
91
|
+
|
|
92
|
+
# GZIP Compression
|
|
93
|
+
gzip on;
|
|
94
|
+
gzip_types text/plain application/json;
|
|
95
|
+
|
|
96
|
+
location / {
|
|
97
|
+
# Proxy traffic to internal local process
|
|
98
|
+
proxy_pass http://127.0.0.1:3000;
|
|
99
|
+
|
|
100
|
+
# Forward original IP and Protocol for rate limiters
|
|
101
|
+
proxy_set_header Host $host;
|
|
102
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
103
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
104
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
105
|
+
|
|
106
|
+
# WebSocket support (Required for GraphQL subscriptions, TRPC, Socket.io)
|
|
107
|
+
proxy_http_version 1.1;
|
|
108
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
109
|
+
proxy_set_header Connection "upgrade";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 3. Server Hardening Fundamentals
|
|
117
|
+
|
|
118
|
+
### SSH Security (`/etc/ssh/sshd_config`)
|
|
119
|
+
```bash
|
|
120
|
+
PermitRootLogin no # Kill direct root login attacks immediately
|
|
121
|
+
PasswordAuthentication no # Enforce SSH key-based login ONLY
|
|
122
|
+
Port 2022 # (Optional) Obscurity defense against automated script-kiddie scanners
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Uncomplicated Firewall (UFW)
|
|
126
|
+
A naked server with all ports open is a honeypot.
|
|
127
|
+
```bash
|
|
128
|
+
sudo ufw default deny incoming
|
|
129
|
+
sudo ufw default allow outgoing
|
|
130
|
+
sudo ufw allow 22/tcp # Allow SSH
|
|
131
|
+
sudo ufw allow 80/tcp # Allow HTTP
|
|
132
|
+
sudo ufw allow 443/tcp # Allow HTTPS
|
|
133
|
+
sudo ufw enable
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Fail2Ban
|
|
137
|
+
Automatically bans IPs attempting brute force credential filling after 5 bad attempts.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 4. Log Rotation (Prevent Disk Full Outages)
|
|
142
|
+
|
|
143
|
+
A server will inevitably crash when `/var/log` consumes 100% of the disk.
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# /etc/logrotate.d/myapp
|
|
147
|
+
|
|
148
|
+
/var/www/myapp/logs/*.log {
|
|
149
|
+
daily # Rotate every day
|
|
150
|
+
missingok # Ignore if file is missing
|
|
151
|
+
rotate 14 # Keep 14 days of history
|
|
152
|
+
compress # Gzip old logs
|
|
153
|
+
delaycompress # Don't compress the one created yesterday
|
|
154
|
+
notifempty # Do nothing if log is empty
|
|
155
|
+
copytruncate # Copy then clear (avoids disrupting Node's open file handles)
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## 🤖 LLM-Specific Traps (Server Management)
|
|
162
|
+
|
|
163
|
+
1. **PM2 Fallacy:** AI frequently defaults to `pm2 start app.js` for production deployments. Demand raw `systemd`. It ensures startup order (Wait for network) and unified journalctl logging.
|
|
164
|
+
2. **Root Execution:** Suggesting `ExecStart=npm start` under the `User=root` directive. The application process should operate under a restricted `appuser` daemon tier.
|
|
165
|
+
3. **Missing Proxy Headers:** AI writing basic Nginx configs but omitting `X-Forwarded-For`. This causes the internal App to log all requests as coming from "127.0.0.1", instantly breaking IP Rate limiters.
|
|
166
|
+
4. **WebSocket Blocking:** Forgetting to pass `Upgrade` headers in Nginx proxy setups, breaking realtime web applications silently.
|
|
167
|
+
5. **Naked Node Ports:** Instructing users to run `node index.js` on `port 80`. Never natively bind unprivileged web processes to port 80. Bind to 3000 locally and use reverse proxy routing.
|
|
168
|
+
6. **Firewall Blindness:** Assuming Docker auto-secures ports. Executing `docker run -p 8080:80` on Ubuntu completely bypasses UFW restrictions through iptables hooks, exposing the database to the internet. Always bind `127.0.0.1:8080:80`.
|
|
169
|
+
7. **Password SSH Prompts:** Creating automation scripts utilizing raw passwords (e.g., `sshpass`). Always assume ed25519 identity keyfiles for automated CI deployments.
|
|
170
|
+
8. **Log Rotation Void:** Neglecting log rotation in custom bash script loops, guaranteeing a 100% disk usage outage 3 months later.
|
|
171
|
+
9. **GZIP Assumption:** Forgetting to enable `gzip on` in Nginx resulting in 10MB JSON payloads saturating the virtual server network adapter.
|
|
172
|
+
10. **In-place Nginx Modding:** Editing `/etc/nginx/nginx.conf` directly instead of writing symlinks between the `sites-available` and `sites-enabled` architecture.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 🏛️ Tribunal Integration
|
|
177
|
+
|
|
178
|
+
### ✅ Pre-Flight Self-Audit
|
|
179
|
+
```
|
|
180
|
+
✅ Are persistent services orchestrated securely via `systemd` (not PM2)?
|
|
181
|
+
✅ Does the systemd service explicitly execute as a non-root `appuser`?
|
|
182
|
+
✅ Is the internal application shielded by an Nginx/Caddy reverse proxy?
|
|
183
|
+
✅ Does the reverse proxy explicitly forward realtime `Upgrade` (WebSocket) headers?
|
|
184
|
+
✅ Does the reverse proxy forward IP integrity headers (`X-Forwarded-For`)?
|
|
185
|
+
✅ Has SSH `PasswordAuthentication` been disabled defensively?
|
|
186
|
+
✅ Is UFW configured to strictly deny all incoming non-essential ports?
|
|
187
|
+
✅ If suggesting Docker, are database/internal ports scoped to `127.0.0.1:X:Y`?
|
|
188
|
+
✅ Have manual application log files been mapped in `logrotate.d`?
|
|
189
|
+
✅ Has `PermitRootLogin` been set to `no`?
|
|
190
|
+
```
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: shadcn-ui-expert
|
|
3
|
+
description: shadcn/ui mastery. Installation, customization via tailwind.config, component extraction, state management with Radix Primitives, theme variables (CSS custom properties), dark mode implementations, and overriding default designs. Use when building or modifying shadcn/ui components in React/Next.js projects.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
last-updated: 2026-04-02
|
|
7
|
+
applies-to-model: gemini-2.5-pro, claude-3-7-sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# shadcn/ui Expert — Component Architecture Mastery
|
|
11
|
+
|
|
12
|
+
> shadcn/ui is NOT a component library. It is a collection of re-usable components that you copy and paste into your apps.
|
|
13
|
+
> You own the code. You own the styling. You own the accessibility.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 1. Core Architecture
|
|
18
|
+
|
|
19
|
+
shadcn/ui leverages two layers:
|
|
20
|
+
1. **Radix UI Primitives**: Headless, fully accessible functionality (Focus management, ARIA, Keyboard nav).
|
|
21
|
+
2. **Tailwind CSS**: The styling layer mapped over the headless components.
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// ❌ BAD: Re-inventing the wheel for accessibility
|
|
25
|
+
const Select = ({ options }) => {
|
|
26
|
+
const [open, setOpen] = useState(false)
|
|
27
|
+
return <div onClick={() => setOpen(!open)}>...</div> // Breaks keyboard/screen readers
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// ✅ GOOD: Using shadcn (Radix under the hood)
|
|
31
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
|
|
32
|
+
|
|
33
|
+
export function MySelect() {
|
|
34
|
+
return (
|
|
35
|
+
<Select>
|
|
36
|
+
<SelectTrigger className="w-[180px]">
|
|
37
|
+
<SelectValue placeholder="Theme" />
|
|
38
|
+
</SelectTrigger>
|
|
39
|
+
<SelectContent>
|
|
40
|
+
<SelectItem value="light">Light</SelectItem>
|
|
41
|
+
<SelectItem value="dark">Dark</SelectItem>
|
|
42
|
+
</SelectContent>
|
|
43
|
+
</Select>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 2. Component Modification (You Own The Code)
|
|
51
|
+
|
|
52
|
+
Do not treat `components/ui/*` as an immutable black box. You are *supposed* to modify them.
|
|
53
|
+
|
|
54
|
+
### Adding Variants via `cva` (Class Variance Authority)
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
58
|
+
|
|
59
|
+
// Adding a new "ghost-rounded" variant to the Button component
|
|
60
|
+
const buttonVariants = cva(
|
|
61
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors...",
|
|
62
|
+
{
|
|
63
|
+
variants: {
|
|
64
|
+
variant: {
|
|
65
|
+
default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
66
|
+
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
67
|
+
outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
68
|
+
// YOUR CUSTOM VARIANT:
|
|
69
|
+
"ghost-rounded": "bg-transparent hover:bg-accent hover:text-accent-foreground rounded-full px-6",
|
|
70
|
+
},
|
|
71
|
+
size: {
|
|
72
|
+
default: "h-9 px-4 py-2",
|
|
73
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
74
|
+
lg: "h-10 rounded-md px-8",
|
|
75
|
+
icon: "h-9 w-9",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
variant: "default",
|
|
80
|
+
size: "default",
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 3. Theming & Dark Mode (CSS Variables)
|
|
89
|
+
|
|
90
|
+
shadcn/ui manages themes explicitly through CSS custom properties (variables), not Tailwind config hardcoding.
|
|
91
|
+
|
|
92
|
+
```css
|
|
93
|
+
/* app/globals.css */
|
|
94
|
+
@layer base {
|
|
95
|
+
:root {
|
|
96
|
+
--background: 0 0% 100%;
|
|
97
|
+
--foreground: 222.2 84% 4.9%;
|
|
98
|
+
--card: 0 0% 100%;
|
|
99
|
+
--card-foreground: 222.2 84% 4.9%;
|
|
100
|
+
--primary: 221.2 83.2% 53.3%;
|
|
101
|
+
--primary-foreground: 210 40% 98%;
|
|
102
|
+
/* ... */
|
|
103
|
+
--radius: 0.5rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.dark {
|
|
107
|
+
--background: 222.2 84% 4.9%;
|
|
108
|
+
--foreground: 210 40% 98%;
|
|
109
|
+
--card: 222.2 84% 4.9%;
|
|
110
|
+
--primary: 217.2 91.2% 59.8%;
|
|
111
|
+
/* ... */
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Implementation with Tailwind v4 CSS-first configuration:
|
|
117
|
+
```css
|
|
118
|
+
/* Note how standard colors map directly to the CSS vars */
|
|
119
|
+
@theme {
|
|
120
|
+
--color-background: hsl(var(--background));
|
|
121
|
+
--color-foreground: hsl(var(--foreground));
|
|
122
|
+
--color-primary: hsl(var(--primary));
|
|
123
|
+
--color-primary-foreground: hsl(var(--primary-foreground));
|
|
124
|
+
--radius-lg: var(--radius);
|
|
125
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
126
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 4. Using the `cn` Utility
|
|
133
|
+
|
|
134
|
+
The `cn` utility combines `clsx` (conditional classes) and `tailwind-merge` (fixing class conflicts).
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import { clsx, type ClassValue } from "clsx"
|
|
138
|
+
import { twMerge } from "tailwind-merge"
|
|
139
|
+
|
|
140
|
+
export function cn(...inputs: ClassValue[]) {
|
|
141
|
+
return twMerge(clsx(inputs))
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ❌ BAD: String concatenation breeds conflicts
|
|
145
|
+
// hover:bg-blue-500 will fail if className contains hover:bg-red-500 earlier
|
|
146
|
+
const className = `px-4 py-2 bg-blue-500 hover:bg-blue-600 ${props.className}`
|
|
147
|
+
|
|
148
|
+
// ✅ GOOD: cn resolves conflicts correctly
|
|
149
|
+
const className = cn("px-4 py-2 bg-blue-500 hover:bg-blue-600", props.className)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 5. Next.js App Router Integration
|
|
155
|
+
|
|
156
|
+
### Modals / Dialogs inside Server Components
|
|
157
|
+
Radix primitives (Dialog, Select, etc.) utilize React context and side effects. They must be Client Components.
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// ❌ BAD: Server Component trying to use a shadcn Dialog directly with state
|
|
161
|
+
export default function Page() {
|
|
162
|
+
const [open, setOpen] = useState(false); // ERROR
|
|
163
|
+
return <Dialog open={open}>...</Dialog>
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ✅ GOOD: Extract the interactive part to a Client Component
|
|
167
|
+
import { MyDialogComponent } from "./MyDialogComponent" // "use client" inside
|
|
168
|
+
|
|
169
|
+
export default async function Page() {
|
|
170
|
+
const data = await fetchDb(); // Server Component fetches data
|
|
171
|
+
return <MyDialogComponent data={data} /> // Passes data to interactive client component
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## 🤖 LLM-Specific Traps (shadcn/ui)
|
|
178
|
+
|
|
179
|
+
1. **Treating it like an NPM Package:** AI asks to run `npm install shadcn-ui`. It's `npx shadcn@latest add [component]`. Components live in your tree (`components/ui`), not in `node_modules`.
|
|
180
|
+
2. **Missing the `cn` utility:** AI writes generic template literals for className overrides, guaranteeing Tailwind specificity conflicts. Always import and wrap overrides in `cn()`.
|
|
181
|
+
3. **Hardcoding Colors:** AI writes `bg-blue-500` inside standard components. shadcn demands semantic variables: `bg-primary`, `bg-accent`, `text-muted-foreground`.
|
|
182
|
+
4. **Server Component Conflicts:** AI inserts interactive shadcn components (Dialog, Tabs, Accordion) directly into Next.js Server Components without creating a `"use client"` wrapper boundary.
|
|
183
|
+
5. **Radix Primitive Ignorance:** AI attempts to pass `onClick` or `onChange` to headless wrapper elements like `<Select>` instead of `<SelectValue>` or tracking state properly via the `onValueChange` prop of the root component.
|
|
184
|
+
6. **Forgetting `asChild`:** When wrapping existing buttons or links in shadcn Triggers, AI forgets the `asChild` prop, resulting in invalid HTML (e.g., `<button><button>click</button></button>`).
|
|
185
|
+
7. **Modifying `node_modules/@radix-ui`:** AI tries to fix Radix a11y bugs by editing node_modules. Modify your local wrappers in `components/ui`, never Radix internals.
|
|
186
|
+
8. **Broken Form Integration:** AI tries to manually string together standard React state with shadcn inputs. You MUST use `<Form>`, `<FormField>`, `<FormItem>`, and `react-hook-form` logic for proper shadcn forms.
|
|
187
|
+
9. **Tailwind Class Order:** AI doesn't understand that `tailwind-merge` resolves conflicts from left to right. Overriding classes must be passed at the *end* of the `cn()` arguments.
|
|
188
|
+
10. **Theme Variable Format:** AI writes `--primary: #3b82f6`. shadcn/ui CSS custom properties are strictly HSL scalar values WITHOUT the `hsl()` wrapper inside the root definition: `--primary: 221.2 83.2% 53.3%;`.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 🏛️ Tribunal Integration
|
|
193
|
+
|
|
194
|
+
### ✅ Pre-Flight Self-Audit
|
|
195
|
+
```
|
|
196
|
+
✅ Are interactive shadcn components safely inside "use client" boundaries?
|
|
197
|
+
✅ Are classes merged dynamically using the `cn()` utility?
|
|
198
|
+
✅ Are colors utilizing standard semantic vars (`bg-primary`) rather than hardcoded colors?
|
|
199
|
+
✅ Did I remember the `asChild` prop when wrapping links/buttons in Triggers?
|
|
200
|
+
✅ Are forms correctly using `react-hook-form` via the `<Form>` and `<FormField>` components?
|
|
201
|
+
✅ Are CSS theme root variables using raw HSL scalar values?
|
|
202
|
+
✅ Am I modifying the local `components/ui/*` files if new variants are needed?
|
|
203
|
+
✅ Have I respected Radix a11y primitives (not inventing my own onClick focus handling)?
|
|
204
|
+
✅ Are component variants properly declared using `cva`?
|
|
205
|
+
✅ Did I pass user-supplied `className` props at the END of the `cn()` function to allow overrides?
|
|
206
|
+
```
|