一键导入
scout-best-practices-reviewer
Review Scout UI/API tests (including Scout test migrations) for best practices, reuse, and parity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Review Scout UI/API tests (including Scout test migrations) for best practices, reuse, and parity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Investigate Scout and FTR flaky test failures in Kibana. Use when triaging a failed-test issue, a Buildkite-reported failure, a test path that has been failing intermittently, or any time the user asks to look at a flaky test, deflake a test, or stabilize a test.
Single entry point for migrating Kibana Functional Test Runner (FTR) tests to Scout. Plans the migration first, asks the user to review the plan, then executes it and runs the new tests. Use when migrating FTR tests to Scout, triaging FTR suites for Scout readiness, deciding UI vs API vs RTL/Jest, mapping FTR services/page objects/hooks to Scout fixtures, or splitting loadTestFile patterns.
| name | scout-best-practices-reviewer |
| description | Review Scout UI/API tests (including Scout test migrations) for best practices, reuse, and parity. |
Perform a static PR review of Scout UI and API test files (*.spec.ts) against Scout best practices and existing Scout abstractions (fixtures, page objects, API helpers). Produce actionable, PR-review-ready feedback that pushes for reuse over one-off implementations.
Solution-specific skills may extend this skill with additional review criteria. Check if one exists for your solution (e.g., Security Solution has one at <plugin>/.agents/skills/scout-best-practices-reviewer/). Run the general review first, then apply solution-specific checks.
Important: Do not post GitHub comments unless explicitly stated.
Changed *.spec.ts files (and imported helpers/fixtures).
test / spaceTest (usually in **/test/scout/ui/**).apiTest (usually in **/test/scout/api/**).Neighboring Scout code in the same plugin/solution (existing specs + test/scout/**/fixtures/**) to spot reuse opportunities and avoid duplicating helpers.
Removed/previous tests (if this is a migration) to verify behavior parity.
Scout docs (open only what you need — best practices are split by test type so you can skip the irrelevant half):
docs/extend/scout/best-practices.mddocs/extend/scout/ui-best-practices.mddocs/extend/scout/api-best-practices.mddocs/extend/scout/core-concepts.md, docs/extend/scout/fixtures.mddocs/extend/scout/page-objects.md, docs/extend/scout/api-services.mddocs/extend/scout/write-ui-tests.md, docs/extend/scout/write-api-tests.mddocs/extend/scout/api-auth.md, docs/extend/scout/browser-auth.md, docs/extend/scout/parallelism.md, docs/extend/scout/deployment-tags.md, docs/extend/scout/a11y-checks.md, docs/extend/scout/debugging.md, docs/extend/scout/run-tests.mdRule of thumb: always read the general best practices, then open only the UI-specific file for UI reviews or the API-specific file for API reviews. If a PR mixes UI and API specs, open both.
docs/extend/scout/fixtures.md + local test/scout/**/fixtures)@kbn/scout, solution Scout packages, and plugin-local test/scout/**) before suggesting brand-new helpersChecklist items are tagged with the document they're detailed in:
docs/extend/scout/best-practices.md (applies to both UI and API tests)docs/extend/scout/ui-best-practices.mddocs/extend/scout/api-best-practices.mdOpen only the docs relevant to the test type(s) under review.
pageObjects, fixtures, and apiServices; if adding helpers/page objects, place them in the right scope (plugin vs solution vs @kbn/scout) and register via fixtures.apiClient for the endpoint under test; apiServices/kbnClient for setup/teardown only; correct auth + common headers.expect), test flow (test.step), and page-object method calls. Short inline locator calls for simple one-off assertions (e.g. a single label or nav-link check) are acceptable. Flag raw locators when the interaction is complex enough to benefit from abstraction or is duplicated across specs. Extract all locators as readonly properties in the constructor; no inline locator creation inside methods.afterAll/afterEach; defensive cleanup in beforeAll for failed-run leftovers; scoutSpace.savedObjects.cleanStandardList() as catch-all after domain-specific cleanup; no reliance on file ordering or shared mutable state.admin unless required); space-aware behavior covered or explicitly out of scope.waitForTimeout() and time-based assertions/retries; rely on auto-waiting + explicit readiness signals. Some locators are restricted by @kbn/eslint/scout_no_locators (e.g. globalLoadingIndicator).global.teardown.ts is present): cleanup must use esClient/kbnClient/apiServices. esArchiver isn't on the teardown fixture surface — Scout intentionally never exposed archive-unloading (slow and unnecessary; leftover indexes don't break tests with idempotent loadIfNeeded). Flag teardowns that try to use esArchiver at all, that load new data (teardown is for state reset only), or that duplicate work belonging in afterAll/per-test cleanup.Do not review or comment on:
.meta manifest files (e.g., **/.meta/**/*.json): these are auto-generated for CI test planning and lane distribution. No manual regeneration is needed.Use these definitions when assigning severity:
When in doubt, prefer a lower severity. Optimization suggestions (efficiency improvements) should be minor or nit, not major.
test/functional/**, loadTestFile(), FTR configs) alongside new/changed Scout specs.blocker unless explicitly de-scoped.admin vs viewer), spaces behavior, and permission realismignoreErrors, automatic retries)loadTestFile()).These EUI/Kibana component behaviours are non-obvious and cannot be inferred from documentation alone.
QueryStringInput: fill() races with React prop sync; use pressSequentially() instead.EuiBasicTable empty state: always renders a phantom "no items found" row — assert toContainText('No items found'), never toHaveCount(0).span:has([data-test-subj="..."]) wrapper, not the button itself..euiTableRow, .euiToolTipAnchor, etc.): internal to EUI, change between versions — use data-test-subj or ARIA roles.dispatchEvent('click') over { force: true }; document the bug location in a comment.This skill does not prescribe an output format. The caller decides how findings are reported:
OUTPUT.md.Offer to generate the updated code, fully incorporating the suggested improvements and resolving any parity gaps.