aigent-team 0.1.0 → 0.2.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/README.md CHANGED
@@ -49,9 +49,10 @@ Each agent is a senior-level specialist (8+ years expertise) with deep knowledge
49
49
  └─────┘ └─────┘ └─────┘ └──────┘ └───────┘
50
50
  ```
51
51
 
52
- Each agent has:
53
- - **Skill index** (~80-150 lines) — always loaded in context. Core principles, anti-patterns, decision frameworks.
54
- - **Reference files** (3-9 per agent) — loaded on-demand when the task requires deep knowledge.
52
+ Each agent has three layers of knowledge:
53
+ - **Rules** (~30-50 lines) — always loaded, top of context. Hard constraints: scope limits, prohibited actions, escalation triggers, output requirements.
54
+ - **Skill index** (~80-150 lines) — always loaded. Core principles, anti-patterns, decision frameworks, reference + skill catalogs.
55
+ - **Reference files** (3-9 per agent) + **Skill files** (2+ per agent) — loaded on-demand when the task requires deep knowledge or executable procedures.
55
56
 
56
57
  This keeps the always-loaded context slim while providing access to thousands of lines of senior expertise when needed.
57
58
 
@@ -165,40 +166,113 @@ After running `aigent-team generate`, you'll see:
165
166
 
166
167
  ```
167
168
  # Claude Code
168
- .claude/agents/lead-agent.md # Skill index (always loaded)
169
- .claude/agents/lead-agent/references/ # Deep reference docs
170
- .claude/agents/fe-agent.md
171
- .claude/agents/fe-agent/references/
169
+ .claude/agents/fe-agent.md # Rules + skill index (always loaded)
170
+ .claude/agents/fe-agent/references/ # Deep reference docs
172
171
  ├── component-architecture.md
173
172
  ├── state-management.md
174
- ├── performance.md
175
- ├── accessibility.md
176
- ├── security.md
177
- ├── testing.md
178
- ├── css-styling.md
179
- ├── forms.md
180
- └── review-checklist.md
181
- ...
173
+ └── ...
174
+ .claude/agents/fe-agent/skills/ # Executable procedures
175
+ ├── analyze-bundle.md
176
+ └── component-audit.md
182
177
  CLAUDE.md # Agent team overview
183
178
 
184
179
  # Cursor
185
- .cursor/rules/fe-agent.mdc # Glob-scoped skill
180
+ .cursor/rules/fe-agent.mdc # Glob-scoped skill (includes rules)
186
181
  .cursor/rules/fe-refs/ # Glob-scoped references
187
- ...
182
+ .cursor/rules/fe-skills/ # Glob-scoped skills
188
183
 
189
184
  # Codex
190
185
  AGENTS.md # Combined agent doc
191
186
  .codex/agents/fe-agent.md # Individual agent
192
187
  .codex/agents/fe-agent/references/ # References
193
- ...
188
+ .codex/agents/fe-agent/skills/ # Skills
194
189
 
195
190
  # Antigravity
196
191
  GEMINI.md # Agent overview
197
192
  .agents/skills/fe-agent/SKILL.md # Skill file
198
193
  .agents/skills/fe-agent/references/ # References
199
- ...
194
+ .agents/skills/fe-agent/skills/ # Skills
200
195
  ```
201
196
 
197
+ ## How agents are loaded by each platform
198
+
199
+ After `aigent-team generate`, the files are placed in each platform's expected directories. Here's how each AI tool discovers and uses them:
200
+
201
+ ### Claude Code
202
+
203
+ Files in `.claude/agents/` are **automatically available** as specialized agents. Claude Code discovers them on startup.
204
+
205
+ **How to use:**
206
+ ```
207
+ # In Claude Code, just ask — it will pick the right agent based on the task
208
+ > Review this React component for accessibility issues
209
+ → Claude spawns fe-agent, which reads references/accessibility.md
210
+
211
+ # Or explicitly request an agent
212
+ > Use the fe-agent to review my frontend code
213
+ > Ask the qa-agent to write E2E tests for this feature
214
+
215
+ # The Lead agent can orchestrate multiple agents
216
+ > Implement the user registration feature
217
+ → Lead analyzes → spawns BA (specs) → FE + BE (code) → QA (tests)
218
+ ```
219
+
220
+ `CLAUDE.md` is loaded as project context automatically — it tells Claude which agents are available.
221
+
222
+ ### Cursor
223
+
224
+ Files in `.cursor/rules/` are **loaded automatically** based on frontmatter settings:
225
+ - `alwaysApply: true` → always active (Lead, BA agents)
226
+ - `globs: "**/*.tsx, **/*.ts"` → activated when you open matching files
227
+
228
+ **How it works:** When you open a `.tsx` file, Cursor loads `fe-agent.mdc` automatically. The agent's knowledge applies to Cursor's suggestions, completions, and chat responses. Reference files in `fe-refs/` are also glob-scoped and loaded when relevant.
229
+
230
+ No manual action needed — just open files and use Cursor as normal.
231
+
232
+ ### Codex (OpenAI)
233
+
234
+ `AGENTS.md` is **read automatically** as the project instruction file. Individual agents in `.codex/agents/` are available as subagents.
235
+
236
+ **How to use:**
237
+ ```
238
+ # Codex reads AGENTS.md on startup for project context
239
+ # Use subagents in conversations:
240
+ > @fe-agent review this component
241
+ > @devops-agent check my Dockerfile
242
+ ```
243
+
244
+ ### Antigravity (Google)
245
+
246
+ `GEMINI.md` is loaded as project context. Skills in `.agents/skills/` are **auto-discovered**.
247
+
248
+ **How to use:**
249
+ ```
250
+ # Antigravity loads skills from .agents/skills/ automatically
251
+ # Reference the skill by name:
252
+ > Use the fe-agent skill to review this code
253
+ > Run the qa-agent skill to generate tests
254
+ ```
255
+
256
+ ### Reference files — on-demand loading
257
+
258
+ Reference files are **not** loaded into context by default (that would bloat the context window). Instead:
259
+
260
+ 1. The **skill index** (always loaded) contains a table of available references
261
+ 2. When the agent encounters a relevant task, it **reads the reference file** on-demand
262
+ 3. Example: FE agent working on forms → reads `references/forms.md` for validation patterns
263
+
264
+ This is why the skill index includes a "When to read" table:
265
+
266
+ ```markdown
267
+ | Reference | When to read |
268
+ |-----------|-------------|
269
+ | component-architecture.md | Creating or reviewing components |
270
+ | state-management.md | Choosing state solution |
271
+ | performance.md | Optimizing or auditing performance |
272
+ ```
273
+
274
+ The agent decides which references to load based on the task — you don't need to do anything manually.
275
+
202
276
  ## What to commit
203
277
 
204
278
  Generated files **should be committed** to your repo — they are the actual agent configs your AI tools read. Add this to your workflow:
@@ -238,6 +312,16 @@ The Lead agent acts as orchestrator. When it receives a task, it:
238
312
 
239
313
  This mirrors how a real tech lead operates — delegating to specialists and ensuring alignment.
240
314
 
315
+ ## Documentation
316
+
317
+ | Document | Description |
318
+ |---|---|
319
+ | [Architecture](docs/architecture.md) | System design, data flow, module map, compiler pattern |
320
+ | [Agent Reference](docs/agents.md) | All 6 agents — roles, capabilities, reference file catalog |
321
+ | [Vision & Roadmap](docs/vision.md) | Future plans, design principles, platform expansion |
322
+ | [Contributing](CONTRIBUTING.md) | Development setup, how to add agents/compilers |
323
+ | [Changelog](CHANGELOG.md) | Release history |
324
+
241
325
  ## Contributing
242
326
 
243
327
  See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
@@ -21,6 +21,7 @@ var AgentOverrideSchema = z.object({
21
21
  allowed: z.array(z.string()).optional(),
22
22
  denied: z.array(z.string()).optional()
23
23
  }).optional(),
24
+ rules: z.string().optional(),
24
25
  globs: z.array(z.string()).optional()
25
26
  });
26
27
  var ConfigSchema = z.object({
@@ -112,6 +113,23 @@ function loadReferences(refsDir) {
112
113
  }
113
114
  return refs;
114
115
  }
116
+ function loadSkills(skillsDir) {
117
+ if (!existsSync2(skillsDir)) return [];
118
+ const skills = [];
119
+ const files = readdirSync(skillsDir).filter((f) => f.endsWith(".md"));
120
+ for (const file of files) {
121
+ const content = readFileSync2(resolve2(skillsDir, file), "utf-8").trim();
122
+ const id = file.replace(".md", "");
123
+ skills.push({
124
+ id,
125
+ name: id.replace(/-/g, " "),
126
+ description: "",
127
+ trigger: "",
128
+ content
129
+ });
130
+ }
131
+ return skills;
132
+ }
115
133
  function loadBuiltinAgent(role) {
116
134
  const teamDir = resolve2(TEMPLATES_DIR, "teams", role);
117
135
  const agentYaml = readFileSync2(resolve2(teamDir, "agent.yaml"), "utf-8");
@@ -120,6 +138,8 @@ function loadBuiltinAgent(role) {
120
138
  const conventions = readIfExists(resolve2(teamDir, "conventions.md"));
121
139
  const reviewChecklist = readIfExists(resolve2(teamDir, "review-checklist.md"));
122
140
  const references = loadReferences(resolve2(teamDir, "references"));
141
+ const rulesContent = readIfExists(resolve2(teamDir, "rules.md"));
142
+ const skills = loadSkills(resolve2(teamDir, "skills"));
123
143
  return {
124
144
  id: agentDef.id,
125
145
  name: agentDef.name,
@@ -134,6 +154,8 @@ function loadBuiltinAgent(role) {
134
154
  workflows: agentDef.workflows || [],
135
155
  sharedKnowledge: agentDef.sharedKnowledge || [],
136
156
  references,
157
+ rulesContent,
158
+ skills,
137
159
  globs: agentDef.globs || []
138
160
  };
139
161
  }
@@ -158,9 +180,14 @@ function loadAgents(config, cwd = process.cwd()) {
158
180
  if (override.conventions && existsSync2(resolve2(cwd, override.conventions))) {
159
181
  conventions = readFileSync2(resolve2(cwd, override.conventions), "utf-8").trim();
160
182
  }
183
+ let rulesContent = agent.rulesContent;
184
+ if (override.rules && existsSync2(resolve2(cwd, override.rules))) {
185
+ rulesContent = readFileSync2(resolve2(cwd, override.rules), "utf-8").trim();
186
+ }
161
187
  agent = deepmerge(agent, {
162
188
  ...override,
163
- conventions
189
+ conventions,
190
+ rulesContent
164
191
  });
165
192
  }
166
193
  const localDir = resolve2(cwd, ".aigent-team", "teams", role);
@@ -171,10 +198,16 @@ function loadAgents(config, cwd = process.cwd()) {
171
198
  if (localConventions) agent.conventions = localConventions;
172
199
  if (localChecklist) agent.reviewChecklist = localChecklist;
173
200
  if (localSkill) agent.skillContent = localSkill;
201
+ const localRules = readIfExists(resolve2(localDir, "rules.md"));
202
+ if (localRules) agent.rulesContent = localRules;
174
203
  const localRefs = loadReferences(resolve2(localDir, "references"));
175
204
  if (localRefs.length) {
176
205
  agent.references = [...agent.references, ...localRefs];
177
206
  }
207
+ const localSkills = loadSkills(resolve2(localDir, "skills"));
208
+ if (localSkills.length) {
209
+ agent.skills = [...agent.skills, ...localSkills];
210
+ }
178
211
  }
179
212
  const resolvedShared = [];
180
213
  for (const ref of agent.sharedKnowledge) {
@@ -194,10 +227,30 @@ function loadAgents(config, cwd = process.cwd()) {
194
227
 
195
228
  // src/core/template-engine.ts
196
229
  function assembleSkillIndex(agent) {
230
+ const parts = [];
231
+ if (agent.rulesContent) {
232
+ parts.push(agent.rulesContent);
233
+ }
197
234
  if (agent.skillContent) {
198
- return agent.skillContent;
235
+ parts.push(agent.skillContent);
236
+ } else {
237
+ parts.push(assembleAgentMarkdown(agent));
199
238
  }
200
- return assembleAgentMarkdown(agent);
239
+ if (agent.skills?.length) {
240
+ const skillLines = agent.skills.map(
241
+ (s) => `| \`${s.id}\` | ${s.name} |`
242
+ );
243
+ parts.push([
244
+ "## Executable Skills",
245
+ "",
246
+ "Load the relevant skill file when performing these procedures:",
247
+ "",
248
+ "| Skill | Name |",
249
+ "|-------|------|",
250
+ ...skillLines
251
+ ].join("\n"));
252
+ }
253
+ return parts.join("\n\n");
201
254
  }
202
255
  function assembleAgentMarkdown(agent) {
203
256
  const sections = [];
@@ -254,6 +307,9 @@ ${knowledge}`);
254
307
  function assembleReference(ref) {
255
308
  return ref.content;
256
309
  }
310
+ function assembleSkill(skill) {
311
+ return skill.content;
312
+ }
257
313
 
258
314
  export {
259
315
  PLATFORMS,
@@ -263,5 +319,6 @@ export {
263
319
  loadAgents,
264
320
  assembleSkillIndex,
265
321
  assembleAgentMarkdown,
266
- assembleReference
322
+ assembleReference,
323
+ assembleSkill
267
324
  };
package/dist/cli.js CHANGED
@@ -3,11 +3,12 @@ import { createRequire } from 'module'; const require = createRequire(import.met
3
3
  import {
4
4
  PLATFORMS,
5
5
  assembleReference,
6
+ assembleSkill,
6
7
  assembleSkillIndex,
7
8
  configExists,
8
9
  loadAgents,
9
10
  loadConfig
10
- } from "./chunk-N3RYHWTR.js";
11
+ } from "./chunk-U3NGK2UZ.js";
11
12
 
12
13
  // bin/cli.ts
13
14
  import { Command } from "commander";
@@ -83,6 +84,18 @@ var BaseCompiler = class {
83
84
  overwriteStrategy: "replace"
84
85
  }));
85
86
  }
87
+ /**
88
+ * Compile skill files for an agent into a given directory.
89
+ * Returns CompiledOutput[] for each skill file.
90
+ */
91
+ compileSkills(agent, baseDir, extension = ".md") {
92
+ if (!agent.skills?.length) return [];
93
+ return agent.skills.map((skill) => ({
94
+ filePath: `${baseDir}/${skill.id}${extension}`,
95
+ content: assembleSkill(skill) + "\n",
96
+ overwriteStrategy: "replace"
97
+ }));
98
+ }
86
99
  formatFrontmatter(data) {
87
100
  const lines = ["---"];
88
101
  for (const [key, value] of Object.entries(data)) {
@@ -127,6 +140,11 @@ ${body}
127
140
  `.claude/agents/${agent.id}-agent/references`
128
141
  );
129
142
  outputs.push(...refs);
143
+ const skills = this.compileSkills(
144
+ agent,
145
+ `.claude/agents/${agent.id}-agent/skills`
146
+ );
147
+ outputs.push(...skills);
130
148
  }
131
149
  const agentList = agents.map((a) => `- **${a.name}** (\`${a.id}\`): ${a.description.trim().split("\n")[0]}`).join("\n");
132
150
  const claudeMd = [
@@ -154,7 +172,7 @@ ${body}
154
172
  const errors = [];
155
173
  const warnings = [];
156
174
  for (const output of outputs) {
157
- if (output.filePath.includes("/references/")) continue;
175
+ if (output.filePath.includes("/references/") || output.filePath.includes("/skills/")) continue;
158
176
  const lineCount = output.content.split("\n").length;
159
177
  if (lineCount > 300) {
160
178
  warnings.push(
@@ -203,6 +221,23 @@ ${body}
203
221
  content: `${refFrontmatter}
204
222
 
205
223
  ${ref.content}
224
+ `,
225
+ overwriteStrategy: "replace"
226
+ });
227
+ }
228
+ }
229
+ if (agent.skills?.length) {
230
+ for (const skill of agent.skills) {
231
+ const skillFrontmatter = this.formatFrontmatter({
232
+ description: `${agent.name} skill: ${skill.name}`,
233
+ alwaysApply: false,
234
+ globs: globs || void 0
235
+ });
236
+ outputs.push({
237
+ filePath: `.cursor/rules/${agent.id}-skills/${skill.id}.mdc`,
238
+ content: `${skillFrontmatter}
239
+
240
+ ${skill.content}
206
241
  `,
207
242
  overwriteStrategy: "replace"
208
243
  });
@@ -289,6 +324,11 @@ ${body}
289
324
  `.codex/agents/${agent.id}-agent/references`
290
325
  );
291
326
  outputs.push(...refs);
327
+ const skills = this.compileSkills(
328
+ agent,
329
+ `.codex/agents/${agent.id}-agent/skills`
330
+ );
331
+ outputs.push(...skills);
292
332
  }
293
333
  return outputs;
294
334
  }
@@ -355,6 +395,11 @@ ${body}
355
395
  `.agents/skills/${agent.id}-agent/references`
356
396
  );
357
397
  outputs.push(...refs);
398
+ const skills = this.compileSkills(
399
+ agent,
400
+ `.agents/skills/${agent.id}-agent/skills`
401
+ );
402
+ outputs.push(...skills);
358
403
  }
359
404
  return outputs;
360
405
  }
package/dist/index.d.ts CHANGED
@@ -11,6 +11,13 @@ interface ReferenceFile {
11
11
  whenToRead: string;
12
12
  content: string;
13
13
  }
14
+ interface SkillFile {
15
+ id: string;
16
+ name: string;
17
+ description: string;
18
+ trigger: string;
19
+ content: string;
20
+ }
14
21
  interface TechStackConfig {
15
22
  languages: string[];
16
23
  frameworks: string[];
@@ -40,6 +47,8 @@ interface AgentDefinition {
40
47
  workflows: WorkflowDefinition[];
41
48
  sharedKnowledge: string[];
42
49
  references: ReferenceFile[];
50
+ rulesContent: string;
51
+ skills: SkillFile[];
43
52
  globs?: string[];
44
53
  }
45
54
  declare const ConfigSchema: z.ZodObject<{
@@ -78,6 +87,7 @@ declare const ConfigSchema: z.ZodObject<{
78
87
  allowed?: string[] | undefined;
79
88
  denied?: string[] | undefined;
80
89
  }>>;
90
+ rules: z.ZodOptional<z.ZodString>;
81
91
  globs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
92
  }, "strip", z.ZodTypeAny, {
83
93
  name?: string | undefined;
@@ -95,6 +105,7 @@ declare const ConfigSchema: z.ZodObject<{
95
105
  allowed?: string[] | undefined;
96
106
  denied?: string[] | undefined;
97
107
  } | undefined;
108
+ rules?: string | undefined;
98
109
  globs?: string[] | undefined;
99
110
  }, {
100
111
  name?: string | undefined;
@@ -112,6 +123,7 @@ declare const ConfigSchema: z.ZodObject<{
112
123
  allowed?: string[] | undefined;
113
124
  denied?: string[] | undefined;
114
125
  } | undefined;
126
+ rules?: string | undefined;
115
127
  globs?: string[] | undefined;
116
128
  }>>>;
117
129
  shared: z.ZodOptional<z.ZodObject<{
@@ -154,6 +166,7 @@ declare const ConfigSchema: z.ZodObject<{
154
166
  allowed?: string[] | undefined;
155
167
  denied?: string[] | undefined;
156
168
  } | undefined;
169
+ rules?: string | undefined;
157
170
  globs?: string[] | undefined;
158
171
  }>> | undefined;
159
172
  shared?: {
@@ -184,6 +197,7 @@ declare const ConfigSchema: z.ZodObject<{
184
197
  allowed?: string[] | undefined;
185
198
  denied?: string[] | undefined;
186
199
  } | undefined;
200
+ rules?: string | undefined;
187
201
  globs?: string[] | undefined;
188
202
  }>> | undefined;
189
203
  shared?: {
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  configExists,
9
9
  loadAgents,
10
10
  loadConfig
11
- } from "./chunk-N3RYHWTR.js";
11
+ } from "./chunk-U3NGK2UZ.js";
12
12
 
13
13
  // src/index.ts
14
14
  function defineConfig(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aigent-team",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Cross-platform AI agent team plugin for Claude Code, Cursor, Codex, and Antigravity",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,26 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** modify source code, test files, or infrastructure configs
5
+ - **DO NOT** make implementation decisions — define the "what", not the "how"
6
+ - You may read any file to understand current behavior, but only produce specifications and documentation
7
+
8
+ ## Action Rules
9
+ - **NEVER** write acceptance criteria without Given/When/Then format
10
+ - **NEVER** approve a requirement that has no measurable acceptance criteria
11
+ - **NEVER** assume missing requirements — ask for clarification instead
12
+ - **DO NOT** specify technical implementation details (database schemas, API frameworks, UI libraries)
13
+ - **DO NOT** skip edge cases — every user story must address error scenarios and boundary conditions
14
+
15
+ ## Escalation Rules — Stop and Ask
16
+ - Conflicting requirements from different stakeholders
17
+ - Requirement that contradicts existing system behavior
18
+ - Missing stakeholder input needed to proceed
19
+ - Scope creep detected: requirement is growing beyond the original intent
20
+ - Non-functional requirement (performance, security) that needs specialist input
21
+
22
+ ## Output Rules
23
+ - Every user story must follow: "As a [role], I want [action], so that [benefit]"
24
+ - Every acceptance criterion must follow Given/When/Then format
25
+ - API contracts must specify request/response schemas, status codes, and error formats
26
+ - All stories must be estimated for complexity before implementation begins
@@ -0,0 +1,42 @@
1
+ # Skill: Requirement Validation
2
+
3
+ **Trigger**: When validating that requirements are complete, consistent, and implementable before development starts.
4
+
5
+ ## Steps
6
+
7
+ 1. **Completeness check** — For each requirement:
8
+ - Is the "who" defined? (which user persona)
9
+ - Is the "what" specific? (observable behavior, not vague goals)
10
+ - Is the "why" stated? (business value or user need)
11
+ - Are error scenarios covered? (what happens when things go wrong)
12
+ - Are boundary conditions defined? (limits, edge cases, empty states)
13
+
14
+ 2. **Consistency check** — Across all requirements:
15
+ - Do any requirements contradict each other?
16
+ - Are terms used consistently? (same entity name everywhere)
17
+ - Do data types and formats match between related requirements?
18
+ - Are permissions/roles consistent across features?
19
+
20
+ 3. **Feasibility check** — With the technical team:
21
+ - Can each requirement be implemented within the current architecture?
22
+ - Are there technical constraints that limit the requirement?
23
+ - Are third-party dependencies available and reliable?
24
+ - Is the performance target achievable with current infrastructure?
25
+
26
+ 4. **Testability check** — For each acceptance criterion:
27
+ - Can it be verified automatically?
28
+ - Is the expected result measurable and unambiguous?
29
+ - Is the precondition reproducible in a test environment?
30
+
31
+ 5. **Gap analysis** — Identify what's missing:
32
+ - Non-functional requirements (performance, security, accessibility)
33
+ - Error handling and recovery flows
34
+ - Data migration needs (if changing existing behavior)
35
+ - Internationalization / localization considerations
36
+
37
+ ## Expected Output
38
+
39
+ - Validation report: pass/fail per requirement
40
+ - List of gaps and missing requirements
41
+ - Contradictions or ambiguities found
42
+ - Questions for stakeholders to resolve before development
@@ -0,0 +1,47 @@
1
+ # Skill: Story Decomposition
2
+
3
+ **Trigger**: When breaking an epic or large feature into implementable user stories.
4
+
5
+ ## Steps
6
+
7
+ 1. **Understand the epic**:
8
+ - What is the business goal?
9
+ - Who are the users/personas involved?
10
+ - What is the scope boundary? (what's in, what's explicitly out)
11
+
12
+ 2. **Identify user workflows**:
13
+ - Map the primary user journey (happy path)
14
+ - Map alternative paths (edge cases, error scenarios)
15
+ - Map admin/system workflows (background jobs, notifications)
16
+
17
+ 3. **Slice vertically** — Each story should deliver user-visible value:
18
+ - **Bad**: "Create database schema", "Build API", "Build UI" (horizontal slices)
19
+ - **Good**: "User can register with email", "User can reset password" (vertical slices)
20
+ - Each story should be independently deployable and testable
21
+
22
+ 4. **Apply INVEST criteria** to each story:
23
+ - **I**ndependent: can be developed without other stories
24
+ - **N**egotiable: details can be discussed
25
+ - **V**aluable: delivers value to user or business
26
+ - **E**stimable: team can estimate the effort
27
+ - **S**mall: fits in one sprint (ideally 1-3 days of work)
28
+ - **T**estable: has clear acceptance criteria
29
+
30
+ 5. **Write acceptance criteria** for each story:
31
+ ```
32
+ Given [precondition]
33
+ When [action]
34
+ Then [expected result]
35
+ ```
36
+
37
+ 6. **Define dependencies and order**:
38
+ - Which stories must be done first?
39
+ - Which can be parallelized?
40
+ - Where are the integration points between FE/BE?
41
+
42
+ ## Expected Output
43
+
44
+ - List of user stories with title, description, and acceptance criteria
45
+ - Dependency graph showing implementation order
46
+ - Estimation notes (complexity, unknowns, risks)
47
+ - API contract drafts for stories involving FE+BE integration
@@ -0,0 +1,28 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** modify frontend files (components, styles, client-side state, UI tests)
5
+ - **DO NOT** modify infrastructure files (Dockerfile, K8s manifests, CI/CD pipelines) unless the task explicitly requires it
6
+ - **DO NOT** modify database schemas or run migrations without explicit approval
7
+ - You may read any file for context, but only write backend code and tests
8
+
9
+ ## Action Rules
10
+ - **NEVER** log PII (emails, passwords, tokens, IP addresses) — use structured logging with redaction
11
+ - **NEVER** write raw SQL without parameterized queries — no string concatenation for queries
12
+ - **NEVER** catch exceptions and return HTTP 200 — use proper error status codes
13
+ - **NEVER** store secrets in code, config files, or environment variable defaults
14
+ - **DO NOT** add new service dependencies (Redis, queues, external APIs) without stating the reason
15
+ - **DO NOT** bypass the repository/service layer to access the database directly from controllers
16
+
17
+ ## Escalation Rules — Stop and Ask
18
+ - Database migration that alters or drops existing columns — requires explicit approval
19
+ - New external API dependency or third-party service integration
20
+ - Breaking change to an API contract that frontend consumes
21
+ - Performance concern: query estimated to scan > 10K rows without index
22
+ - Security decision: authentication/authorization flow changes
23
+
24
+ ## Output Rules
25
+ - Every new API endpoint must have request/response validation (Zod, Joi, or equivalent)
26
+ - Every database query must have a LIMIT or pagination — no unbounded queries
27
+ - Error responses must follow a consistent format: `{ error: string, code: string, details?: unknown }`
28
+ - All async operations must have timeout and retry configuration
@@ -0,0 +1,45 @@
1
+ # Skill: API Load Test
2
+
3
+ **Trigger**: When validating endpoint performance under load, before a release with traffic expectations, or investigating latency issues.
4
+
5
+ ## Steps
6
+
7
+ 1. **Identify target endpoints** — Focus on:
8
+ - High-traffic endpoints (homepage, search, API gateways)
9
+ - Endpoints with database queries (list, search, aggregation)
10
+ - Endpoints with external dependencies (third-party APIs, file uploads)
11
+
12
+ 2. **Define load profile**:
13
+ - Expected concurrent users
14
+ - Requests per second target
15
+ - Ramp-up period
16
+ - Test duration (minimum 5 minutes for stable results)
17
+
18
+ 3. **Run load test**:
19
+ ```bash
20
+ # Using k6
21
+ k6 run --vus 50 --duration 5m load-test.js
22
+ # Using autocannon
23
+ npx autocannon -c 50 -d 300 http://localhost:3000/api/endpoint
24
+ # Using hey
25
+ hey -n 10000 -c 50 http://localhost:3000/api/endpoint
26
+ ```
27
+
28
+ 4. **Collect metrics** — Measure during the test:
29
+ - Response time: p50, p95, p99
30
+ - Throughput: requests/second
31
+ - Error rate: 4xx, 5xx percentage
32
+ - Resource usage: CPU, memory, DB connections, open file descriptors
33
+
34
+ 5. **Analyze results**:
35
+ - Compare against SLA targets (e.g., p95 < 200ms)
36
+ - Identify bottlenecks (slow queries, connection pool exhaustion, CPU saturation)
37
+ - Check for memory leaks (growing memory over test duration)
38
+
39
+ 6. **Document findings** — Record baseline for future comparison
40
+
41
+ ## Expected Output
42
+
43
+ - Performance summary table (p50, p95, p99, throughput, error rate)
44
+ - Identified bottlenecks with specific recommendations
45
+ - Baseline metrics for regression tracking
@@ -0,0 +1,50 @@
1
+ # Skill: Database Migration
2
+
3
+ **Trigger**: When schema changes are needed — new tables, column changes, index additions, or data migrations.
4
+
5
+ ## Steps
6
+
7
+ 1. **Assess impact** — Before writing the migration:
8
+ - Which tables are affected?
9
+ - Is this additive (safe) or destructive (column drop, type change)?
10
+ - Estimate rows affected and lock duration
11
+ - Does this require backfill of existing data?
12
+
13
+ 2. **Generate migration file**:
14
+ ```bash
15
+ # Prisma
16
+ npx prisma migrate dev --name descriptive_name
17
+ # Knex
18
+ npx knex migrate:make descriptive_name
19
+ # TypeORM
20
+ npx typeorm migration:generate -n DescriptiveName
21
+ ```
22
+
23
+ 3. **Write migration** — Follow these rules:
24
+ - Additive changes first (add column with default), destructive changes in a later migration
25
+ - Always include a `down()` / rollback function
26
+ - Add indexes in a separate migration with `CONCURRENTLY` if supported
27
+ - For large tables (>1M rows), use batched updates instead of single ALTER
28
+
29
+ 4. **Test locally**:
30
+ ```bash
31
+ # Apply migration
32
+ npx prisma migrate dev # or equivalent
33
+ # Verify schema
34
+ npx prisma db pull --print
35
+ # Test rollback
36
+ npx prisma migrate reset # on dev only
37
+ ```
38
+
39
+ 5. **Validate** — After migration:
40
+ - All existing queries still work
41
+ - New columns have appropriate defaults or are nullable
42
+ - Indexes are used (check EXPLAIN on key queries)
43
+ - Application code handles both old and new schema during deployment window
44
+
45
+ ## Expected Output
46
+
47
+ - Migration file with up/down functions
48
+ - Impact assessment (tables affected, estimated lock time, data volume)
49
+ - Rollback procedure
50
+ - Verification queries
@@ -0,0 +1,28 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** modify application business logic (controllers, services, models, UI components)
5
+ - **DO NOT** modify test files unless they are infrastructure/deployment tests
6
+ - You may read any file for context, but only write infrastructure, CI/CD, and deployment configs
7
+
8
+ ## Action Rules
9
+ - **NEVER** store secrets in plaintext — use secret managers (Vault, AWS Secrets Manager, etc.)
10
+ - **NEVER** use `:latest` tags in production container images — always pin specific versions
11
+ - **NEVER** run containers as root in production — use non-root users
12
+ - **NEVER** use `kubectl exec` in production as a fix — create a proper deployment
13
+ - **NEVER** force-push to main/master or delete protected branches
14
+ - **DO NOT** make infrastructure changes without idempotency — every apply must be safe to re-run
15
+
16
+ ## Escalation Rules — Stop and Ask
17
+ - Production incident — alert immediately, don't attempt silent fixes
18
+ - Cost increase > 20% from infrastructure changes
19
+ - Security group or firewall rule change that opens new ports to public
20
+ - Database backup/restore operations in production
21
+ - Certificate rotation or DNS changes that could cause downtime
22
+
23
+ ## Output Rules
24
+ - All IaC must be idempotent — `terraform apply` or equivalent must be safe to run multiple times
25
+ - Every deployment must have a rollback procedure documented
26
+ - Container images must have health checks defined
27
+ - CI/CD pipelines must not have hardcoded secrets — use pipeline variables or secret refs
28
+ - Monitoring alerts must have runbook links
@@ -0,0 +1,61 @@
1
+ # Skill: Health Check Verification
2
+
3
+ **Trigger**: When verifying service health after deployment, setting up monitoring, or debugging availability issues.
4
+
5
+ ## Steps
6
+
7
+ 1. **Check application health endpoints**:
8
+ ```bash
9
+ # Basic health
10
+ curl -sf http://localhost:3000/health | jq .
11
+ # Detailed health (with dependency checks)
12
+ curl -sf http://localhost:3000/health/ready | jq .
13
+ # Liveness probe
14
+ curl -sf http://localhost:3000/health/live | jq .
15
+ ```
16
+
17
+ 2. **Verify dependency connectivity**:
18
+ ```bash
19
+ # Database
20
+ curl -sf http://localhost:3000/health/ready | jq '.checks.database'
21
+ # Redis/Cache
22
+ curl -sf http://localhost:3000/health/ready | jq '.checks.cache'
23
+ # External APIs
24
+ curl -sf http://localhost:3000/health/ready | jq '.checks.external'
25
+ ```
26
+
27
+ 3. **Check container/pod status**:
28
+ ```bash
29
+ # Docker
30
+ docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
31
+ # Kubernetes
32
+ kubectl get pods -l app=service-name -o wide
33
+ kubectl describe pod <pod-name> | grep -A5 "Conditions"
34
+ ```
35
+
36
+ 4. **Verify resource usage**:
37
+ ```bash
38
+ # Container resources
39
+ docker stats --no-stream
40
+ # K8s resources
41
+ kubectl top pods -l app=service-name
42
+ # Check for OOM kills
43
+ kubectl get events --field-selector reason=OOMKilling
44
+ ```
45
+
46
+ 5. **Validate traffic flow**:
47
+ - Check load balancer targets are healthy
48
+ - Verify DNS resolution points to correct endpoints
49
+ - Confirm TLS certificates are valid and not near expiry
50
+
51
+ 6. **Smoke test critical paths**:
52
+ - Authentication endpoint responds with 200
53
+ - Key API endpoints return expected data shapes
54
+ - Static assets are served with correct cache headers
55
+
56
+ ## Expected Output
57
+
58
+ - Health status summary (all services green/red)
59
+ - Dependency connectivity matrix
60
+ - Resource usage snapshot
61
+ - List of any failing checks with remediation steps
@@ -0,0 +1,56 @@
1
+ # Skill: Rollback Procedure
2
+
3
+ **Trigger**: When a deployment needs to be reverted due to errors, performance regression, or unexpected behavior in production.
4
+
5
+ ## Steps
6
+
7
+ 1. **Assess the situation**:
8
+ - What symptoms are observed? (errors, latency, data corruption)
9
+ - When did the issue start? (correlate with deployment time)
10
+ - What was deployed? (commit hash, image tag, config changes)
11
+ - Is this a full outage or degraded service?
12
+
13
+ 2. **Decide rollback strategy**:
14
+ - **Application rollback**: revert to previous container image/build
15
+ - **Database rollback**: run down-migration (only if migration was part of deploy)
16
+ - **Config rollback**: revert environment variables or feature flags
17
+ - **Infrastructure rollback**: revert IaC changes via previous state
18
+
19
+ 3. **Execute application rollback**:
20
+ ```bash
21
+ # Kubernetes
22
+ kubectl rollout undo deployment/service-name
23
+ kubectl rollout status deployment/service-name
24
+
25
+ # Docker Compose
26
+ docker compose up -d --no-build # with previous image tag in .env
27
+
28
+ # AWS ECS
29
+ aws ecs update-service --cluster prod --service service-name --task-definition service-name:PREVIOUS_VERSION
30
+ ```
31
+
32
+ 4. **Verify rollback succeeded**:
33
+ - Run health checks (use health-check skill)
34
+ - Check error rates in monitoring dashboard
35
+ - Verify the previous version is running:
36
+ ```bash
37
+ kubectl get deployment service-name -o jsonpath='{.spec.template.spec.containers[0].image}'
38
+ ```
39
+
40
+ 5. **Communicate status**:
41
+ - Notify stakeholders: rollback completed, service restored
42
+ - Create incident ticket with timeline
43
+ - Document: what was deployed, what broke, what was rolled back
44
+
45
+ 6. **Post-rollback**:
46
+ - Do NOT re-deploy the broken version
47
+ - Root cause analysis before next attempt
48
+ - Add test coverage for the failure scenario
49
+ - Update deployment checklist if a step was missed
50
+
51
+ ## Expected Output
52
+
53
+ - Confirmation that previous version is running
54
+ - Health check results showing service is healthy
55
+ - Incident timeline documentation
56
+ - Root cause investigation action items
@@ -0,0 +1,28 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** modify backend files (API routes, database models, migrations, server configs)
5
+ - **DO NOT** modify infrastructure files (Dockerfile, K8s manifests, CI/CD pipelines)
6
+ - **DO NOT** modify files outside your glob patterns unless explicitly instructed
7
+ - You may read any file for context, but only write frontend code and tests
8
+
9
+ ## Action Rules
10
+ - **NEVER** add new npm dependencies without stating the reason and bundle size impact
11
+ - **NEVER** disable ESLint rules, TypeScript strict checks, or accessibility linting
12
+ - **NEVER** use `any`, `@ts-ignore`, or `as unknown as T` — find the correct type
13
+ - **DO NOT** refactor code outside the scope of the current task
14
+ - **DO NOT** add features, optimizations, or abstractions that weren't requested
15
+ - **DO NOT** create utility files or helper functions for one-time use
16
+
17
+ ## Escalation Rules — Stop and Ask
18
+ - API contract doesn't match what the backend provides — escalate to Lead
19
+ - Accessibility requirement is unclear or conflicts with design — escalate to Lead
20
+ - Performance budget would be exceeded (component > 50KB, page LCP > 2.5s)
21
+ - Breaking change needed to a shared component used by other features
22
+ - Need to introduce a new state management pattern not already in the codebase
23
+
24
+ ## Output Rules
25
+ - Components must not exceed 300 lines — split if larger
26
+ - Every interactive element must have keyboard navigation and ARIA attributes
27
+ - No barrel file re-exports (`index.ts`) in new code
28
+ - Tests must use `getByRole`/`getByLabelText`, not `getByTestId`
@@ -0,0 +1,42 @@
1
+ # Skill: Analyze Bundle Size
2
+
3
+ **Trigger**: When adding new dependencies, investigating slow page loads, or performing a performance audit.
4
+
5
+ ## Steps
6
+
7
+ 1. **Check current bundle** — Run the project's build with analysis:
8
+ ```bash
9
+ # Next.js
10
+ ANALYZE=true npx next build
11
+ # Vite
12
+ npx vite build --report
13
+ # Webpack
14
+ npx webpack-bundle-analyzer dist/stats.json
15
+ ```
16
+
17
+ 2. **Identify large dependencies** — Look for packages > 50KB gzipped:
18
+ ```bash
19
+ npx source-map-explorer dist/**/*.js --json | jq '.results[] | select(.totalBytes > 51200)'
20
+ ```
21
+
22
+ 3. **Check for duplicates** — Multiple versions of the same package:
23
+ ```bash
24
+ npx depcheck
25
+ npm ls --all | grep -E "deduped|invalid"
26
+ ```
27
+
28
+ 4. **Evaluate alternatives** — For each large dependency:
29
+ - Can it be lazy-loaded with `dynamic()` or `React.lazy()`?
30
+ - Is there a lighter alternative (e.g., `date-fns` vs `moment`)?
31
+ - Can tree-shaking be improved by changing import style?
32
+
33
+ 5. **Measure impact** — Compare before/after:
34
+ - Total JS transferred (gzipped)
35
+ - Largest chunk size
36
+ - Number of chunks
37
+
38
+ ## Expected Output
39
+
40
+ - Table of top 10 largest dependencies with sizes
41
+ - Specific recommendations (lazy-load, replace, tree-shake)
42
+ - Before/after size comparison if changes were made
@@ -0,0 +1,41 @@
1
+ # Skill: Component Audit
2
+
3
+ **Trigger**: When reviewing component library health, finding duplicates, or preparing for a design system migration.
4
+
5
+ ## Steps
6
+
7
+ 1. **Inventory components** — List all component files:
8
+ ```bash
9
+ find src/components -name "*.tsx" -o -name "*.jsx" | sort
10
+ ```
11
+
12
+ 2. **Check for duplicates** — Find components with similar names or functionality:
13
+ - Search for components with overlapping names (e.g., `Button`, `Btn`, `ActionButton`)
14
+ - Compare prop interfaces for similarity
15
+ - Check for copy-pasted components across feature directories
16
+
17
+ 3. **Measure usage** — For each component, count imports:
18
+ ```bash
19
+ grep -r "from.*ComponentName" src/ --include="*.tsx" --include="*.ts" | wc -l
20
+ ```
21
+
22
+ 4. **Assess quality** — For each component check:
23
+ - Has proper TypeScript props interface (no `any`)
24
+ - Has `ref` forwarding where appropriate
25
+ - Handles all visual states (loading, error, empty, disabled)
26
+ - Has ARIA attributes for interactive elements
27
+ - Has tests
28
+
29
+ 5. **Identify dead components** — Components with 0 imports (excluding entry points and stories)
30
+
31
+ 6. **Generate report** — Categorize components as:
32
+ - **Healthy**: typed, tested, accessible, used
33
+ - **Needs attention**: missing tests, missing a11y, or partial types
34
+ - **Candidate for removal**: unused or duplicated
35
+
36
+ ## Expected Output
37
+
38
+ - Component inventory table (name, location, import count, quality score)
39
+ - List of duplicate/overlapping components with merge recommendations
40
+ - List of dead components safe to remove
41
+ - Priority list of components needing quality improvements
@@ -0,0 +1,25 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** write implementation code directly — delegate to specialist agents (FE, BE, QA, DevOps)
5
+ - **DO NOT** modify test files, infrastructure configs, or CI/CD pipelines — those belong to specialist agents
6
+ - You may read any file for analysis, but only write planning/coordination artifacts
7
+
8
+ ## Action Rules
9
+ - **NEVER** assign a task without providing the full context template (Task, Context, Scope, Constraints, Related, Acceptance criteria)
10
+ - **NEVER** skip quality gates — every agent output must be reviewed before integration
11
+ - **NEVER** merge or approve work that hasn't passed the Definition of Done
12
+ - **DO NOT** parallelize dependent tasks — BA specs must be complete before FE/BE start coding
13
+ - **DO NOT** spawn more than 3 agents simultaneously without explicit user approval
14
+
15
+ ## Escalation Rules — Stop and Ask
16
+ - Scope change detected: new requirements emerged during implementation
17
+ - Cross-team conflict: FE and BE disagree on API contract
18
+ - Timeline risk: estimated effort exceeds what was planned
19
+ - Ambiguous requirements: cannot determine acceptance criteria from available information
20
+ - Security concern: any agent flags a potential vulnerability
21
+
22
+ ## Output Rules
23
+ - Task assignments must use the structured context template, never free-form
24
+ - Status updates at every milestone (spec done, implementation done, tests done, review done)
25
+ - Every coordinated feature must have a dependency graph before work begins
@@ -0,0 +1,46 @@
1
+ # Skill: Parallel Agent Orchestration
2
+
3
+ **Trigger**: When implementing a feature that requires multiple specialist agents working simultaneously.
4
+
5
+ ## Steps
6
+
7
+ 1. **Map the dependency graph**:
8
+ - List all subtasks and which agent owns each
9
+ - Identify dependencies: which tasks must complete before others can start
10
+ - Group independent tasks that can run in parallel
11
+ - Example:
12
+ ```
13
+ BA (specs) → [FE (UI) + BE (API)] → QA (integration tests) → DevOps (deploy config)
14
+ ```
15
+
16
+ 2. **Define the API contract first** (if FE + BE are both involved):
17
+ - Have BA produce the API contract specification
18
+ - Both FE and BE must acknowledge the contract before starting
19
+ - Contract includes: endpoints, request/response schemas, error codes, auth requirements
20
+
21
+ 3. **Spawn parallel agents with full context**:
22
+ - Each agent gets: task description, relevant specs, file scope, acceptance criteria
23
+ - Each agent gets: the API contract (if applicable)
24
+ - Each agent gets: constraints and deadlines
25
+
26
+ 4. **Monitor and coordinate**:
27
+ - Check agent outputs at each milestone
28
+ - If one agent's output changes the contract, pause and realign all affected agents
29
+ - Resolve conflicts immediately — don't let agents proceed on divergent assumptions
30
+
31
+ 5. **Integration checkpoint**:
32
+ - After parallel work completes, verify FE and BE outputs match the same contract
33
+ - Have QA write integration tests that exercise the full flow
34
+ - Run all unit tests from all agents together
35
+
36
+ 6. **Final review**:
37
+ - Review combined diff for consistency
38
+ - Verify no duplicate code or conflicting patterns across agent outputs
39
+ - Confirm all acceptance criteria are met
40
+
41
+ ## Expected Output
42
+
43
+ - Dependency graph (which tasks depend on which)
44
+ - Agent assignments with full context templates
45
+ - Integration verification results
46
+ - Combined review summary
@@ -0,0 +1,38 @@
1
+ # Skill: Sprint Review
2
+
3
+ **Trigger**: When reviewing completed work at the end of a sprint or milestone, assessing quality and completeness.
4
+
5
+ ## Steps
6
+
7
+ 1. **Gather deliverables** — Collect all outputs from the sprint:
8
+ - List all PRs merged or in review
9
+ - List all tasks completed and their acceptance criteria status
10
+ - Identify any tasks that were carried over (incomplete)
11
+
12
+ 2. **Quality assessment** — For each deliverable:
13
+ - Does it meet the acceptance criteria defined by BA?
14
+ - Has it passed code review by the relevant specialist agent?
15
+ - Are tests written and passing (unit, integration, E2E as appropriate)?
16
+ - Are there any open review comments or unresolved discussions?
17
+
18
+ 3. **Cross-team alignment check**:
19
+ - FE and BE APIs match — no mismatched contracts
20
+ - Shared components modified by one team don't break another
21
+ - Database changes are compatible with both current and previous app versions
22
+
23
+ 4. **Technical debt assessment**:
24
+ - Were any shortcuts taken that need follow-up tickets?
25
+ - Are there TODO comments that should be tracked?
26
+ - Were any rules or constraints violated with justification?
27
+
28
+ 5. **Produce sprint summary**:
29
+ - Completed: what was delivered and working
30
+ - Carried over: what wasn't finished and why
31
+ - Risks: what might cause issues in the next sprint
32
+ - Improvements: what went well, what should change
33
+
34
+ ## Expected Output
35
+
36
+ - Sprint summary document with completed/carried/risks sections
37
+ - Quality scorecard per deliverable
38
+ - Follow-up tickets for technical debt or unfinished work
@@ -0,0 +1,27 @@
1
+ # Rules (Hard Constraints)
2
+
3
+ ## Scope Rules
4
+ - **DO NOT** modify production source code — only test files, test utilities, and test configuration
5
+ - **DO NOT** modify infrastructure or deployment configs
6
+ - You may read any source file to understand behavior, but only write test code
7
+
8
+ ## Action Rules
9
+ - **NEVER** commit `.only` or `.skip` on tests — all tests must run in CI
10
+ - **NEVER** use `sleep()` or fixed delays in tests — use explicit waits and polling
11
+ - **NEVER** disable or delete existing tests without documenting the reason
12
+ - **NEVER** mock what you can test against a real implementation (prefer integration over mocking)
13
+ - **DO NOT** write tests that depend on execution order or shared mutable state
14
+ - **DO NOT** assert on implementation details (internal state, private methods, CSS classes)
15
+
16
+ ## Escalation Rules — Stop and Ask
17
+ - Test coverage would drop below the project threshold after changes
18
+ - Flaky test requires infrastructure fix (timing, race condition, external dependency)
19
+ - Cannot write meaningful test because the source code has no testable interface
20
+ - Security test reveals an actual vulnerability — report immediately, don't just log it
21
+ - Performance test shows regression > 20% from baseline
22
+
23
+ ## Output Rules
24
+ - Every test must have a clear description that reads as a behavior specification
25
+ - No empty test bodies or placeholder tests — every `it()` must assert something
26
+ - Test data must be self-contained — no dependency on external fixtures or seed data that isn't in the test
27
+ - E2E tests must clean up after themselves (created records, uploaded files, etc.)
@@ -0,0 +1,50 @@
1
+ # Skill: Diagnose Flaky Test
2
+
3
+ **Trigger**: When a test is intermittently failing in CI or locally, passing on retry but failing inconsistently.
4
+
5
+ ## Steps
6
+
7
+ 1. **Reproduce the flake** — Run the test in a loop to confirm:
8
+ ```bash
9
+ # Run 20 times, stop on first failure
10
+ for i in $(seq 1 20); do npx vitest run path/to/test.ts || break; done
11
+ # Or with Jest
12
+ npx jest --forceExit --runInBand path/to/test.ts --repeat=20
13
+ ```
14
+
15
+ 2. **Classify the flake** — Common root causes:
16
+ - **Timing**: test depends on setTimeout, animation frames, or network delays
17
+ - **Shared state**: tests modify global/module state that leaks between runs
18
+ - **Order dependency**: test passes alone but fails when run with others
19
+ - **Race condition**: async operations complete in unpredictable order
20
+ - **External dependency**: test hits a real API, database, or file system
21
+ - **Resource exhaustion**: port conflicts, file descriptor leaks, memory pressure
22
+
23
+ 3. **Isolate** — Narrow down the cause:
24
+ ```bash
25
+ # Run the failing test alone
26
+ npx vitest run --testNamePattern "specific test name"
27
+ # Run with the test before it
28
+ npx vitest run path/to/test.ts --sequence
29
+ # Check for shared state
30
+ npx vitest run --isolate path/to/test.ts
31
+ ```
32
+
33
+ 4. **Fix by category**:
34
+ - **Timing**: Replace `sleep()` with explicit waits (`waitFor`, `waitForElement`, polling)
35
+ - **Shared state**: Add proper `beforeEach`/`afterEach` cleanup, avoid global mutations
36
+ - **Order dependency**: Make each test fully self-contained with its own setup
37
+ - **Race condition**: Use proper async/await, avoid fire-and-forget promises
38
+ - **External dependency**: Mock the external service, use test containers for databases
39
+
40
+ 5. **Verify the fix** — Run the loop again to confirm stability:
41
+ ```bash
42
+ for i in $(seq 1 50); do npx vitest run path/to/test.ts || { echo "FAILED on run $i"; exit 1; }; done
43
+ echo "All 50 runs passed"
44
+ ```
45
+
46
+ ## Expected Output
47
+
48
+ - Root cause classification (timing, shared state, race condition, etc.)
49
+ - Specific fix applied with explanation
50
+ - Verification that the test passes 50 consecutive runs
@@ -0,0 +1,56 @@
1
+ # Skill: Generate Test Data
2
+
3
+ **Trigger**: When setting up test fixtures, creating seed data for E2E tests, or testing edge cases and boundary conditions.
4
+
5
+ ## Steps
6
+
7
+ 1. **Analyze data requirements**:
8
+ - Read the schema/types for entities involved
9
+ - Identify required fields, constraints (unique, foreign keys, enums)
10
+ - Identify edge cases: empty strings, max-length values, unicode, special characters
11
+
12
+ 2. **Create factory functions** — Use the project's factory pattern:
13
+ ```typescript
14
+ // Example with factory pattern
15
+ function createUser(overrides?: Partial<User>): User {
16
+ return {
17
+ id: crypto.randomUUID(),
18
+ name: `Test User ${Date.now()}`,
19
+ email: `test-${Date.now()}@example.com`,
20
+ role: 'user',
21
+ createdAt: new Date(),
22
+ ...overrides,
23
+ };
24
+ }
25
+ ```
26
+
27
+ 3. **Generate edge case data sets**:
28
+ - **Boundary values**: empty string, 1 char, max length
29
+ - **Unicode**: emoji, CJK characters, RTL text, zero-width characters
30
+ - **Numeric edges**: 0, -1, MAX_SAFE_INTEGER, NaN, Infinity
31
+ - **Date edges**: epoch, far future, timezone boundaries, DST transitions
32
+ - **Null/undefined**: every nullable field tested with null
33
+
34
+ 4. **Create relationship data** — For entities with foreign keys:
35
+ - Build parent entities before children
36
+ - Create both happy-path and orphan scenarios
37
+ - Test cascade delete/update behavior
38
+
39
+ 5. **Seed data for E2E**:
40
+ ```typescript
41
+ async function seedTestDatabase() {
42
+ const admin = await createUser({ role: 'admin' });
43
+ const users = await Promise.all(
44
+ Array.from({ length: 10 }, () => createUser())
45
+ );
46
+ // Create related entities...
47
+ return { admin, users };
48
+ }
49
+ ```
50
+
51
+ ## Expected Output
52
+
53
+ - Factory functions for each entity involved
54
+ - Edge case data sets organized by category
55
+ - Seed script for E2E test environment
56
+ - Cleanup function to reset test data after runs