Token导航 LogoToken导航

Agent Skill · 研究检索

testing-philosophy(测试理念)

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

testing-philosophy 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 51,212。

总安装 588周安装 24GitHub Stars 8下载 188核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/phrazzld/claude-config --skill testing-philosophy

这个 Skill 是做什么的

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

探讨测试理念与质量文化建设的深层思考。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。适合团队讨论测试价值、自动化边界与人力投入。提供关于测试左移、全员质量等趋势的观点参考。不替代具体技术规范,重在启发思维方向。

testing-philosophy 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/testing-philosophy

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/phrazzld/claude-config --skill testing-philoso…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

testing-philosophy 怎么安装?

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

testing-philosophy 支持哪些 AI 工具?

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

testing-philosophy 需要什么权限?

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

testing-philosophy 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

testing-philosophy 用的人多吗?

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

testing-philosophy 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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调用外部服务未明确有提醒
testing-philosophy

测试理念 · 本页

5888操作浏览器未明确通过

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

SKILL.md 原文

Testing Philosophy

Universal principles for writing effective tests. Language-agnostic—applies across testing frameworks and languages.

Test Thinking

Before writing tests, commit to a clear approach:

  • What is the ONE behavior this test suite must verify? If you can't answer clearly, the production code needs refactoring.
  • Behavior or implementation? Tests should survive refactoring. If you're testing how, not what, you're coupling to implementation.
  • What failure would make you distrust this code? Test that scenario first.

CRITICAL: You are capable of identifying subtle behavioral contracts that most tests miss. Don't write generic happy-path tests—find the edge cases that matter, the error handling that fails silently, the state transitions that corrupt data.

Core Principle

Test behavior, not implementation.

Tests should verify what code does, not how it does it. Implementation can change; behavior should remain stable.

Test-First Workflow (Canon TDD)

When to TDD:

  • ✅ Core domain logic, algorithms, business rules
  • ✅ Well-defined requirements
  • ✅ Production code (not prototypes)
  • ✅ AI-assisted development (tests guard against hallucinations)
  • ❌ UI prototyping, exploration, fuzzy requirements

Canon TDD Pattern (Kent Beck 2024):

  1. Write test list - enumerate all scenarios (happy, edge, error)
  2. Turn one into failing test - focus on interface design
  3. Make it pass - minimal implementation
  4. Refactor - improve design while green
  5. Repeat until list empty

AI-Assisted TDD:

  • AI generates test list from requirements
  • AI implements code to pass tests (human reviews)
  • Tests are specifications in executable form
  • Commit tests separately before implementation

NEVER test:

  • Private method internals (test through public API)
  • Mock call counts unless the count IS the behavior
  • Internal state unless state IS the contract
  • Framework code (trust the framework)

What and When to Test

Testing Boundaries

Test at module boundaries (public API):

Unit Tests:

  • Pure functions (deterministic input → output)
  • Isolated modules (single unit of behavior)
  • Business logic (calculations, validations, transformations)

Integration Tests:

  • Module interactions (how components work together)
  • API contracts (request/response shapes)
  • Workflows (multi-step processes)

E2E Tests:

  • Critical user journeys (end-to-end flows)
  • Happy path + critical errors only
  • Not every feature needs E2E

What to Test

✅ Always test:

  • Public API (what callers depend on)
  • Business logic (critical rules, calculations)
  • Error handling (failure modes)
  • Edge cases (boundaries, null, empty)

❌ Don't test:

  • Private implementation details
  • Third-party libraries (already tested)
  • Simple getters/setters (unless they have logic)
  • Framework code (trust the framework)

TDD: Always (With Rare Exceptions)

TDD is the default for all production code:

  • Bug fixes (failing test captures the bug before fixing)
  • New features (tests define the contract before implementation)
  • Refactors (tests ensure behavior preserved)
  • Simple CRUD (yes, even simple code—tests are cheap, regressions aren't)

The Critical Step Most Skip: After writing a failing test, verify it fails for the right reason:

  • Not a syntax error
  • Not a wrong import
  • Not an incorrect assertion
  • The test should fail because the behavior doesn't exist yet

Skip TDD only with justification:

  • Pure exploration (will be deleted, not shipped)
  • UI layout prototyping (test interactions, not pixels)
  • Generated code you don't maintain

Coverage Philosophy: Meaningful > Percentage

Don't chase coverage percentages.

✅ Good coverage:

  • Critical paths tested (happy + error cases)
  • Edge cases covered (boundary values, null, empty)
  • Confidence in refactoring

❌ Bad coverage:

  • High % but testing wrong things
  • Testing implementation details
  • Brittle tests that break on refactor

Remember: Untested code is legacy code. But 100% coverage doesn't guarantee quality.


Mocking and Test Structure

Mocking Philosophy: Minimize Mocks

Prefer real objects when fast and deterministic.

When to Mock:

ALWAYS mock:

  • External APIs, third-party services
  • Network calls
  • Non-deterministic behavior (time, randomness)

USUALLY mock:

  • Databases (or use in-memory/test DB for integration)
  • File system (depends on speed needs)

SOMETIMES mock:

  • Slow operations (if they slow tests significantly)

NEVER mock:

  • Your own domain logic (test it directly)
  • Simple data structures
  • Internal collaborators (modules in your own codebase)

Red flag: >3 mocks in a test suggests coupling to implementation.

Internal vs External: The Mock Boundary

NEVER mock internal collaborators:

  • Functions/modules in your own codebase (@/lib/*, ./utils/*, ../../convex/lib/*)
  • Custom hooks (@/hooks/*)
  • Domain logic helpers

WHY: Mocking internal code:

  • Hides integration bugs between modules
  • Couples tests to implementation details
  • Creates false confidence ("tests pass but prod breaks")
  • Requires test updates when internals change

INSTEAD: Mock only at system boundaries:

  • Third-party libraries (framework, SDK)
  • External APIs (network calls)
  • Browser/runtime APIs
  • Non-deterministic sources

Pattern: If the mock path starts with @/ or ../, stop and reconsider.

Test Isolation: No Shared State

Tests must be independent:

  • No shared mutable state between tests
  • No execution order dependencies
  • Each test sets up and tears down its own context
  • Parallel execution should be safe

Red flags:

  • Test passes alone, fails in suite (or vice versa)
  • Test relies on previous test's side effects
  • Global state modified without cleanup
  • Flaky tests that pass "sometimes"

Pattern: If tests share setup, use fresh fixtures per test (factory functions, not shared instances).

Test Structure: AAA (Arrange, Act, Assert)

Clear three-phase structure:

// Arrange: Set up test data, mocks, preconditions
setup test data
configure mocks
establish preconditions

// Act: Execute the behavior being tested
result = performAction()

// Assert: Verify expected outcome
verify result matches expectation

Guidelines:

  • Visual separation between phases (blank lines)
  • One logical assertion per test (can have multiple assert statements for same behavior)
  • Keep Arrange simple (complex setup = simplify production code)
  • One behavior per test—if you need multiple headings to describe it, split it

Test Naming: Descriptive Sentences

Pattern: "should [expected behavior] when [condition]"

Examples:

  • "should return total when all items valid"
  • "should throw error when user not found"
  • "calculateTotal with empty cart returns zero"
  • "should retry on network failure"

Guidelines:

  • Be specific about what's being tested
  • State expected behavior clearly
  • Don't use "test" prefix (redundant in test files)
  • Read like documentation

Exclusions Are Last Resort

Before adding to any exclusion list, exhaust these options:

Coverage Exclusions

Don't exclude files from coverage as a first response to CI failure.

Before excluding, try:

  1. Can the function be exported and tested with mocked dependencies?
  2. Can code be refactored to separate testable logic from runtime infrastructure?
  3. Is there a pattern in the codebase for testing similar code?

Example: convex/http.ts webhook handlers were initially excluded but are now tested by:

  • Exporting handler functions
  • Creating mock ActionCtx with vi.fn() for runMutation
  • Testing business logic separately from httpAction wrapper

When exclusion IS appropriate:

  • Truly untestable runtime code (cryptographic verification with no seams)
  • Auto-generated code that's not maintained
  • Third-party code copied into repo (test at integration level instead)

Always add a comment explaining WHY the exclusion is necessary.

ESLint Disables

  • Fix the code if possible
  • Prefer eslint-disable-next-line over file-wide disables
  • Always add explanation comment: // eslint-disable-next-line rule-name -- reason
  • Consider: is the linter telling you something important?

TypeScript Assertions

  • as any hides type errors; fix the underlying type issue
  • @ts-expect-error requires explanation comment
  • @ts-ignore should be avoided (use @ts-expect-error instead)
  • Consider: is the type system revealing a design flaw?

Test Skips

  • .skip() is for temporary WIP, not permanent exclusion
  • Flaky tests should be fixed, not skipped
  • If a test can't pass, the code or test needs refactoring

Test Quality and Smells

Behavior Change Conflicts

When changing behavior (e.g., constructor now panics on nil), existing tests may expect the OLD behavior:

// OLD test expected nil tolerance
expectPanic: false, // Should handle nil gracefully

// NEW behavior panics on nil
// Test now fails with "panicked unexpectedly"

Before changing behavior that tests might cover:

  1. Search for test functions related to the change
  2. Check assertions about the OLD behavior
  3. Update or remove conflicting tests
  4. Add tests for the NEW behavior

Pattern: rg "TestNew.*NilDependencies" --type go to find tests

Test Smells (Anti-Patterns)

❌ Too many mocks (>3 mocks)

  • Indicates coupling to implementation
  • Test becomes brittle, changes with internals

❌ Brittle assertions

  • Asserting exact strings when substring would work
  • Asserting exact ordering when order doesn't matter
  • Over-specifying expected values

❌ Unclear test intent

  • Can't tell what's being tested from reading test
  • Vague test names
  • Hidden test logic in helpers

❌ Testing implementation details

  • Testing private methods directly
  • Asserting internal state
  • Mocking your own classes

❌ Flaky tests

  • Pass/fail randomly
  • Timing dependencies
  • Shared mutable state between tests

❌ Slow tests

  • Unit tests >100ms
  • Integration tests >1s
  • Slows development feedback loop

❌ One giant test

  • Testing multiple behaviors in single test
  • Hard to understand failures
  • Breaks single responsibility for tests

❌ Magic values

  • Unexplained constants
  • Unclear test data
  • No context for why values matter

Test Quality Priorities

Readable > DRY

Tests are documentation. Clarity trumps reuse.

✅ Good test practices:

  • Each test understandable in isolation
  • Explicit setup visible in test
  • Some duplication okay for clarity
  • Descriptive variable names (even if verbose)

❌ Over-DRY tests:

  • Extract helpers that hide test logic
  • Shared setup that obscures what's being tested
  • Reuse at expense of clarity

Test length:

  • No hard limit
  • Unit tests: Usually <50 lines
  • Integration tests: Can be longer (setup needed)
  • Long test? Ask: Testing too much? Simplify production code?

Edge Cases: Required for Critical Paths

Always test critical functionality:

  • Boundary values (0, 1, -1, max, min)
  • Empty inputs (empty array, empty string, null)
  • Error conditions (invalid input, missing data, failures)

Ask: "What could break? What do users depend on?"

Opportunistic edge cases:

  • Nice-to-have features
  • Non-critical paths
  • When you find bugs (add regression test)

Quick Reference

Testing Decision Tree

Should I write a test?

  1. Is this public API? → Yes, test it
  2. Is this critical business logic? → Yes, test it
  3. Is this error handling? → Yes, test it
  4. Is this private implementation? → No, test through public API
  5. Is this a framework feature? → No, trust framework
  6. Will this test give confidence? → Yes, write it

Should I use TDD?

  1. Production code? → Yes, use TDD
  2. Bug fix? → Yes, failing test first captures the bug
  3. Exploring/prototyping (will delete)? → Skip TDD
  4. UI layout only (not behavior)? → Skip TDD

Should I mock this?

  1. External system? → Mock it
  2. Non-deterministic? → Mock it
  3. My domain logic? → Don't mock, test it
  4. 3 mocks already? → Refactor, too coupled

Test Checklist

Before writing test:

  • What behavior am I testing?
  • What's the happy path?
  • What edge cases matter?
  • Can I test this without mocks?

After writing test:

  • Is test name descriptive?
  • Is AAA structure clear?
  • Does test test behavior (not implementation)?
  • Will test break only if behavior changes?
  • Is test fast (<100ms for unit)?

Philosophy

"Tests are a safety net, not a security blanket."

Good tests give confidence to refactor. Bad tests give false confidence and slow development.

Test the contract, not the implementation:

  • Contract: What code promises to do
  • Implementation: How code does it

Tests should:

  • Verify behavior works
  • Document how to use code
  • Enable refactoring with confidence
  • Fail only when behavior breaks

Tests should NOT:

  • Duplicate production code
  • Test framework features
  • Prevent all refactoring
  • Replace thinking about design

Remember: The goal is confidence, not coverage. Write tests that make you confident the code works, not tests that make metrics happy.


Integration Test Patterns

API Route Tests

describe('POST /api/users', () => {
  it('creates user and persists to database', async () => {
    const res = await request(app)
      .post('/api/users')
      .send({ email: 'test@example.com' })

    expect(res.status).toBe(201)

    // Verify side effects
    const user = await db.users.findByEmail('test@example.com')
    expect(user).toBeDefined()
  })
})

Database Integration

  • Use real test database, not mocks
  • Transaction rollback for isolation:
beforeEach(() => db.beginTransaction())
afterEach(() => db.rollback())

Webhook Integration

it('handles Stripe webhook end-to-end', async () => {
  const payload = stripeFixtures.subscriptionCreated
  const signature = stripe.webhooks.generateTestHeaderString({ payload })

  const res = await request(app)
    .post('/api/webhooks/stripe')
    .set('stripe-signature', signature)
    .send(payload)

  expect(res.status).toBe(200)
  // Verify database state changed
})

Convex Integration Tests

import { convexTest } from "convex-test"
import { api } from "./_generated/api"
import schema from "./schema"

describe('user workflows', () => {
  it('creates user and sends welcome email', async () => {
    const t = convexTest(schema)

    // Act
    const userId = await t.mutation(api.users.create, {
      email: 'test@example.com'
    })

    // Assert database state
    const user = await t.query(api.users.get, { id: userId })
    expect(user.email).toBe('test@example.com')

    // Assert scheduled actions
    const scheduledFunctions = await t.run((ctx) =>
      ctx.db.system.query("_scheduled_functions").collect()
    )
    expect(scheduledFunctions).toHaveLength(1)
  })
})

平台分布

Codex

36.79%
按下载量换算69

Claude

30.09%
按下载量换算57

Cursor

19.81%
按下载量换算37

Gemini CLI

8.66%
按下载量换算16

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills