code-ai-installer 1.1.4 → 1.1.5
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/README.md +4 -0
- package/dist/banner.d.ts +4 -0
- package/dist/banner.js +35 -0
- package/dist/index.js +39 -0
- package/dist/sourceResolver.d.ts +2 -0
- package/dist/sourceResolver.js +27 -5
- package/dist/types.d.ts +1 -0
- package/locales/en/.agents/a11y_baseline/SKILL.md +41 -0
- package/locales/en/.agents/adr_log/SKILL.md +69 -0
- package/locales/en/.agents/api_contract_compliance_review/SKILL.md +18 -0
- package/locales/en/.agents/api_contracts/SKILL.md +42 -0
- package/locales/en/.agents/architecture_compliance_review/SKILL.md +17 -0
- package/locales/en/.agents/architecture_doc/SKILL.md +92 -0
- package/locales/en/.agents/board/SKILL.md +43 -0
- package/locales/en/.agents/cloud_infrastructure_security/SKILL.md +68 -0
- package/locales/en/.agents/code_review_checklist/SKILL.md +47 -0
- package/locales/en/.agents/current_state_analysis/SKILL.md +44 -0
- package/locales/en/.agents/data_model/SKILL.md +40 -0
- package/locales/en/.agents/dependency_supply_chain_review/SKILL.md +20 -0
- package/locales/en/.agents/deployment_ci_plan/SKILL.md +51 -0
- package/locales/en/.agents/design_intake/SKILL.md +71 -0
- package/locales/en/.agents/design_parity_review/SKILL.md +73 -0
- package/locales/en/.agents/design_systems/SKILL.md +15 -0
- package/locales/en/.agents/dev_reference_snippets/SKILL.md +397 -0
- package/locales/en/.agents/docker_kubernetes_architecture/SKILL.md +144 -0
- package/locales/en/.agents/es2025_beast_practices/SKILL.md +15 -0
- package/locales/en/.agents/gates/SKILL.md +35 -0
- package/locales/en/.agents/go_beast_practices/SKILL.md +23 -0
- package/locales/en/.agents/handoff/SKILL.md +52 -0
- package/locales/en/.agents/k8s_manifests_conventions/SKILL.md +175 -0
- package/locales/en/.agents/memory/SKILL.md +29 -0
- package/locales/en/.agents/mongodb_mongoose_best_practices/SKILL.md +233 -0
- package/locales/en/.agents/node_express_beast_practices/SKILL.md +30 -0
- package/locales/en/.agents/observability_logging/SKILL.md +16 -0
- package/locales/en/.agents/observability_plan/SKILL.md +38 -0
- package/locales/en/.agents/observability_review/SKILL.md +20 -0
- package/locales/en/.agents/performance_review_baseline/SKILL.md +17 -0
- package/locales/en/.agents/pm_backlog/SKILL.md +32 -0
- package/locales/en/.agents/pm_interview/SKILL.md +56 -0
- package/locales/en/.agents/pm_prd/SKILL.md +56 -0
- package/locales/en/.agents/qa_api_contract_tests/SKILL.md +16 -0
- package/locales/en/.agents/qa_e2e_playwright/SKILL.md +0 -0
- package/locales/en/.agents/qa_manual_run/SKILL.md +16 -0
- package/locales/en/.agents/qa_security_smoke_tests/SKILL.md +14 -0
- package/locales/en/.agents/qa_test_plan/SKILL.md +20 -0
- package/locales/en/.agents/qa_ui_a11y_smoke/SKILL.md +12 -0
- package/locales/en/.agents/react_15_3_wix_iframe/SKILL.md +20 -0
- package/locales/en/.agents/react_beast_practices/SKILL.md +29 -0
- package/locales/en/.agents/release_gate/SKILL.md +77 -0
- package/locales/en/.agents/release_gate_checklist_template/SKILL.md +68 -0
- package/locales/en/.agents/review_reference_snippets/SKILL.md +436 -0
- package/locales/en/.agents/security_baseline_dev/SKILL.md +16 -0
- package/locales/en/.agents/security_review/SKILL.md +55 -0
- package/locales/en/.agents/security_review_baseline/SKILL.md +25 -0
- package/locales/en/.agents/state_rtk_beast_practices/SKILL.md +15 -0
- package/locales/en/.agents/state_zustand_beast_practices/SKILL.md +11 -0
- package/locales/en/.agents/styling_css_stack/SKILL.md +12 -0
- package/locales/en/.agents/system_design_checklist/SKILL.md +48 -0
- package/locales/en/.agents/tanstack_beast_practices/SKILL.md +19 -0
- package/locales/en/.agents/tdd_workflow/SKILL.md +34 -0
- package/locales/en/.agents/testing_strategy_js/SKILL.md +30 -0
- package/locales/en/.agents/tests_quality_review/SKILL.md +18 -0
- package/locales/en/.agents/threat_model_baseline/SKILL.md +57 -0
- package/locales/en/.agents/tooling_bun_biome/SKILL.md +17 -0
- package/locales/en/.agents/typescript_beast_practices/SKILL.md +15 -0
- package/locales/en/.agents/ui_a11y_smoke_review/SKILL.md +15 -0
- package/locales/en/.agents/ui_inventory/SKILL.md +50 -0
- package/locales/en/.agents/ux_discovery/SKILL.md +48 -0
- package/locales/en/.agents/ux_spec/SKILL.md +56 -0
- package/locales/en/.agents/wix_self_hosted_embedded_script/SKILL.md +88 -0
- package/locales/en/AGENTS.md +120 -0
- package/locales/en/agents/architect.md +239 -0
- package/locales/en/agents/conductor.md +205 -0
- package/locales/en/agents/product_manager.md +119 -0
- package/locales/en/agents/reviewer.md +200 -0
- package/locales/en/agents/senior_full_stack.md +216 -0
- package/locales/en/agents/tester.md +186 -0
- package/locales/en/agents/ux_ui_designer.md +144 -0
- package/package.json +3 -2
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dev_reference_snippets
|
|
3
|
+
description: A single file with snippets and anti-examples (do/don’t) for Senior Full Stack: TDD, API, validation, errors, logging, React, state (Zustand/RTK), security, legacy React 15.3 (Wix), DoD scripts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Dev Reference Snippets (Do/Don't)
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Provide copy-paste standards and anti-patterns so that the code is consistent, testable (TDD), safe and easy to maintain.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1) TDD: RED → GREEN → REFACTOR (example)
|
|
14
|
+
|
|
15
|
+
### ✅ DO: test first (Vitest)
|
|
16
|
+
```ts
|
|
17
|
+
// src/lib/slugify.test.ts
|
|
18
|
+
import { describe, it, expect } from "vitest";
|
|
19
|
+
import { slugify } from "./slugify";
|
|
20
|
+
|
|
21
|
+
describe("slugify", () => {
|
|
22
|
+
it("makes lowercase and replaces spaces with hyphens", () => {
|
|
23
|
+
expect(slugify("Hello World")).toBe("hello-world");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("removes non-alphanumeric characters", () => {
|
|
27
|
+
expect(slugify("Hi, John!")).toBe("hi-john");
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("collapses multiple spaces", () => {
|
|
31
|
+
expect(slugify(" Hello World ")).toBe("hello-world");
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### ✅ GREEN: minimal implementation
|
|
37
|
+
```ts
|
|
38
|
+
// src/lib/slugify.ts
|
|
39
|
+
export function slugify(input: string): string {
|
|
40
|
+
return input
|
|
41
|
+
.trim()
|
|
42
|
+
.toLowerCase()
|
|
43
|
+
.replace(/[^a-z0-9\s-]/g, "")
|
|
44
|
+
.replace(/\s+/g, "-");
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### ❌ DON'T: “code first, tests later” + testing details
|
|
49
|
+
```ts
|
|
50
|
+
// Плохо: тест проверяет внутренние переменные/шаги реализации, а не поведение.
|
|
51
|
+
// Итог: тесты ломаются при рефакторинге без изменения поведения.
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 2) API: layers Route → Controller → Service → Repo (Express)
|
|
57
|
+
|
|
58
|
+
### ✅ DO: project structure (example)
|
|
59
|
+
```txt
|
|
60
|
+
src/
|
|
61
|
+
http/
|
|
62
|
+
routes/
|
|
63
|
+
controllers/
|
|
64
|
+
middleware/
|
|
65
|
+
domain/
|
|
66
|
+
services/
|
|
67
|
+
models/
|
|
68
|
+
data/
|
|
69
|
+
repos/
|
|
70
|
+
lib/
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### ✅ DO: Routes are thin, logic is in controller/service
|
|
74
|
+
```ts
|
|
75
|
+
// src/http/routes/users.routes.ts
|
|
76
|
+
import { Router } from "express";
|
|
77
|
+
import { createUser } from "../controllers/users.create";
|
|
78
|
+
import { requireAuth } from "../middleware/requireAuth";
|
|
79
|
+
|
|
80
|
+
export const usersRouter = Router();
|
|
81
|
+
|
|
82
|
+
usersRouter.post("/", requireAuth, createUser);
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### ❌ DON'T: everything in one route file
|
|
86
|
+
```ts
|
|
87
|
+
// Плохо: в routes файл запихана валидация, бизнес-логика и доступ к БД.
|
|
88
|
+
// Тестирование и переиспользование становится болью.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 3) Validation at the boundary + safe errors (Zod)
|
|
94
|
+
|
|
95
|
+
### ✅ DO: parse on input, safe error handling
|
|
96
|
+
```ts
|
|
97
|
+
// src/http/controllers/users.create.ts
|
|
98
|
+
import { z } from "zod";
|
|
99
|
+
import type { Request, Response, NextFunction } from "express";
|
|
100
|
+
import { usersService } from "../../domain/services/users.service";
|
|
101
|
+
import { AppError } from "../middleware/errors";
|
|
102
|
+
|
|
103
|
+
const CreateUserSchema = z.object({
|
|
104
|
+
email: z.string().email(),
|
|
105
|
+
name: z.string().min(1).max(100),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
export async function createUser(req: Request, res: Response, next: NextFunction) {
|
|
109
|
+
try {
|
|
110
|
+
const input = CreateUserSchema.parse(req.body); // ✅ boundary validation
|
|
111
|
+
const user = await usersService.create(input);
|
|
112
|
+
res.status(201).json({ id: user.id });
|
|
113
|
+
} catch (err) {
|
|
114
|
+
// zod errors -> 422
|
|
115
|
+
next(err instanceof z.ZodError ? AppError.validation(err.flatten()) : err);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### ❌ DON'T: trust req.body
|
|
121
|
+
```ts
|
|
122
|
+
// Плохо: нет валидации, можно словить мусор/инъекции/500
|
|
123
|
+
export async function createUser(req: any, res: any) {
|
|
124
|
+
const user = await usersService.create(req.body);
|
|
125
|
+
res.json(user);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 4) Centralized error handler (single error format)
|
|
132
|
+
|
|
133
|
+
### ✅ DO: AppError + single format { error_code, message, details? }
|
|
134
|
+
```ts
|
|
135
|
+
// src/http/middleware/errors.ts
|
|
136
|
+
import type { ErrorRequestHandler } from "express";
|
|
137
|
+
|
|
138
|
+
export class AppError extends Error {
|
|
139
|
+
constructor(
|
|
140
|
+
public readonly status: number,
|
|
141
|
+
public readonly code: string,
|
|
142
|
+
message: string,
|
|
143
|
+
public readonly details?: unknown
|
|
144
|
+
) {
|
|
145
|
+
super(message);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
static validation(details: unknown) {
|
|
149
|
+
return new AppError(422, "VALIDATION_ERROR", "Invalid input", details);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
static forbidden() {
|
|
153
|
+
return new AppError(403, "FORBIDDEN", "Not enough permissions");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export const errorHandler: ErrorRequestHandler = (err, _req, res, _next) => {
|
|
158
|
+
const isApp = err instanceof AppError;
|
|
159
|
+
const status = isApp ? err.status : 500;
|
|
160
|
+
const code = isApp ? err.code : "INTERNAL_ERROR";
|
|
161
|
+
|
|
162
|
+
// Без утечек: для 500 — нейтральное сообщение
|
|
163
|
+
const message = status === 500 ? "Unexpected error" : err.message;
|
|
164
|
+
|
|
165
|
+
res.status(status).json({
|
|
166
|
+
error_code: code,
|
|
167
|
+
message,
|
|
168
|
+
...(isApp && err.details ? { details: err.details } : {}),
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### ❌ DON'T: give the entire “err” (stack/SQL/secrets leak)
|
|
174
|
+
```ts
|
|
175
|
+
// Плохо: утечка внутренностей и нестабильный контракт
|
|
176
|
+
res.status(500).json({ err });
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## 5) Logging: request_id, structured logs, prohibition of PII/secrets
|
|
182
|
+
|
|
183
|
+
### ✅ DO: request_id middleware + structured logs
|
|
184
|
+
```ts
|
|
185
|
+
// src/http/middleware/requestContext.ts
|
|
186
|
+
import { randomUUID } from "node:crypto";
|
|
187
|
+
import type { RequestHandler } from "express";
|
|
188
|
+
|
|
189
|
+
export const requestContext: RequestHandler = (req, res, next) => {
|
|
190
|
+
const id = req.header("x-request-id") ?? randomUUID();
|
|
191
|
+
res.setHeader("x-request-id", id);
|
|
192
|
+
(req as any).requestId = id;
|
|
193
|
+
next();
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
// usage example
|
|
199
|
+
logger.info(
|
|
200
|
+
{ request_id: (req as any).requestId, user_id: ctx.user?.id },
|
|
201
|
+
"user_created"
|
|
202
|
+
);
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### ❌ DON'T: log the entire body (passwords/tokens/PII there)
|
|
206
|
+
```ts
|
|
207
|
+
// Плохо: утечка секретов в логи
|
|
208
|
+
logger.info({ body: req.body }, "incoming_request");
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 6) React: loading/empty/error/success (TanStack Query)
|
|
214
|
+
|
|
215
|
+
### ✅ DO: explicit states
|
|
216
|
+
```tsx
|
|
217
|
+
import { useQuery } from "@tanstack/react-query";
|
|
218
|
+
|
|
219
|
+
type User = { id: string; name: string };
|
|
220
|
+
|
|
221
|
+
async function fetchUsers(): Promise<User[]> {
|
|
222
|
+
const r = await fetch("/api/users");
|
|
223
|
+
if (!r.ok) throw new Error("Failed to load users");
|
|
224
|
+
return r.json();
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function UsersList() {
|
|
228
|
+
const q = useQuery({ queryKey: ["users"], queryFn: fetchUsers });
|
|
229
|
+
|
|
230
|
+
if (q.isLoading) return <div aria-busy="true">Loading…</div>;
|
|
231
|
+
if (q.isError) return <div role="alert">Error: {String(q.error)}</div>;
|
|
232
|
+
if (!q.data || q.data.length === 0) return <div>No users yet</div>;
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<ul>
|
|
236
|
+
{q.data.map((u) => (
|
|
237
|
+
<li key={u.id}>{u.name}</li>
|
|
238
|
+
))}
|
|
239
|
+
</ul>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### ❌ DON'T: fetch inside render / no error/empty
|
|
245
|
+
```tsx
|
|
246
|
+
// Плохо: нет обработки ошибок/пустоты, легко словить гонки и “мерцания”.
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 7) Zustand: small domain stores + selectors
|
|
252
|
+
|
|
253
|
+
### ✅ DO: domain store + selector
|
|
254
|
+
```ts
|
|
255
|
+
import { create } from "zustand";
|
|
256
|
+
|
|
257
|
+
type AuthState = {
|
|
258
|
+
token: string | null;
|
|
259
|
+
setToken: (t: string | null) => void;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export const useAuthStore = create<AuthState>((set) => ({
|
|
263
|
+
token: null,
|
|
264
|
+
setToken: (t) => set({ token: t }),
|
|
265
|
+
}));
|
|
266
|
+
|
|
267
|
+
// usage: подписываемся только на нужное
|
|
268
|
+
const token = useAuthStore((s) => s.token);
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### ❌ DON'T: “god-store” for the entire application
|
|
272
|
+
```ts
|
|
273
|
+
// Плохо: один огромный store с десятками полей и действий → лишние ререндеры и каша доменов.
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 8) RTK: slices by domain + normalization (EntityAdapter)
|
|
279
|
+
|
|
280
|
+
### ✅ DO: entityAdapter for user list
|
|
281
|
+
```ts
|
|
282
|
+
// src/state/usersSlice.ts
|
|
283
|
+
import { createSlice, createAsyncThunk, createEntityAdapter } from "@reduxjs/toolkit";
|
|
284
|
+
import type { RootState } from "./store";
|
|
285
|
+
|
|
286
|
+
type User = { id: string; name: string };
|
|
287
|
+
|
|
288
|
+
export const usersAdapter = createEntityAdapter<User>();
|
|
289
|
+
|
|
290
|
+
export const fetchUsers = createAsyncThunk("users/fetch", async () => {
|
|
291
|
+
const r = await fetch("/api/users");
|
|
292
|
+
if (!r.ok) throw new Error("Failed to load users");
|
|
293
|
+
return (await r.json()) as User[];
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
const slice = createSlice({
|
|
297
|
+
name: "users",
|
|
298
|
+
initialState: usersAdapter.getInitialState({ status: "idle" as "idle" | "loading" | "failed" }),
|
|
299
|
+
reducers: {},
|
|
300
|
+
extraReducers: (b) => {
|
|
301
|
+
b.addCase(fetchUsers.pending, (s) => {
|
|
302
|
+
s.status = "loading";
|
|
303
|
+
});
|
|
304
|
+
b.addCase(fetchUsers.fulfilled, (s, a) => {
|
|
305
|
+
s.status = "idle";
|
|
306
|
+
usersAdapter.setAll(s, a.payload);
|
|
307
|
+
});
|
|
308
|
+
b.addCase(fetchUsers.rejected, (s) => {
|
|
309
|
+
s.status = "failed";
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
export const usersReducer = slice.reducer;
|
|
315
|
+
|
|
316
|
+
export const usersSelectors = usersAdapter.getSelectors<RootState>((st) => st.users);
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### ❌ DON'T: side effects in components + manual “sheets” of reducers
|
|
320
|
+
```ts
|
|
321
|
+
// Плохо: компонент сам дергает fetch, сам хранит кэш, сам нормализует.
|
|
322
|
+
// Итог: непредсказуемость и дублирование.
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## 9) Security: authz on the server (don't trust the client)
|
|
328
|
+
|
|
329
|
+
### ✅ DO: checking rights on the server
|
|
330
|
+
```ts
|
|
331
|
+
import { AppError } from "../http/middleware/errors";
|
|
332
|
+
|
|
333
|
+
export function requireRole(user: { role: string } | null, role: string) {
|
|
334
|
+
if (!user) throw new AppError(401, "UNAUTHORIZED", "Authentication required");
|
|
335
|
+
if (user.role !== role) throw AppError.forbidden();
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### ❌ DON'T: “if the button is hidden, it means it’s safe”
|
|
340
|
+
```ts
|
|
341
|
+
// Плохо: безопасность только на UI.
|
|
342
|
+
// Сервер обязан проверять авторизацию/права.
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 10) Legacy: React 15.3 (Wix iFrame) + DoD scripts
|
|
348
|
+
|
|
349
|
+
### ✅ DO: React 15.3 class component + lifecycle
|
|
350
|
+
```jsx
|
|
351
|
+
class Widget extends React.Component {
|
|
352
|
+
constructor(props) {
|
|
353
|
+
super(props);
|
|
354
|
+
this.state = { loading: true, data: null, error: null };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
componentDidMount() {
|
|
358
|
+
this.load();
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
load() {
|
|
362
|
+
apiFetch()
|
|
363
|
+
.then((data) => this.setState({ loading: false, data: data }))
|
|
364
|
+
.catch(() => this.setState({ loading: false, error: "Failed" }));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
render() {
|
|
368
|
+
if (this.state.loading) return React.createElement("div", null, "Loading…");
|
|
369
|
+
if (this.state.error) return React.createElement("div", { role: "alert" }, this.state.error);
|
|
370
|
+
return React.createElement("div", null, "OK");
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### ❌ DON'T: hooks/modern APIs (not allowed in React 15.3)
|
|
376
|
+
```tsx
|
|
377
|
+
// Нельзя в React 15.3
|
|
378
|
+
// function Widget(){ const [x,setX]=useState(...) }
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### ✅ DO: DoD scripts (package.json)
|
|
382
|
+
```json
|
|
383
|
+
{
|
|
384
|
+
"scripts": {
|
|
385
|
+
"dev": "node ./src/index.js",
|
|
386
|
+
"test": "vitest",
|
|
387
|
+
"test:coverage": "vitest --coverage",
|
|
388
|
+
"lint": "biome lint .",
|
|
389
|
+
"format": "biome format . --write"
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### ❌ DON'T: mix formatters/linters without reason
|
|
395
|
+
```txt
|
|
396
|
+
// Плохо: eslint + prettier + biome одновременно без согласованных правил → вечные конфликты и шум в PR.
|
|
397
|
+
```
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docker_kubernetes_architecture
|
|
3
|
+
description: Containerization and Kubernetes architecture: Dockerfile best practices, k8s manifests, security, scaling, rollout, observability, CI/CD.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
#Skill: Docker & Kubernetes Architecture
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Design and document containerization and deployment in Kubernetes so that:
|
|
10
|
+
- the builds were reproducible and safe,
|
|
11
|
+
- environments (dev/staging/prod) were consistent,
|
|
12
|
+
- the application was scaled and updated without downtime (according to the chosen strategy),
|
|
13
|
+
- there were clear runbooks, rollback and observability.
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
- The project is deployed in Docker / Kubernetes (self-hosted, cloud k8s, on-prem).
|
|
17
|
+
- There are microservices/multiple components.
|
|
18
|
+
- Need horizontal scaling, HPA, blue-green/canary.
|
|
19
|
+
- Strict security/compliance measures required.
|
|
20
|
+
|
|
21
|
+
If the deployment will be without containers (Vercel-only, etc.), the skill is not required.
|
|
22
|
+
|
|
23
|
+
## Inputs
|
|
24
|
+
- Architecture Doc + ADR
|
|
25
|
+
- Deployment/CI Plan
|
|
26
|
+
- Non-functional requirements (SLA, perf, security, cost)
|
|
27
|
+
- Tech stack (FE/BE/DB/queues)
|
|
28
|
+
|
|
29
|
+
## Outputs (artifacts)
|
|
30
|
+
- Containerization plan:
|
|
31
|
+
- basic Dockerfile rules and standards
|
|
32
|
+
- build/run strategy (multi-stage, non-root)
|
|
33
|
+
- Kubernetes plan:
|
|
34
|
+
- namespaces, ingress, service, deployment/statefulset
|
|
35
|
+
- config/secrets strategy
|
|
36
|
+
- health probes, resources, autoscaling
|
|
37
|
+
- rollout/rollback strategy
|
|
38
|
+
- Ops plan:
|
|
39
|
+
- logging/metrics/tracing
|
|
40
|
+
- backups/DR
|
|
41
|
+
- runbooks (deploy, rollback, incident)
|
|
42
|
+
|
|
43
|
+
## Checklist: Docker (must)
|
|
44
|
+
###Build
|
|
45
|
+
- Multi-stage build (builder → runtime)
|
|
46
|
+
- Reproducibility: lockfile + fixed versions
|
|
47
|
+
- Minimum runtime image (alpine/distroless - as appropriate)
|
|
48
|
+
- Cache-friendly layers (dependencies before sources)
|
|
49
|
+
- SBOM/scan (if there is a pipeline)
|
|
50
|
+
|
|
51
|
+
### Runtime security
|
|
52
|
+
- Non-root user (USER), minimal rights
|
|
53
|
+
- Read-only filesystem where possible
|
|
54
|
+
- Do not copy secrets to image
|
|
55
|
+
- Healthcheck (if applicable)
|
|
56
|
+
- Clear separation of build args vs runtime env
|
|
57
|
+
|
|
58
|
+
### Logging
|
|
59
|
+
- Logs to stdout/stderr (12-factor)
|
|
60
|
+
- No secrets/PII
|
|
61
|
+
|
|
62
|
+
## Checklist: Kubernetes (must)
|
|
63
|
+
### Workloads
|
|
64
|
+
- Deployment for stateless services
|
|
65
|
+
- StatefulSet for stateful (if it is impossible to place state in managed DB)
|
|
66
|
+
- Separation by namespaces (dev/staging/prod)
|
|
67
|
+
- Service (ClusterIP), Ingress/Gateway for external traffic
|
|
68
|
+
|
|
69
|
+
### Health & Resilience
|
|
70
|
+
- readinessProbe / livenessProbe are correct
|
|
71
|
+
- startupProbe for a hard start
|
|
72
|
+
- PodDisruptionBudget (if critical)
|
|
73
|
+
- graceful shutdown (terminationGracePeriodSeconds)
|
|
74
|
+
- retries/timeouts on clients
|
|
75
|
+
|
|
76
|
+
### Resources & Scaling
|
|
77
|
+
- requests/limits are defined
|
|
78
|
+
- HPA by CPU/Memory and/or custom metrics (if necessary)
|
|
79
|
+
- anti-affinity/topology spread (if HA)
|
|
80
|
+
|
|
81
|
+
### Config & Secrets
|
|
82
|
+
- ConfigMap for configs
|
|
83
|
+
- Secrets only through k8s secrets / external secret managers (preferably)
|
|
84
|
+
- Rotation strategy (especially for DB/3rd-party keys)
|
|
85
|
+
- Do not log secrets
|
|
86
|
+
- Split per-env values
|
|
87
|
+
|
|
88
|
+
### Network & Access
|
|
89
|
+
- NetworkPolicy (if the cluster supports it)
|
|
90
|
+
- RBAC least privilege (service accounts)
|
|
91
|
+
- Restrict access to metadata endpoints (if relevant)
|
|
92
|
+
|
|
93
|
+
###Security posture
|
|
94
|
+
- Pod Security Standards / admission policies (baseline/restricted)
|
|
95
|
+
- Drop capabilities, seccompProfile, runAsNonRoot
|
|
96
|
+
- ImagePullPolicy by release strategy
|
|
97
|
+
- Image scanning (in CI) if possible
|
|
98
|
+
|
|
99
|
+
### Rollout/Rollback
|
|
100
|
+
- Strategy: RollingUpdate / Blue-Green / Canary (fix ADR)
|
|
101
|
+
- MaxUnavailable/MaxSurge configured- Rollback plan is documented and realistically executable
|
|
102
|
+
|
|
103
|
+
## Checklist: Observability (must)
|
|
104
|
+
- Correlation id (request_id/trace_id)
|
|
105
|
+
- Metrics (latency, errors, saturation)
|
|
106
|
+
- Tracing (if provided)
|
|
107
|
+
- Alerts (errors/latency/degradation)
|
|
108
|
+
- Log retention (if required)
|
|
109
|
+
|
|
110
|
+
## Checklist: Data & DR (if there is a DB/data)
|
|
111
|
+
- Backups + retention
|
|
112
|
+
- PITR (if necessary)
|
|
113
|
+
- Recovery test (periodically)
|
|
114
|
+
- RPO/RTO (if specified)
|
|
115
|
+
|
|
116
|
+
## ADRs (must be recorded)
|
|
117
|
+
Create ADR if selected/changed:
|
|
118
|
+
- cluster/provider
|
|
119
|
+
- rollout strategy (canary/blue-green)
|
|
120
|
+
- ingress (nginx/traefik/gateway)
|
|
121
|
+
- secrets manager
|
|
122
|
+
- security policies (PSS/restricted)
|
|
123
|
+
- scaling (HPA/metrics)
|
|
124
|
+
|
|
125
|
+
## Red flags (P0/P1)
|
|
126
|
+
🔴P0:
|
|
127
|
+
- containers are launched by root
|
|
128
|
+
- secrets got into image/repo
|
|
129
|
+
- no readiness/liveness on critical services
|
|
130
|
+
- no rollback plan for production deployment
|
|
131
|
+
- there are no resource restrictions (requests/limits) and the service is critical
|
|
132
|
+
|
|
133
|
+
🟠P1:
|
|
134
|
+
- no HPA at expected load
|
|
135
|
+
- no network policy/RBAC restrictions (if required)
|
|
136
|
+
|
|
137
|
+
## Response format
|
|
138
|
+
### Containerization Plan
|
|
139
|
+
### Kubernetes Topology
|
|
140
|
+
###Security Posture
|
|
141
|
+
### Rollout/Rollback
|
|
142
|
+
### Observability
|
|
143
|
+
### Required ADRs
|
|
144
|
+
### Risks (P0/P1/P2)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: es2025_beast_practices
|
|
3
|
+
description: Write modern JavaScript (ES2025) with an emphasis on readability, predictability, safe work with async, typical patterns and performance hygiene.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
#Skill: ES2025 Beast Practices
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Modern JS without “magic”, with clear asynchrony and safe errors.
|
|
10
|
+
|
|
11
|
+
## Rules
|
|
12
|
+
- Prefer clear designs, early returns, obvious errors
|
|
13
|
+
- async/await with correct try/catch and context errors
|
|
14
|
+
- Don't ignore errors
|
|
15
|
+
- Minimize side effects and global conditions
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gates
|
|
3
|
+
description: Control of process gates and Definition of Done: do not skip stages, check for the presence of artifacts and verification criteria, organize return cycles (Dev↔Reviewer↔Tester).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Gates & DoD (conductor quality control)
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Avoid “pseudo-readiness”: each stage should end with an artifact and verification.
|
|
10
|
+
|
|
11
|
+
## Gates (general logic)
|
|
12
|
+
- You cannot move forward if the previous stage did not give an artifact.
|
|
13
|
+
- Any P0 comments = stop, return for revision.
|
|
14
|
+
|
|
15
|
+
## Minimum artifacts by stage (template)
|
|
16
|
+
- PM: PRD + acceptance criteria
|
|
17
|
+
- UX: UX Spec (flows/screens/states/a11y/components)
|
|
18
|
+
- ARCH: Architecture + key decisions (ADR) + task plan
|
|
19
|
+
- DEV: code + unit+integration tests + run instructions
|
|
20
|
+
- REV: review report (P0/P1/P2) + result approve/changes
|
|
21
|
+
- TEST: test plan + test report + bugs
|
|
22
|
+
|
|
23
|
+
## DoD (universal conductor check)
|
|
24
|
+
You can mark “☑ ready” only if:
|
|
25
|
+
- tests pass (unit + integration),
|
|
26
|
+
- no secrets in the code/logs,
|
|
27
|
+
- there are startup/check instructions,
|
|
28
|
+
- basic security is met (validation, authz, dependencies),
|
|
29
|
+
- UX/UI: implemented loading/empty/error/success states according to UX Spec,
|
|
30
|
+
- a11y minimum completed (keyboard/focus/labels/ARIA where needed).
|
|
31
|
+
|
|
32
|
+
## “Return” algorithm
|
|
33
|
+
1) Reviewer/Test found the problem → create task `DEV-xx Fix...`
|
|
34
|
+
2) Put `REV-xx`/`TEST-xx` in `⚠️` until fixed
|
|
35
|
+
3) After the fix: repeat the review/test, close the gate
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: go_beast_practices
|
|
3
|
+
description: Go best practices: simplicity, errors as values, interfaces, context, concurrency, project structure, linters and testing (TDD).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
#Skill: Go Beast Practices
|
|
7
|
+
|
|
8
|
+
## Principles
|
|
9
|
+
- Readability > “cleverness”
|
|
10
|
+
- Wrap errors in context, do not ignore them
|
|
11
|
+
- Context as the first parameter (timeouts/cancel)
|
|
12
|
+
- Small interfaces, DI instead of global state
|
|
13
|
+
- Gentle competition: worker pools, errgroup, graceful shutdown
|
|
14
|
+
|
|
15
|
+
##Tooling
|
|
16
|
+
- gofmt/goimports
|
|
17
|
+
- go test (race, cover)
|
|
18
|
+
- golangci-lint (a set of linters for the project)
|
|
19
|
+
|
|
20
|
+
## Testing
|
|
21
|
+
- table-driven tests
|
|
22
|
+
- helper functions with t.Helper()
|
|
23
|
+
- test isolation, t.Cleanup()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: handoff
|
|
3
|
+
description: Formation of the Context Pack and setting the task for the agent: goals, restrictions, artifacts, solutions, questions, Definition of Done. Requires a standard response format.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: Context Pack Handoff (transferring tasks to agents)
|
|
7
|
+
|
|
8
|
+
## Goal
|
|
9
|
+
Provide agents with exactly the context they need to complete a task, without losing key decisions.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
Every time the conductor delegates work to any agent.
|
|
13
|
+
|
|
14
|
+
## Context Pack (required fields)
|
|
15
|
+
- **Goal**: what you need to get
|
|
16
|
+
- **Scope**: what is included/not included
|
|
17
|
+
- **Constraints**: stack/deployment/timing/integrations/security
|
|
18
|
+
- **Inputs**: links to documents/files/inserts
|
|
19
|
+
- **Decisions**: what has already been decided (and cannot be broken without agreement)
|
|
20
|
+
- **Open Questions**: what is unknown
|
|
21
|
+
- **Definition of Done**: “done” criterion
|
|
22
|
+
- **Output Format**: in what form to return the result
|
|
23
|
+
|
|
24
|
+
## Delegation algorithm
|
|
25
|
+
1) Create a Context Pack (short but complete).
|
|
26
|
+
2) Clearly formulate the task and the expected artifact.
|
|
27
|
+
3) Set a “quality bar”: checks, criteria, response format.
|
|
28
|
+
4) Ask to return the result strictly according to the report template.
|
|
29
|
+
|
|
30
|
+
## Universal problem statement template
|
|
31
|
+
**Context Pack**
|
|
32
|
+
- Goal:
|
|
33
|
+
- Scope:
|
|
34
|
+
- Constraints:
|
|
35
|
+
- Inputs:
|
|
36
|
+
- Decisions:
|
|
37
|
+
- Open Questions:
|
|
38
|
+
-DoD:
|
|
39
|
+
- Output Format:
|
|
40
|
+
|
|
41
|
+
**Task**
|
|
42
|
+
- ID:
|
|
43
|
+
- What to do:
|
|
44
|
+
- Acceptance criteria:
|
|
45
|
+
|
|
46
|
+
**Reply Format**
|
|
47
|
+
### Summary
|
|
48
|
+
### Deliverables
|
|
49
|
+
###Decisions
|
|
50
|
+
###Risks/Blockers
|
|
51
|
+
### Open Questions
|
|
52
|
+
### Next Actions (IDs)
|