Token导航 LogoToken导航

Agent Skill · 研究检索

smart-test(智能测试)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

smart-test 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 33,257。

总安装 2,376周安装 110GitHub Stars 55下载 832核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/rysweet/amplihack --skill smart-test

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

smart-test 用于辅助测试设计、自动化测试和回归验证,帮助编写单元测试或端到端测试。适用于根据失败日志定位问题、生成测试计划或整理用例的场景。使用时需确认项目测试框架、运行命令和夹具数据配置。涉及浏览器或外部服务时,应区分本地模拟与生产环境,避免误改真实逻辑。

不能仅依赖工具输出作为最终结论,需人工复核测试有效性。

来源仓库内路径:skills/smart-test

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/rysweet/amplihack --skill smart-test;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

smart-test 怎么安装?

在终端执行 npx skills add https://github.com/rysweet/amplihack --skill smart-test。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

smart-test 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

smart-test 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

smart-test 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

smart-test 用的人多吗?

公开数据是累计安装 2,376 次,近一周安装 110 次,下载 832 次,GitHub 55 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

smart-test 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
smart-test

智能测试 · 本页

2,37655接触敏感数据MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Smart Test Selection Skill

Purpose

Optimizes test execution by intelligently selecting which tests to run based on code changes. Instead of running the full test suite every time, this skill:

  1. Maps code changes to affected test files using import dependency analysis
  2. Provides tiered testing strategies for different feedback loop needs
  3. Tracks test reliability to prioritize stable tests in fast runs

When I Activate

I automatically load when you mention:

  • "run affected tests" or "run impacted tests"
  • "smart test" or "intelligent testing"
  • "which tests to run" or "test selection"
  • "fast tests" or "quick tests"
  • "tests for changes" or "tests for this PR"

Core Concepts

Test Tiers

Tier 1: Fast Tests (< 1 minute)

  • Directly affected unit tests (imports changed file)
  • High-reliability tests only (no flaky tests)
  • Run on every save or pre-commit
  • Command: pytest -m "not slow and not integration" [selected_tests]

Tier 2: Impacted Tests (< 5 minutes)

  • All tests affected by changes (direct + transitive dependencies)
  • Includes integration tests for changed modules
  • Run before commit or on PR draft
  • Command: pytest [selected_tests]

Tier 3: Full Suite

  • Complete test suite
  • Run on PR ready-for-review or CI
  • Command: pytest

Import Dependency Analysis

The skill builds a dependency graph by analyzing Python imports:

source_file.py
    |
    +-- Imported by: module_a.py, module_b.py
    |       |
    |       +-- Tested by: test_module_a.py, test_module_b.py
    |
    +-- Tested by: test_source_file.py (direct test)

Direct Tests: Files matching pattern test_{module}.py or {module}_test.py Indirect Tests: Tests that import modules which import the changed file

Reliability Tracking

Tests are scored on reliability (0.0 to 1.0):

  • 1.0: Always passes (stable)
  • 0.5-0.9: Occasional failures (investigate)
  • < 0.5: Frequently fails (flaky - excluded from Tier 1)

Reliability is tracked in ~/.amplihack/.claude/data/test-mapping/reliability.yaml

Usage

Analyze Changes and Get Test Commands

User: What tests should I run for my changes?

Claude (using smart-test):
1. Analyzes git diff or staged changes
2. Maps changed files to test dependencies
3. Returns tiered test commands

Example Output:
------------------------------------------
Smart Test Analysis
------------------------------------------

Changed Files:
- src/amplihack/core/processor.py
- src/amplihack/utils/helpers.py

Tier 1 (Fast - 45s estimated):
  pytest tests/unit/test_processor.py tests/unit/test_helpers.py -v

Tier 2 (Impacted - 3m estimated):
  pytest tests/unit/test_processor.py tests/unit/test_helpers.py \
         tests/integration/test_pipeline.py -v

Tier 3 (Full - 12m estimated):
  pytest

Recommendation: Start with Tier 1 for quick feedback.

Build or Refresh Mapping Cache

User: Build the test mapping for this project

Claude:
1. Scans all Python files
2. Builds import dependency graph
3. Maps source files to test files
4. Saves to .claude/data/test-mapping/code_to_tests.yaml

Check Test Reliability

User: Show flaky tests

Claude:
1. Reads reliability.yaml
2. Lists tests with reliability < 0.8
3. Suggests investigation or quarantine

Process

Step 1: Identify Changed Files

# For staged changes
git diff --cached --name-only --diff-filter=ACMR

# For all uncommitted changes
git diff --name-only --diff-filter=ACMR

# For PR changes (vs main)
git diff main...HEAD --name-only --diff-filter=ACMR

Filter to only Python source files (exclude tests themselves for mapping).

Step 2: Build Import Graph

For each Python file, extract imports:

# Patterns to detect:
import module
from module import item
from package.module import item
from . import relative
from ..parent import item

Build bidirectional mapping:

  • Forward: file -> what it imports
  • Reverse: file -> what imports it

Step 3: Map to Tests

For each changed file, find tests via:

  1. Direct test match: test_{filename}.py or {filename}_test.py
  2. Import-based: Tests that import the changed module
  3. Transitive: Tests that import modules that import changed module (1 level)

Step 4: Apply Reliability Filter

For Tier 1 only, exclude tests with reliability < 0.8.

Step 5: Generate Commands

Output pytest commands with appropriate markers:

# Tier 1
pytest -m "not slow and not integration" tests/a.py tests/b.py

# Tier 2
pytest tests/a.py tests/b.py tests/c.py

# Tier 3
pytest

Data Storage

code_to_tests.yaml

# .claude/data/test-mapping/code_to_tests.yaml
version: 1
last_updated: "2025-11-25T10:00:00Z"
mappings:
  src/amplihack/core/processor.py:
    direct_tests:
      - tests/unit/test_processor.py
    indirect_tests:
      - tests/integration/test_pipeline.py
    transitive_tests:
      - tests/e2e/test_full_workflow.py

  src/amplihack/utils/helpers.py:
    direct_tests:
      - tests/unit/test_helpers.py
    indirect_tests:
      - tests/unit/test_processor.py # processor imports helpers

reliability.yaml

# .claude/data/test-mapping/reliability.yaml
version: 1
last_updated: "2025-11-25T10:00:00Z"
tests:
  tests/unit/test_processor.py::test_basic:
    passes: 98
    failures: 2
    reliability: 0.98
    last_failure: "2025-11-20"

  tests/integration/test_api.py::test_timeout:
    passes: 45
    failures: 15
    reliability: 0.75
    last_failure: "2025-11-24"
    flaky_reason: "Network dependent"

Integration with Workflow

This skill integrates with DEFAULT_WORKFLOW.md:

Step 12: Run Tests and Pre-commit Hooks

  • Use Tier 1 (fast) for pre-commit
  • Quick feedback on changed code

Step 13: Mandatory Local Testing

  • Use Tier 2 (impacted) before commit
  • Ensures affected code paths are tested

CI Pipeline

  • Use Tier 2 on draft PRs
  • Use Tier 3 (full) on ready-for-review PRs

Markers Integration

Works with existing pytest markers from pyproject.toml:

  • slow - Excluded from Tier 1
  • integration - Excluded from Tier 1
  • e2e - Excluded from Tier 1 and 2
  • neo4j - Requires special environment
  • requires_docker - Requires Docker daemon

Quick Reference

ScenarioTierTime BudgetCommand Pattern
Pre-commit1< 1 minpytest -m "not slow" [affected]
Pre-push2< 5 minpytest [affected + transitive]
Draft PR2< 5 minpytest [affected + transitive]
Ready PR3Fullpytest
CI main3Fullpytest

Philosophy Alignment

Ruthless Simplicity

  • Simple tier system (1, 2, 3)
  • YAML storage over database
  • Import analysis over complex AST parsing

Zero-BS Implementation

  • Real pytest commands (copy-paste ready)
  • Actual time estimates based on test count
  • No placeholder data or mock reliability scores

Testing Pyramid

  • Tier 1 prioritizes unit tests (60%)
  • Tier 2 adds integration tests (30%)
  • Tier 3 includes E2E tests (10%)

Complementary Skills

  • test-gap-analyzer: Identifies missing tests
  • qa-team: Creates E2E and parity test scenarios (outside-in-testing alias supported)
  • tester agent: Writes new tests for gaps
  • pre-commit-diagnostic: Fixes pre-commit failures

Common Patterns

Pattern 1: Quick Iteration

[Developer makes small change]
Claude: Run affected tests (Tier 1)
[45 seconds later]
Claude: 3/3 tests passed. Ready for commit.

Pattern 2: Pre-Push Validation

[Developer about to push]
Claude: Run impacted tests (Tier 2)
[3 minutes later]
Claude: 12/12 tests passed including integrations.

Pattern 3: Flaky Test Investigation

User: Tests keep failing randomly

Claude: Checking reliability data...
Found 2 flaky tests (< 0.8 reliability):
- test_api_timeout (0.75) - Network dependent
- test_concurrent_write (0.68) - Race condition

Recommend: Quarantine these tests or fix root cause.

Limitations

  • Python-only import analysis
  • Single-level transitive analysis (deeper chains excluded)
  • Reliability data requires initial seeding from test runs
  • Does not detect dynamic imports or string-based imports

When to Avoid

Do NOT use smart-test when:

  1. First time setting up tests - No mapping cache exists yet; run full suite first
  2. Major refactoring - When module structure changes significantly, mappings become stale
  3. Configuration changes - Changes to pytest.ini, conftest.py, or fixtures affect all tests
  4. CI environment variables changed - Environment-dependent tests may all need re-running
  5. Database schema migrations - All database-touching tests should run
  6. Flaky test investigation - Run full suite to get accurate reliability data
  7. Pre-merge final check - Always run Tier 3 (full suite) before merging to main

Rule of thumb: When in doubt, run the full suite. Smart-test optimizes iteration speed, not correctness.

Error Handling and Troubleshooting

Common Issues

Issue: "No tests found for changed file"

Cause: File is new or not yet mapped
Fix: Rebuild the mapping cache
     User: "Rebuild test mapping cache"

Issue: "Import analysis failed"

Cause: Syntax error in Python file or circular imports
Fix: 1. Check file for syntax errors: python -m py_compile file.py
     2. Resolve circular imports
     3. Rebuild mapping cache

Issue: "Reliability data missing"

Cause: No test runs have been recorded yet
Fix: Run full test suite once, then:
     User: "Update test reliability with these results"

Issue: "Tier 1 tests taking too long"

Cause: Too many tests marked as "fast" or slow tests not marked
Fix: 1. Add @pytest.mark.slow to tests > 1 second
     2. Add @pytest.mark.integration to integration tests
     3. Review test granularity

Issue: "Cache is stale / wrong tests selected"

Cause: Module structure changed since last cache build
Fix: Delete cache and rebuild:
     rm -rf .claude/data/test-mapping/*.yaml
     User: "Rebuild test mapping cache"

Recovery Commands

# Verify test mapping is valid
python -c "import yaml; yaml.safe_load(open('.claude/data/test-mapping/code_to_tests.yaml'))"

# Check reliability data
python -c "import yaml; print(yaml.safe_load(open('.claude/data/test-mapping/reliability.yaml')))"

# Force full suite (bypass smart-test)
pytest --ignore-glob='**/test_slow_*'

# Find tests with no source mapping (orphaned tests)
find tests -name "test_*.py" -exec basename {} \; | sort > /tmp/tests.txt

Cache Maintenance

The mapping cache should be rebuilt when:

  • New test files are added
  • Module structure changes significantly
  • Cache is older than 7 days

Trigger manually: "Rebuild test mapping cache"


Note: Start with Tier 1 for rapid feedback. If tests pass, you likely caught any regressions. Only escalate to higher tiers when approaching commit/push milestones.

平台分布

Claude Code

27.27%
按下载量换算227

Antigravity

22.75%
按下载量换算189

OpenCode

17.72%
按下载量换算147

Gemini CLI

12.52%
按下载量换算104

windsurf

6.34%
按下载量换算53

Cursor

2.83%
按下载量换算24

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills