testing-test-writing
使用现代测试框架编写战略性的、聚焦的测试,针对关键用户流程和核心功能,关注行为而非实现。在创建测试文件、编写单元测试、集成测试或端到端测试时使用此技能,测试目录包括tests/, __tests__, spec/, *.test.js, *.spec.py。在测试核心用户流程和业务关键功能时应用此技能;使用红灯-绿灯-重构周期实现测试驱动开发(TDD);为隔离的单元测试模拟外部依赖;使用清晰描述性测试名称来说明预期行为;遵循安排-行动-断言模式;确保测试快速独立运行。此技能优先测试最重要的内容(主要用户流程),同时将边缘情况和非关键路径推迟到 later;强调行为测试而非实现细节,以减少脆弱性;使用现代框架如Jest、Playwright、Cypress、pytest、RSpec或Testing Library获得可靠、可维护的测试。
📖 中文导读:使用现代测试框架编写战略性的、聚焦的测试,针对关键用户流程和核心功能,关注行为而非实现。在创建测试文件、编写单元测试、集成测试或端到端测试时使用此技能,测试目录包括tests/, __tests__, spec/, *.test.js, *.spec.py。在测试核心用户流程和业务关键功能时应用此技能;使用红灯-绿灯-重构周期实现测试驱动开发(TDD);为隔离的单元测试模拟外部依赖;使用清晰描述性测试名称来说明预期行为;遵循安排-行动-断言模式;确保测试快速独立运行。此技能优先测试最重要的内容(主要用户流程),同时将边缘情况和非关键路径推迟到 later;强调行为测试而非实现细节,以减少脆弱性;使用现代框架如Jest、Playwright、Cypress、pytest、RSpec或Testing Library获得可靠、可维护的测试。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Testing Test Writing description: Write strategic, focused tests for critical user flows and core functionality using modern testing frameworks, focusing on behavior over implementation. Use this skill when creating test files, writing unit tests, integration tests, or end-to-end tests in test directories (tests/, tests, spec/, *.test.js, *.spec.py). Apply this skill when testing core user workflows and business-critical features, implementing test-driven development (TDD) with red-green-refactor cycles, mocking external dependencies for isolated unit tests, using clear descriptive test names that explain expected behavior, following arrange-act-assert patterns, and ensuring tests run fast and independently. This skill prioritizes testing what matters most (primary user flows) while deferring edge cases and non-critical paths until later, emphasizes behavior testing over implementation details to reduce brittleness, and uses modern frameworks like Jest, Playwright, Cypress, pytest, RSpec, or Testing Library for reliable, maintainable test suites.
Testing Test Writing
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.
When to use this skill
- When creating test files in test directories (tests/, tests, spec/, *.test.js, *.spec.py)
- When writing unit tests for core functions, classes, or business logic
- When implementing integration tests for API endpoints, database interactions, or service layers
- When creating end-to-end tests for critical user workflows using Playwright or Cypress
- When practicing test-driven development (TDD) with red-green-refactor cycles
- When testing behavior (what the code does) rather than implementation (how it does it)
- When writing clear, descriptive test names that explain expected outcomes
- When using arrange-act-assert (AAA) pattern to structure tests clearly
- When mocking external dependencies (databases, APIs, file systems) for isolated unit tests
- When ensuring tests are fast (milliseconds for unit tests) and run independently
- When testing core user flows and primary functionality (deferring edge cases until later)
- When working with testing frameworks (Jest, Vitest, pytest, RSpec, JUnit, Testing Library)
- When implementing test fixtures, factories, or test data management
- When ensuring tests provide value without slowing down development velocity
Instructions
For details, refer to the information provided in this file: testing test writing