tribunal-kit 4.6.0 → 5.7.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/ARCHITECTURE.md +7 -4
- package/.agent/routing_index.json +714 -654
- package/.agent/rules/GEMINI.md +10 -9
- package/.agent/skills/emil-design-eng/SKILL.md +147 -0
- package/.agent/skills/review-animations/SKILL.md +72 -0
- package/.agent/skills/review-animations/STANDARDS.md +73 -0
- package/.agent/workflows/generate.md +1 -1
- package/.agent/workflows/tribunal-database.md +8 -1
- package/.agent/workflows/tribunal-frontend.md +18 -99
- package/.agent/workflows/tribunal-full.md +12 -10
- package/.agent/workflows/tribunal-mobile.md +8 -1
- package/.agent/workflows/tribunal-performance.md +1 -1
- package/.agent/workflows/tribunal-speed.md +1 -1
- package/.agent/workflows/ui-ux-pro-max.md +22 -12
- package/README.md +15 -1
- package/bin/mcp-server.js +89 -19
- package/bin/wrapper.js +5 -4
- package/dist/cli.js +234 -0
- package/dist/commands/case.js +48 -0
- package/dist/commands/context.js +66 -0
- package/dist/commands/graph.js +38 -0
- package/dist/commands/hook.js +28 -0
- package/dist/commands/init.js +297 -0
- package/dist/commands/learn.js +60 -0
- package/dist/commands/marathon.js +45 -0
- package/dist/commands/mutate.js +30 -0
- package/dist/commands/status.js +35 -0
- package/dist/commands/sync.js +25 -0
- package/dist/commands/uninstall.js +42 -0
- package/dist/commands/update.js +37 -0
- package/dist/mcp/server.js +142 -0
- package/dist/types.js +8 -0
- package/dist/utils/fs.js +96 -0
- package/dist/utils/hasher.js +142 -0
- package/dist/utils/helpers.js +68 -0
- package/dist/utils/logger.js +54 -0
- package/dist/utils/version.js +150 -0
- package/package.json +3 -2
- package/scripts/benchmark.js +160 -0
- package/.agent/GEMINI.md +0 -127
- package/.agent/skills/doc.md +0 -209
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Tribunal-Kit Performance Benchmark
|
|
4
|
+
*
|
|
5
|
+
* Measures and reports performance metrics for key operations.
|
|
6
|
+
* Run: node scripts/benchmark.js
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const { execSync, spawnSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
|
|
14
|
+
// ANSI colors
|
|
15
|
+
const C = {
|
|
16
|
+
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
17
|
+
red: '\x1b[91m', green: '\x1b[92m', yellow: '\x1b[93m',
|
|
18
|
+
cyan: '\x1b[96m', white: '\x1b[97m', gray: '\x1b[90m',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
function c(color, text) { return `${C[color]}${text}${C.reset}`; }
|
|
22
|
+
function bold(text) { return `${C.bold}${text}${C.reset}`; }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Time a command execution in milliseconds.
|
|
26
|
+
* @param {string} label - Description of the benchmark
|
|
27
|
+
* @param {function} fn - Function to benchmark
|
|
28
|
+
* @param {number} [runs=3] - Number of runs for averaging
|
|
29
|
+
* @returns {{ label: string, avg: number, min: number, max: number, runs: number }}
|
|
30
|
+
*/
|
|
31
|
+
async function benchmark(label, fn, runs = 3) {
|
|
32
|
+
const times = [];
|
|
33
|
+
for (let i = 0; i < runs; i++) {
|
|
34
|
+
const start = performance.now();
|
|
35
|
+
await fn();
|
|
36
|
+
const end = performance.now();
|
|
37
|
+
times.push(end - start);
|
|
38
|
+
}
|
|
39
|
+
const avg = times.reduce((a, b) => a + b, 0) / times.length;
|
|
40
|
+
const min = Math.min(...times);
|
|
41
|
+
const max = Math.max(...times);
|
|
42
|
+
return { label, avg, min, max, runs };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Time a shell command.
|
|
47
|
+
*/
|
|
48
|
+
function benchmarkCommand(label, command, runs = 3) {
|
|
49
|
+
return benchmark(label, () => {
|
|
50
|
+
spawnSync('node', command.split(' '), {
|
|
51
|
+
stdio: 'pipe',
|
|
52
|
+
encoding: 'utf8',
|
|
53
|
+
env: { ...process.env, TK_SKIP_UPDATE_CHECK: '1' },
|
|
54
|
+
});
|
|
55
|
+
}, runs);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function main() {
|
|
59
|
+
console.log();
|
|
60
|
+
console.log(bold(` ⚡ Tribunal-Kit Performance Benchmark`));
|
|
61
|
+
console.log(c('gray', ` ─────────────────────────────────────────`));
|
|
62
|
+
console.log(c('gray', ` Platform: ${os.platform()} ${os.arch()}`));
|
|
63
|
+
console.log(c('gray', ` Node: ${process.version}`));
|
|
64
|
+
console.log(c('gray', ` CPUs: ${os.cpus().length}x ${os.cpus()[0]?.model || 'unknown'}`));
|
|
65
|
+
console.log(c('gray', ` ─────────────────────────────────────────`));
|
|
66
|
+
console.log();
|
|
67
|
+
|
|
68
|
+
const cliPath = path.resolve(__dirname, '../bin/wrapper.js');
|
|
69
|
+
const tempDir = path.join(os.tmpdir(), `tribunal-bench-${Date.now()}`);
|
|
70
|
+
fs.mkdirSync(tempDir, { recursive: true });
|
|
71
|
+
|
|
72
|
+
const results = [];
|
|
73
|
+
|
|
74
|
+
// 1. Cold start (help)
|
|
75
|
+
console.log(c('cyan', ' ▸ Benchmarking: CLI cold-start (--help)'));
|
|
76
|
+
const helpResult = await benchmarkCommand(
|
|
77
|
+
'CLI cold-start (--help)',
|
|
78
|
+
`${cliPath} --help`,
|
|
79
|
+
5
|
|
80
|
+
);
|
|
81
|
+
results.push(helpResult);
|
|
82
|
+
|
|
83
|
+
// 2. Status check
|
|
84
|
+
console.log(c('cyan', ' ▸ Benchmarking: tk status'));
|
|
85
|
+
const statusResult = await benchmarkCommand(
|
|
86
|
+
'Status check',
|
|
87
|
+
`${cliPath} status --quiet`,
|
|
88
|
+
5
|
|
89
|
+
);
|
|
90
|
+
results.push(statusResult);
|
|
91
|
+
|
|
92
|
+
// 3. Init (dry-run)
|
|
93
|
+
console.log(c('cyan', ' ▸ Benchmarking: tk init --dry-run'));
|
|
94
|
+
const initResult = await benchmarkCommand(
|
|
95
|
+
'Init (dry-run)',
|
|
96
|
+
`${cliPath} init --dry-run --quiet --skip-update-check --path=${tempDir}`,
|
|
97
|
+
3
|
|
98
|
+
);
|
|
99
|
+
results.push(initResult);
|
|
100
|
+
|
|
101
|
+
// 4. Init (real, to temp dir)
|
|
102
|
+
console.log(c('cyan', ' ▸ Benchmarking: tk init (real copy)'));
|
|
103
|
+
const initRealResult = await benchmark(
|
|
104
|
+
'Init (full copy)',
|
|
105
|
+
() => {
|
|
106
|
+
const runDir = path.join(tempDir, `run-${Date.now()}`);
|
|
107
|
+
fs.mkdirSync(runDir, { recursive: true });
|
|
108
|
+
spawnSync('node', [cliPath, 'init', '--quiet', '--skip-update-check', `--path=${runDir}`], {
|
|
109
|
+
stdio: 'pipe',
|
|
110
|
+
encoding: 'utf8',
|
|
111
|
+
env: { ...process.env, TK_SKIP_UPDATE_CHECK: '1' },
|
|
112
|
+
});
|
|
113
|
+
// Cleanup
|
|
114
|
+
try { fs.rmSync(runDir, { recursive: true, force: true }); } catch {}
|
|
115
|
+
},
|
|
116
|
+
3
|
|
117
|
+
);
|
|
118
|
+
results.push(initRealResult);
|
|
119
|
+
|
|
120
|
+
// Print results table
|
|
121
|
+
console.log();
|
|
122
|
+
console.log(bold(` Results`));
|
|
123
|
+
console.log(c('gray', ` ─────────────────────────────────────────────────────────`));
|
|
124
|
+
console.log(` ${c('white', 'Operation'.padEnd(30))} ${c('white', 'Avg (ms)'.padStart(10))} ${c('white', 'Min'.padStart(8))} ${c('white', 'Max'.padStart(8))}`);
|
|
125
|
+
console.log(c('gray', ` ─────────────────────────────────────────────────────────`));
|
|
126
|
+
|
|
127
|
+
for (const r of results) {
|
|
128
|
+
const avgColor = r.avg < 100 ? 'green' : r.avg < 500 ? 'yellow' : 'red';
|
|
129
|
+
console.log(` ${c('white', r.label.padEnd(30))} ${c(avgColor, String(Math.round(r.avg)).padStart(10))} ${c('gray', String(Math.round(r.min)).padStart(8))} ${c('gray', String(Math.round(r.max)).padStart(8))}`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
console.log(c('gray', ` ─────────────────────────────────────────────────────────`));
|
|
133
|
+
console.log();
|
|
134
|
+
|
|
135
|
+
// Write results to JSON for CI/comparison
|
|
136
|
+
const outputPath = path.resolve(__dirname, '../benchmark-results.json');
|
|
137
|
+
const outputData = {
|
|
138
|
+
timestamp: new Date().toISOString(),
|
|
139
|
+
platform: `${os.platform()}-${os.arch()}`,
|
|
140
|
+
node: process.version,
|
|
141
|
+
results: results.map(r => ({
|
|
142
|
+
label: r.label,
|
|
143
|
+
avg_ms: Math.round(r.avg),
|
|
144
|
+
min_ms: Math.round(r.min),
|
|
145
|
+
max_ms: Math.round(r.max),
|
|
146
|
+
runs: r.runs,
|
|
147
|
+
})),
|
|
148
|
+
};
|
|
149
|
+
fs.writeFileSync(outputPath, JSON.stringify(outputData, null, 2));
|
|
150
|
+
console.log(c('green', ` ✔ Results saved to benchmark-results.json`));
|
|
151
|
+
|
|
152
|
+
// Cleanup temp
|
|
153
|
+
try { fs.rmSync(tempDir, { recursive: true, force: true }); } catch {}
|
|
154
|
+
console.log();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
main().catch(err => {
|
|
158
|
+
console.error(`Benchmark failed: ${err.message}`);
|
|
159
|
+
process.exit(1);
|
|
160
|
+
});
|
package/.agent/GEMINI.md
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
trigger: always_on
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# HALLUCINATION-GUARD GEMINI.md
|
|
6
|
-
|
|
7
|
-
This file defines the AI behaviour for the Anti-Hallucination Tribunal system.
|
|
8
|
-
Works with Cursor, Windsurf, Antigravity, and any AI IDE that supports `.agent` folders.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## CRITICAL: AGENT & SKILL PROTOCOL
|
|
13
|
-
|
|
14
|
-
Before responding to ANY complex or ambiguous coding request, you MUST:
|
|
15
|
-
|
|
16
|
-
1. **Invoke the Pre-Router:** Read `.agent/skills/intelligent-routing/SKILL.md` to accurately determine the domain and required skills. Do NOT rely on guessing.
|
|
17
|
-
2. **Select the correct reviewer agents** based on the Pre-Router's output.
|
|
18
|
-
3. **Announce** which skills and agents are active.
|
|
19
|
-
4. **Apply** the Tribunal workflow to your code generation.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## BASIC REQUEST CLASSIFICATION (Fallback)
|
|
24
|
-
|
|
25
|
-
If the request is extremely simple, you may use this fallback table. Otherwise, rely on the `intelligent-routing` Pre-Router.
|
|
26
|
-
|
|
27
|
-
| Request Type | Trigger Words | Tribunal Agents Activated |
|
|
28
|
-
| ---------------------------- | ------------------------------------------------------- | ----------------------------------------------------------- |
|
|
29
|
-
| **General Code** | "write", "create", "generate" | Logic + Security (default) |
|
|
30
|
-
| **Backend / API** | "api", "server", "endpoint", "route" | Logic + Security + Dependency + Types |
|
|
31
|
-
| **Database / SQL** | "query", "database", "sql", "prisma", "orm" | Logic + Security + SQL |
|
|
32
|
-
| **React / Frontend** | "component", "hook", "react", "next", "ui" | Logic + Security + Frontend + Types |
|
|
33
|
-
| **Performance** | "optimize", "speed", "bottleneck", "slow" | Logic + Performance |
|
|
34
|
-
| **Performance (Full-Stack)** | "latency", "throughput", "end-to-end perf" | vitals-reviewer + db-latency-auditor + throughput-optimizer |
|
|
35
|
-
| **Tests** | "test", "spec", "coverage", "vitest", "jest" | Logic + TestCoverage |
|
|
36
|
-
| **AI / LLM** | "openai", "anthropic", "llm", "embedding", "prompt" | Logic + Security + AI-Code-Reviewer |
|
|
37
|
-
| **Accessibility** | "a11y", "wcag", "aria", "accessibility" | Logic + Accessibility-Reviewer |
|
|
38
|
-
| **Mobile** | "mobile", "react native", "flutter" | Logic + Security + Mobile-Reviewer |
|
|
39
|
-
| **Design / UX** | "design", "trend", "palette", "inspiration", "ux audit" | `trend-researcher` + `ui-ux-researcher` |
|
|
40
|
-
| **API Testing** | "test api", "endpoint test", "api flow" | `api-tester` workflow |
|
|
41
|
-
| **Performance** | "benchmark", "lighthouse", "bundle size", "latency" | `performance-benchmarker` workflow |
|
|
42
|
-
| **Test Analysis** | "test failed", "analyze tests", "what broke" | `test-result-analyzer` |
|
|
43
|
-
| **All Domains** | "/tribunal-full" or "audit everything" | ALL 14 agents |
|
|
44
|
-
| **Review Only** | "/review", "check this", "audit" | All relevant agents, no Maker |
|
|
45
|
-
| **Swarm / Multi-Domain** | "/swarm", "multiple agents", "parallel tasks" | `supervisor-agent` → dispatches to specialist Workers |
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
## TIER 0: UNIVERSAL RULES (Always Active)
|
|
50
|
-
|
|
51
|
-
### Anti-Hallucination Constraints (MANDATORY)
|
|
52
|
-
|
|
53
|
-
Every code response MUST:
|
|
54
|
-
|
|
55
|
-
1. **Only reference real imports** — never invent library methods or package names
|
|
56
|
-
2. **Ground in context** — if no context is provided, say what assumptions are being made
|
|
57
|
-
3. **Be iterative** — generate one function/feature at a time, not entire apps
|
|
58
|
-
4. **Flag uncertainty** — when unsure, write `// VERIFY: this method may not exist`
|
|
59
|
-
5. **Respect the active schema** — don't invent database columns or table names
|
|
60
|
-
|
|
61
|
-
### Code Quality (MANDATORY)
|
|
62
|
-
|
|
63
|
-
- No `any` types in TypeScript without a comment explaining why
|
|
64
|
-
- Every exported function needs a return type annotation
|
|
65
|
-
- Async functions must handle errors (try/catch or `.catch()`)
|
|
66
|
-
- No `eval()`, `innerHTML`, unparameterized SQL string concatenation
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## SLASH COMMANDS AVAILABLE
|
|
71
|
-
|
|
72
|
-
| Command | Description |
|
|
73
|
-
| -------------------------- | ------------------------------------------------------------------------------------------ |
|
|
74
|
-
| `/generate` | Run the full Tribunal (Maker → Parallel Review → Human Gate) |
|
|
75
|
-
| `/create` | Structured 4-stage app creation |
|
|
76
|
-
| `/enhance` | Add or update features in existing apps |
|
|
77
|
-
| `/plan` | Project planning only — no code written |
|
|
78
|
-
| `/review` | Review an existing file or snippet for hallucinations |
|
|
79
|
-
| `/review-sql` | SQL-specific deep audit |
|
|
80
|
-
| `/review-react` | React/Frontend-specific deep audit |
|
|
81
|
-
| `/review-types` | TypeScript type safety audit |
|
|
82
|
-
| `/review-deps` | Dependency hallucination audit (checks against package.json) |
|
|
83
|
-
| `/tribunal-full` | All 14 reviewer agents run in parallel |
|
|
84
|
-
| `/tribunal-backend` | Logic + Security + Dependency + Types |
|
|
85
|
-
| `/tribunal-frontend` | Logic + Security + Frontend + Types |
|
|
86
|
-
| `/tribunal-database` | Logic + Security + SQL |
|
|
87
|
-
| `/tribunal-mobile` | Logic + Security + Mobile — for React Native, Flutter, responsive web |
|
|
88
|
-
| `/tribunal-performance` | Logic + Performance — for optimization, profiling, bottlenecks |
|
|
89
|
-
| `/tribunal-speed` | Full-stack parallel performance audit — CWV + DB latency + Node throughput |
|
|
90
|
-
| `/brainstorm` | Explore implementation options before coding |
|
|
91
|
-
| `/debug` | Systematic debugging with root cause analysis |
|
|
92
|
-
| `/refactor` | Dependency-safe code refactoring with behavior preservation |
|
|
93
|
-
| `/migrate` | Framework upgrades, dependency bumps, DB migrations |
|
|
94
|
-
| `/deploy` | Pre-flight checks and deployment execution |
|
|
95
|
-
| `/test` | Test generation and test running |
|
|
96
|
-
| `/preview` | Start / stop local dev server |
|
|
97
|
-
| `/status` | Agent and project status board |
|
|
98
|
-
| `/session` | Multi-session state tracking |
|
|
99
|
-
| `/orchestrate` | Coordinate multiple agents for complex tasks |
|
|
100
|
-
| `/swarm` | Supervisor decomposes goal → dispatches to specialist Workers → synthesizes unified output |
|
|
101
|
-
| `/ui-ux-pro-max` | Plan and implement cutting-edge UI/UX |
|
|
102
|
-
| `/audit` | Full project health audit (security → lint → tests → deps → bundle) |
|
|
103
|
-
| `/fix` | Auto-fix lint, formatting, and import issues (with human gate) |
|
|
104
|
-
| `/changelog` | Generate changelog from git history |
|
|
105
|
-
| `/api-tester` | Multi-stage API endpoint testing with auth-aware request sequences |
|
|
106
|
-
| `/performance-benchmarker` | Lighthouse, bundle analysis, and API latency benchmarks |
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## RESPONSE FORMAT (MANDATORY)
|
|
111
|
-
|
|
112
|
-
When generating code, always respond as:
|
|
113
|
-
|
|
114
|
-
```markdown
|
|
115
|
-
🏛️ **Tribunal [domain] review active**
|
|
116
|
-
🤖 Applying agents: [list active agents]
|
|
117
|
-
|
|
118
|
-
[Generated code]
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
⚖️ **Self-audit notes:**
|
|
123
|
-
|
|
124
|
-
- [Any assumption made]
|
|
125
|
-
- [Any `// VERIFY` tags placed and why]
|
|
126
|
-
- [Dependencies added and where to install them]
|
|
127
|
-
```
|
package/.agent/skills/doc.md
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
# Antigravity Skills
|
|
2
|
-
|
|
3
|
-
**Guide to creating and using Skills in the Antigravity Kit**
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 📋 Overview
|
|
8
|
-
|
|
9
|
-
While Antigravity's base models (like Gemini) are powerful generalists, they don't know your specific project context or your team's standards. Loading every rule or tool into the agent's context window leads to "tool bloat," higher costs, latency, and confusion.
|
|
10
|
-
|
|
11
|
-
**Antigravity Skills** solve this through **Progressive Disclosure**. A Skill is a package of specialized knowledge that remains dormant until needed. This information is only loaded into the agent's context when your specific request matches the skill's description.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 📁 Structure and Scope
|
|
16
|
-
|
|
17
|
-
Skills are folder-based packages. You can define these scopes based on your needs:
|
|
18
|
-
|
|
19
|
-
| Scope | Path | Description |
|
|
20
|
-
| ------------- | --------------------------------- | ------------------------------------ |
|
|
21
|
-
| **Workspace** | `<workspace-root>/.agent/skills/` | Available only in a specific project |
|
|
22
|
-
|
|
23
|
-
### Skill Directory Structure
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
my-skill/
|
|
27
|
-
├── SKILL.md # (Required) Metadata & instructions
|
|
28
|
-
├── scripts/ # (Optional) Python or Bash scripts
|
|
29
|
-
├── references/ # (Optional) Text, documentation, templates
|
|
30
|
-
└── assets/ # (Optional) Images or logos
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 🔍 Example 1: Code Review Skill
|
|
36
|
-
|
|
37
|
-
This is an instruction-only skill; you only need to create the `SKILL.md` file.
|
|
38
|
-
|
|
39
|
-
### Step 1: Create the directory
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
mkdir -p .agent/skills/code-review
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Step 2: Create SKILL.md
|
|
46
|
-
|
|
47
|
-
```markdown
|
|
48
|
-
---
|
|
49
|
-
name: code-review
|
|
50
|
-
description: Reviews code changes for bugs, style issues, and best practices. Use when reviewing PRs or checking code quality.
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
# Code Review Skill
|
|
54
|
-
|
|
55
|
-
When reviewing code, follow these steps:
|
|
56
|
-
|
|
57
|
-
## Review checklist
|
|
58
|
-
|
|
59
|
-
1. **Correctness**: Does the code do what it's supposed to?
|
|
60
|
-
2. **Edge cases**: Are error conditions handled?
|
|
61
|
-
3. **Style**: Does it follow project conventions?
|
|
62
|
-
4. **Performance**: Are there obvious inefficiencies?
|
|
63
|
-
|
|
64
|
-
## How to provide feedback
|
|
65
|
-
|
|
66
|
-
- Be specific about what needs to change
|
|
67
|
-
- Explain why, not just what
|
|
68
|
-
- Suggest alternatives when possible
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
**Note**: The `SKILL.md` file contains metadata (name, description) at the top, followed by the instructions. The agent will only read the metadata and load the full instructions only when needed.
|
|
72
|
-
|
|
73
|
-
### Try it out
|
|
74
|
-
|
|
75
|
-
Create a file `demo_bad_code.py`:
|
|
76
|
-
|
|
77
|
-
```python
|
|
78
|
-
import time
|
|
79
|
-
|
|
80
|
-
def get_user_data(users, id):
|
|
81
|
-
# Find user by ID
|
|
82
|
-
for u in users:
|
|
83
|
-
if u['id'] == id:
|
|
84
|
-
return u
|
|
85
|
-
return None
|
|
86
|
-
|
|
87
|
-
def process_payments(items):
|
|
88
|
-
total = 0
|
|
89
|
-
for i in items:
|
|
90
|
-
# Calculate tax
|
|
91
|
-
tax = i['price'] * 0.1
|
|
92
|
-
total = total + i['price'] + tax
|
|
93
|
-
time.sleep(0.1) # Simulate slow network call
|
|
94
|
-
return total
|
|
95
|
-
|
|
96
|
-
def run_batch():
|
|
97
|
-
users = [{'id': 1, 'name': 'Alice'}, {'id': 2, 'name': 'Bob'}]
|
|
98
|
-
items = [{'price': 10}, {'price': 20}, {'price': 100}]
|
|
99
|
-
|
|
100
|
-
u = get_user_data(users, 3)
|
|
101
|
-
print("User found: " + u['name']) # Will crash if None
|
|
102
|
-
|
|
103
|
-
print("Total: " + str(process_payments(items)))
|
|
104
|
-
|
|
105
|
-
if __name__ == "__main__":
|
|
106
|
-
run_batch()
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**Prompt**: `review the @demo_bad_code.py file`
|
|
110
|
-
|
|
111
|
-
The Agent will automatically identify the `code-review` skill, load the information, and follow the instructions.
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## 📄 Example 2: License Header Skill
|
|
116
|
-
|
|
117
|
-
This skill uses a reference file in the `resources/` (or `references/`) directory.
|
|
118
|
-
|
|
119
|
-
### Step 1: Create the directory
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
mkdir -p .agent/skills/license-header-adder/resources
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Step 2: Create the template file
|
|
126
|
-
|
|
127
|
-
**`.agent/skills/license-header-adder/resources/HEADER.txt`**:
|
|
128
|
-
|
|
129
|
-
```
|
|
130
|
-
/*
|
|
131
|
-
* Copyright (c) 2026 YOUR_COMPANY_NAME LLC.
|
|
132
|
-
* All rights reserved.
|
|
133
|
-
* This code is proprietary and confidential.
|
|
134
|
-
*/
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Step 3: Create SKILL.md
|
|
138
|
-
|
|
139
|
-
**`.agent/skills/license-header-adder/SKILL.md`**:
|
|
140
|
-
|
|
141
|
-
```markdown
|
|
142
|
-
---
|
|
143
|
-
name: license-header-adder
|
|
144
|
-
description: Adds the standard corporate license header to new source files.
|
|
145
|
-
---
|
|
146
|
-
|
|
147
|
-
# License Header Adder
|
|
148
|
-
|
|
149
|
-
This skill ensures that all new source files have the correct copyright header.
|
|
150
|
-
|
|
151
|
-
## Instructions
|
|
152
|
-
|
|
153
|
-
1. **Read the Template**: Read the content of `resources/HEADER.txt`.
|
|
154
|
-
2. **Apply to File**: When creating a new file, prepend this exact content.
|
|
155
|
-
3. **Adapt Syntax**:
|
|
156
|
-
- For C-style languages (Java, TS), keep the `/* */` block.
|
|
157
|
-
- For Python/Shell, convert to `#` comments.
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Try it out
|
|
161
|
-
|
|
162
|
-
**Prompt**: `Create a new Python script named data_processor.py that prints 'Hello World'.`
|
|
163
|
-
|
|
164
|
-
The Agent will read the template, convert the comments to Python style, and automatically add it to the top of the file.
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
## 🎯 Conclusion
|
|
169
|
-
|
|
170
|
-
By creating Skills, you transform a general AI model into an expert for your project:
|
|
171
|
-
|
|
172
|
-
- ✅ Systematize best practices
|
|
173
|
-
- ✅ Adhere to code review rules
|
|
174
|
-
- ✅ Automatically add license headers
|
|
175
|
-
- ✅ The Agent automatically knows how to work with your team
|
|
176
|
-
|
|
177
|
-
Instead of constantly reminding the AI to "remember to add the license" or "fix the commit format," now the Agent will do it automatically!
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## 🚀 Industry Level 2 — Pro Skills
|
|
182
|
-
|
|
183
|
-
These advanced skills are automatically loaded by the `system-architect` and `cloud-engineer` agents when the request domain matches. They are NOT loaded by default — only when explicitly needed, preventing context bloat.
|
|
184
|
-
|
|
185
|
-
| Skill | Activation Trigger | What It Knows |
|
|
186
|
-
| ---------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
|
|
187
|
-
| `git-pro` | Advanced Git operations, monorepo, release engineering | Git internals, bisect, worktrees, semantic-release, OIDC GitHub Actions, CODEOWNERS |
|
|
188
|
-
| `containerization-pro` | "containerize", "Dockerfile", "Docker", "ECR" | Multi-stage builds (Node/Python/Rust/Go), image hardening, BuildKit, Trivy scanning, AWS ECR |
|
|
189
|
-
| `cicd-pro` | "CI/CD pipeline", "deploy to", "GitHub Actions" | 3-stage pipeline, OIDC AWS auth, Blue/Green ECS deploy, rollback, Slack notifications |
|
|
190
|
-
| `system-design-pro` | "design a system", "scale this", "N users", "capacity" | 6-step framework, scale estimation, CAP Theorem, database matrix, reference designs |
|
|
191
|
-
| `cloud-architect` | "AWS", "Terraform", "ECS", "VPC", "infrastructure" | AWS service selection, Terraform HCL, VPC design, IAM, Secrets Manager, CloudWatch |
|
|
192
|
-
|
|
193
|
-
### Golden Path (Decision 2B)
|
|
194
|
-
|
|
195
|
-
All cloud/infra skills are opinionated toward:
|
|
196
|
-
|
|
197
|
-
- **Cloud**: AWS
|
|
198
|
-
- **Containers**: Docker + AWS ECR
|
|
199
|
-
- **CI/CD**: GitHub Actions
|
|
200
|
-
- **Compute**: ECS Fargate (API) / Lambda (events)
|
|
201
|
-
- **IaC**: Terraform
|
|
202
|
-
- **Auth**: OIDC (zero static secrets)
|
|
203
|
-
|
|
204
|
-
### New Agents
|
|
205
|
-
|
|
206
|
-
| Agent | Owns | Use When |
|
|
207
|
-
| ------------------ | ------------------------------------------------------- | ----------------------------------------------------- |
|
|
208
|
-
| `system-architect` | `system-design-pro` + `architecture` | Designing systems, capacity planning, scale questions |
|
|
209
|
-
| `cloud-engineer` | `cloud-architect` + `cicd-pro` + `containerization-pro` | AWS infra, Dockerfiles, CI/CD pipelines, Terraform |
|