Token导航 LogoToken导航TokenDH.com
开发需要联网github未标认证来源可访问clear审计未展示

tests-standards测试标准

Agent Skill

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

总安装

8,200

周安装

233

GitHub Stars

1,581

下载量

1,926
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/maxritter/claude-codepro --skill 'Tests Standards'

简介

用于辅助测试设计、自动化测试、用例整理和回归验证。

  • 适合编写单元测试、端到端测试、测试计划或根据失败日志定位问题。
  • 使用时需确认项目测试框架、运行命令和夹具数据,避免误改真实逻辑。
  • 涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。
  • 建议结合原始 README 进一步核验具体用法和限制条件。

SKILL.md

Tests Standards

Core Philosophy: Write minimal, focused tests for critical paths. Defer comprehensive testing until explicitly requested.

When to use this skill

  • When creating or modifying test files (test/, tests/, *.test.js, *.spec.ts, test_*.py)
  • When writing unit tests for core business logic and critical user workflows
  • When implementing integration tests at logical feature completion points
  • When writing test names that clearly describe what is being tested and expected outcome
  • When mocking external dependencies like databases, APIs, or file systems to isolate units
  • When focusing tests on behavior (what the code does) rather than implementation details
  • When ensuring unit tests execute quickly (milliseconds) for frequent developer runs
  • When testing core user flows and primary workflows (deferring edge cases unless critical)
  • When writing minimal tests during feature development, focusing on main functionality
  • When avoiding excessive testing of non-critical utilities or secondary workflows
  • When deciding test coverage strategy for new features or refactoring

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle testing test writing.

Strategic Test Writing

Minimal Testing During Development

Do NOT write tests for:

  • Every intermediate step or code change
  • Non-critical utility functions
  • Secondary workflows or helper functions
  • Edge cases unless business-critical
  • Error states unless explicitly required
  • Validation logic unless core to feature

DO write tests for:

  • Primary user workflows (happy path)
  • Critical business logic
  • Core feature functionality
  • Features at logical completion points

Pattern:

1. Implement feature completely
2. Identify critical paths
3. Write tests for those paths only
4. Move to next feature

Test Scope Priority

Priority 1 - Always Test:

  • Main user flows (login, checkout, data submission)
  • Business-critical calculations
  • Data transformations affecting core features

Priority 2 - Test When Requested:

  • Edge cases and boundary conditions
  • Error handling and validation
  • Non-critical utilities
  • Secondary workflows

Priority 3 - Defer:

  • Exhaustive input validation
  • All possible error states
  • Performance edge cases
  • Rare user scenarios

Test Quality Standards

Test Naming Convention

Use descriptive names following pattern: test_<function>_<scenario>_<expected_result>

Good:

test_checkout_with_valid_cart_creates_order()
test_login_with_correct_credentials_returns_token()

Bad:

test_checkout()
test_user_login()

Behavior Over Implementation

Test what the code does, not how it does it.

Good - Tests behavior:

def test_discount_calculation_applies_percentage():
    result = calculate_discount(price=100, rate=0.2)
    assert result == 80

Bad - Tests implementation:

def test_discount_uses_multiplication():
    # Don't test internal calculation method
    assert discount._multiply_called == True

Mock External Dependencies

Isolate units by mocking external systems.

Always mock:

  • Database connections
  • API calls
  • File system operations
  • Network requests
  • External services

Example:

@mock.patch('app.database.query')
def test_fetch_user_returns_user_data(mock_query):
    mock_query.return_value = {'id': 1, 'name': 'Test'}
    result = fetch_user(1)
    assert result['name'] == 'Test'

Fast Execution

Unit tests must execute in milliseconds.

Fast tests enable:

  • Frequent test runs during development
  • Quick feedback loops
  • Developer confidence

If test is slow:

  • Mock external dependencies
  • Use in-memory databases
  • Move to integration test suite

Decision Framework

Before writing a test, ask:

  1. Is this a critical path? → If no, defer
  2. Is this core business logic? → If no, defer
  3. Was I explicitly asked to test this? → If no, defer
  4. Is this the happy path? → If yes, test it

Integration with TDD

When following TDD:

  1. Write minimal failing test for critical path only
  2. Implement feature
  3. Verify test passes
  4. Stop - don't add more tests unless requested

Common Mistakes to Avoid

Over-testing during development:

  • Writing tests for every function
  • Testing all edge cases upfront
  • Testing implementation details
  • Slowing down feature development

Under-testing critical paths:

  • Skipping main user flow tests
  • Not testing business logic
  • Ignoring core feature validation

Brittle tests:

  • Testing internal implementation
  • Coupling tests to code structure
  • Not mocking external dependencies

Quick Reference

ScenarioAction
Implementing new featureTest critical path only
User requests edge case testingAdd those specific tests
Non-critical utility functionSkip testing unless requested
Core business calculationAlways test
Error handlingDefer unless business-critical
Integration pointTest at completion

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

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

平台分布

Claude Code

29.05%
按下载量换算560

Cursor

23.46%
按下载量换算452

OpenCode

18.4%
按下载量换算354

Codex

12.3%
按下载量换算237

Gemini CLI

7.56%
按下载量换算146

windsurf

3.72%
按下载量换算72

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源字段存在多来源差异,先按来源优先级自动处理,无法消解时进入异常复核队列。

来源信息

继续浏览同类 Skills