@istmx/skills 1.0.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 +49 -0
- package/bin/cli.js +251 -0
- package/istm/SKILL.md +65 -0
- package/istm-animate/SKILL.md +87 -0
- package/istm-animate/animations/animation_utils.md +280 -0
- package/istm-animate/animations/animations.md +220 -0
- package/istm-animate/animations/core_motion.md +250 -0
- package/istm-animate/animations/examples/README.md +29 -0
- package/istm-animate/animations/examples/nuxt/app/app.vue +3 -0
- package/istm-animate/animations/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/istm-animate/animations/examples/nuxt/app/pages/index.vue +55 -0
- package/istm-animate/animations/examples/nuxt/nuxt.config.ts +4 -0
- package/istm-animate/animations/examples/nuxt/package.json +18 -0
- package/istm-animate/animations/examples/react/App.jsx +46 -0
- package/istm-animate/animations/examples/react/index.html +12 -0
- package/istm-animate/animations/examples/react/main.jsx +9 -0
- package/istm-animate/animations/examples/react/package.json +21 -0
- package/istm-animate/animations/examples/react/vite.config.js +7 -0
- package/istm-animate/animations/examples/vanilla/index.html +33 -0
- package/istm-animate/animations/examples/vanilla/main.js +36 -0
- package/istm-animate/animations/examples/vue/app.vue +47 -0
- package/istm-animate/animations/examples/vue/index.html +15 -0
- package/istm-animate/animations/examples/vue/main.js +9 -0
- package/istm-animate/animations/examples/vue/package.json +19 -0
- package/istm-animate/animations/examples/vue/vite.config.js +7 -0
- package/istm-animate/animations/framework_motion.md +262 -0
- package/istm-animate/animations/motion.csv +17 -0
- package/istm-animate/animations/motion.md +11 -0
- package/istm-animate/animations/motion_catalog.json +226 -0
- package/istm-animate/animations/motion_performance.md +75 -0
- package/istm-animate/animations/motion_plugins.md +429 -0
- package/istm-animate/animations/react_animations.md +132 -0
- package/istm-animate/animations/scroll_trigger_effects.md +291 -0
- package/istm-animate/animations/timeline_sequencing.md +103 -0
- package/istm-architecture/SKILL.md +109 -0
- package/istm-architecture/frameworks/angular.csv +51 -0
- package/istm-architecture/frameworks/astro.csv +54 -0
- package/istm-architecture/frameworks/avalonia.csv +57 -0
- package/istm-architecture/frameworks/flutter.csv +53 -0
- package/istm-architecture/frameworks/javafx.csv +76 -0
- package/istm-architecture/frameworks/jetpack-compose.csv +53 -0
- package/istm-architecture/frameworks/laravel.csv +51 -0
- package/istm-architecture/frameworks/nextjs.csv +53 -0
- package/istm-architecture/frameworks/nuxtjs.csv +59 -0
- package/istm-architecture/frameworks/react-native.csv +52 -0
- package/istm-architecture/frameworks/react.csv +54 -0
- package/istm-architecture/frameworks/svelte.csv +54 -0
- package/istm-architecture/frameworks/swiftui.csv +51 -0
- package/istm-architecture/frameworks/uwp.csv +56 -0
- package/istm-architecture/frameworks/vue.csv +50 -0
- package/istm-architecture/frameworks/winui.csv +60 -0
- package/istm-architecture/frameworks/wpf.csv +57 -0
- package/istm-architecture/templates/agents.md +229 -0
- package/istm-architecture/templates/architecture.md +111 -0
- package/istm-architecture/templates/design.md +138 -0
- package/istm-architecture/templates/project-overview.md +215 -0
- package/istm-awwward-designer/SKILL.md +43 -0
- package/istm-awwward-designer/libraries/threejs.csv +54 -0
- package/istm-awwward-designer/references/accessibility.md +774 -0
- package/istm-awwward-designer/references/anim-anti-patterns.md +576 -0
- package/istm-awwward-designer/references/animation-map.md +166 -0
- package/istm-awwward-designer/references/animation-standards.md +86 -0
- package/istm-awwward-designer/references/anti-patterns.md +191 -0
- package/istm-awwward-designer/references/color-systems.md +604 -0
- package/istm-awwward-designer/references/css-performance.md +477 -0
- package/istm-awwward-designer/references/descender-safety.md +490 -0
- package/istm-awwward-designer/references/design-audit.md +93 -0
- package/istm-awwward-designer/references/font-loading.md +378 -0
- package/istm-awwward-designer/references/image-optimization.md +440 -0
- package/istm-awwward-designer/references/invention-gate.md +356 -0
- package/istm-awwward-designer/references/micro-interactions.md +825 -0
- package/istm-awwward-designer/references/page-transitions.md +365 -0
- package/istm-awwward-designer/references/performance-standards.md +79 -0
- package/istm-awwward-designer/references/quality-gate.md +103 -0
- package/istm-awwward-designer/references/responsive-design.md +778 -0
- package/istm-awwward-designer/references/scoring-guide.md +201 -0
- package/istm-awwward-designer/references/scroll-patterns.md +668 -0
- package/istm-awwward-designer/references/stitch-brief.md +124 -0
- package/istm-awwward-designer/references/tech-stack.md +204 -0
- package/istm-awwward-designer/references/technical-audit.md +133 -0
- package/istm-awwward-designer/references/technique-families.md +293 -0
- package/istm-awwward-designer/references/testing.md +535 -0
- package/istm-awwward-designer/references/text-animation.md +585 -0
- package/istm-awwward-designer/references/typography.md +504 -0
- package/istm-awwward-designer/references/usability-audit.md +108 -0
- package/istm-awwward-designer/references/visual-standards.md +97 -0
- package/istm-design/SKILL.md +98 -0
- package/istm-design/colors/color_theory.md +293 -0
- package/istm-design/colors/colors.csv +193 -0
- package/istm-design/colors/colors_catalog.json +4034 -0
- package/istm-design/colors/palette.json +21 -0
- package/istm-design/styles/design_system.md +288 -0
- package/istm-design/styles/html-tailwind.csv +56 -0
- package/istm-design/styles/nuxt-ui.csv +71 -0
- package/istm-design/styles/product_design.md +55 -0
- package/istm-design/styles/shadcn.csv +61 -0
- package/istm-design/styles/style.md +12 -0
- package/istm-design/styles/styles.csv +85 -0
- package/istm-design/styles/styles_catalog.json +2018 -0
- package/istm-design/styles/ui-reasoning.csv +162 -0
- package/istm-design/styles/uno.csv +60 -0
- package/istm-design/typography/font_and_font.md +10 -0
- package/istm-design/typography/google-fonts.csv +1924 -0
- package/istm-design/typography/sans_serif_fonts.md +112 -0
- package/istm-design/typography/typography.csv +75 -0
- package/istm-design/typography/typography_catalog.json +964 -0
- package/istm-design/ux/app-interface.csv +31 -0
- package/istm-design/ux/charts.csv +26 -0
- package/istm-design/ux/icons.csv +106 -0
- package/istm-design/ux/landing.csv +35 -0
- package/istm-design/ux/products.csv +193 -0
- package/istm-design/ux/react-performance.csv +45 -0
- package/istm-design/ux/responsive_rules.md +62 -0
- package/istm-design/ux/storytelling.md +47 -0
- package/istm-design/ux/ux-guidelines.csv +100 -0
- package/istm-design/ux/ux_guidelines.json +1190 -0
- package/istm-system-design/SKILL.md +88 -0
- package/istm-system-design/principles/01-architecture-patterns.md +24 -0
- package/istm-system-design/principles/02-database-selection.md +32 -0
- package/istm-system-design/principles/03-api-design.md +25 -0
- package/istm-system-design/principles/04-authentication-security.md +23 -0
- package/istm-system-design/principles/05-caching-performance.md +21 -0
- package/istm-system-design/principles/06-asynchronous-processing.md +17 -0
- package/istm-system-design/principles/07-infrastructure-deployment.md +22 -0
- package/istm-system-design/principles/08-low-level-design.md +35 -0
- package/istm-system-design/principles/09-state-management.md +14 -0
- package/istm-system-design/principles/10-error-handling-and-logging.md +26 -0
- package/istm-system-design/principles/11-testing-strategy.md +18 -0
- package/istm-system-design/principles/12-seo-and-web-vitals.md +18 -0
- package/istm-system-design/stacks/SETUP.md +82 -0
- package/istm-system-design/stacks/STACK.md +67 -0
- package/istm-system-design/stacks/WORKFLOW.md +84 -0
- package/istm-system-design/templates/api-route.ts.template +32 -0
- package/istm-system-design/templates/migrations.md.template +30 -0
- package/istm-system-design/templates/schema.drizzle.ts.template +17 -0
- package/istm-system-design/templates/schema.prisma.template +28 -0
- package/istm-system-design/templates/trpc-router.ts.template +22 -0
- package/istm-system-design/templates/zod-validators.ts.template +14 -0
- package/istm-workflow/istm-audit/SKILL.md +108 -0
- package/istm-workflow/istm-audit/agent-prompt.md +393 -0
- package/istm-workflow/istm-audit/agents/openai.yaml +7 -0
- package/istm-workflow/istm-audit/modes/area.md +19 -0
- package/istm-workflow/istm-audit/modes/gapfill.md +12 -0
- package/istm-workflow/istm-audit/modes/greenfield.md +24 -0
- package/istm-workflow/istm-audit/modes/tool-skills.md +39 -0
- package/istm-workflow/istm-audit/modes/whole-repo.md +5 -0
- package/istm-workflow/istm-audit/patterns/clean-architecture.md +15 -0
- package/istm-workflow/istm-audit/patterns/domain-driven.md +16 -0
- package/istm-workflow/istm-audit/patterns/functional.md +16 -0
- package/istm-workflow/istm-audit/patterns/solid-oop.md +17 -0
- package/istm-workflow/istm-check/SKILL.md +52 -0
- package/istm-workflow/istm-check/agents/openai.yaml +7 -0
- package/istm-workflow/istm-check/modes/review.md +156 -0
- package/istm-workflow/istm-check/modes/verify.md +197 -0
- package/istm-workflow/istm-check/review-agent-prompt.md +57 -0
- package/istm-workflow/istm-check/review-guide.md +133 -0
- package/istm-workflow/istm-craft/SKILL.md +37 -0
- package/istm-workflow/istm-craft/agent-modes/architecture.md +73 -0
- package/istm-workflow/istm-craft/agent-modes/cross-cutting.md +65 -0
- package/istm-workflow/istm-craft/agent-modes/enhancement.md +45 -0
- package/istm-workflow/istm-craft/agent-modes/feature.md +85 -0
- package/istm-workflow/istm-craft/agent-prompt.md +249 -0
- package/istm-workflow/istm-craft/agents/openai.yaml +7 -0
- package/istm-workflow/istm-craft/internal/after-subagent.md +90 -0
- package/istm-workflow/istm-craft/internal/design-conversation.md +140 -0
- package/istm-workflow/istm-craft/internal/tool-discovery.md +58 -0
- package/istm-workflow/istm-craft/spec-template.md +278 -0
- package/istm-workflow/istm-debug/SKILL.md +102 -0
- package/istm-workflow/istm-debug/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/SKILL.md +144 -0
- package/istm-workflow/istm-develop/agents/openai.yaml +7 -0
- package/istm-workflow/istm-develop/checklist.md +95 -0
- package/istm-workflow/istm-develop/flow/build.md +133 -0
- package/istm-workflow/istm-develop/flow/git.md +34 -0
- package/istm-workflow/istm-develop/logical-guide.md +99 -0
- package/istm-workflow/istm-develop/ui/existing.md +23 -0
- package/istm-workflow/istm-develop/ui/generate.md +131 -0
- package/istm-workflow/istm-develop/ui/image.md +41 -0
- package/istm-workflow/istm-develop/ui/implementation.md +281 -0
- package/istm-workflow/istm-develop/ui/mcp.md +11 -0
- package/istm-workflow/istm-develop/ui-guide.md +164 -0
- package/istm-workflow/istm-document/SKILL.md +123 -0
- package/istm-workflow/istm-document/agent-prompt.md +57 -0
- package/istm-workflow/istm-document/agents/openai.yaml +7 -0
- package/istm-workflow/istm-document/templates/changelog.md +54 -0
- package/istm-workflow/istm-document/templates/postmortem.md +58 -0
- package/istm-workflow/istm-document/templates/pr.md +43 -0
- package/istm-workflow/istm-document/templates/release-note.md +41 -0
- package/istm-workflow/istm-scope/SKILL.md +100 -0
- package/istm-workflow/istm-scope/agents/openai.yaml +7 -0
- package/istm-workflow/istm-scope/approaches/facade.md +33 -0
- package/istm-workflow/istm-scope/approaches/journey.md +31 -0
- package/istm-workflow/istm-scope/approaches/skateboard.md +33 -0
- package/istm-workflow/istm-scope/approaches/tracer-bullet.md +34 -0
- package/istm-workflow/istm-scope/modes/add.md +14 -0
- package/istm-workflow/istm-scope/modes/plan-brownfield.md +11 -0
- package/istm-workflow/istm-scope/modes/plan-greenfield.md +20 -0
- package/istm-workflow/istm-scope/modes/plan-monorepo.md +8 -0
- package/istm-workflow/istm-scope/modes/plan.md +120 -0
- package/istm-workflow/istm-scope/modes/replan.md +13 -0
- package/istm-workflow/istm-scope/scope-template.md +148 -0
- package/istm-workflow/istm-sync/SKILL.md +166 -0
- package/istm-workflow/istm-sync/agent-prompt.md +211 -0
- package/istm-workflow/istm-sync/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/SKILL.md +233 -0
- package/istm-workflow/istm-test/agent-prompt.md +62 -0
- package/istm-workflow/istm-test/agents/openai.yaml +7 -0
- package/istm-workflow/istm-test/modes/setup.md +97 -0
- package/istm-workflow/istm-test/writing-guide.md +196 -0
- package/package.json +35 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test
|
|
3
|
+
allowed-tools: Bash, Read, Grep, Glob, Write, Edit, Agent, AskUserQuestion
|
|
4
|
+
description: "Run /test to write a test suite for code you just built or changed, after implementing a feature, route, or fix. Targets uncommitted changes automatically, reads test preferences.json for your framework (asks and saves it if absent), and picks the right strategy per file: happy path, edge cases, error states, accessibility."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Output style (plain words, no dashes, no hyphens)
|
|
8
|
+
|
|
9
|
+
<!-- OUTPUT-STYLE:START -->
|
|
10
|
+
Write everything this skill produces, files and messages alike, in plain simple language. Keep technical terms that carry real meaning; explain each in plain words. Never use a dash or a hyphen as punctuation: no em dash, no en dash, and no hyphenated compounds. Write `read only`, not `read-only`. Say it in simple words, or reword the sentence. Code, file paths, command flags, and values other skills match on keep their hyphens. Use short sentences, commas, or parentheses. Clear beats clever.
|
|
11
|
+
<!-- OUTPUT-STYLE:END -->
|
|
12
|
+
|
|
13
|
+
## What this skill does
|
|
14
|
+
|
|
15
|
+
Role: a senior test engineer writing the suite the code deserves, no more, no less. Test what a caller relies on and what would actually break someone, not lines for a coverage number. Pick a strategy per file by reading what the thing is. Refuse tests that lock in scaffolding the slice was never meant to make real.
|
|
16
|
+
|
|
17
|
+
Target: the code changed in this branch but not yet committed. Each changed file is classified (pure logic, component, API route, page/flow) and tested with the right strategy; tests verify real behavior and catch regressions, not coverage farming. The main thread writes the tests itself (a read only `scout` may do the heavy file reading for a large set); with a governing spec, tests trace to its acceptance criteria (Steps 7 and 8).
|
|
18
|
+
|
|
19
|
+
Does not write application code. Does not update `.istm-context/agents.md`/`CLAUDE.md` context files (/sync owns that).
|
|
20
|
+
|
|
21
|
+
## Asks vs acts
|
|
22
|
+
|
|
23
|
+
- Acts without asking when `test-preferences.json` exists, the tool is installed, and uncommitted source files exist: straight to writing.
|
|
24
|
+
- Always asks one thing every run, even with prefs: run the suite after writing, or hand back manual instructions (Step 7.5). Per run choice, never saved.
|
|
25
|
+
- Otherwise asks only when: no `test-preferences.json` (framework; E2E addon only if pages/flows changed); a chosen tool is not installed (confirm first); no uncommitted changes (Step 3); >15 files (Step 1b).
|
|
26
|
+
- No scope question. The git working tree defines the scope.
|
|
27
|
+
|
|
28
|
+
## Artifact ownership
|
|
29
|
+
|
|
30
|
+
- Test files (`*.test.ts`, `*.spec.ts`, `test_*.py`, `*_test.go`, etc.), created by this skill
|
|
31
|
+
- `test-preferences.json` at the project root, created and maintained by this skill
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Portability (any OS, any agent)
|
|
36
|
+
|
|
37
|
+
Any Agent Skills client on macOS, Linux, or Windows:
|
|
38
|
+
- `git` is the only required CLI, identical everywhere; run the `git` lines as shown. Other shell snippets are POSIX reference, not literal scripts: do not assume `find`, `grep`, `sed`, `cat`, `test`/`[ ]`, `xargs`, `mkdir -p`, or `node -e` exist. Use your agent's cross platform file tools (read, search/glob, write) and apply branching logic yourself, not via shell `if`/variables/redirects.
|
|
39
|
+
- Bundled files: referenced relative to this skill's folder. The main thread resolves the folder to an absolute path and reads the bundled files itself at write time (Step 8): `agent-prompt.md` and `writing-guide.md`.
|
|
40
|
+
- No interactive question support? Ask any multiple choice question as plain text with the same options.
|
|
41
|
+
|
|
42
|
+
In the Ask blocks below, each option is `"label": "description"`; render them through your agent's picker (`AskUserQuestion` on Claude Code) or as plain text.
|
|
43
|
+
|
|
44
|
+
## Execution
|
|
45
|
+
|
|
46
|
+
### Pre-flight (main thread)
|
|
47
|
+
|
|
48
|
+
#### 1. Determine scope from git (do this first, if empty, no point asking anything)
|
|
49
|
+
|
|
50
|
+
Changed but uncommitted files (cross platform git):
|
|
51
|
+
- Tracked (staged + unstaged), excluding deletions: `git diff --name-only --diff-filter=ACMR HEAD`
|
|
52
|
+
- Untracked, and not ignored: `git ls-files --others --exclude-standard`
|
|
53
|
+
- No commits yet (`git diff HEAD` errors): use `git diff --name-only --diff-filter=ACMR --cached`.
|
|
54
|
+
|
|
55
|
+
Combine, remove duplicates, filter out files that cannot be tested:
|
|
56
|
+
- Test files: `*.test.*`, `*.spec.*`, `test_*.py`, `*_test.go`, anything under `__tests__/`, `e2e/`, `tests/`, `cypress/`
|
|
57
|
+
- Config: `*.config.*`, `.*rc`, `tsconfig*`, `*.json` (except where logic lives in JSON), `Dockerfile`, CI yaml
|
|
58
|
+
- Lock files, `.lock`, generated/build output (`dist/`, `build/`, `.next/`, `coverage/`)
|
|
59
|
+
- Styling: `*.css`, `*.scss`, `*.module.css`; type only declarations: `*.d.ts`
|
|
60
|
+
- Docs and markdown, specs, `.istm-context/design.md`, `test-preferences.json`
|
|
61
|
+
|
|
62
|
+
The remainder is the scope. Empty: go to Step 3. Otherwise continue.
|
|
63
|
+
|
|
64
|
+
#### 1b. Classify each scoped file
|
|
65
|
+
|
|
66
|
+
Classify from path and filename alone, cheaply; if genuinely ambiguous, tag `logic` and tag it again when you read the file at write time. Record each file's class for the write step.
|
|
67
|
+
|
|
68
|
+
| Signals in path / filename | Class | Test strategy |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `*.tsx`/`*.jsx`/`*.vue`/`*.svelte` not under a route/page path | **component** | Component test (render + interact + assert DOM/ARIA) |
|
|
71
|
+
| `app/**/page.*`, `pages/**` (not `pages/api`), `*Screen.*`, `*View.*` | **page/flow** | E2E candidate + component test of pieces |
|
|
72
|
+
| `app/**/route.*`, `pages/api/**`, `*.controller.*`, `*.handler.*`, `*.resolver.*`, `actions.*` | **api/server** | Integration test (call handler, mock at boundary) |
|
|
73
|
+
| Plain `.ts`/`.js`/`.py`/`.go`/`.rs`, utils, hooks, services, domain logic | **logic** | Unit test (inputs → outputs, edge cases, errors) |
|
|
74
|
+
| `cli.*`, `bin/**`, `*.command.*`, `cmd/**` | **cli** | Integration test invoking the command |
|
|
75
|
+
|
|
76
|
+
`E2E_RELEVANT = yes` if any file is **page/flow**; otherwise `no`.
|
|
77
|
+
|
|
78
|
+
Large diff guard: more than 15 source files, don't try to write them all in one pass. Prioritise by class (logic and api/server first, most risk, cheapest to test well) and ask:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Ask: "<N> changed files is a lot for one pass. How should I focus?" (header: "Scope size")
|
|
82
|
+
- "Logic & API first (recommended)": "Test the <count> logic/api files now; I'll note the rest as not-yet-covered"
|
|
83
|
+
- "Test everything in batches": "Cover all <N> files across multiple passes, slower but complete"
|
|
84
|
+
- "Let me narrow it": "I'll tell you which files or directory matter most"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Monorepo resolution: find each scoped file's nearest enclosing `package.json` (walk up). Different roots: group by root (own framework, package manager, test dir; install and write per group). One shared root (common case): single project. Record each file's `packageRoot` for the write step.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
#### 2. Load preferences
|
|
92
|
+
|
|
93
|
+
Read `test-preferences.json` at the project root (file tool; "not found" = no prefs). Branch on whether it names a `tool`, not on whether the file exists:
|
|
94
|
+
- **`tool` is set** (the common write path): load `tool`, `additionalTools`, `e2eTool`, `testDir`, `filePattern`, `packageManager`; skip to Step 5.
|
|
95
|
+
- **`tool` is `null` and `gate` is set** (`GATE_ONLY`): this project gates without a test runner, by an earlier deliberate choice. Do not write a suite, do not install a runner, do not ask again, and do not read `modes/setup.md`. Run the project's typecheck/lint gate, then stop and report: "This project gates on `<gate>`, not a test suite. Ran the typecheck gate; use `/check verify` to confirm behavior."
|
|
96
|
+
- **No file** (`NO_PREFS`, first run): read `modes/setup.md` and do its Step 4 (stack detection and framework questions), then return here for Step 5 (installation check), then do its Step 6 (save preferences), then continue at Step 7. Do not read `modes/setup.md` on a write run.
|
|
97
|
+
- **Malformed** (a file with neither `tool` nor `gate`, or unparseable JSON): say so, then treat it as `NO_PREFS` and run setup again, which overwrites it.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
#### 3. No uncommitted changes
|
|
102
|
+
|
|
103
|
+
Empty scope: skip the framework questions, tell the engineer, offer fallbacks:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
Ask: "No uncommitted source changes found. What should I test?" (header: "No changes")
|
|
107
|
+
- "The last commit": "Diff HEAD~1..HEAD and test what that commit changed"
|
|
108
|
+
- "Specific files": "I'll test the files or directory you name"
|
|
109
|
+
- "Nothing right now": "Stop. I'll run /test after I make changes"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
- Last commit: scope = `git diff --name-only --diff-filter=ACMR HEAD~1 HEAD`, run Step 1b again.
|
|
113
|
+
- Specific files: classify the named files, continue.
|
|
114
|
+
- Nothing: stop cleanly.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
#### 5. Installation check
|
|
119
|
+
|
|
120
|
+
Check the chosen unit tool, E2E tool (if any), and addon (if any) with file tools:
|
|
121
|
+
- JS/TS: under `node_modules/<pkg>`, or in `package.json` devDependencies?
|
|
122
|
+
- Python: in `pyproject.toml`/`requirements.txt` (or `pip show <tool>` where Python is available)?
|
|
123
|
+
- Go: `stretchr/testify` in `go.sum`?
|
|
124
|
+
|
|
125
|
+
All present → Step 6. Any missing → confirm first:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Ask: "<missing tools> not installed. Install now?" (header: "Install")
|
|
129
|
+
- "Yes, install and continue": "Run the install with the detected package manager, then write tests"
|
|
130
|
+
- "No, write runnable stubs": "Skip install; write tests I can run once I install the tools myself"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Yes: install with the project's package manager (`pnpm` shown; substitute the detected npm/yarn/bun, or the language's manager for Python/Go):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pnpm add -D vitest # unit
|
|
137
|
+
pnpm add -D @testing-library/react @testing-library/user-event @testing-library/jest-dom # addon
|
|
138
|
+
pnpm add -D @playwright/test && pnpm exec playwright install # E2E (Playwright)
|
|
139
|
+
pnpm add -D cypress # E2E (Cypress)
|
|
140
|
+
pip install pytest pytest-mock # Python
|
|
141
|
+
go get github.com/stretchr/testify # Go
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
"No": record `INSTALL=deferred`; write complete tests anyway, the run command is reported as "run after installing".
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
#### 7. Gather lightweight pointers (do NOT read heavy files here)
|
|
149
|
+
|
|
150
|
+
Paths and cheap signals only; the heavy reading happens at write time (by you, or a `scout` if offloaded). Do not read specs or `.istm-context/design.md` in full here. Don't read source files here; they're read at write time.
|
|
151
|
+
|
|
152
|
+
With file tools:
|
|
153
|
+
- List the 3 most recently modified spec paths under `.istm-context/specs/` (paths only).
|
|
154
|
+
- Identify the governing spec: the feature dir `.istm-context/specs/NNNN-<feature>/` (or single `.istm-context/specs/NNNN-<feature>.md`) these files implement, matched by branch/feature name or touched surfaces (a `.istm-context/scope/` entry, if present, points to it). Note its path and whether a `verify.md` sits beside it (`.istm-context/specs/NNNN-<feature>/verify.md`). This contract is what tests trace to; it may not be among the 3 recent paths. Set `TRACE_TO_CONTRACT = yes` when a governing spec exists, else `no`.
|
|
155
|
+
- Note whether `.istm-context/design.md` exists at the project root; use its path only when a **component** or **page/flow** file is in scope, else `none`.
|
|
156
|
+
- Read `.istm-context/agents.md` (canonical; `CLAUDE.md` if absent) as project context (short and cheap). Also note the build approach as one line: the slice shaping approach the team chose, recorded in the scope header (or root `.istm-context/agents.md`), e.g. thin end to end path, thinnest usable whole core loop, UI first shell on placeholders, full user journey per phase. It doesn't branch the logic; it calibrates your judgment when writing (Step 8, rule a).
|
|
157
|
+
- Read `package.json`, note `scripts.test`. `RUN_COMMAND` = `<pkgmgr> test` when a `test` script exists (`<pkgmgr> run test` for npm); a raw invocation (e.g. `pnpm exec vitest run`) only when none does.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
#### 7.5 Ask whether to run the suite (always)
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
Ask: "Tests will be written for <N> changed files. Run the suite after writing?" (header: "Run tests?")
|
|
165
|
+
- "Yes, run and fix to green": "Execute the suite; I'll fix any test mistakes and flag real bugs the tests catch"
|
|
166
|
+
- "Skip, just write them": "Write the tests and give me manual run-and-verify instructions instead"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Set `RUN_AFTER = yes | no` and apply it at write time.
|
|
170
|
+
|
|
171
|
+
#### 8. Write the suite (main thread)
|
|
172
|
+
|
|
173
|
+
The main thread writes the tests itself. Do not spawn a writer. Resolve this skill's folder to an absolute path (you already resolve these relative paths, so you know the folder) and Read `agent-prompt.md` and `writing-guide.md` now (only now, at write time): `agent-prompt.md` is your operating template, `writing-guide.md` is the strategy, tool rules, iteration loop, and report format you follow. Reading the changed files under test is the one expensive part; for a large or unfamiliar set, offload just the reading to a read only `scout` subagent on the cheapest model (Claude Code: `haiku`, not inheriting the session model) that returns a compact map, then write from it.
|
|
174
|
+
|
|
175
|
+
The inputs to apply (the labeled values you gathered):
|
|
176
|
+
1. unit tool, E2E tool, additional tools, `INSTALL` state; `testDir`, `filePattern`, package manager, stack/framework, `packageRoot`; the classified scope (each file path with its class: logic / component / page flow / api server / cli); `RUN_COMMAND`, `RUN_AFTER`; project context plus the build approach line; the 3 recent spec paths or `none` (read only if relevant to what you're testing); the .istm-context/design.md path or `none`; `TRACE_TO_CONTRACT`, the governing spec path, and the `verify.md` path (each `none` if absent).
|
|
177
|
+
2. Two rules to apply: (a) let the build approach calibrate which behaviors are durably real for this slice (lock those in as stable assertions) versus deliberate scaffolding the slice fakes by design (don't assert a real implementation the plan hasn't built yet, e.g. a real backend expectation on a shell that stubs its data). (b) when `TRACE_TO_CONTRACT = yes`, read the acceptance criteria (from `verify.md` if present, preferring its already resolved `AC-N`-tagged checklist, else the spec's `## Requirements`) and lock in the durable ones: an automated test for every criterion that can be pinned as a stable assertion, each test tagged with the `AC-N` it covers (e.g. a `covers: AC-3` comment, or `AC-3` in the test title) so the suite traces back to the contract. Never fake a criterion that can't be automated (visual/manual/environmental, e.g. "email actually arrives"); record it in `NOT_COVERED` as `AC-N, <why not automatable> → defer to /check verify manual step`.
|
|
178
|
+
|
|
179
|
+
Monorepo (multiple package roots from Step 1b): write each root's suite in turn, scoped to its root's files, tool, and package manager (offload each root's file reading to its own `scout` if large). Single root (common case): just write it.
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### After writing the suite
|
|
184
|
+
|
|
185
|
+
If the write failed or produced no report: say so and do it again; never report a passing or failing suite you didn't actually produce. Otherwise relay the format matching `RUN_AFTER`.
|
|
186
|
+
|
|
187
|
+
Update the scope: if this feature is on the scope (`.istm-context/scope/`) and the suite passes, tick its `Test it` box. If `Design`, `Build` (+ its milestones), `Verify`, and `Test` are now all ticked, set the feature's status to `done` (in the At a glance table and beside the heading), unless its governing spec is still `Assumed` (a decision built on an unratified assumption): then leave it `in-progress` and point to `/architect <feature>` to ratify first. If tests fail or coverage is partial, leave `Test it` unticked and the status `in-progress`. **Confirm the update as a closing gate** (don't skip it): report exactly what you ticked in each file, e.g. "Scope: ticked `Test it`, status → `done`. Spec: status → `Accepted`." No matching scope row → say so, don't finish silently. On `done`, advise `/clear` before the next feature: the scope and spec hold everything, a fresh session keeps the next build cheap. **Git:** if the nearest `.istm-context/agents.md` `## Git` says `integration: on` and `commit` is not `manual`, offer to commit the suite with a one line subject (`test(<scope>): …`) plus the `Co-Authored-By` trailer; never push. (`/test` is the closer for the `Medium` and `Full` workflow tiers; `Vibe` closes at `/develop` and `Lean` at `/check verify`, so on those tiers this feature would already be `done` or not use `/test`.)
|
|
188
|
+
|
|
189
|
+
Parse from the report: `TESTS_WRITTEN`, `NOT_COVERED`, plus `RUN_RESULT` and `BUGS_FOUND` when `RUN_AFTER = yes`, or `MANUAL_INSTRUCTIONS` when `RUN_AFTER = no`. Relay this template: keep lines marked `← yes` only when `RUN_AFTER = yes`, `← no` only when `RUN_AFTER = no` (a marked heading carries its list lines), unmarked lines always; strip the markers.
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
## /test complete (suite run) ← yes; when no, use: ## /test complete (not run)
|
|
193
|
+
|
|
194
|
+
**Scope**: <N> changed files (uncommitted)
|
|
195
|
+
**Tool**: <unit tool> [+ E2E tool] [+ addons]
|
|
196
|
+
**Preferences**: loaded | saved to test-preferences.json
|
|
197
|
+
|
|
198
|
+
**Tests written**:
|
|
199
|
+
- `<file path>`, <N tests> covering <happy path / edges / errors / a11y> [→ AC-1, AC-3]
|
|
200
|
+
|
|
201
|
+
**Run result**: <X passed, Y failed> via `<RUN_COMMAND>` ← yes
|
|
202
|
+
|
|
203
|
+
**Traceability** (only when TRACE_TO_CONTRACT=yes, spec NNNN):
|
|
204
|
+
- AC-1 ✅ locked in, `<test file · test name>`
|
|
205
|
+
- AC-3 ✅ locked in, `<test file · test name>`
|
|
206
|
+
|
|
207
|
+
**Bugs caught** (tests failing because the code is wrong, not the test): ← yes
|
|
208
|
+
- <file:line, what's broken and the failing expectation> ← only if BUGS_FOUND is non-empty
|
|
209
|
+
|
|
210
|
+
**How to run them**: ← no
|
|
211
|
+
1. <setup step, e.g. install if INSTALL=deferred>
|
|
212
|
+
2. Run: `<RUN_COMMAND>`
|
|
213
|
+
3. Watch a single file: `<focused command>`
|
|
214
|
+
|
|
215
|
+
**What you should see**: <expected pass output, and which tests prove which behaviour> ← no
|
|
216
|
+
**If something fails**: <how to read the failure, is it a test gap or a real bug> ← no
|
|
217
|
+
|
|
218
|
+
**Not covered** (consider adding):
|
|
219
|
+
- <gap and why>
|
|
220
|
+
- AC-N, <criterion that can't be automated (visual/manual/env)> → defer to /check verify manual step ← when TRACE_TO_CONTRACT=yes
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
If `BUGS_FOUND` is not empty, lead with it: a test that correctly fails on real broken code is a genuine finding, not something to silence. /test does not modify application code to make a test pass.
|
|
224
|
+
|
|
225
|
+
This skill is complete after relaying the report: it does not invoke other skills.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Reference files (in this skill's folder; referenced by relative path)
|
|
230
|
+
|
|
231
|
+
- `modes/setup.md`: first run only steps (stack detection, framework questions, save preferences); read on the main thread only when `NO_PREFS`
|
|
232
|
+
- `agent-prompt.md`: the operating template the main thread reads at write time (Step 8)
|
|
233
|
+
- `writing-guide.md`: strategy, tool rules, iteration loop, report format; the main thread reads it at write time too
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Test Writing Template (main thread)
|
|
2
|
+
|
|
3
|
+
You, the main thread, read and follow this at write time (Step 8). Read each ALL_CAPS placeholder as the matching input you gathered in pre-flight and the question rounds.
|
|
4
|
+
|
|
5
|
+
Read `writing-guide.md` alongside this: the detailed rules, strategies, iteration loop, and report format live there; read it in full before writing.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Writing guide (your rulebook, follow it exactly)
|
|
10
|
+
|
|
11
|
+
WRITING_GUIDE
|
|
12
|
+
<!-- Read writing-guide.md from this skill's folder in full before writing. -->
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
You are a senior test engineer with deep expertise in writing production grade test suites. Your guiding principle: a test that passes but fails to catch real bugs is worse than no test. You write tests that verify behavior, catch regressions, and read like documentation.
|
|
17
|
+
|
|
18
|
+
You are testing **code that was just changed and is not yet committed**. The scope is fixed, test exactly the files listed below, nothing else.
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
- **Unit/integration tool**: TOOL
|
|
23
|
+
- **E2E tool**: E2E_TOOL
|
|
24
|
+
- **Additional tools**: ADDITIONAL_TOOLS
|
|
25
|
+
- **Install state**: INSTALL_STATE (installed = ready; deferred = write complete tests, they run after the engineer installs)
|
|
26
|
+
- **Test directory**: TEST_DIR
|
|
27
|
+
- **File pattern**: FILE_PATTERN
|
|
28
|
+
- **Package manager**: PACKAGE_MANAGER
|
|
29
|
+
- **Package root**: PACKAGE_ROOT (run all commands and resolve paths from here)
|
|
30
|
+
- **Stack / framework**: STACK
|
|
31
|
+
- **Run command**: RUN_COMMAND (use this exact command)
|
|
32
|
+
- **Run after writing**: RUN_AFTER (yes = run the suite and iterate; no = write only, then manual instructions)
|
|
33
|
+
|
|
34
|
+
## Scope: changed files to test (each tagged with its class)
|
|
35
|
+
|
|
36
|
+
SCOPE_CLASSIFIED
|
|
37
|
+
<!-- e.g.
|
|
38
|
+
- src/lib/pricing.ts [logic]
|
|
39
|
+
- src/components/CartItem.tsx [component]
|
|
40
|
+
- app/checkout/page.tsx [page/flow]
|
|
41
|
+
- app/api/orders/route.ts [api/server]
|
|
42
|
+
-->
|
|
43
|
+
|
|
44
|
+
## Project context (.istm-context/agents.md, inlined because it is short)
|
|
45
|
+
|
|
46
|
+
PROJECT_CONTEXT
|
|
47
|
+
|
|
48
|
+
## Pointers to read only if relevant (do not assume; read on demand)
|
|
49
|
+
|
|
50
|
+
- **Recent spec paths**: SPEC_PATHS (read one only if it plainly governs a file you're testing)
|
|
51
|
+
- **.istm-context/design.md path**: DESIGN_PATH (read only when writing component/page accessibility cases; `none` if not provided)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## How to proceed
|
|
56
|
+
|
|
57
|
+
1. **Follow the Writing guide above**, it's your rulebook: strategy per file class, coverage priorities, expert rules, tool specific rules, accessibility cases, file placement, the run/iterate loop, and the exact report format you must output.
|
|
58
|
+
2. Read each source file in scope (or work from the `scout` map if you offloaded the reading). Read spec/design pointers only when they bear on what you're testing.
|
|
59
|
+
3. For each file, check for an existing test file and **extend it** rather than duplicate (per the guide).
|
|
60
|
+
4. Write or extend the tests using the strategy for each file's class.
|
|
61
|
+
5. If `RUN_AFTER = yes`, run and iterate per the guide (terse reporter; run only the failing files again). Never modify application source to make a test pass.
|
|
62
|
+
6. Output the report block from the guide that matches `RUN_AFTER`, verbatim, no extra prose.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# OpenAI Codex adapter. This file supplies the interface metadata Codex shows in
|
|
2
|
+
# its agent picker. The skill's actual instructions live in ../SKILL.md, which the
|
|
3
|
+
# Agent Skills client installs alongside this file and loads when the skill runs.
|
|
4
|
+
interface:
|
|
5
|
+
display_name: "Test"
|
|
6
|
+
short_description: "Write focused regression test suites"
|
|
7
|
+
default_prompt: "Run the test skill: read its SKILL.md, then write focused tests for the current uncommitted change."
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Test Mode: setup (first run only, when `NO_PREFS`)
|
|
2
|
+
|
|
3
|
+
Read this only when `test-preferences.json` is absent. It holds the two first run only steps. Ordering in the main flow: do Step 4 here, return to SKILL.md Step 5 (installation check), then do Step 6 here, then continue at SKILL.md Step 7.
|
|
4
|
+
|
|
5
|
+
## Step 4: Stack detection and first run questions
|
|
6
|
+
|
|
7
|
+
With file tools (not shell utilities), determine:
|
|
8
|
+
- Package manager by lockfile: `pnpm-lock.yaml` → pnpm, `yarn.lock` → yarn, `bun.lockb` → bun, `package-lock.json` → npm.
|
|
9
|
+
- Language and framework: `package.json` for `next`/`vite`/`nuxt`/`svelte`/`react`; `pyproject.toml` (pytest/unittest) → Python; `go.mod` → Go; `Cargo.toml` → Rust.
|
|
10
|
+
- Installed test tools: `vitest`/`jest`/`@playwright/test`/`cypress`/`@testing-library/*` in `package.json`. A different runner already in use (`bun test`, `node:test`, `ava`, `deno test`, etc.): detect and use it instead of installing a new one.
|
|
11
|
+
|
|
12
|
+
**Q0: No test setup at all? Don't assume they want one.** No test tool installed (whole repo, or this package in a monorepo): first check for a deliberate no test runner convention.
|
|
13
|
+
- Stated in the nearest `.istm-context/agents.md` or governing spec (e.g. "no test runner, typecheck + `/check verify` is the gate"): respect it, don't push a framework. Save the **gate shape** of `test-preferences.json` (Step 6), run the project's typecheck/lint as the gate, point to `/check verify` for behavior. Report: "This project gates on typecheck + `/check verify`, not a test suite. Ran the typecheck gate; use `/check verify` to confirm behavior."
|
|
14
|
+
- Not stated: ask (don't default to installing): "This has no test setup. How do you want to gate changes here?" → `Set up a test framework` (→ Q1, install with confirmation) · `No test runner, typecheck + /check verify` (→ save the gate shape, run typecheck, defer behavior to `/check verify`; never install) · `Just typecheck for now` (→ also the gate shape).
|
|
15
|
+
- Per package in a monorepo: a package with no tests by design gates on typecheck/`/check verify` even if a sibling has a full suite; apply per resolved package root.
|
|
16
|
+
|
|
17
|
+
Skip Q1 unless the engineer chose "set up a framework".
|
|
18
|
+
|
|
19
|
+
**Q1: Framework for unit/integration** (first run, engineer opted to set up tests)
|
|
20
|
+
|
|
21
|
+
Filter by detected language. List an already installed tool first with `(already installed)` appended and treat it as recommended.
|
|
22
|
+
|
|
23
|
+
| Language | Options (max 4) |
|
|
24
|
+
|---|---|
|
|
25
|
+
| JS / TS | Vitest (recommended), Jest, [+ already installed first] |
|
|
26
|
+
| Python | pytest (recommended), unittest |
|
|
27
|
+
| Go | `testing` + testify (recommended), `testing` stdlib only |
|
|
28
|
+
| Rust | `cargo test` (built in), no question needed, skip |
|
|
29
|
+
|
|
30
|
+
Unlisted language: ask with whatever tools you detect; the picker's automatic Other covers free text, so add no own Other option.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Ask: "Which framework for unit & integration tests?" (header: "Framework")
|
|
34
|
+
- options: [filtered list]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Q2: E2E tool** (ask only if `E2E_RELEVANT = yes`)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Ask: "Pages/flows changed. Add end-to-end tests too?" (header: "E2E")
|
|
41
|
+
- "Playwright (recommended)": "Real-browser flow tests for the changed pages"
|
|
42
|
+
- "Cypress": "Real-browser flow tests with the Cypress runner"
|
|
43
|
+
- "No E2E (unit/component only)": "Skip browser tests; cover pages at the component level"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Q3: Component testing addon** (JS/TS only, when any **component** or **page/flow** file is in scope and React/Vue/Svelte is detected)
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Ask: "Add component testing support?" (header: "Components")
|
|
50
|
+
- "Yes, Testing Library (recommended)": "Installs @testing-library/<framework> + user-event for render+interact tests"
|
|
51
|
+
- "No, logic tests only": "Plain module/function tests, no DOM rendering"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Skip Q3 entirely if scope is logic/api/cli only.
|
|
55
|
+
|
|
56
|
+
## Step 6: Save preferences
|
|
57
|
+
|
|
58
|
+
Write `test-preferences.json` at the project root. It has two shapes, and which one you write depends on what the engineer chose at Q0.
|
|
59
|
+
|
|
60
|
+
**Framework shape** (a runner is set up):
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"tool": "<unit framework>",
|
|
65
|
+
"gate": null,
|
|
66
|
+
"additionalTools": ["@testing-library/react"],
|
|
67
|
+
"e2eTool": "<playwright|cypress|none>",
|
|
68
|
+
"testDir": "<conventional dir for the tool>",
|
|
69
|
+
"filePattern": "<*.test.ts>",
|
|
70
|
+
"packageManager": "<npm|pnpm|yarn|bun>"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Gate shape** (the project gates without a runner, by convention or by the engineer's Q0 answer). `tool` is `null` and `gate` names the gate. Write both keys, never just one: `/test` reads `tool` to decide whether to write a suite, and `/check review` reads `gate` to tell a deliberate no runner project apart from one that simply never set tests up. A file with neither key is malformed.
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"tool": null,
|
|
79
|
+
"gate": "typecheck+verify",
|
|
80
|
+
"packageManager": "<npm|pnpm|yarn|bun>"
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Conventional directories and patterns:
|
|
85
|
+
|
|
86
|
+
| Tool | `testDir` | `filePattern` |
|
|
87
|
+
|---|---|---|
|
|
88
|
+
| Vitest | beside the source | `*.test.ts` / `*.test.tsx` |
|
|
89
|
+
| Jest | beside the source, or `__tests__/` | `*.test.ts` |
|
|
90
|
+
| Playwright | `e2e/` | `*.spec.ts` |
|
|
91
|
+
| Cypress | `cypress/e2e/` | `*.cy.ts` |
|
|
92
|
+
| pytest | `tests/` mirroring source | `test_*.py` |
|
|
93
|
+
| Go testing | same package as source | `*_test.go` |
|
|
94
|
+
| Rust | `#[cfg(test)]` in file / `tests/` | n/a |
|
|
95
|
+
|
|
96
|
+
Then tell the engineer:
|
|
97
|
+
> "Preferences saved to `test-preferences.json`. Future `/test` runs load these and skip straight to writing."
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Test Writing Guide (read by the main thread at write time)
|
|
2
|
+
|
|
3
|
+
The main thread reads this file in full at write time (Step 8), just before it writes the tests. It holds the strategy, rules, tool specifics, iteration loop, and required report format. Reading it only at write time keeps this detail out of context through the earlier pre-flight and question steps.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Rules of engagement
|
|
8
|
+
|
|
9
|
+
**You must not modify application source files.** /test writes tests; it never changes the code under test to make a test pass.
|
|
10
|
+
|
|
11
|
+
### Existing tests: extend, never duplicate or clobber
|
|
12
|
+
|
|
13
|
+
Before writing a new test file, look for one that already covers the source file (same base name with the test pattern, co-located or under TEST_DIR). If it exists:
|
|
14
|
+
- **Extend it** with `Edit`, add the missing cases, keep the engineer's existing tests intact.
|
|
15
|
+
- Never create a second parallel test file for the same source, and never overwrite hand-written tests.
|
|
16
|
+
- If existing tests look wrong or contradict the current code, do not silently rewrite them, note them under `NOT_COVERED` as "existing tests may be stale" so the engineer decides.
|
|
17
|
+
|
|
18
|
+
### Config files: minimal and additive only
|
|
19
|
+
|
|
20
|
+
You generally write only test files. The one exception: if the chosen runner **cannot execute without a config that does not yet exist**, create the minimal one needed:
|
|
21
|
+
- Vitest + Testing Library with no `vitest.config.*`: create one with `environment: 'jsdom'` and a setup file importing `@testing-library/jest-dom`.
|
|
22
|
+
- Playwright with no `playwright.config.*`: create a minimal config (test dir, base webServer if obvious).
|
|
23
|
+
- **Never edit an existing config**, if one is present, respect it and adapt the tests to it. List any conflict under `NOT_COVERED`.
|
|
24
|
+
|
|
25
|
+
### Security-sensitive code: add security cases by default
|
|
26
|
+
|
|
27
|
+
If any file in scope handles authentication, authorization, sessions, payments, or PII (signals: `auth`, `login`, `session`, `token`, `password`, `permission`, `role`, `payment`, `charge`, `webhook`, `checkout`), add cases for: unauthorized/forbidden access, missing/expired/tampered credentials, and that secrets or sensitive fields are not leaked in responses or logs. Note any security risk you cannot cover with a test in `NOT_COVERED`.
|
|
28
|
+
|
|
29
|
+
If `INSTALL_STATE = deferred`, still write complete, correct tests, they simply won't run until the engineer installs.
|
|
30
|
+
|
|
31
|
+
### Reading context efficiently
|
|
32
|
+
|
|
33
|
+
- Read each scoped source file, that is your primary input.
|
|
34
|
+
- Read a spec path you were given **only if** it plainly governs a file you're testing; skip the rest. Don't read all three reflexively.
|
|
35
|
+
- Read the `.istm-context/design.md` path **only** when writing component/page accessibility cases.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Strategy per file class
|
|
40
|
+
|
|
41
|
+
| Class | What to write |
|
|
42
|
+
|---|---|
|
|
43
|
+
| **logic** | Pure unit tests. Call the function with real inputs, assert outputs. Cover edge and error cases exhaustively. Mock only true boundaries (network, fs, clock, randomness). |
|
|
44
|
+
| **component** | Render the component, interact via user events, assert what the user sees (rendered text, roles, disabled/expanded state) and accessibility. Never assert internal state or class names. |
|
|
45
|
+
| **page/flow** | If E2E_TOOL is set, write a real browser flow test for the primary path through the page (load → act → assert outcome) plus one failure path. Also component test any pieces that are not trivial. If E2E_TOOL is `none`, cover the page at the component level. |
|
|
46
|
+
| **api/server** | Integration test: invoke the handler/route/action with representative requests. Assert status, response shape, and error responses (bad input, unauthorized, not found). Mock the DB/external services at the boundary only. |
|
|
47
|
+
| **cli** | Invoke the command with arguments, assert stdout/exit code/side effects. Cover an invalid args path. |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Coverage priorities (in order)
|
|
52
|
+
|
|
53
|
+
1. **Happy path**: the normal, expected use
|
|
54
|
+
2. **Edge cases**: empty, null/undefined, zero, boundary, max length, unicode
|
|
55
|
+
3. **Error states**: invalid input, dependency failure, network error, unauthorized, not found
|
|
56
|
+
4. **State transitions**: initial → action → expected new state (components, reducers, state machines)
|
|
57
|
+
5. **Accessibility** (component/page scope): keyboard reachable, ARIA present, accessible names correct
|
|
58
|
+
|
|
59
|
+
A good suite for a changed feature has more than the happy path. If you only wrote happy path tests, you are not done.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Expert rules (all tools)
|
|
64
|
+
|
|
65
|
+
- **Test names are sentences**: `"returns null when the cart is empty"`, not `"test3"`.
|
|
66
|
+
- **One concept per test.** Multiple `expect`s are fine only if they verify the same behavior.
|
|
67
|
+
- **Arrange → Act → Assert** in every test body.
|
|
68
|
+
- **Test the public interface, not internals.** Assert observable output, not that a private method ran.
|
|
69
|
+
- **Do not mock what you own.** Mock only at the system boundary: HTTP, DB, filesystem, clock, randomness.
|
|
70
|
+
- **Deterministic.** No reliance on real time, real network, or test ordering. Freeze the clock when time matters.
|
|
71
|
+
- **Keep setup DRY but readable.** Shared setup in `beforeEach`/fixtures; the test body still reads on its own.
|
|
72
|
+
- **Every async call is awaited.** No floating promises.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Tool specific rules
|
|
77
|
+
|
|
78
|
+
### Vitest / Jest
|
|
79
|
+
- `describe` groups by file or function under test
|
|
80
|
+
- `vi.fn()` / `jest.fn()` for simple mocks; `vi.mock()` / `jest.mock()` at top of file for modules
|
|
81
|
+
- Timers: `vi.useFakeTimers()` in `beforeEach`, `vi.advanceTimersByTime()`, `vi.useRealTimers()` in `afterEach`
|
|
82
|
+
- Async errors: `await expect(fn()).rejects.toThrow('message')`
|
|
83
|
+
- `vi.spyOn()` when the call itself is the observable effect (e.g. an analytics event)
|
|
84
|
+
|
|
85
|
+
### Testing Library (when ADDITIONAL_TOOLS includes it)
|
|
86
|
+
- Query priority: `getByRole` → `getByLabelText` → `getByText` → `getByTestId` (last resort)
|
|
87
|
+
- `userEvent.setup()` before interactions, never `fireEvent`
|
|
88
|
+
- Async render: `await findByRole(...)`, not `waitFor(() => getByRole(...))`
|
|
89
|
+
- Assert what the user perceives: text, role, disabled/expanded, not `className` or React state
|
|
90
|
+
|
|
91
|
+
### Playwright (E2E)
|
|
92
|
+
- Each test stands on its own: setup in `test.beforeEach`, teardown in `test.afterEach`
|
|
93
|
+
- `page.getByRole()` / `page.getByLabel()` over CSS selectors
|
|
94
|
+
- Wait on assertions, never arbitrary timeouts: `await expect(locator).toBeVisible()`
|
|
95
|
+
- Test mobile (375px) and desktop (1280px) when the page is responsive
|
|
96
|
+
- Forms: fill → submit → assert success or error state
|
|
97
|
+
|
|
98
|
+
### Cypress (E2E)
|
|
99
|
+
- `cy.findByRole()` (with @testing library/cypress) or `cy.get()` with data attributes
|
|
100
|
+
- Assert with `.should(...)`; let Cypress retry, no fixed `cy.wait(ms)`
|
|
101
|
+
- Stub network with `cy.intercept()` at the boundary
|
|
102
|
+
|
|
103
|
+
### pytest
|
|
104
|
+
- `@pytest.fixture` for shared setup; `@pytest.mark.parametrize` for input variations
|
|
105
|
+
- `with pytest.raises(ValueError):` for error assertions
|
|
106
|
+
- Mock with the `mocker` fixture (pytest mock)
|
|
107
|
+
- Async: `@pytest.mark.asyncio`
|
|
108
|
+
|
|
109
|
+
### Go testing + testify
|
|
110
|
+
- Name `Test<Func>_<scenario>`; `assert.Equal(t, want, got)`; `require.NoError(t, err)` for early exit
|
|
111
|
+
- Table driven tests with `t.Run(tt.name, ...)`; `t.Parallel()` when no shared mutable state
|
|
112
|
+
|
|
113
|
+
### Rust (cargo test)
|
|
114
|
+
- Unit tests in `#[cfg(test)] mod tests`; integration tests in `tests/`
|
|
115
|
+
- `assert_eq!` / `assert!`; `#[should_panic(expected = "...")]`; `-> Result<(), E>` with `?` for fallible tests
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Accessibility cases (component / page scope, or when a .istm-context/design.md path was given)
|
|
120
|
+
|
|
121
|
+
- Every interactive element is reachable by Tab in logical order
|
|
122
|
+
- Every `button` has an accessible name (visible text or `aria-label`)
|
|
123
|
+
- Every `input` has an associated label (visible, `aria-label`, or `aria-labelledby`)
|
|
124
|
+
- Error messages link to their input via `aria-describedby`
|
|
125
|
+
- Modal/dialog traps focus while open and returns focus to the trigger on close
|
|
126
|
+
- `aria-expanded` toggles correctly on disclosure triggers
|
|
127
|
+
- Icon only buttons expose screen reader text
|
|
128
|
+
- Do not test colour contrast here (visual, defer to design review)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## File placement
|
|
133
|
+
|
|
134
|
+
Follow TEST_DIR and FILE_PATTERN exactly, and match any existing test convention in the repo.
|
|
135
|
+
|
|
136
|
+
- **Beside the source**: `<source>.test.ts` beside `<source>.ts`
|
|
137
|
+
- **Dedicated dir**: mirror the source path under TEST_DIR (e.g. `src/auth/login.ts` → `tests/auth/login.test.ts`)
|
|
138
|
+
- **E2E**: under the E2E tool's directory (`e2e/`, `cypress/e2e/`), named by the flow not the source file
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Running and iterating (only when RUN_AFTER = yes)
|
|
143
|
+
|
|
144
|
+
Run from `PACKAGE_ROOT`. Keep your own context small, test output is verbose, so:
|
|
145
|
+
|
|
146
|
+
- **First run**: use the terse reporter for your tool (`--reporter=dot` for Vitest/Jest, `--reporter=line` for Playwright, `-q` for pytest, `-q` for `go test`). You want pass/fail counts and the failing names, not full passing output.
|
|
147
|
+
- **On each retry, run only the file(s) that failed**, never the whole suite. E.g. `<RUN_COMMAND> path/to/failing.test.ts`. This keeps each iteration's output small and fast.
|
|
148
|
+
|
|
149
|
+
Then iterate:
|
|
150
|
+
|
|
151
|
+
1. **A test fails because the test is wrong** (bad import, wrong selector, incorrect expectation, missing setup): fix the test and run just that file again. Repeat until these are gone.
|
|
152
|
+
2. **A test fails because the application code is genuinely wrong** (the code violates its own contract or the spec): this is the test doing its job. **Do not change the source to make it pass, and do not weaken the assertion.** Leave the test failing, capture it under `BUGS_FOUND`, and move on.
|
|
153
|
+
3. Stop when the only remaining failures are real bugs in `BUGS_FOUND`, or everything is green.
|
|
154
|
+
|
|
155
|
+
Distinguish the two honestly. Silencing a real failure by loosening the assertion defeats the purpose of the suite. Do not paste raw test output into your report, summarise to counts plus the specific failing cases.
|
|
156
|
+
|
|
157
|
+
If `RUN_AFTER = no`: do not run anything. Write the tests, then produce `MANUAL_INSTRUCTIONS` so the engineer can run and verify themselves.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Report
|
|
162
|
+
|
|
163
|
+
After finishing, output the block matching `RUN_AFTER` verbatim, no extra prose around it.
|
|
164
|
+
|
|
165
|
+
**When RUN_AFTER = yes:**
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
TESTS_WRITTEN:
|
|
169
|
+
- <file path> (<class>): <N tests>, <one-line coverage summary> [extended existing | new]
|
|
170
|
+
- <file path> (<class>): <N tests>, <summary>
|
|
171
|
+
|
|
172
|
+
RUN_RESULT: <X passed, Y failed> via <RUN_COMMAND>
|
|
173
|
+
|
|
174
|
+
BUGS_FOUND:
|
|
175
|
+
- <file:line, the assertion that failed and what it reveals is broken in the code> (omit the whole block if none)
|
|
176
|
+
|
|
177
|
+
NOT_COVERED:
|
|
178
|
+
- <scenario left out, one line each, with reason>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**When RUN_AFTER = no:**
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
TESTS_WRITTEN:
|
|
185
|
+
- <file path> (<class>): <N tests>, <one-line coverage summary> [extended existing | new]
|
|
186
|
+
|
|
187
|
+
MANUAL_INSTRUCTIONS:
|
|
188
|
+
- setup: <e.g. install command if INSTALL_STATE=deferred, else "none">
|
|
189
|
+
- run_all: <RUN_COMMAND>
|
|
190
|
+
- run_focused: <command to run a single file>
|
|
191
|
+
- expected: <what a passing run looks like, and which tests prove which behaviour>
|
|
192
|
+
- on_failure: <how to tell a test gap from a real bug>
|
|
193
|
+
|
|
194
|
+
NOT_COVERED:
|
|
195
|
+
- <scenario left out, one line each, with reason>
|
|
196
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@istmx/skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Context-as-a-Service (CaaS) for AI Coding Agents. Elite orchestrators for Cursor, Windsurf, Gemini, and Claude.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": "bin/cli.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/istmX/skills.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"agents",
|
|
17
|
+
"cursor",
|
|
18
|
+
"windsurf",
|
|
19
|
+
"gemini",
|
|
20
|
+
"claude",
|
|
21
|
+
"orchestrator",
|
|
22
|
+
"context-engine",
|
|
23
|
+
"prompt-engineering"
|
|
24
|
+
],
|
|
25
|
+
"author": "Aryan <roaringmoon07@gmail.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/istmX/skills/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/istmX/skills#readme",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"chalk": "^5.3.0",
|
|
33
|
+
"prompts": "^2.4.2"
|
|
34
|
+
}
|
|
35
|
+
}
|