@jigyasudham/veto 0.8.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/.claude/settings.local.json +9 -0
- package/README.md +190 -0
- package/dist/adapters/claude.js +57 -0
- package/dist/adapters/codex.js +58 -0
- package/dist/adapters/gemini.js +58 -0
- package/dist/adapters/index.js +156 -0
- package/dist/agents/development/api.js +116 -0
- package/dist/agents/development/backend.js +82 -0
- package/dist/agents/development/coder.js +207 -0
- package/dist/agents/development/database.js +81 -0
- package/dist/agents/development/debugger.js +234 -0
- package/dist/agents/development/devops.js +84 -0
- package/dist/agents/development/frontend.js +83 -0
- package/dist/agents/development/migration.js +141 -0
- package/dist/agents/development/performance.js +142 -0
- package/dist/agents/development/refactor.js +85 -0
- package/dist/agents/development/reviewer.js +260 -0
- package/dist/agents/development/tester.js +143 -0
- package/dist/agents/executor.js +144 -0
- package/dist/agents/memory/context-manager.js +167 -0
- package/dist/agents/memory/decision-logger.js +157 -0
- package/dist/agents/memory/knowledge-base.js +120 -0
- package/dist/agents/memory/pattern-learner.js +140 -0
- package/dist/agents/memory/project-mapper.js +114 -0
- package/dist/agents/quality/accessibility.js +89 -0
- package/dist/agents/quality/code-quality.js +109 -0
- package/dist/agents/quality/compatibility.js +55 -0
- package/dist/agents/quality/documentation.js +95 -0
- package/dist/agents/quality/error-handling.js +87 -0
- package/dist/agents/research/competitor-analyzer.js +44 -0
- package/dist/agents/research/cost-analyzer.js +51 -0
- package/dist/agents/research/estimator.js +57 -0
- package/dist/agents/research/ethics-bias.js +111 -0
- package/dist/agents/research/researcher.js +112 -0
- package/dist/agents/research/risk-assessor.js +61 -0
- package/dist/agents/research/tech-advisor.js +52 -0
- package/dist/agents/security/auth.js +269 -0
- package/dist/agents/security/dependency-audit.js +273 -0
- package/dist/agents/security/penetration.js +245 -0
- package/dist/agents/security/privacy.js +259 -0
- package/dist/agents/security/scanner.js +288 -0
- package/dist/agents/security/secrets.js +212 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/workflow/automation.js +56 -0
- package/dist/agents/workflow/file-manager.js +49 -0
- package/dist/agents/workflow/git-agent.js +52 -0
- package/dist/agents/workflow/reporter.js +48 -0
- package/dist/agents/workflow/search-agent.js +39 -0
- package/dist/agents/workflow/task-coordinator.js +40 -0
- package/dist/agents/workflow/task-planner.js +46 -0
- package/dist/cli.js +132 -0
- package/dist/council/decision-engine.js +136 -0
- package/dist/council/devil-advocate.js +106 -0
- package/dist/council/index.js +37 -0
- package/dist/council/lead-developer.js +108 -0
- package/dist/council/legal-compliance.js +142 -0
- package/dist/council/product-manager.js +92 -0
- package/dist/council/security.js +162 -0
- package/dist/council/system-architect.js +122 -0
- package/dist/council/types.js +2 -0
- package/dist/council/ux-designer.js +109 -0
- package/dist/memory/local.js +182 -0
- package/dist/memory/schema.js +116 -0
- package/dist/memory/sync.js +199 -0
- package/dist/router/complexity-scorer.js +78 -0
- package/dist/router/context-compressor.js +58 -0
- package/dist/router/index.js +29 -0
- package/dist/router/learning-updater.js +186 -0
- package/dist/router/model-selector.js +51 -0
- package/dist/router/rate-monitor.js +73 -0
- package/dist/server.js +949 -0
- package/dist/skills/development/skill-api-design.js +313 -0
- package/dist/skills/development/skill-auth.js +255 -0
- package/dist/skills/development/skill-ci-cd.js +2 -0
- package/dist/skills/development/skill-crud.js +193 -0
- package/dist/skills/development/skill-db-schema.js +2 -0
- package/dist/skills/development/skill-docker.js +2 -0
- package/dist/skills/development/skill-env-setup.js +2 -0
- package/dist/skills/development/skill-scaffold.js +299 -0
- package/dist/skills/intelligence/skill-complexity-score.js +66 -0
- package/dist/skills/intelligence/skill-cost-track.js +36 -0
- package/dist/skills/intelligence/skill-learning-loop.js +66 -0
- package/dist/skills/intelligence/skill-pattern-detect.js +35 -0
- package/dist/skills/intelligence/skill-rate-watch.js +58 -0
- package/dist/skills/memory/skill-context-compress.js +82 -0
- package/dist/skills/memory/skill-cross-sync.js +88 -0
- package/dist/skills/memory/skill-decision-log.js +103 -0
- package/dist/skills/memory/skill-session-restore.js +44 -0
- package/dist/skills/memory/skill-session-save.js +78 -0
- package/dist/skills/quality/skill-accessibility.js +2 -0
- package/dist/skills/quality/skill-code-review.js +60 -0
- package/dist/skills/quality/skill-docs-gen.js +2 -0
- package/dist/skills/quality/skill-perf-audit.js +2 -0
- package/dist/skills/quality/skill-security-scan.js +67 -0
- package/dist/skills/quality/skill-test-suite.js +274 -0
- package/dist/skills/workflow/skill-deploy.js +2 -0
- package/dist/skills/workflow/skill-git-workflow.js +2 -0
- package/dist/skills/workflow/skill-rollback.js +2 -0
- package/dist/skills/workflow/skill-task-breakdown.js +2 -0
- package/package.json +30 -0
- package/src/adapters/claude.ts +70 -0
- package/src/adapters/codex.ts +71 -0
- package/src/adapters/gemini.ts +71 -0
- package/src/adapters/index.ts +217 -0
- package/src/agents/development/api.ts +120 -0
- package/src/agents/development/backend.ts +85 -0
- package/src/agents/development/coder.ts +213 -0
- package/src/agents/development/database.ts +83 -0
- package/src/agents/development/debugger.ts +238 -0
- package/src/agents/development/devops.ts +86 -0
- package/src/agents/development/frontend.ts +85 -0
- package/src/agents/development/migration.ts +144 -0
- package/src/agents/development/performance.ts +144 -0
- package/src/agents/development/refactor.ts +86 -0
- package/src/agents/development/reviewer.ts +268 -0
- package/src/agents/development/tester.ts +151 -0
- package/src/agents/executor.ts +158 -0
- package/src/agents/memory/context-manager.ts +171 -0
- package/src/agents/memory/decision-logger.ts +160 -0
- package/src/agents/memory/knowledge-base.ts +124 -0
- package/src/agents/memory/pattern-learner.ts +143 -0
- package/src/agents/memory/project-mapper.ts +118 -0
- package/src/agents/quality/accessibility.ts +99 -0
- package/src/agents/quality/code-quality.ts +115 -0
- package/src/agents/quality/compatibility.ts +58 -0
- package/src/agents/quality/documentation.ts +105 -0
- package/src/agents/quality/error-handling.ts +96 -0
- package/src/agents/research/competitor-analyzer.ts +45 -0
- package/src/agents/research/cost-analyzer.ts +54 -0
- package/src/agents/research/estimator.ts +60 -0
- package/src/agents/research/ethics-bias.ts +113 -0
- package/src/agents/research/researcher.ts +114 -0
- package/src/agents/research/risk-assessor.ts +63 -0
- package/src/agents/research/tech-advisor.ts +55 -0
- package/src/agents/security/auth.ts +287 -0
- package/src/agents/security/dependency-audit.ts +337 -0
- package/src/agents/security/penetration.ts +262 -0
- package/src/agents/security/privacy.ts +285 -0
- package/src/agents/security/scanner.ts +322 -0
- package/src/agents/security/secrets.ts +249 -0
- package/src/agents/types.ts +66 -0
- package/src/agents/workflow/automation.ts +59 -0
- package/src/agents/workflow/file-manager.ts +52 -0
- package/src/agents/workflow/git-agent.ts +55 -0
- package/src/agents/workflow/reporter.ts +51 -0
- package/src/agents/workflow/search-agent.ts +40 -0
- package/src/agents/workflow/task-coordinator.ts +41 -0
- package/src/agents/workflow/task-planner.ts +47 -0
- package/src/cli.ts +143 -0
- package/src/council/decision-engine.ts +171 -0
- package/src/council/devil-advocate.ts +116 -0
- package/src/council/index.ts +44 -0
- package/src/council/lead-developer.ts +118 -0
- package/src/council/legal-compliance.ts +152 -0
- package/src/council/product-manager.ts +102 -0
- package/src/council/security.ts +172 -0
- package/src/council/system-architect.ts +132 -0
- package/src/council/types.ts +33 -0
- package/src/council/ux-designer.ts +121 -0
- package/src/memory/local.ts +305 -0
- package/src/memory/schema.ts +174 -0
- package/src/memory/sync.ts +274 -0
- package/src/router/complexity-scorer.ts +96 -0
- package/src/router/context-compressor.ts +74 -0
- package/src/router/index.ts +60 -0
- package/src/router/learning-updater.ts +271 -0
- package/src/router/model-selector.ts +83 -0
- package/src/router/rate-monitor.ts +103 -0
- package/src/server.ts +1038 -0
- package/src/skills/development/skill-api-design.ts +329 -0
- package/src/skills/development/skill-auth.ts +271 -0
- package/src/skills/development/skill-ci-cd.ts +0 -0
- package/src/skills/development/skill-crud.ts +209 -0
- package/src/skills/development/skill-db-schema.ts +0 -0
- package/src/skills/development/skill-docker.ts +0 -0
- package/src/skills/development/skill-env-setup.ts +0 -0
- package/src/skills/development/skill-scaffold.ts +323 -0
- package/src/skills/intelligence/skill-complexity-score.ts +69 -0
- package/src/skills/intelligence/skill-cost-track.ts +39 -0
- package/src/skills/intelligence/skill-learning-loop.ts +69 -0
- package/src/skills/intelligence/skill-pattern-detect.ts +38 -0
- package/src/skills/intelligence/skill-rate-watch.ts +61 -0
- package/src/skills/memory/skill-context-compress.ts +98 -0
- package/src/skills/memory/skill-cross-sync.ts +104 -0
- package/src/skills/memory/skill-decision-log.ts +119 -0
- package/src/skills/memory/skill-session-restore.ts +59 -0
- package/src/skills/memory/skill-session-save.ts +94 -0
- package/src/skills/quality/skill-accessibility.ts +0 -0
- package/src/skills/quality/skill-code-review.ts +84 -0
- package/src/skills/quality/skill-docs-gen.ts +0 -0
- package/src/skills/quality/skill-perf-audit.ts +0 -0
- package/src/skills/quality/skill-security-scan.ts +91 -0
- package/src/skills/quality/skill-test-suite.ts +290 -0
- package/src/skills/workflow/skill-deploy.ts +0 -0
- package/src/skills/workflow/skill-git-workflow.ts +0 -0
- package/src/skills/workflow/skill-rollback.ts +0 -0
- package/src/skills/workflow/skill-task-breakdown.ts +0 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// Skill: crud — complete CRUD implementation guide
|
|
2
|
+
|
|
3
|
+
export interface SkillInput {
|
|
4
|
+
task: string;
|
|
5
|
+
context?: string;
|
|
6
|
+
options?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SkillOutput {
|
|
10
|
+
skill: string;
|
|
11
|
+
template?: string;
|
|
12
|
+
checklist: string[];
|
|
13
|
+
patterns: string[];
|
|
14
|
+
gotchas: string[];
|
|
15
|
+
resources: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const TEMPLATE = `
|
|
19
|
+
// ── 1. Model (src/models/item.ts) ─────────────────────────────────────────
|
|
20
|
+
export interface Item {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
userId: string; // ownership field — always include
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CreateItemInput {
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface UpdateItemInput {
|
|
35
|
+
name?: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// ── 2. Repository (src/repositories/item.repository.ts) ──────────────────
|
|
40
|
+
export interface ItemRepository {
|
|
41
|
+
findById(id: string): Promise<Item | null>;
|
|
42
|
+
findAllByUser(userId: string): Promise<Item[]>;
|
|
43
|
+
create(userId: string, input: CreateItemInput): Promise<Item>;
|
|
44
|
+
update(id: string, input: UpdateItemInput): Promise<Item>;
|
|
45
|
+
delete(id: string): Promise<void>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// PrismaItemRepository implements ItemRepository
|
|
49
|
+
export class PrismaItemRepository implements ItemRepository {
|
|
50
|
+
constructor(private readonly db: PrismaClient) {}
|
|
51
|
+
|
|
52
|
+
async findById(id: string): Promise<Item | null> {
|
|
53
|
+
return this.db.item.findUnique({ where: { id } });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async findAllByUser(userId: string): Promise<Item[]> {
|
|
57
|
+
return this.db.item.findMany({ where: { userId }, orderBy: { createdAt: 'desc' } });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async create(userId: string, input: CreateItemInput): Promise<Item> {
|
|
61
|
+
return this.db.item.create({ data: { ...input, userId } });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async update(id: string, input: UpdateItemInput): Promise<Item> {
|
|
65
|
+
return this.db.item.update({ where: { id }, data: input });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async delete(id: string): Promise<void> {
|
|
69
|
+
await this.db.item.delete({ where: { id } });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ── 3. Service (src/services/item.service.ts) ────────────────────────────
|
|
74
|
+
export class ItemService {
|
|
75
|
+
constructor(private readonly repo: ItemRepository) {}
|
|
76
|
+
|
|
77
|
+
async getItem(id: string, requestingUserId: string): Promise<Item> {
|
|
78
|
+
const item = await this.repo.findById(id);
|
|
79
|
+
if (!item) throw new NotFoundError('Item not found');
|
|
80
|
+
if (item.userId !== requestingUserId) throw new ForbiddenError('Access denied');
|
|
81
|
+
return item;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async listItems(userId: string): Promise<Item[]> {
|
|
85
|
+
return this.repo.findAllByUser(userId);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async createItem(userId: string, input: CreateItemInput): Promise<Item> {
|
|
89
|
+
return this.repo.create(userId, input);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async updateItem(id: string, input: UpdateItemInput, requestingUserId: string): Promise<Item> {
|
|
93
|
+
await this.getItem(id, requestingUserId); // throws if not found or not owned
|
|
94
|
+
return this.repo.update(id, input);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async deleteItem(id: string, requestingUserId: string): Promise<void> {
|
|
98
|
+
await this.getItem(id, requestingUserId); // ownership check
|
|
99
|
+
return this.repo.delete(id);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ── 4. Controller (src/controllers/item.controller.ts) ───────────────────
|
|
104
|
+
export class ItemController {
|
|
105
|
+
constructor(private readonly service: ItemService) {}
|
|
106
|
+
|
|
107
|
+
// GET /items
|
|
108
|
+
list = async (req: Request, res: Response): Promise<void> => {
|
|
109
|
+
const items = await this.service.listItems(req.user.id);
|
|
110
|
+
res.json({ data: items });
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// GET /items/:id
|
|
114
|
+
get = async (req: Request, res: Response): Promise<void> => {
|
|
115
|
+
const item = await this.service.getItem(req.params.id, req.user.id);
|
|
116
|
+
res.json({ data: item });
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// POST /items
|
|
120
|
+
create = async (req: Request, res: Response): Promise<void> => {
|
|
121
|
+
const item = await this.service.createItem(req.user.id, req.body);
|
|
122
|
+
res.status(201).json({ data: item });
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// PATCH /items/:id
|
|
126
|
+
update = async (req: Request, res: Response): Promise<void> => {
|
|
127
|
+
const item = await this.service.updateItem(req.params.id, req.body, req.user.id);
|
|
128
|
+
res.json({ data: item });
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// DELETE /items/:id
|
|
132
|
+
delete = async (req: Request, res: Response): Promise<void> => {
|
|
133
|
+
await this.service.deleteItem(req.params.id, req.user.id);
|
|
134
|
+
res.status(204).send();
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// ── 5. Routes (src/routes/items.ts) ─────────────────────────────────────
|
|
139
|
+
import { Router } from 'express';
|
|
140
|
+
import { z } from 'zod';
|
|
141
|
+
|
|
142
|
+
const CreateItemSchema = z.object({
|
|
143
|
+
name: z.string().min(1).max(100),
|
|
144
|
+
description: z.string().max(500).optional(),
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const UpdateItemSchema = z.object({
|
|
148
|
+
name: z.string().min(1).max(100).optional(),
|
|
149
|
+
description: z.string().max(500).optional(),
|
|
150
|
+
}).refine(obj => Object.keys(obj).length > 0, { message: 'At least one field required' });
|
|
151
|
+
|
|
152
|
+
export function createItemRouter(controller: ItemController): Router {
|
|
153
|
+
const router = Router();
|
|
154
|
+
router.get('/', controller.list);
|
|
155
|
+
router.get('/:id', controller.get);
|
|
156
|
+
router.post('/', validate(CreateItemSchema), controller.create);
|
|
157
|
+
router.patch('/:id', validate(UpdateItemSchema), controller.update);
|
|
158
|
+
router.delete('/:id', controller.delete);
|
|
159
|
+
return router;
|
|
160
|
+
}
|
|
161
|
+
`.trim();
|
|
162
|
+
|
|
163
|
+
export function run(input: SkillInput): SkillOutput {
|
|
164
|
+
return {
|
|
165
|
+
skill: 'crud',
|
|
166
|
+
template: TEMPLATE,
|
|
167
|
+
checklist: [
|
|
168
|
+
'Define TypeScript model interface with id, ownership field (userId), createdAt, updatedAt',
|
|
169
|
+
'Define separate CreateInput and UpdateInput types (no id, no userId, all update fields optional)',
|
|
170
|
+
'Create repository interface — program to the interface, not the implementation',
|
|
171
|
+
'Implement repository with Prisma/Drizzle/raw queries; keep DB logic isolated here',
|
|
172
|
+
'Implement service layer: all ownership and business rule checks happen here',
|
|
173
|
+
'Add service method getById that always checks ownership before returning data',
|
|
174
|
+
'Implement controller: parse request → call service → format response; no DB access',
|
|
175
|
+
'Create Zod schemas for create and update request bodies',
|
|
176
|
+
'Add validate middleware that runs Zod schema and returns 400 on failure',
|
|
177
|
+
'Register routes: GET / (list), GET /:id, POST / (create), PATCH /:id, DELETE /:id',
|
|
178
|
+
'Mount routes behind auth middleware so req.user is always populated',
|
|
179
|
+
'Add 204 No Content for successful DELETE (no body)',
|
|
180
|
+
'Add 201 Created with Location header for successful POST',
|
|
181
|
+
'Write unit tests for service layer (mock the repository)',
|
|
182
|
+
'Write integration tests covering happy path, 404, 403 (wrong user), 400 (bad input)',
|
|
183
|
+
'Add pagination to the list endpoint: limit/offset or cursor-based',
|
|
184
|
+
'Add filtering and sorting parameters to the list endpoint',
|
|
185
|
+
'Document all endpoints with JSDoc or OpenAPI comments',
|
|
186
|
+
],
|
|
187
|
+
patterns: [
|
|
188
|
+
'Controller → Service → Repository three-layer architecture',
|
|
189
|
+
'Repository pattern: data access is behind an interface for testability',
|
|
190
|
+
'Ownership check in every service read/write operation (prevents IDOR)',
|
|
191
|
+
'Zod schema validation at the route boundary',
|
|
192
|
+
'Error-first service methods: throw typed errors, not returning null for auth failures',
|
|
193
|
+
],
|
|
194
|
+
gotchas: [
|
|
195
|
+
'Forgetting ownership check in the service — returns any user\'s data via IDOR',
|
|
196
|
+
'Putting DB queries directly in controllers — bypasses repository layer and breaks tests',
|
|
197
|
+
'Not returning 404 before 403 — leaks resource existence to unauthorised users (use 404 for both)',
|
|
198
|
+
'Updating with empty body — add a Zod refine check that at least one field is present for PATCH',
|
|
199
|
+
'Not invalidating caches after update/delete — stale data returned to other users',
|
|
200
|
+
'Using findMany without a userId filter on list — returns all users\' data',
|
|
201
|
+
],
|
|
202
|
+
resources: [
|
|
203
|
+
'https://www.prisma.io/docs/concepts/components/prisma-client/crud',
|
|
204
|
+
'https://zod.dev/',
|
|
205
|
+
'https://owasp.org/www-project-api-security/ (API4:2023 Broken Object Level Authorization)',
|
|
206
|
+
'https://expressjs.com/en/guide/routing.html',
|
|
207
|
+
],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// Skill: scaffold — generates project scaffold structure for detected project type
|
|
2
|
+
|
|
3
|
+
export interface SkillInput {
|
|
4
|
+
task: string;
|
|
5
|
+
context?: string;
|
|
6
|
+
options?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SkillOutput {
|
|
10
|
+
skill: string;
|
|
11
|
+
template?: string;
|
|
12
|
+
checklist: string[];
|
|
13
|
+
patterns: string[];
|
|
14
|
+
gotchas: string[];
|
|
15
|
+
resources: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type ProjectType = 'rest-api' | 'full-stack' | 'cli' | 'library' | 'generic';
|
|
19
|
+
|
|
20
|
+
function detectProjectType(task: string): ProjectType {
|
|
21
|
+
const t = task.toLowerCase();
|
|
22
|
+
if (/\bcli\b|command[\s-]?line|commander|yargs|oclif/.test(t)) return 'cli';
|
|
23
|
+
if (/\blibrary\b|npm\s+package|sdk|module|publishable/.test(t)) return 'library';
|
|
24
|
+
if (/\bfull[\s-]?stack\b|next\.?js|nuxt|remix|frontend\s*\+\s*backend/.test(t)) return 'full-stack';
|
|
25
|
+
if (/\bapi\b|rest(?:ful)?|express|fastify|hono|koa|endpoint/.test(t)) return 'rest-api';
|
|
26
|
+
return 'generic';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const TEMPLATES: Record<ProjectType, string> = {
|
|
30
|
+
'rest-api': `
|
|
31
|
+
my-api/
|
|
32
|
+
├── src/
|
|
33
|
+
│ ├── index.ts # Entry point — creates and starts the server
|
|
34
|
+
│ ├── app.ts # Express/Fastify app factory (no listen call)
|
|
35
|
+
│ ├── config/
|
|
36
|
+
│ │ └── env.ts # Typed env validation with zod
|
|
37
|
+
│ ├── routes/
|
|
38
|
+
│ │ ├── index.ts # Route aggregator
|
|
39
|
+
│ │ └── health.ts # GET /health — liveness probe
|
|
40
|
+
│ ├── controllers/ # HTTP layer: parse request, call service, send response
|
|
41
|
+
│ ├── services/ # Business logic — no HTTP types
|
|
42
|
+
│ ├── repositories/ # Data access layer — DB queries only
|
|
43
|
+
│ ├── middleware/
|
|
44
|
+
│ │ ├── auth.ts # JWT / session verification
|
|
45
|
+
│ │ ├── validate.ts # Zod request schema validation
|
|
46
|
+
│ │ └── error-handler.ts # Centralised error → HTTP response mapping
|
|
47
|
+
│ ├── models/ # TypeScript interfaces / Prisma types
|
|
48
|
+
│ └── utils/
|
|
49
|
+
│ ├── logger.ts # Pino / Winston structured logger
|
|
50
|
+
│ └── errors.ts # Typed application error classes
|
|
51
|
+
├── tests/
|
|
52
|
+
│ ├── unit/ # Service and utility unit tests
|
|
53
|
+
│ ├── integration/ # Route-level supertest tests
|
|
54
|
+
│ └── fixtures/ # Test data factories
|
|
55
|
+
├── .env.example # Template with all required env keys (no real values)
|
|
56
|
+
├── .gitignore
|
|
57
|
+
├── .eslintrc.json
|
|
58
|
+
├── .prettierrc
|
|
59
|
+
├── tsconfig.json
|
|
60
|
+
├── jest.config.ts # Or vitest.config.ts
|
|
61
|
+
├── Dockerfile
|
|
62
|
+
├── docker-compose.yml
|
|
63
|
+
└── package.json
|
|
64
|
+
`.trim(),
|
|
65
|
+
|
|
66
|
+
'full-stack': `
|
|
67
|
+
my-app/
|
|
68
|
+
├── apps/
|
|
69
|
+
│ ├── web/ # Frontend (React / Next.js / Astro)
|
|
70
|
+
│ │ ├── src/
|
|
71
|
+
│ │ │ ├── app/ # Next.js App Router pages
|
|
72
|
+
│ │ │ ├── components/ # Shared UI components
|
|
73
|
+
│ │ │ ├── hooks/ # Custom React hooks
|
|
74
|
+
│ │ │ ├── lib/ # API client, utilities
|
|
75
|
+
│ │ │ └── styles/ # Global CSS / Tailwind config
|
|
76
|
+
│ │ └── package.json
|
|
77
|
+
│ └── api/ # Backend (Express / Fastify)
|
|
78
|
+
│ ├── src/
|
|
79
|
+
│ │ ├── routes/
|
|
80
|
+
│ │ ├── services/
|
|
81
|
+
│ │ └── repositories/
|
|
82
|
+
│ └── package.json
|
|
83
|
+
├── packages/
|
|
84
|
+
│ ├── ui/ # Shared component library
|
|
85
|
+
│ ├── types/ # Shared TypeScript types between frontend and backend
|
|
86
|
+
│ └── config/ # Shared ESLint, tsconfig base
|
|
87
|
+
├── infra/ # IaC (Terraform / Pulumi / CDK)
|
|
88
|
+
├── .env.example
|
|
89
|
+
├── pnpm-workspace.yaml # Or turbo.json for Turborepo
|
|
90
|
+
├── turbo.json
|
|
91
|
+
└── package.json
|
|
92
|
+
`.trim(),
|
|
93
|
+
|
|
94
|
+
cli: `
|
|
95
|
+
my-cli/
|
|
96
|
+
├── src/
|
|
97
|
+
│ ├── index.ts # Entry point — calls main()
|
|
98
|
+
│ ├── cli.ts # Commander / yargs setup, command registration
|
|
99
|
+
│ ├── commands/
|
|
100
|
+
│ │ ├── index.ts # Command exports
|
|
101
|
+
│ │ └── init.ts # Example: "my-cli init" command
|
|
102
|
+
│ ├── config/
|
|
103
|
+
│ │ ├── loader.ts # Reads ~/.my-cli/config.json or XDG config
|
|
104
|
+
│ │ └── schema.ts # Zod schema for config validation
|
|
105
|
+
│ ├── utils/
|
|
106
|
+
│ │ ├── logger.ts # Chalk-powered coloured console output
|
|
107
|
+
│ │ ├── spinner.ts # Ora spinner wrapper
|
|
108
|
+
│ │ └── prompt.ts # Inquirer / clack prompt helpers
|
|
109
|
+
│ └── errors.ts # CLI-specific error classes with exit codes
|
|
110
|
+
├── tests/
|
|
111
|
+
│ ├── commands/ # Command unit tests
|
|
112
|
+
│ └── integration/ # Full CLI invocation tests via execa
|
|
113
|
+
├── bin/
|
|
114
|
+
│ └── my-cli.js # Executable shim (#!/usr/bin/env node)
|
|
115
|
+
├── .env.example
|
|
116
|
+
├── .gitignore
|
|
117
|
+
├── tsconfig.json
|
|
118
|
+
├── tsconfig.build.json # Excludes test files from build output
|
|
119
|
+
├── package.json # "bin" field pointing to dist/index.js
|
|
120
|
+
└── README.md
|
|
121
|
+
`.trim(),
|
|
122
|
+
|
|
123
|
+
library: `
|
|
124
|
+
my-library/
|
|
125
|
+
├── src/
|
|
126
|
+
│ ├── index.ts # Public API barrel — re-exports only the public surface
|
|
127
|
+
│ ├── core/ # Core implementation modules
|
|
128
|
+
│ ├── types/
|
|
129
|
+
│ │ └── index.ts # Exported TypeScript types and interfaces
|
|
130
|
+
│ └── utils/ # Internal utilities (not exported)
|
|
131
|
+
├── tests/
|
|
132
|
+
│ ├── unit/
|
|
133
|
+
│ └── snapshots/
|
|
134
|
+
├── examples/ # Runnable usage examples
|
|
135
|
+
├── scripts/
|
|
136
|
+
│ └── build.ts # Build script (tsup / rollup / esbuild)
|
|
137
|
+
├── .env.example
|
|
138
|
+
├── .gitignore
|
|
139
|
+
├── .eslintrc.json
|
|
140
|
+
├── .prettierrc
|
|
141
|
+
├── tsconfig.json
|
|
142
|
+
├── tsup.config.ts # Bundles CJS + ESM + type declarations
|
|
143
|
+
├── vitest.config.ts
|
|
144
|
+
├── CHANGELOG.md
|
|
145
|
+
└── package.json # "exports", "main", "module", "types" fields
|
|
146
|
+
`.trim(),
|
|
147
|
+
|
|
148
|
+
generic: `
|
|
149
|
+
my-project/
|
|
150
|
+
├── src/
|
|
151
|
+
│ ├── index.ts # Entry point
|
|
152
|
+
│ └── lib/ # Core modules
|
|
153
|
+
├── tests/
|
|
154
|
+
├── .env.example
|
|
155
|
+
├── .gitignore
|
|
156
|
+
├── tsconfig.json
|
|
157
|
+
└── package.json
|
|
158
|
+
`.trim(),
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const CHECKLISTS: Record<ProjectType, string[]> = {
|
|
162
|
+
'rest-api': [
|
|
163
|
+
'Run: npm init -y && git init && echo "node_modules" > .gitignore',
|
|
164
|
+
'Install TypeScript: npm install -D typescript ts-node @types/node && npx tsc --init',
|
|
165
|
+
'Configure tsconfig.json: strict:true, outDir:dist, rootDir:src, target:ES2022',
|
|
166
|
+
'Install framework: npm install express && npm install -D @types/express',
|
|
167
|
+
'Install security middleware: npm install helmet express-rate-limit cors',
|
|
168
|
+
'Install validation: npm install zod',
|
|
169
|
+
'Install logger: npm install pino && npm install -D pino-pretty',
|
|
170
|
+
'Set up database ORM: npm install prisma && npx prisma init',
|
|
171
|
+
'Configure ESLint and Prettier: npm install -D eslint @typescript-eslint/parser prettier',
|
|
172
|
+
'Install testing: npm install -D vitest supertest @types/supertest',
|
|
173
|
+
'Create .env.example with all required variables; add .env to .gitignore',
|
|
174
|
+
'Write src/app.ts factory and src/index.ts entry point',
|
|
175
|
+
'Add npm scripts: dev (ts-node-dev), build (tsc), start (node dist/index.js), test, lint',
|
|
176
|
+
'Write a Dockerfile with multi-stage build: builder + production runner',
|
|
177
|
+
'Set up GitHub Actions CI: install → lint → test → build on every PR',
|
|
178
|
+
'Add docker-compose.yml for local development with database service',
|
|
179
|
+
],
|
|
180
|
+
'full-stack': [
|
|
181
|
+
'Initialise monorepo: npm install -D turbo && pnpm init (or use create-turbo)',
|
|
182
|
+
'Create pnpm-workspace.yaml listing apps/* and packages/*',
|
|
183
|
+
'Scaffold frontend: pnpm create next-app apps/web --typescript',
|
|
184
|
+
'Scaffold backend: follow rest-api checklist in apps/api',
|
|
185
|
+
'Create packages/types with shared TypeScript interfaces',
|
|
186
|
+
'Create packages/config with shared tsconfig.base.json and eslint config',
|
|
187
|
+
'Configure Turborepo pipeline in turbo.json: build, test, lint tasks',
|
|
188
|
+
'Set up shared environment: turbo.env or dotenv in each app',
|
|
189
|
+
'Install Tailwind CSS and shadcn/ui in apps/web',
|
|
190
|
+
'Set up API client in apps/web/src/lib/api.ts using fetch with typed responses',
|
|
191
|
+
'Configure CORS in apps/api to allow the web origin in development',
|
|
192
|
+
'Add Prettier and ESLint configs in packages/config; extend in each app',
|
|
193
|
+
'Write GitHub Actions matrix workflow that tests each app independently',
|
|
194
|
+
'Write docker-compose.yml that starts both apps and their dependencies',
|
|
195
|
+
],
|
|
196
|
+
cli: [
|
|
197
|
+
'npm init -y && git init',
|
|
198
|
+
'Install TypeScript: npm install -D typescript @types/node && npx tsc --init',
|
|
199
|
+
'Install CLI framework: npm install commander && npm install -D @types/commander',
|
|
200
|
+
'Install UX tools: npm install chalk ora inquirer && npm install -D @types/inquirer',
|
|
201
|
+
'Install build tool: npm install -D tsup',
|
|
202
|
+
'Configure package.json: add "bin" field, "files" field, and build/dev scripts',
|
|
203
|
+
'Create bin/my-cli.js shim with #!/usr/bin/env node pointing to dist/index.js',
|
|
204
|
+
'Set "prepublishOnly" script to run build and tests before npm publish',
|
|
205
|
+
'Create src/cli.ts with the Commander program definition',
|
|
206
|
+
'Add at least one example command in src/commands/',
|
|
207
|
+
'Write integration tests using execa to invoke the compiled CLI binary',
|
|
208
|
+
'Set up ESLint and Prettier',
|
|
209
|
+
'Add GitHub Actions workflow: test on push + publish to npm on release tag',
|
|
210
|
+
'Write README.md with installation and usage examples',
|
|
211
|
+
],
|
|
212
|
+
library: [
|
|
213
|
+
'npm init -y && git init',
|
|
214
|
+
'Install TypeScript and tsup: npm install -D typescript tsup',
|
|
215
|
+
'Configure tsconfig.json with strict:true, declaration:true, declarationMap:true',
|
|
216
|
+
'Configure tsup.config.ts: entry src/index.ts, formats [cjs, esm], dts:true',
|
|
217
|
+
'Set package.json "exports", "main", "module", "types" fields for dual CJS/ESM',
|
|
218
|
+
'Add "files" field to package.json to only publish src + dist, not tests',
|
|
219
|
+
'Install vitest for testing: npm install -D vitest',
|
|
220
|
+
'Install Changesets for versioning: npm install -D @changesets/cli && npx changeset init',
|
|
221
|
+
'Write public API in src/index.ts; keep internal modules unexported',
|
|
222
|
+
'Write tests covering edge cases, error paths, and type narrowing',
|
|
223
|
+
'Add ESLint with @typescript-eslint and prettier',
|
|
224
|
+
'Create examples/ directory with a working usage example',
|
|
225
|
+
'Set up GitHub Actions: test → build → publish on changeset release',
|
|
226
|
+
'Add CHANGELOG.md and seed first version with npx changeset',
|
|
227
|
+
],
|
|
228
|
+
generic: [
|
|
229
|
+
'npm init -y && git init',
|
|
230
|
+
'Install TypeScript: npm install -D typescript && npx tsc --init',
|
|
231
|
+
'Add strict TypeScript configuration',
|
|
232
|
+
'Set up ESLint and Prettier',
|
|
233
|
+
'Install testing framework (vitest or jest)',
|
|
234
|
+
'Create .env.example and add .env to .gitignore',
|
|
235
|
+
'Add CI workflow (GitHub Actions)',
|
|
236
|
+
'Write README with purpose, setup, and usage',
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const PATTERNS_MAP: Record<ProjectType, string[]> = {
|
|
241
|
+
'rest-api': ['Controller → Service → Repository layered architecture', 'Middleware chain for cross-cutting concerns', 'Dependency injection via constructor parameters'],
|
|
242
|
+
'full-stack': ['Turborepo monorepo with shared packages', 'Type-sharing between frontend and backend via shared package', 'API contract-first development'],
|
|
243
|
+
cli: ['Commander subcommand pattern', 'Config file with XDG base directory spec', 'Spinner + prompt UX pattern'],
|
|
244
|
+
library: ['Barrel export pattern (src/index.ts as public API surface)', 'Dual CJS/ESM build with tsup', 'Semantic versioning with Changesets'],
|
|
245
|
+
generic: ['Separation of concerns', 'Environment-based configuration', 'Test-driven development'],
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const GOTCHAS: Record<ProjectType, string[]> = {
|
|
249
|
+
'rest-api': [
|
|
250
|
+
'Not separating app factory from server listen — makes supertest integration tests impossible',
|
|
251
|
+
'Importing from .ts paths instead of .js in ESM projects — Node requires .js extensions at runtime',
|
|
252
|
+
'Forgetting to handle unhandled promise rejections: process.on("unhandledRejection")',
|
|
253
|
+
'Not setting NODE_ENV=production in Docker — some libraries skip optimisations',
|
|
254
|
+
],
|
|
255
|
+
'full-stack': [
|
|
256
|
+
'pnpm hoisting rules differ from npm — some packages require explicit workspace installation',
|
|
257
|
+
'Turbo caches outputs — always define "outputs" in turbo.json or caching will miss files',
|
|
258
|
+
'Next.js Server Actions run on the server but are bundled client-side if marked incorrectly',
|
|
259
|
+
'CORS in development must allow the exact origin including port number',
|
|
260
|
+
],
|
|
261
|
+
cli: [
|
|
262
|
+
'bin script must have chmod +x and #!/usr/bin/env node shebang — otherwise it won\'t run on Unix',
|
|
263
|
+
'Using process.exit() inside async code without await — unhandled async errors go silently',
|
|
264
|
+
'Global config paths differ per OS — use the "env-paths" package for cross-platform XDG dirs',
|
|
265
|
+
'Not handling SIGINT / SIGTERM — CLI leaves terminal in bad state on Ctrl+C',
|
|
266
|
+
],
|
|
267
|
+
library: [
|
|
268
|
+
'Publishing src/ instead of dist/ — consumers get TypeScript source, not compiled output',
|
|
269
|
+
'Missing "exports" field in package.json — prevents dual CJS/ESM consumers from working',
|
|
270
|
+
'Exporting internal implementation details — breaks semver compatibility on refactors',
|
|
271
|
+
'Not testing the built package locally with "npm link" before publishing',
|
|
272
|
+
],
|
|
273
|
+
generic: [
|
|
274
|
+
'Committing .env files — always add to .gitignore before the first commit',
|
|
275
|
+
'Missing tsconfig strict mode — allows silent type errors',
|
|
276
|
+
'No CI from the start — technical debt accumulates quickly without automated checks',
|
|
277
|
+
],
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
const RESOURCES: Record<ProjectType, string[]> = {
|
|
281
|
+
'rest-api': [
|
|
282
|
+
'https://expressjs.com/en/advanced/best-practice-security.html',
|
|
283
|
+
'https://www.prisma.io/docs/getting-started',
|
|
284
|
+
'https://vitest.dev/guide/',
|
|
285
|
+
'https://docs.npmjs.com/cli/v10/configuring-npm/package-json#main',
|
|
286
|
+
],
|
|
287
|
+
'full-stack': [
|
|
288
|
+
'https://turbo.build/repo/docs',
|
|
289
|
+
'https://nextjs.org/docs',
|
|
290
|
+
'https://pnpm.io/workspaces',
|
|
291
|
+
'https://ui.shadcn.com/docs',
|
|
292
|
+
],
|
|
293
|
+
cli: [
|
|
294
|
+
'https://www.npmjs.com/package/commander',
|
|
295
|
+
'https://www.npmjs.com/package/ora',
|
|
296
|
+
'https://www.npmjs.com/package/inquirer',
|
|
297
|
+
'https://tsup.egoist.dev/',
|
|
298
|
+
],
|
|
299
|
+
library: [
|
|
300
|
+
'https://tsup.egoist.dev/',
|
|
301
|
+
'https://github.com/changesets/changesets',
|
|
302
|
+
'https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html',
|
|
303
|
+
'https://nodejs.org/api/packages.html#package-entry-points',
|
|
304
|
+
],
|
|
305
|
+
generic: [
|
|
306
|
+
'https://www.typescriptlang.org/docs/handbook/tsconfig-json.html',
|
|
307
|
+
'https://vitest.dev/guide/',
|
|
308
|
+
'https://eslint.org/docs/latest/use/getting-started',
|
|
309
|
+
],
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export function run(input: SkillInput): SkillOutput {
|
|
313
|
+
const projectType = detectProjectType(input.task);
|
|
314
|
+
|
|
315
|
+
return {
|
|
316
|
+
skill: 'scaffold',
|
|
317
|
+
template: TEMPLATES[projectType],
|
|
318
|
+
checklist: CHECKLISTS[projectType],
|
|
319
|
+
patterns: PATTERNS_MAP[projectType],
|
|
320
|
+
gotchas: GOTCHAS[projectType],
|
|
321
|
+
resources: RESOURCES[projectType],
|
|
322
|
+
};
|
|
323
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Skill: complexity-score — how to write task descriptions that route correctly
|
|
2
|
+
|
|
3
|
+
export interface SkillInput { task: string; context?: string; options?: Record<string, unknown>; }
|
|
4
|
+
export interface SkillOutput { skill: string; template?: string; checklist: string[]; patterns: string[]; gotchas: string[]; resources: string[]; }
|
|
5
|
+
|
|
6
|
+
export function run(input: SkillInput): SkillOutput {
|
|
7
|
+
return {
|
|
8
|
+
skill: 'complexity-score',
|
|
9
|
+
template: `
|
|
10
|
+
// ── Complexity Scoring Cheat Sheet ───────────────────────────────────────
|
|
11
|
+
//
|
|
12
|
+
// The router scores 0–100 from five factors:
|
|
13
|
+
//
|
|
14
|
+
// Factor 1: Word count 0–20 pts (1 pt per 3 words, cap 20)
|
|
15
|
+
// Factor 2: Tech keywords 0–30 pts HIGH +5, MEDIUM +2
|
|
16
|
+
// Factor 3: Task depth 0–20 pts conjunctions, commas, length
|
|
17
|
+
// Factor 4: Files affected 0–20 pts 3 pts per file
|
|
18
|
+
// Factor 5: Council bonus +10 pts security/auth/migration keywords
|
|
19
|
+
//
|
|
20
|
+
// Tier thresholds (defaults, adjusted by learning loop):
|
|
21
|
+
// Tier 1: score 0–30 → Haiku / Flash (fast, cheap)
|
|
22
|
+
// Tier 2: score 31–70 → Sonnet / Pro (daily coding)
|
|
23
|
+
// Tier 3: score 71+ → Sonnet / Advanced (hard problems)
|
|
24
|
+
//
|
|
25
|
+
// To get a higher tier: add detail, technical keywords, or pass files_affected
|
|
26
|
+
// To get a lower tier: simplify the description or scope down the task
|
|
27
|
+
//
|
|
28
|
+
// Example — under-scored:
|
|
29
|
+
// "write tests" → score 9 → Tier 1 (too short)
|
|
30
|
+
//
|
|
31
|
+
// Example — correctly scored:
|
|
32
|
+
// "write unit and integration tests for the JWT auth middleware, covering
|
|
33
|
+
// token expiry, refresh rotation, and concurrent request edge cases"
|
|
34
|
+
// → score 47 → Tier 2
|
|
35
|
+
//
|
|
36
|
+
// Example — correctly scored, high complexity:
|
|
37
|
+
// "migrate user authentication from session cookies to JWT with refresh
|
|
38
|
+
// token rotation — update middleware, session store, and all auth tests"
|
|
39
|
+
// → score 78 → Tier 3 (contains 'migrate', 'authentication', 'jwt')
|
|
40
|
+
`.trim(),
|
|
41
|
+
checklist: [
|
|
42
|
+
'Call veto_route_task to see the current score before submitting a task',
|
|
43
|
+
'If the score is too low: add technical keywords and more specific detail to the description',
|
|
44
|
+
'If the score is too high: simplify the description or split into sub-tasks',
|
|
45
|
+
'Pass files_affected if the task touches multiple files — adds 3 pts per file',
|
|
46
|
+
'Use force_council=true to bypass scoring and go straight to Tier 3',
|
|
47
|
+
'After completing a task: call veto_record_outcome with the actual quality (0–100)',
|
|
48
|
+
'After 20+ outcomes: call veto_learning_apply to update the router thresholds',
|
|
49
|
+
],
|
|
50
|
+
patterns: [
|
|
51
|
+
'Specificity → score: more specific descriptions score higher and route to better models',
|
|
52
|
+
'Keyword density: security/auth/migration keywords add +5 each and trigger council',
|
|
53
|
+
'files_affected multiplier: 5 files = +12 pts — use this for multi-file refactors',
|
|
54
|
+
'Outcome feedback: recording actuals enables the learning loop to tune thresholds over time',
|
|
55
|
+
],
|
|
56
|
+
gotchas: [
|
|
57
|
+
'Short task descriptions under-score — "fix auth bug" scores ~9, Tier 1 is almost certainly wrong for auth',
|
|
58
|
+
'The learning loop needs 20 outcomes before it adjusts thresholds — the router is static until then',
|
|
59
|
+
'force_council=true always routes to Tier 3 regardless of score — use sparingly',
|
|
60
|
+
'Council auto-triggers on: architecture, security, auth, migration, drop table — you cannot suppress this',
|
|
61
|
+
],
|
|
62
|
+
resources: [
|
|
63
|
+
'veto_route_task — score a task and see the tier before submitting',
|
|
64
|
+
'veto_record_outcome — record output quality to feed the learning loop',
|
|
65
|
+
'veto_learning_apply — apply learned thresholds after 20+ recorded outcomes',
|
|
66
|
+
'veto_learning_stats — see current tier distribution and suggested thresholds',
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Skill: cost-track — monitor and reduce AI token spend and infrastructure costs
|
|
2
|
+
|
|
3
|
+
export interface SkillInput { task: string; context?: string; options?: Record<string, unknown>; }
|
|
4
|
+
export interface SkillOutput { skill: string; checklist: string[]; patterns: string[]; gotchas: string[]; resources: string[]; }
|
|
5
|
+
|
|
6
|
+
export function run(input: SkillInput): SkillOutput {
|
|
7
|
+
return {
|
|
8
|
+
skill: 'cost-track',
|
|
9
|
+
checklist: [
|
|
10
|
+
'Call veto_learning_stats to see the current Tier 1/2/3 distribution',
|
|
11
|
+
'A healthy distribution is roughly 40% T1 / 45% T2 / 15% T3 — more T3 than this is expensive',
|
|
12
|
+
'Identify tasks that are routed to Tier 3 but could be Tier 2 with a better description',
|
|
13
|
+
'Call veto_rate_status to check current daily usage % per platform',
|
|
14
|
+
'If Claude is above 70%: T1/T2 tasks are already auto-routing to Gemini — verify this is working',
|
|
15
|
+
'Call veto_agent_performance_stats to identify agents with low quality scores — they waste tokens on retries',
|
|
16
|
+
'Record task outcomes via veto_record_outcome — this is the only way to measure actual cost/quality ratio',
|
|
17
|
+
'After 20+ outcomes: call veto_learning_apply — learned thresholds reduce over-routing to expensive tiers',
|
|
18
|
+
'Monthly: export veto_memory_export and review knowledge base size — prune irrelevant entries',
|
|
19
|
+
],
|
|
20
|
+
patterns: [
|
|
21
|
+
'Tier distribution monitoring: T3% × avg_T3_tokens = the main cost driver',
|
|
22
|
+
'Outcome recording: quality data enables threshold calibration which directly reduces cost',
|
|
23
|
+
'Rate limit utilisation: 70–90% is healthy; under 30% means you are paying for unused capacity',
|
|
24
|
+
'Context compression: veto_route_task with context= returns a compression plan — use it',
|
|
25
|
+
],
|
|
26
|
+
gotchas: [
|
|
27
|
+
'Not recording outcomes — the learning loop cannot calibrate without quality data',
|
|
28
|
+
'Treating all Tier 3 tasks as justified — many are there because of a short description, not actual complexity',
|
|
29
|
+
'Ignoring context compression — a 15,000 token context costs 10× more than a compressed 1,500 token context',
|
|
30
|
+
'Optimising AI cost while ignoring developer time — developer time is almost always the larger cost',
|
|
31
|
+
],
|
|
32
|
+
resources: [
|
|
33
|
+
'veto_learning_stats — current tier distribution and suggested thresholds',
|
|
34
|
+
'veto_rate_status — daily usage % per platform',
|
|
35
|
+
'veto_learning_apply — apply learned thresholds to reduce over-routing',
|
|
36
|
+
'veto_record_outcome — record output quality to feed the cost/quality calibration loop',
|
|
37
|
+
],
|
|
38
|
+
};
|
|
39
|
+
}
|