[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70J0DSAGPJ9TNT60G0RYN3Z":3,"skill-same:01M70J0DSAGPJ9TNT60G0RYN3Z":87},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":31,"publishedAt":52,"linkOnly":53,"markdownContent":54,"markdownBody":55,"frontMatter":56,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":62,"ownerHtmlUrl":63,"ownerBlogUrl":64,"ownerDescription":65,"updatedAt":66,"install":67,"resources":80},"01M70J0DSAGPJ9TNT60G0RYN3Z","test-design",null,"Apply test pyramid principles, coverage targets, and framework-specific patterns. Use when designing test suites, reviewing test coverage, or implementing tests. Covers Jest, Pytest, and common testing frameworks with naming conventions and organization patterns.","shengdabai\u002FTony-Claude-Code-Skills","shengdabai","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F116417419?v=4","01M70F6D2WY5PQV5A92BKYJQEW","Tony Sheng","01M70F6D3GAAAYZ5H4CC1G8VXM",3,"MIT","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Frsmdt-the-startup\u002Fplugins\u002Fteam\u002Fskills\u002Fdevelopment\u002Ftest-design\u002FSKILL.md",[18,23,26],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],"design","test","test design","when","testing","apply","framework-specific","implementing","with","tests","jest","organization","frameworks","patterns","pytest","test coverage","use","coverage","common","framework","2026-11-10 10:12:30",false,"---\nname: test-design\ndescription: Apply test pyramid principles, coverage targets, and framework-specific patterns. Use when designing test suites, reviewing test coverage, or implementing tests. Covers Jest, Pytest, and common testing frameworks with naming conventions and organization patterns.\n---\n\n# Testing Strategies\n\nA development skill that provides comprehensive testing methodology including test pyramid structure, coverage targets, framework-specific patterns, and test organization conventions.\n\n## When to Use\n\n- Designing test suites for new features or projects\n- Reviewing test coverage and identifying gaps\n- Implementing unit, integration, or E2E tests\n- Establishing test naming and organization conventions\n- Selecting appropriate testing frameworks\n- Planning test automation strategies\n\n## Test Pyramid\n\nThe test pyramid guides test distribution for optimal feedback speed and confidence:\n\n```\n        \u002F\\\n       \u002F  \\        E2E Tests (5-10%)\n      \u002F----\\       - Critical user journeys\n     \u002F      \\      - Slow, expensive, flaky-prone\n    \u002F--------\\\n   \u002F          \\    Integration Tests (20-30%)\n  \u002F  Service   \\   - API contracts, database\n \u002F--------------\\  - Component interactions\n\u002F                \\\n\u002F   Unit Tests    \\  Unit Tests (60-70%)\n\u002F==================\\ - Fast, isolated, deterministic\n                     - Business logic focus\n```\n\n### Distribution Guidelines\n\n| Test Type   | Target % | Execution Time | Scope                    |\n|-------------|----------|----------------|--------------------------|\n| Unit        | 60-70%   | \u003C 100ms each   | Single function\u002Fclass    |\n| Integration | 20-30%   | \u003C 5s each      | Service boundaries       |\n| E2E         | 5-10%    | \u003C 30s each     | Critical user paths      |\n\n## Core Patterns\n\n### Pattern 1: Test Behavior, Not Implementation\n\nTests should verify observable behavior, not internal implementation details.\n\n```typescript\n\u002F\u002F CORRECT: Tests behavior\ndescribe('ShoppingCart', () => {\n  it('calculates total with quantity discounts', () => {\n    const cart = new ShoppingCart();\n    cart.add({ sku: 'WIDGET', price: 10, quantity: 5 });\n\n    expect(cart.total).toBe(45); \u002F\u002F 10% discount for 5+ items\n  });\n});\n\n\u002F\u002F INCORRECT: Tests implementation\ndescribe('ShoppingCart', () => {\n  it('calls _applyDiscount method', () => {\n    const cart = new ShoppingCart();\n    const spy = jest.spyOn(cart, '_applyDiscount');\n\n    cart.add({ sku: 'WIDGET', price: 10, quantity: 5 });\n\n    expect(spy).toHaveBeenCalledWith(0.1);\n  });\n});\n```\n\n### Pattern 2: Arrange-Act-Assert Structure\n\nEvery test follows the AAA pattern for clarity and consistency.\n\n```python\ndef test_user_registration_sends_welcome_email():\n    # Arrange\n    email_service = MockEmailService()\n    user_service = UserService(email_service=email_service)\n    registration_data = {\"email\": \"new@user.com\", \"name\": \"New User\"}\n\n    # Act\n    user_service.register(registration_data)\n\n    # Assert\n    assert email_service.sent_emails == [\n        {\"to\": \"new@user.com\", \"template\": \"welcome\"}\n    ]\n```\n\n### Pattern 3: One Assertion Per Behavior\n\nEach test verifies one specific behavior. Multiple assertions are acceptable when verifying a single logical outcome.\n\n```typescript\n\u002F\u002F CORRECT: One behavior, multiple related assertions\nit('creates order with correct initial state', () => {\n  const order = createOrder(items);\n\n  expect(order.status).toBe('pending');\n  expect(order.items).toHaveLength(items.length);\n  expect(order.createdAt).toBeInstanceOf(Date);\n});\n\n\u002F\u002F INCORRECT: Multiple unrelated behaviors\nit('creates and processes order', () => {\n  const order = createOrder(items);\n  expect(order.status).toBe('pending');\n\n  processPayment(order);\n  expect(order.status).toBe('paid');  \u002F\u002F Different behavior\n});\n```\n\n### Pattern 4: Descriptive Test Names\n\nTest names describe the scenario and expected outcome.\n\n```typescript\n\u002F\u002F Format: [unit]_[scenario]_[expected outcome]\n\u002F\u002F or: [action]_[condition]_[result]\n\n\u002F\u002F CORRECT\nit('calculateTotal returns zero for empty cart')\nit('validateEmail rejects addresses without @ symbol')\nit('UserService throws NotFoundError when user does not exist')\n\n\u002F\u002F INCORRECT\nit('test calculateTotal')\nit('validateEmail works')\nit('error handling')\n```\n\n### Pattern 5: Test Isolation\n\nTests must be independent and not share mutable state.\n\n```python\n# CORRECT: Fresh fixture per test\nclass TestOrderService:\n    def setup_method(self):\n        self.db = InMemoryDatabase()\n        self.service = OrderService(self.db)\n\n    def test_create_order(self):\n        order = self.service.create(items=[...])\n        assert order.id is not None\n\n    def test_list_orders_empty(self):\n        orders = self.service.list()\n        assert orders == []\n\n# INCORRECT: Shared state between tests\ndb = Database()  # Shared!\n\ndef test_create_order():\n    order = OrderService(db).create(items=[...])\n\ndef test_list_orders_empty():\n    orders = OrderService(db).list()  # May see order from previous test!\n```\n\n## Coverage Targets\n\n### Recommended Coverage by Code Type\n\n| Code Type          | Statement | Branch | Target |\n|--------------------|-----------|--------|--------|\n| Business Logic     | 90%       | 85%    | High   |\n| API Controllers    | 80%       | 75%    | Medium |\n| Utility Functions  | 95%       | 90%    | High   |\n| UI Components      | 70%       | 65%    | Medium |\n| Generated Code     | N\u002FA       | N\u002FA    | Skip   |\n\n### Coverage Quality Over Quantity\n\nCoverage percentage alone is insufficient. Prioritize:\n\n1. **Critical paths**: Authentication, payments, data integrity\n2. **Edge cases**: Boundaries, empty states, error conditions\n3. **Regression prevention**: Previously broken functionality\n4. **Complex logic**: High cyclomatic complexity areas\n\n## Framework-Specific Patterns\n\n### Jest (JavaScript\u002FTypeScript)\n\n```typescript\n\u002F\u002F File structure\nsrc\u002F\n  services\u002F\n    UserService.ts\n    UserService.test.ts  \u002F\u002F Co-located\n\n\u002F\u002F Test setup\ndescribe('UserService', () => {\n  let userService: UserService;\n  let mockRepo: jest.Mocked\u003CUserRepository>;\n\n  beforeEach(() => {\n    mockRepo = {\n      findById: jest.fn(),\n      save: jest.fn(),\n    };\n    userService = new UserService(mockRepo);\n  });\n\n  afterEach(() => {\n    jest.clearAllMocks();\n  });\n\n  describe('getUser', () => {\n    it('returns user when found', async () => {\n      const expected = { id: '1', name: 'Alice' };\n      mockRepo.findById.mockResolvedValue(expected);\n\n      const result = await userService.getUser('1');\n\n      expect(result).toEqual(expected);\n      expect(mockRepo.findById).toHaveBeenCalledWith('1');\n    });\n\n    it('throws NotFoundError when user does not exist', async () => {\n      mockRepo.findById.mockResolvedValue(null);\n\n      await expect(userService.getUser('999'))\n        .rejects.toThrow(NotFoundError);\n    });\n  });\n});\n```\n\n### Pytest (Python)\n\n```python\n# File structure\nsrc\u002F\n  services\u002F\n    user_service.py\ntests\u002F\n  services\u002F\n    test_user_service.py  # Mirror structure\n\n# conftest.py - Shared fixtures\nimport pytest\nfrom unittest.mock import Mock\n\n@pytest.fixture\ndef mock_user_repo():\n    return Mock(spec=UserRepository)\n\n@pytest.fixture\ndef user_service(mock_user_repo):\n    return UserService(repository=mock_user_repo)\n\n# test_user_service.py\nclass TestUserService:\n    def test_get_user_returns_user_when_found(\n        self, user_service, mock_user_repo\n    ):\n        expected = User(id=\"1\", name=\"Alice\")\n        mock_user_repo.find_by_id.return_value = expected\n\n        result = user_service.get_user(\"1\")\n\n        assert result == expected\n        mock_user_repo.find_by_id.assert_called_once_with(\"1\")\n\n    def test_get_user_raises_not_found_when_missing(\n        self, user_service, mock_user_repo\n    ):\n        mock_user_repo.find_by_id.return_value = None\n\n        with pytest.raises(NotFoundError):\n            user_service.get_user(\"999\")\n\n    @pytest.mark.parametrize(\"invalid_email\", [\n        \"\",\n        \"no-at-sign\",\n        \"@no-local-part.com\",\n        \"no-domain@\",\n    ])\n    def test_validate_email_rejects_invalid_formats(\n        self, user_service, invalid_email\n    ):\n        assert not user_service.validate_email(invalid_email)\n```\n\n### React Testing Library\n\n```typescript\n\u002F\u002F Component test\nimport { render, screen, userEvent } from '@testing-library\u002Freact';\nimport { LoginForm } from '.\u002FLoginForm';\n\ndescribe('LoginForm', () => {\n  it('calls onSubmit with credentials when form is submitted', async () => {\n    const onSubmit = jest.fn();\n    const user = userEvent.setup();\n\n    render(\u003CLoginForm onSubmit={onSubmit} \u002F>);\n\n    await user.type(screen.getByLabelText('Email'), 'test@example.com');\n    await user.type(screen.getByLabelText('Password'), 'secret123');\n    await user.click(screen.getByRole('button', { name: 'Sign In' }));\n\n    expect(onSubmit).toHaveBeenCalledWith({\n      email: 'test@example.com',\n      password: 'secret123',\n    });\n  });\n\n  it('displays validation error for invalid email', async () => {\n    const user = userEvent.setup();\n\n    render(\u003CLoginForm onSubmit={jest.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText('Email'), 'invalid');\n    await user.click(screen.getByRole('button', { name: 'Sign In' }));\n\n    expect(screen.getByText('Please enter a valid email')).toBeInTheDocument();\n  });\n});\n```\n\n## Test Organization\n\n### File Naming Conventions\n\n| Framework | Test File Pattern      | Example                    |\n|-----------|------------------------|----------------------------|\n| Jest      | `*.test.ts`            | `UserService.test.ts`      |\n| Pytest    | `test_*.py`            | `test_user_service.py`     |\n| Go        | `*_test.go`            | `user_service_test.go`     |\n| JUnit     | `*Test.java`           | `UserServiceTest.java`     |\n\n### Directory Structure Patterns\n\n**Co-located tests** (preferred for unit tests):\n```\nsrc\u002F\n  services\u002F\n    UserService.ts\n    UserService.test.ts\n  utils\u002F\n    validators.ts\n    validators.test.ts\n```\n\n**Separate test directory** (for integration\u002FE2E):\n```\nsrc\u002F\n  services\u002F\n    UserService.ts\ntests\u002F\n  unit\u002F\n    services\u002F\n      UserService.test.ts\n  integration\u002F\n    api\u002F\n      users.test.ts\n  e2e\u002F\n    user-registration.spec.ts\n```\n\n## Best Practices\n\n- Run tests before committing; never commit failing tests\n- Keep unit tests under 100ms execution time\n- Mock external dependencies at service boundaries only\n- Use factories or fixtures for test data, not raw literals\n- Delete flaky tests or fix them immediately\n- Review tests during code review with same rigor as production code\n- Name tests as specifications that document behavior\n- Prefer real implementations over mocks when practical\n- Test edge cases: nulls, empty collections, boundaries\n- Avoid conditional logic in tests\n\n## Anti-Patterns to Avoid\n\n### Testing Implementation Details\n\n```typescript\n\u002F\u002F WRONG: Brittle test that breaks on refactoring\nit('stores user in _users array', () => {\n  const service = new UserService();\n  service.addUser(user);\n  expect(service._users).toContain(user);\n});\n```\n\n### Shared Mutable State\n\n```python\n# WRONG: Tests interfere with each other\nusers = []\n\ndef test_add_user():\n    users.append(User())\n\ndef test_user_count():\n    assert len(users) == 0  # Fails if test_add_user runs first\n```\n\n### Over-Mocking\n\n```typescript\n\u002F\u002F WRONG: Mocking the system under test\nit('processes payment', () => {\n  const processor = new PaymentProcessor();\n  jest.spyOn(processor, 'validate').mockReturnValue(true);\n  jest.spyOn(processor, 'charge').mockResolvedValue({ success: true });\n\n  \u002F\u002F What are we even testing?\n  const result = processor.process(payment);\n});\n```\n\n### Test Duplication\n\n```python\n# WRONG: Copy-paste tests with minor variations\ndef test_validate_email_empty():\n    assert not validate_email(\"\")\n\ndef test_validate_email_no_at():\n    assert not validate_email(\"invalid\")\n\ndef test_validate_email_no_domain():\n    assert not validate_email(\"user@\")\n\n# CORRECT: Parameterized test\n@pytest.mark.parametrize(\"invalid_email\", [\"\", \"invalid\", \"user@\"])\ndef test_validate_email_rejects_invalid_formats(invalid_email):\n    assert not validate_email(invalid_email)\n```\n\n## References\n\n- `examples\u002Ftest-pyramid.md` - Detailed test pyramid implementation guide with framework examples\n","# Testing Strategies\n\nA development skill that provides comprehensive testing methodology including test pyramid structure, coverage targets, framework-specific patterns, and test organization conventions.\n\n## When to Use\n\n- Designing test suites for new features or projects\n- Reviewing test coverage and identifying gaps\n- Implementing unit, integration, or E2E tests\n- Establishing test naming and organization conventions\n- Selecting appropriate testing frameworks\n- Planning test automation strategies\n\n## Test Pyramid\n\nThe test pyramid guides test distribution for optimal feedback speed and confidence:\n\n```\n        \u002F\\\n       \u002F  \\        E2E Tests (5-10%)\n      \u002F----\\       - Critical user journeys\n     \u002F      \\      - Slow, expensive, flaky-prone\n    \u002F--------\\\n   \u002F          \\    Integration Tests (20-30%)\n  \u002F  Service   \\   - API contracts, database\n \u002F--------------\\  - Component interactions\n\u002F                \\\n\u002F   Unit Tests    \\  Unit Tests (60-70%)\n\u002F==================\\ - Fast, isolated, deterministic\n                     - Business logic focus\n```\n\n### Distribution Guidelines\n\n| Test Type   | Target % | Execution Time | Scope                    |\n|-------------|----------|----------------|--------------------------|\n| Unit        | 60-70%   | \u003C 100ms each   | Single function\u002Fclass    |\n| Integration | 20-30%   | \u003C 5s each      | Service boundaries       |\n| E2E         | 5-10%    | \u003C 30s each     | Critical user paths      |\n\n## Core Patterns\n\n### Pattern 1: Test Behavior, Not Implementation\n\nTests should verify observable behavior, not internal implementation details.\n\n```typescript\n\u002F\u002F CORRECT: Tests behavior\ndescribe('ShoppingCart', () => {\n  it('calculates total with quantity discounts', () => {\n    const cart = new ShoppingCart();\n    cart.add({ sku: 'WIDGET', price: 10, quantity: 5 });\n\n    expect(cart.total).toBe(45); \u002F\u002F 10% discount for 5+ items\n  });\n});\n\n\u002F\u002F INCORRECT: Tests implementation\ndescribe('ShoppingCart', () => {\n  it('calls _applyDiscount method', () => {\n    const cart = new ShoppingCart();\n    const spy = jest.spyOn(cart, '_applyDiscount');\n\n    cart.add({ sku: 'WIDGET', price: 10, quantity: 5 });\n\n    expect(spy).toHaveBeenCalledWith(0.1);\n  });\n});\n```\n\n### Pattern 2: Arrange-Act-Assert Structure\n\nEvery test follows the AAA pattern for clarity and consistency.\n\n```python\ndef test_user_registration_sends_welcome_email():\n    # Arrange\n    email_service = MockEmailService()\n    user_service = UserService(email_service=email_service)\n    registration_data = {\"email\": \"new@user.com\", \"name\": \"New User\"}\n\n    # Act\n    user_service.register(registration_data)\n\n    # Assert\n    assert email_service.sent_emails == [\n        {\"to\": \"new@user.com\", \"template\": \"welcome\"}\n    ]\n```\n\n### Pattern 3: One Assertion Per Behavior\n\nEach test verifies one specific behavior. Multiple assertions are acceptable when verifying a single logical outcome.\n\n```typescript\n\u002F\u002F CORRECT: One behavior, multiple related assertions\nit('creates order with correct initial state', () => {\n  const order = createOrder(items);\n\n  expect(order.status).toBe('pending');\n  expect(order.items).toHaveLength(items.length);\n  expect(order.createdAt).toBeInstanceOf(Date);\n});\n\n\u002F\u002F INCORRECT: Multiple unrelated behaviors\nit('creates and processes order', () => {\n  const order = createOrder(items);\n  expect(order.status).toBe('pending');\n\n  processPayment(order);\n  expect(order.status).toBe('paid');  \u002F\u002F Different behavior\n});\n```\n\n### Pattern 4: Descriptive Test Names\n\nTest names describe the scenario and expected outcome.\n\n```typescript\n\u002F\u002F Format: [unit]_[scenario]_[expected outcome]\n\u002F\u002F or: [action]_[condition]_[result]\n\n\u002F\u002F CORRECT\nit('calculateTotal returns zero for empty cart')\nit('validateEmail rejects addresses without @ symbol')\nit('UserService throws NotFoundError when user does not exist')\n\n\u002F\u002F INCORRECT\nit('test calculateTotal')\nit('validateEmail works')\nit('error handling')\n```\n\n### Pattern 5: Test Isolation\n\nTests must be independent and not share mutable state.\n\n```python\n# CORRECT: Fresh fixture per test\nclass TestOrderService:\n    def setup_method(self):\n        self.db = InMemoryDatabase()\n        self.service = OrderService(self.db)\n\n    def test_create_order(self):\n        order = self.service.create(items=[...])\n        assert order.id is not None\n\n    def test_list_orders_empty(self):\n        orders = self.service.list()\n        assert orders == []\n\n# INCORRECT: Shared state between tests\ndb = Database()  # Shared!\n\ndef test_create_order():\n    order = OrderService(db).create(items=[...])\n\ndef test_list_orders_empty():\n    orders = OrderService(db).list()  # May see order from previous test!\n```\n\n## Coverage Targets\n\n### Recommended Coverage by Code Type\n\n| Code Type          | Statement | Branch | Target |\n|--------------------|-----------|--------|--------|\n| Business Logic     | 90%       | 85%    | High   |\n| API Controllers    | 80%       | 75%    | Medium |\n| Utility Functions  | 95%       | 90%    | High   |\n| UI Components      | 70%       | 65%    | Medium |\n| Generated Code     | N\u002FA       | N\u002FA    | Skip   |\n\n### Coverage Quality Over Quantity\n\nCoverage percentage alone is insufficient. Prioritize:\n\n1. **Critical paths**: Authentication, payments, data integrity\n2. **Edge cases**: Boundaries, empty states, error conditions\n3. **Regression prevention**: Previously broken functionality\n4. **Complex logic**: High cyclomatic complexity areas\n\n## Framework-Specific Patterns\n\n### Jest (JavaScript\u002FTypeScript)\n\n```typescript\n\u002F\u002F File structure\nsrc\u002F\n  services\u002F\n    UserService.ts\n    UserService.test.ts  \u002F\u002F Co-located\n\n\u002F\u002F Test setup\ndescribe('UserService', () => {\n  let userService: UserService;\n  let mockRepo: jest.Mocked\u003CUserRepository>;\n\n  beforeEach(() => {\n    mockRepo = {\n      findById: jest.fn(),\n      save: jest.fn(),\n    };\n    userService = new UserService(mockRepo);\n  });\n\n  afterEach(() => {\n    jest.clearAllMocks();\n  });\n\n  describe('getUser', () => {\n    it('returns user when found', async () => {\n      const expected = { id: '1', name: 'Alice' };\n      mockRepo.findById.mockResolvedValue(expected);\n\n      const result = await userService.getUser('1');\n\n      expect(result).toEqual(expected);\n      expect(mockRepo.findById).toHaveBeenCalledWith('1');\n    });\n\n    it('throws NotFoundError when user does not exist', async () => {\n      mockRepo.findById.mockResolvedValue(null);\n\n      await expect(userService.getUser('999'))\n        .rejects.toThrow(NotFoundError);\n    });\n  });\n});\n```\n\n### Pytest (Python)\n\n```python\n# File structure\nsrc\u002F\n  services\u002F\n    user_service.py\ntests\u002F\n  services\u002F\n    test_user_service.py  # Mirror structure\n\n# conftest.py - Shared fixtures\nimport pytest\nfrom unittest.mock import Mock\n\n@pytest.fixture\ndef mock_user_repo():\n    return Mock(spec=UserRepository)\n\n@pytest.fixture\ndef user_service(mock_user_repo):\n    return UserService(repository=mock_user_repo)\n\n# test_user_service.py\nclass TestUserService:\n    def test_get_user_returns_user_when_found(\n        self, user_service, mock_user_repo\n    ):\n        expected = User(id=\"1\", name=\"Alice\")\n        mock_user_repo.find_by_id.return_value = expected\n\n        result = user_service.get_user(\"1\")\n\n        assert result == expected\n        mock_user_repo.find_by_id.assert_called_once_with(\"1\")\n\n    def test_get_user_raises_not_found_when_missing(\n        self, user_service, mock_user_repo\n    ):\n        mock_user_repo.find_by_id.return_value = None\n\n        with pytest.raises(NotFoundError):\n            user_service.get_user(\"999\")\n\n    @pytest.mark.parametrize(\"invalid_email\", [\n        \"\",\n        \"no-at-sign\",\n        \"@no-local-part.com\",\n        \"no-domain@\",\n    ])\n    def test_validate_email_rejects_invalid_formats(\n        self, user_service, invalid_email\n    ):\n        assert not user_service.validate_email(invalid_email)\n```\n\n### React Testing Library\n\n```typescript\n\u002F\u002F Component test\nimport { render, screen, userEvent } from '@testing-library\u002Freact';\nimport { LoginForm } from '.\u002FLoginForm';\n\ndescribe('LoginForm', () => {\n  it('calls onSubmit with credentials when form is submitted', async () => {\n    const onSubmit = jest.fn();\n    const user = userEvent.setup();\n\n    render(\u003CLoginForm onSubmit={onSubmit} \u002F>);\n\n    await user.type(screen.getByLabelText('Email'), 'test@example.com');\n    await user.type(screen.getByLabelText('Password'), 'secret123');\n    await user.click(screen.getByRole('button', { name: 'Sign In' }));\n\n    expect(onSubmit).toHaveBeenCalledWith({\n      email: 'test@example.com',\n      password: 'secret123',\n    });\n  });\n\n  it('displays validation error for invalid email', async () => {\n    const user = userEvent.setup();\n\n    render(\u003CLoginForm onSubmit={jest.fn()} \u002F>);\n\n    await user.type(screen.getByLabelText('Email'), 'invalid');\n    await user.click(screen.getByRole('button', { name: 'Sign In' }));\n\n    expect(screen.getByText('Please enter a valid email')).toBeInTheDocument();\n  });\n});\n```\n\n## Test Organization\n\n### File Naming Conventions\n\n| Framework | Test File Pattern      | Example                    |\n|-----------|------------------------|----------------------------|\n| Jest      | `*.test.ts`            | `UserService.test.ts`      |\n| Pytest    | `test_*.py`            | `test_user_service.py`     |\n| Go        | `*_test.go`            | `user_service_test.go`     |\n| JUnit     | `*Test.java`           | `UserServiceTest.java`     |\n\n### Directory Structure Patterns\n\n**Co-located tests** (preferred for unit tests):\n```\nsrc\u002F\n  services\u002F\n    UserService.ts\n    UserService.test.ts\n  utils\u002F\n    validators.ts\n    validators.test.ts\n```\n\n**Separate test directory** (for integration\u002FE2E):\n```\nsrc\u002F\n  services\u002F\n    UserService.ts\ntests\u002F\n  unit\u002F\n    services\u002F\n      UserService.test.ts\n  integration\u002F\n    api\u002F\n      users.test.ts\n  e2e\u002F\n    user-registration.spec.ts\n```\n\n## Best Practices\n\n- Run tests before committing; never commit failing tests\n- Keep unit tests under 100ms execution time\n- Mock external dependencies at service boundaries only\n- Use factories or fixtures for test data, not raw literals\n- Delete flaky tests or fix them immediately\n- Review tests during code review with same rigor as production code\n- Name tests as specifications that document behavior\n- Prefer real implementations over mocks when practical\n- Test edge cases: nulls, empty collections, boundaries\n- Avoid conditional logic in tests\n\n## Anti-Patterns to Avoid\n\n### Testing Implementation Details\n\n```typescript\n\u002F\u002F WRONG: Brittle test that breaks on refactoring\nit('stores user in _users array', () => {\n  const service = new UserService();\n  service.addUser(user);\n  expect(service._users).toContain(user);\n});\n```\n\n### Shared Mutable State\n\n```python\n# WRONG: Tests interfere with each other\nusers = []\n\ndef test_add_user():\n    users.append(User())\n\ndef test_user_count():\n    assert len(users) == 0  # Fails if test_add_user runs first\n```\n\n### Over-Mocking\n\n```typescript\n\u002F\u002F WRONG: Mocking the system under test\nit('processes payment', () => {\n  const processor = new PaymentProcessor();\n  jest.spyOn(processor, 'validate').mockReturnValue(true);\n  jest.spyOn(processor, 'charge').mockResolvedValue({ success: true });\n\n  \u002F\u002F What are we even testing?\n  const result = processor.process(payment);\n});\n```\n\n### Test Duplication\n\n```python\n# WRONG: Copy-paste tests with minor variations\ndef test_validate_email_empty():\n    assert not validate_email(\"\")\n\ndef test_validate_email_no_at():\n    assert not validate_email(\"invalid\")\n\ndef test_validate_email_no_domain():\n    assert not validate_email(\"user@\")\n\n# CORRECT: Parameterized test\n@pytest.mark.parametrize(\"invalid_email\", [\"\", \"invalid\", \"user@\"])\ndef test_validate_email_rejects_invalid_formats(invalid_email):\n    assert not validate_email(invalid_email)\n```\n\n## References\n\n- `examples\u002Ftest-pyramid.md` - Detailed test pyramid implementation guide with framework examples\n",{"name":5,"description":7},"main","7850740bd837adb32f0a109ab2af82482196c6f2","skills\u002F_collections\u002Frsmdt-the-startup\u002Fplugins\u002Fteam\u002Fskills\u002Fdevelopment\u002Ftest-design",1,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills","https:\u002F\u002Fzturnsgo.com","https:\u002F\u002Fgithub.com\u002Fshengdabai","https:\u002F\u002Fzturnsgo.com\u002F","AI × education creator — producer, not consumer. Taught 6,000+ learners; shipping learning tools & daily essays with Claude Code, practicing @xiaolai's way 🥋","2026-11-01 21:28:23",{"source":8,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add shengdabai\u002FTony-Claude-Code-Skills --skill test-design",{"tool":73,"command":74},"bunx","bunx skills add shengdabai\u002FTony-Claude-Code-Skills --skill test-design",{"tool":76,"command":77},"pnpm","pnpm dlx skills add shengdabai\u002FTony-Claude-Code-Skills --skill test-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Frsmdt-the-startup\u002Fplugins\u002Fteam\u002Fskills\u002Fdevelopment\u002Ftest-design\u002FSKILL.md",true,[81],{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"examples\u002Ftest-pyramid.md","REFERENCE","参考文档",21214,"https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002F_collections\u002Frsmdt-the-startup\u002Fplugins\u002Fteam\u002Fskills\u002Fdevelopment\u002Ftest-design\u002Fexamples\u002Ftest-pyramid.md",[88,97,105,113,121,129],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":96},"01M73H7XKBHE1ETQDZT94MF9HH","seedance-prompt-en","Write effective prompts for Jimeng Seedance 2.0 multimodal AI video generation. Use when users want to create video prompts using text, images, videos, and audio inputs with the @ reference system. Covers camera movements, effects replication, video extension, editing, music beat-matching, e-commerce ads, short dramas, and educational content.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fseedance-prompt-en\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fseedance-prompt-en\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":101,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":96},"01M73GRE9998Q1DZWC71N41JWG","onepage-pdf","Convert an HTML page into a single continuous-page PDF (one tall page, no pagination breaks), preserving desktop layout, backgrounds and selectable text. Use when the user asks to turn an HTML file\u002Freport\u002Fproposal into a \"single-page PDF\", \"long PDF\", \"不分页 PDF\", \"单页 PDF\", \"长图式 PDF\", or complains that an HTML-to-PDF export breaks into pages or cuts content. Supports optional string redaction with leak verification.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fonepage-pdf\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fonepage-pdf\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":96},"01M73GQG1KZDADVPV3MHAT1J5A","native-feel-cross-platform-desktop","Use when the user is designing, prototyping, or rewriting a desktop app that must run on multiple OSes (macOS + Windows, optionally Linux) AND feel indistinguishable from a native app to its users — fast launch, native windowing, native input handling, native materials. Trigger words include \"cross-platform desktop\", \"Electron alternative\", \"Tauri vs native\", \"WebView wrapper\", \"near-native performance\", \"Raycast architecture\", \"WebKit\u002FWebView2 quirks\", \"WKWebView\", \"system tray app\", \"global hotkey app\", \"launcher app\". Do NOT trigger this skill for pure web apps, pure mobile apps, or for greenfield projects that have no native-feel requirement.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fnative-feel-cross-platform-desktop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fnative-feel-cross-platform-desktop\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":96},"01M73G87PDNSMKG2FHWCYER6N8","gstack","Router for the gstack skill suite. (gstack)","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fgstack\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fgstack\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":96},"01M73G3EAQWKCM8DB8D0N0QSVG","fireworks-tech-graph","Use when the user wants to create any technical diagram - architecture, data flow, flowchart, sequence, agent\u002Fmemory, or concept map - and export as SVG+PNG. Trigger on: \"画图\" \"帮我画\" \"生成图\" \"做个图\" \"架构图\" \"流程图\" \"可视化一下\" \"出图\" \"generate diagram\" \"draw diagram\" \"visualize\" or any system\u002Fflow description the user wants illustrated.","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ffireworks-tech-graph\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ffireworks-tech-graph\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":96},"01M73G086AXAH9DW1H5G5N3CPB","dbs-video-extract","接收抖音、小红书、微信视频号等短视频链接或分享文案，查询作品／账号数据并提取语音文字稿，按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用；运行前检查 TikHub 与轻抖使用凭证，缺少时用新手能理解的方式引导购买和安全配置。","https:\u002F\u002Fgithub.com\u002Fshengdabai\u002FTony-Claude-Code-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fdbs-video-extract\u002FSKILL.md",[],[]]