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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: local-first
|
|
3
|
+
description: Local-first software principles. Offline-capable apps, CRDTs, sync engines (ElectricSQL, Replicache, Zero), conflict resolution, and the migration path from REST-first to local-first architecture. Use when building apps that need offline support, fast UI, or collaborative editing.
|
|
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
|
+
# Local-First Software Principles
|
|
11
|
+
|
|
12
|
+
> In a local-first app, the network is an enhancement, not a requirement.
|
|
13
|
+
> The app works fully offline. Sync happens in the background when possible.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## The Local-First Promise
|
|
18
|
+
|
|
19
|
+
Local-first apps satisfy all of these simultaneously — traditional web apps satisfy none:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
✅ Fast UI — reads from local replica, never waits for network
|
|
23
|
+
✅ Offline use — full functionality without internet
|
|
24
|
+
✅ Collaboration — multiple users edit the same data
|
|
25
|
+
✅ Privacy — data lives on device by default
|
|
26
|
+
✅ Longevity — app works even if vendor servers go down
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Architecture Spectrum
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
REST-First (most apps today):
|
|
35
|
+
Client → HTTP → Server → DB
|
|
36
|
+
Offline: ❌ Speed: Network-bound Collaboration: Manual
|
|
37
|
+
|
|
38
|
+
Optimistic UI (halfway):
|
|
39
|
+
Client → Local cache → HTTP → Server → DB
|
|
40
|
+
Offline: Partial Speed: Fast for reads Collaboration: Conflict-prone
|
|
41
|
+
|
|
42
|
+
Local-First:
|
|
43
|
+
Client → Local replica (SQLite/CRDT) → Sync engine ↔ Server → DB
|
|
44
|
+
Offline: ✅ Speed: Instant Collaboration: ✅ via CRDTs
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Sync Engine Selection
|
|
50
|
+
|
|
51
|
+
Choose based on your database, team size, and product requirements:
|
|
52
|
+
|
|
53
|
+
| Engine | Sync Model | Database | Best For |
|
|
54
|
+
|---|---|---|---|
|
|
55
|
+
| **ElectricSQL** | Postgres → SQLite on client | PostgreSQL only | Postgres-native teams |
|
|
56
|
+
| **Replicache** | Mutation log + pull | Any backend | Custom sync logic needed |
|
|
57
|
+
| **Zero (Rocicorp)** | Reactive queries | PostgreSQL | Real-time apps, Figma-speed UIs |
|
|
58
|
+
| **Liveblocks** | CRDT + storage API | Managed | Collaborative SaaS (no own server) |
|
|
59
|
+
| **Yjs + y-indexeddb** | CRDT + local persistence | Any | Text editing, whiteboard |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## CRDT Choices
|
|
64
|
+
|
|
65
|
+
CRDTs (Conflict-free Replicated Data Types) resolve concurrent edits mathematically — no server arbitration needed:
|
|
66
|
+
|
|
67
|
+
| CRDT Type | Use For | Library |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| **LWW Register** | Scalar values (settings, status) | Built-in or custom |
|
|
70
|
+
| **G-Counter** | Incrementing counters (likes, views) | Custom |
|
|
71
|
+
| **OR-Set** | Sets that support add + remove | Yjs `Y.Array` |
|
|
72
|
+
| **Y.Text** | Collaborative rich text | Yjs |
|
|
73
|
+
| **Y.Map** | Shared key-value state | Yjs |
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import * as Y from 'yjs';
|
|
77
|
+
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
78
|
+
|
|
79
|
+
const doc = new Y.Doc();
|
|
80
|
+
|
|
81
|
+
// Persist to IndexedDB — survives page reload, works offline
|
|
82
|
+
new IndexeddbPersistence('my-doc-id', doc);
|
|
83
|
+
|
|
84
|
+
// Shared text — any concurrent edits from any user auto-merge
|
|
85
|
+
const text = doc.getText('content');
|
|
86
|
+
text.insert(0, 'Hello '); // User A
|
|
87
|
+
text.insert(6, 'World'); // User B — concurrent, no conflict
|
|
88
|
+
// Result: "Hello World" — always correct, always the same
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Optimistic UI Patterns
|
|
94
|
+
|
|
95
|
+
Before full local-first, optimistic UI gives most of the speed benefit:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// ❌ Pessimistic — user waits for server response before any UI update
|
|
99
|
+
async function likePost(postId: string) {
|
|
100
|
+
const updated = await api.likePost(postId); // 200ms wait → UI freezes
|
|
101
|
+
setPost(updated);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ✅ Optimistic — update UI immediately, sync in background
|
|
105
|
+
async function likePost(postId: string) {
|
|
106
|
+
// 1. Instant UI update
|
|
107
|
+
setPost(prev => ({ ...prev, likes: prev.likes + 1, liked: true }));
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
// 2. Sync to server in background
|
|
111
|
+
await api.likePost(postId);
|
|
112
|
+
} catch {
|
|
113
|
+
// 3. Rollback on failure
|
|
114
|
+
setPost(prev => ({ ...prev, likes: prev.likes - 1, liked: false }));
|
|
115
|
+
toast.error('Failed to like post');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Conflict Resolution Strategies
|
|
123
|
+
|
|
124
|
+
When two users edit the same data offline and then sync:
|
|
125
|
+
|
|
126
|
+
| Strategy | When to Use | Downside |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| **Last-Write-Wins (LWW)** | Settings, preferences | Concurrent edits silently overwrite each other |
|
|
129
|
+
| **First-Write-Wins** | Booking/reservation slots | Rejecters unhappy, complex UX |
|
|
130
|
+
| **CRDT merge** | Text, lists, collaborative state | Complex to implement from scratch — use Yjs |
|
|
131
|
+
| **3-way merge** | Code files, configs | Requires common ancestor to compute diff |
|
|
132
|
+
| **User-prompted resolution** | Critical data (contracts) | Adds friction but preserves intent |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Migration Path: REST → Local-First
|
|
137
|
+
|
|
138
|
+
Don't try to go from REST to full local-first in one step:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Phase 1: Optimistic UI
|
|
142
|
+
→ Client mutates locally, syncs async
|
|
143
|
+
→ Easy win: 200ms → 0ms perceived latency
|
|
144
|
+
→ Risk: conflicts on concurrent updates
|
|
145
|
+
|
|
146
|
+
Phase 2: Offline Detection + Queue
|
|
147
|
+
→ Queue mutations when offline
|
|
148
|
+
→ Apply queue on reconnect
|
|
149
|
+
→ Risk: conflict ordering
|
|
150
|
+
|
|
151
|
+
Phase 3: CRDT-backed Shared State
|
|
152
|
+
→ Replace mutable shared data with CRDTs
|
|
153
|
+
→ Full offline + collaboration
|
|
154
|
+
→ No more conflicts
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Output Format
|
|
160
|
+
|
|
161
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
━━━ Local First Report ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
165
|
+
Skill: Local First
|
|
166
|
+
Language: [detected language / framework]
|
|
167
|
+
Scope: [N files · N functions]
|
|
168
|
+
─────────────────────────────────────────────────
|
|
169
|
+
✅ Passed: [checks that passed, or "All clean"]
|
|
170
|
+
⚠️ Warnings: [non-blocking issues, or "None"]
|
|
171
|
+
❌ Blocked: [blocking issues requiring fix, or "None"]
|
|
172
|
+
─────────────────────────────────────────────────
|
|
173
|
+
VBC status: PENDING → VERIFIED
|
|
174
|
+
Evidence: [test output / lint pass / compile success]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**VBC (Verification-Before-Completion) is mandatory.**
|
|
178
|
+
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
184
|
+
|
|
185
|
+
**Slash command: `/tribunal-backend`**
|
|
186
|
+
**Active reviewers: `logic` · `security`**
|
|
187
|
+
|
|
188
|
+
### ❌ Forbidden AI Tropes in Local-First
|
|
189
|
+
|
|
190
|
+
1. **Treating CRDTs as magic** — CRDTs solve concurrent edits to shared state, not schema migrations or access control.
|
|
191
|
+
2. **Inventing CRDT libraries** — `crdt-js`, `conflict-free`, `local-sync` are not real packages. Yjs, Automerge, and Loro are the real libraries.
|
|
192
|
+
3. **Skipping conflict detection in LWW** — Last-Write-Wins silently drops data. Always make the conflict resolution strategy explicit and communicate it to the user.
|
|
193
|
+
4. **Local storage for everything** — `localStorage` is synchronous, has a 5MB limit, and is not available in workers. Use IndexedDB via Dexie or Origin Private File System.
|
|
194
|
+
|
|
195
|
+
### ✅ Pre-Flight Self-Audit
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
✅ Is the conflict resolution strategy explicit and documented?
|
|
199
|
+
✅ Are only real CRDT libraries used (Yjs, Automerge, Loro)?
|
|
200
|
+
✅ Is offline state persisted to IndexedDB, not localStorage?
|
|
201
|
+
✅ Is the sync queue replay idempotent (safe to process the same mutation twice)?
|
|
202
|
+
✅ Does the UI clearly communicate offline/syncing/synced state to the user?
|
|
203
|
+
```
|
|
@@ -2,175 +2,223 @@
|
|
|
2
2
|
name: mcp-builder
|
|
3
3
|
description: MCP (Model Context Protocol) server building principles. Tool design, resource patterns, best practices.
|
|
4
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
|
-
# MCP
|
|
10
|
+
# MCP Server Development
|
|
8
11
|
|
|
9
|
-
>
|
|
12
|
+
> An MCP server exposes capabilities to AI assistants.
|
|
13
|
+
> Design tools the way you design a good API: clear contracts, predictable behavior, honest errors.
|
|
10
14
|
|
|
11
15
|
---
|
|
12
16
|
|
|
13
|
-
##
|
|
17
|
+
## What MCP Servers Do
|
|
14
18
|
|
|
15
|
-
|
|
19
|
+
An MCP (Model Context Protocol) server gives an AI assistant structured access to:
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
- **Tools** — actions the AI can invoke (run a query, send a message, fetch data)
|
|
22
|
+
- **Resources** — data the AI can read (files, database records, API responses)
|
|
23
|
+
- **Prompts** — reusable prompt templates with parameters
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
---
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
|---------|---------|
|
|
23
|
-
| **Tools** | Functions AI can call |
|
|
24
|
-
| **Resources** | Data AI can read |
|
|
25
|
-
| **Prompts** | Pre-defined prompt templates |
|
|
27
|
+
## Tool Design Principles
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
### 1. One tool, one responsibility
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
A tool that does two things is a tool that confuses the model. Split tools when they serve different goals.
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
```ts
|
|
34
|
+
// ❌ Ambiguous — does it list AND filter?
|
|
35
|
+
{ name: "get_users", description: "Get users, optionally filtered by role" }
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
│ └── index.ts # Main entry
|
|
37
|
-
├── package.json
|
|
38
|
-
└── tsconfig.json
|
|
37
|
+
// ✅ Separate concerns
|
|
38
|
+
{ name: "list_users", description: "List all users with pagination" }
|
|
39
|
+
{ name: "find_users_by_role", description: "Find users matching a specific role" }
|
|
39
40
|
```
|
|
40
41
|
|
|
41
|
-
###
|
|
42
|
+
### 2. Descriptions are the interface
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
|------|-----|
|
|
45
|
-
| **Stdio** | Local, CLI-based |
|
|
46
|
-
| **SSE** | Web-based, streaming |
|
|
47
|
-
| **WebSocket** | Real-time, bidirectional |
|
|
44
|
+
The AI reads descriptions to decide which tool to call. Write them for the AI, not for humans.
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
- State exactly what the tool does in plain terms
|
|
47
|
+
- State what the tool returns
|
|
48
|
+
- State when NOT to use it if there's common confusion
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
{
|
|
52
|
+
name: "search_products",
|
|
53
|
+
description: "Search products by keyword. Returns an array of matching product records " +
|
|
54
|
+
"with id, name, price, and stock. Use this for keyword search, not for fetching a " +
|
|
55
|
+
"specific product by ID — use get_product_by_id for that."
|
|
56
|
+
}
|
|
57
|
+
```
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
### 3. Input schemas are contracts
|
|
60
|
+
|
|
61
|
+
Every tool input must have a JSON Schema definition with:
|
|
62
|
+
- Required vs. optional fields clearly marked
|
|
63
|
+
- Descriptions on each field
|
|
64
|
+
- Sensible defaults on optional fields
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
inputSchema: {
|
|
68
|
+
type: "object",
|
|
69
|
+
required: ["query"],
|
|
70
|
+
properties: {
|
|
71
|
+
query: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Search keyword. Minimum 2 characters."
|
|
74
|
+
},
|
|
75
|
+
limit: {
|
|
76
|
+
type: "number",
|
|
77
|
+
description: "Maximum results to return. Default: 10. Max: 100.",
|
|
78
|
+
default: 10
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
52
83
|
|
|
53
|
-
###
|
|
84
|
+
### 4. Errors must be informative
|
|
54
85
|
|
|
55
|
-
|
|
56
|
-
|-----------|-------------|
|
|
57
|
-
| Clear name | Action-oriented (get_weather, create_user) |
|
|
58
|
-
| Single purpose | One thing well |
|
|
59
|
-
| Validated input | Schema with types and descriptions |
|
|
60
|
-
| Structured output | Predictable response format |
|
|
86
|
+
When a tool fails, the AI needs to understand what went wrong and whether to retry.
|
|
61
87
|
|
|
62
|
-
|
|
88
|
+
```ts
|
|
89
|
+
// ❌ Useless error
|
|
90
|
+
throw new Error("Failed");
|
|
63
91
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
92
|
+
// ✅ Actionable error
|
|
93
|
+
return {
|
|
94
|
+
isError: true,
|
|
95
|
+
content: [{
|
|
96
|
+
type: "text",
|
|
97
|
+
text: "Product search failed: the search index is temporarily unavailable. " +
|
|
98
|
+
"Try again in a few seconds or use list_products for unfiltered results."
|
|
99
|
+
}]
|
|
100
|
+
};
|
|
101
|
+
```
|
|
70
102
|
|
|
71
103
|
---
|
|
72
104
|
|
|
73
|
-
##
|
|
105
|
+
## Resource Design
|
|
74
106
|
|
|
75
|
-
|
|
107
|
+
Resources give the AI read-only access to data. Use them for content the AI needs to understand context, not for actions.
|
|
76
108
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
| Dynamic | Generated on request |
|
|
81
|
-
| Template | URI with parameters |
|
|
109
|
+
```ts
|
|
110
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
111
|
+
const uri = request.params.uri;
|
|
82
112
|
|
|
83
|
-
|
|
113
|
+
if (uri.startsWith("product://")) {
|
|
114
|
+
const id = uri.replace("product://", "");
|
|
115
|
+
const product = await db.products.findById(id);
|
|
84
116
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
117
|
+
return {
|
|
118
|
+
contents: [{
|
|
119
|
+
uri,
|
|
120
|
+
mimeType: "application/json",
|
|
121
|
+
text: JSON.stringify(product, null, 2)
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
```
|
|
90
127
|
|
|
91
128
|
---
|
|
92
129
|
|
|
93
|
-
##
|
|
94
|
-
|
|
95
|
-
### Error Types
|
|
130
|
+
## Security Rules
|
|
96
131
|
|
|
97
|
-
|
|
98
|
-
|-----------|----------|
|
|
99
|
-
| Invalid params | Validation error message |
|
|
100
|
-
| Not found | Clear "not found" |
|
|
101
|
-
| Server error | Generic error, log details |
|
|
132
|
+
MCP servers execute with user-level permissions and may have access to sensitive systems:
|
|
102
133
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
- Provide actionable messages
|
|
134
|
+
- **Never trust tool arguments without validation** — the AI can be prompted to send malicious input
|
|
135
|
+
- **Parameterize all database queries** — treat tool input as untrusted user input
|
|
136
|
+
- **Scope API keys narrowly** — the MCP server should have the minimum permissions needed
|
|
137
|
+
- **Log tool invocations** — especially for tools that write data or delete records
|
|
138
|
+
- **Rate limit tool calls** — prevent runaway AI loops from hammering backends
|
|
109
139
|
|
|
110
140
|
---
|
|
111
141
|
|
|
112
|
-
##
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
## Configuration Template
|
|
143
|
+
|
|
144
|
+
```json
|
|
145
|
+
{
|
|
146
|
+
"mcpServers": {
|
|
147
|
+
"your-server": {
|
|
148
|
+
"command": "npx",
|
|
149
|
+
"args": ["-y", "your-mcp-package"],
|
|
150
|
+
"env": {
|
|
151
|
+
"API_KEY": "${YOUR_API_KEY}"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
```
|
|
115
157
|
|
|
116
|
-
|
|
117
|
-
|------|----------|
|
|
118
|
-
| Text | Plain text |
|
|
119
|
-
| Images | Base64 + MIME type |
|
|
120
|
-
| Files | Base64 + MIME type |
|
|
158
|
+
Place in `~/.cursor/mcp.json` (Cursor) or `~/.gemini/antigravity/mcp_config.json` (Antigravity).
|
|
121
159
|
|
|
122
160
|
---
|
|
123
161
|
|
|
124
|
-
##
|
|
162
|
+
## Output Format
|
|
125
163
|
|
|
126
|
-
|
|
164
|
+
When this skill produces or reviews code, structure your output as follows:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
━━━ Mcp Builder Report ━━━━━━━━━━━━━━━━━━━━━━━━
|
|
168
|
+
Skill: Mcp Builder
|
|
169
|
+
Language: [detected language / framework]
|
|
170
|
+
Scope: [N files · N functions]
|
|
171
|
+
─────────────────────────────────────────────────
|
|
172
|
+
✅ Passed: [checks that passed, or "All clean"]
|
|
173
|
+
⚠️ Warnings: [non-blocking issues, or "None"]
|
|
174
|
+
❌ Blocked: [blocking issues requiring fix, or "None"]
|
|
175
|
+
─────────────────────────────────────────────────
|
|
176
|
+
VBC status: PENDING → VERIFIED
|
|
177
|
+
Evidence: [test output / lint pass / compile success]
|
|
178
|
+
```
|
|
127
179
|
|
|
128
|
-
-
|
|
129
|
-
|
|
130
|
-
- Limit resource access
|
|
180
|
+
**VBC (Verification-Before-Completion) is mandatory.**
|
|
181
|
+
Do not mark status as VERIFIED until concrete terminal evidence is provided.
|
|
131
182
|
|
|
132
|
-
### API Keys
|
|
133
183
|
|
|
134
|
-
- Use environment variables
|
|
135
|
-
- Don't log secrets
|
|
136
|
-
- Validate permissions
|
|
137
184
|
|
|
138
185
|
---
|
|
139
186
|
|
|
140
|
-
##
|
|
187
|
+
## 🤖 LLM-Specific Traps
|
|
141
188
|
|
|
142
|
-
|
|
189
|
+
AI coding assistants often fall into specific bad habits when dealing with this domain. These are strictly forbidden:
|
|
143
190
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
191
|
+
1. **Over-engineering:** Proposing complex abstractions or distributed systems when a simpler approach suffices.
|
|
192
|
+
2. **Hallucinated Libraries/Methods:** Using non-existent methods or packages. Always `// VERIFY` or check `package.json` / `requirements.txt`.
|
|
193
|
+
3. **Skipping Edge Cases:** Writing the "happy path" and ignoring error handling, timeouts, or data validation.
|
|
194
|
+
4. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
195
|
+
5. **Silent Degradation:** Catching and suppressing errors without logging or re-raising.
|
|
149
196
|
|
|
150
197
|
---
|
|
151
198
|
|
|
152
|
-
##
|
|
199
|
+
## 🏛️ Tribunal Integration (Anti-Hallucination)
|
|
153
200
|
|
|
154
|
-
|
|
201
|
+
**Slash command: `/review` or `/tribunal-full`**
|
|
202
|
+
**Active reviewers: `logic-reviewer` · `security-auditor`**
|
|
155
203
|
|
|
156
|
-
|
|
157
|
-
|------|-------|
|
|
158
|
-
| Unit | Tool logic |
|
|
159
|
-
| Integration | Full server |
|
|
160
|
-
| Contract | Schema validation |
|
|
204
|
+
### ❌ Forbidden AI Tropes
|
|
161
205
|
|
|
162
|
-
|
|
206
|
+
1. **Blind Assumptions:** Never make an assumption without documenting it clearly with `// VERIFY: [reason]`.
|
|
207
|
+
2. **Silent Degradation:** Catching and suppressing errors without logging or handling.
|
|
208
|
+
3. **Context Amnesia:** Forgetting the user's constraints and offering generic advice instead of tailored solutions.
|
|
163
209
|
|
|
164
|
-
|
|
210
|
+
### ✅ Pre-Flight Self-Audit
|
|
165
211
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
212
|
+
Review these questions before confirming output:
|
|
213
|
+
```
|
|
214
|
+
✅ Did I rely ONLY on real, verified tools and methods?
|
|
215
|
+
✅ Is this solution appropriately scoped to the user's constraints?
|
|
216
|
+
✅ Did I handle potential failure modes and edge cases?
|
|
217
|
+
✅ Have I avoided generic boilerplate that doesn't add value?
|
|
218
|
+
```
|
|
173
219
|
|
|
174
|
-
|
|
220
|
+
### 🛑 Verification-Before-Completion (VBC) Protocol
|
|
175
221
|
|
|
176
|
-
|
|
222
|
+
**CRITICAL:** You must follow a strict "evidence-based closeout" state machine.
|
|
223
|
+
- ❌ **Forbidden:** Declaring a task complete because the output "looks correct."
|
|
224
|
+
- ✅ **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.
|