Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计异常

gathering-context收集背景

Agent Skill

gathering-context 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

242

周安装

10

GitHub Stars

4

下载量

79
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:gathering-context(收集背景)
来源仓库:https://github.com/klamping/webdriverio-skills
仓库路径:skills/gathering-context
安装命令:
npx skills add https://github.com/klamping/webdriverio-skills --skill gathering-context
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/klamping/webdriverio-skills --skill gathering-context

简介

gathering-context 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 它支持通过关键词、任务场景或来源线索进行信息检索与筛选,适用于研究类工作流。
  • 可通过 npx skills add 命令从 GitHub 仓库安装,具体用法请参考原始 README。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Context Gatherer

Reads all available artifacts for a failing WebdriverIO test and returns a structured markdown summary. Called by the Investigator agent — does not diagnose or fix, only gathers and organizes evidence.

Inputs

The Investigator passes a structured failure object:

- testName: string        # The it() / describe() title
- specFile: string        # Relative path to the spec file
- errorMessage: string    # The assertion or exception message
- stackTrace: string      # Full stack trace
- logFile?: string        # Optional: path to wdio log file
- snapshotDir?: string    # Optional: dir where HTML/screenshots/video are saved

Project Context Files

Before scanning from scratch, read project cache files when available:

  • .webdriverio-skills/project-context.md
  • .webdriverio-skills/project-context.json
  • .webdriverio-skills/custom-rules.md
  • references/website-analysis/<target>/website-analysis.md
  • references/website-analysis/<target>/website-analysis.json

Use cached reporter, service, artifact, and environment details to narrow discovery work.

If files are missing or stale, run managing-project-customizations first.

Target Resolution Rule

When reading references/website-analysis/<target>/..., resolve <target> as:

  • lowercase site host from the test URL/baseUrl (e.g. demo.learnwebdriverio.com)
  • if host is unknown, use unknown-target and continue without blocking

Workflow

Step 1 — Locate Artifacts

Use cached context first, then read wdio.conf.js (or discovered WDIO config files) to resolve:

  • Reporters — which are configured (e.g. allure, junit, spec) and their output directories. Note artifact paths; do not parse report formats.
  • Log paths — where WDIO writes its log output.
  • Snapshot directories — where screenshots and HTML snapshots are saved on failure (often configured in afterTest hook via browser.saveScreenshot() and browser.savePDF() / page source capture).
  • Video — if a video service (e.g. wdio-video-reporter) is configured, note the output path.
  • Services — list all configured services. Flag any in these categories as a potential failure dimension for the Investigator:
Service typeWhy it matters
Visual regression (e.g. wdio-image-comparison-service)Failure may be a visual diff, not a selector or logic issue
Mobile / AppiumElement interaction differs from browser; gestures, native contexts
Cloud providers (BrowserStack, Sauce, LambdaTest)Session timeouts, capability mismatches, remote-specific failures
selenium-standalone / chromedriverDriver version mismatch can cause unexpected command failures

If snapshotDir or logFile were provided in the failure object, use those directly and skip discovery for those paths.

Step 2 — Read the Spec File

Open specFile and:

  1. Extract the full body of the it() block matching testName
  2. Identify all enclosing describe() blocks (tests can be nested — outer describe hooks apply)
  3. Identify all Mocha hooks in scope: before, beforeEach, after, afterEach at every nesting level — these run around the failing test and may be relevant
  4. Note all import / require statements — these reveal page object dependencies to traverse in Step 3

If website analysis references exist, use them to quickly map the failing test to:

  • likely section/component ownership
  • expected critical states for the area
  • known auth-gated routes or dependencies

Mocha structure to understand:

  • describe() blocks scope hooks and can be nested arbitrarily deep
  • before / after run once per describe block
  • beforeEach / afterEach run around every it() in their scope
  • All hooks from all enclosing describe levels apply to any given it()

Step 3 — Traverse Page Object Dependencies

Starting from the imports found in Step 2, recursively follow all import / require statements.

For each page object class found:

  • Extract method names and their implementations
  • Note every WebdriverIO command used (see Command Reference below)
  • Extract every selector passed to $() or $$() — these are CSS or XPath strings that map directly to DOM elements

Page Object pattern: Page objects are JavaScript classes that encapsulate selectors and interactions. A method like async clickSubmit() wraps await this.submitBtn.click() where submitBtn is defined as get submitBtn() {return $('#submit-btn')}. Understanding this chain — method → command → selector → DOM element — is essential for correlating failures with HTML snapshots.

Continue recursing until all transitive imports are read. Cross-reference selectors from page objects with the HTML snapshots in Step 5.

Step 4 — Search for Custom Commands

Search the codebase for addCommand to find all custom command definitions.

For each custom command found:

  • Note whether it's registered on browser or element
  • Read its full implementation
  • If a custom command appears in the failing test or any page object method, treat it as a first-class suspect — read it completely

Custom commands do not appear as named entries in WDIO logs. You will see only the underlying native commands they delegate to. To understand what a custom command was doing at failure time, cross-reference the native command sequence in the logs with the custom command's implementation.

If a custom command calls another custom command, follow the chain completely.

Step 5 — Read Logs

Open the log file (from logFile input or discovered in Step 1).

Filter to lines associated with the failing test. WDIO logs include:

  • COMMAND <method> <endpoint> — a native browser command being sent
  • DATA <payload> — the command's parameters
  • RESULT <value> — the response from the driver

Match the log's command sequence against the WebdriverIO commands in the spec and page objects to reconstruct what actually executed at runtime. Look for the last successful command before the error appears.

Step 6 — Collect HTML Snapshots

If HTML snapshots exist in the snapshot directory:

  1. Load them in filename / timestamp order — earlier snapshots show DOM state before the failure
  2. For the failure-time snapshot: check whether selectors from page objects are present in the HTML, have the expected attributes, text, and state
  3. CSS selectors can be matched structurally against the HTML. XPath requires understanding document hierarchy.
  4. Note any elements that are absent, hidden (display:none, visibility:hidden, aria-hidden), disabled, or have unexpected attribute values

Step 7 — Collect Visual Artifacts

Locate screenshots and video files associated with the test run. Do not attempt to analyze their content — record file paths and timestamps only. The Investigator decides whether to pass them to a vision-capable model.

Include in the summary:

  • Screenshot file paths (in timestamp order)
  • Video file path (if present)

Command Reference

Use this reference to understand what a failing test was executing. If a command is unfamiliar or you need full parameter details, look it up:

  • Element commands: https://webdriver.io/docs/api/element/<commandName>
  • Browser commands: https://webdriver.io/docs/api/browser/<commandName>
  • Expect / assertions: https://webdriver.io/docs/api/expect-webdriverio
  • Full API index: https://webdriver.io/docs/api

Element Commands

Called on an element object returned by $() or $$(). Operate on a specific DOM node. Failures here relate to that element's state, visibility, or interactability — look at the selector and the DOM snapshot.

CommandWhat it doesCommon failure modes
$('selector')Find first matching elementElement not in DOM, wrong selector, not yet rendered
$$('selector')Find all matching elementsReturns empty array if none match
click()Click the elementElement obscured, not interactable, wrong element matched
setValue(val)Clear and type into inputElement not an input, not focused, readonly
addValue(val)Append to input valueSame as setValue
getText()Get visible text contentElement not rendered, text in shadow DOM
getValue()Get input valueElement not an input type
getAttribute(name)Get DOM attributeAttribute doesn't exist → returns null
getCSSProperty(prop)Get computed CSS valueUseful for checking visibility, color, dimensions
isDisplayed()Is element visible?Returns false if hidden via CSS
isExisting()Is element in DOM?Returns false if not yet rendered
isClickable()Is element clickable?Checks displayed + enabled + in viewport
isEnabled()Is form element enabled?Returns false for disabled inputs/buttons
isSelected()Is checkbox/radio selected?Only for checkboxes and radio buttons
waitForDisplayed(opts)Wait until visibleTimeout if element never becomes visible
waitForExist(opts)Wait until in DOMTimeout if element never appears
waitForClickable(opts)Wait until clickableTimeout if never interactable
selectByVisibleText(text)Select <option> by labelText mismatch, not a <select> element
selectByAttribute(attr, val)Select <option> by attributeAttribute value mismatch
scrollIntoView()Scroll element into viewportNeeded before click on off-screen elements
moveTo()Hover over elementUsed for hover-triggered UI

Browser Commands

Called on the global browser object. Operate at the session or page level. Failures here relate to navigation, page state, or browser context — not element-level issues.

CommandWhat it doesCommon failure modes
browser.url(path)Navigate to URL or pathWrong base URL, page load failure
browser.getUrl()Get current URLUseful for asserting navigation succeeded
browser.getTitle()Get page titlePage not loaded, wrong page
browser.refresh()Reload current page
browser.back() / forward()Browser history navigation
browser.waitUntil(fn, opts)Wait for arbitrary conditionTimeout if condition never true; check fn logic
browser.execute(fn)Run JS in browser contextJS error in fn, wrong return type
browser.executeAsync(fn)Run async JS in browserCallback never called → timeout
browser.pause(ms)Hard wait (avoid if possible)Masks timing issues rather than fixing them
browser.keys(keys)Send keyboard inputFocus not on expected element
browser.switchToFrame(id)Switch context to iframeWrong frame ID, frame not loaded
browser.switchToParentFrame()Return to main frameAlready in main frame
browser.newWindow(url)Open new window/tab
browser.switchWindow(handle)Switch to window by handle/titleWrong handle, window closed
browser.acceptAlert()Accept a browser dialogNo dialog present
browser.dismissAlert()Dismiss a browser dialogNo dialog present
browser.getAlertText()Get dialog message textNo dialog present
browser.setCookies(cookies)Set browser cookiesWrong domain, malformed cookie
browser.getCookies()Get all cookies
browser.deleteCookies()Delete cookies
browser.saveScreenshot(path)Save screenshot to file
browser.getPageSource()Get full page HTMLUseful for snapshot comparison

Expect / Assertions

Assertions use expect-webdriverio. A failing assertion means the element or browser was in the wrong state at that moment.

AssertionWhat it checks
expect(el).toBeDisplayed()Element is visible
expect(el).toExist()Element is in DOM
expect(el).toBeClickable()Element is interactable
expect(el).toBeEnabled()Form element is not disabled
expect(el).toBeSelected()Checkbox/radio is checked
expect(el).toHaveText(str)Element text matches
expect(el).toHaveValue(str)Input value matches
expect(el).toHaveAttribute(attr, val)Attribute has expected value
expect(el).toHaveClass(name)Element has CSS class
expect(el).toHaveURL(str)Current URL matches (on browser)
expect(el).toHaveTitle(str)Page title matches (on browser)
expect(arr).toHaveLength(n)Array/collection length

When an assertion fails, the error message includes the actual vs. expected value. Cross-reference the actual value with the HTML snapshot and logs to understand why the state was wrong.


Output

Return a structured markdown summary to the Investigator:

## Context: <testName>

### Test Flow
Step-by-step reconstruction of what the test was doing,
derived from the spec file, hooks in scope, and page object methods.

### Last Known Good State
What the test had successfully completed just before the failure,
based on log command sequence and intermediate HTML snapshots (if present).

### Point of Failure
- **Error:** <errorMessage>
- **Stack trace:** excerpt pointing to the exact file and line
- **Command:** the WebdriverIO command that failed or produced wrong state
- **Selector involved:** the CSS/XPath selector (if applicable)
- **Page object method:** which method contained the failing command

### DOM State at Failure
Key observations from the HTML snapshot at failure time:
- Was the selector present? Hidden? Disabled?
- Were expected elements missing or in unexpected state?
- Any relevant attribute values or form state?

### Visual Artifacts
- Screenshots: [list of file paths with timestamps, in order]
- Video: [file path if present, otherwise "none"]
- HTML snapshots: [list of file paths in sequence, oldest first]

### Active Services
[List configured services and flag any that may be relevant to the failure]

### Custom Commands Involved
[List any custom commands called in the test flow, with their source location]

### Hypothesis
One or two sentences: the most likely cause of the failure based on the
evidence gathered. Do not speculate beyond what the artifacts support.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.93%
按下载量换算28

Claude

28.81%
按下载量换算23

Cursor

18.71%
按下载量换算15

Gemini CLI

8.18%
按下载量换算6

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills