[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6N4CFGE9HMET5N2VQQFD73X":3,"skill-same:01M6N4CFGE9HMET5N2VQQFD73X":97},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":43,"commitSha":44,"skillDirectory":45,"forksCount":46,"repositoryHtmlUrl":47,"repositoryHomepageUrl":6,"ownerHtmlUrl":48,"ownerBlogUrl":6,"ownerDescription":49,"updatedAt":50,"install":51,"resources":64},"01M6N4CFGE9HMET5N2VQQFD73X","test-specialist",null,"This skill should be used when writing test cases, fixing bugs, analyzing code for potential issues, or improving test coverage for JavaScript\u002FTypeScript applications. Use this for unit tests, integration tests, end-to-end tests, debugging runtime errors, logic bugs, performance issues, security vulnerabilities, and systematic code analysis.","Kernel8901\u002Fai-agent-skills-classification","Kernel8901","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72647553?v=4","01M6KV388J2H5PNC8D8P940BJD","01M6KV38CS5B3AY63RKZB410YM",7,"MIT","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"test specialist","test","analysis","test cases","errors","unit","code analysis","systematic","end","test coverage","coverage","writing","analyzing","issues","code","debugging","integration tests","performance","security","typescript","2026-11-10 10:12:30",false,"---\nname: test-specialist\ndescription: This skill should be used when writing test cases, fixing bugs, analyzing code for potential issues, or improving test coverage for JavaScript\u002FTypeScript applications. Use this for unit tests, integration tests, end-to-end tests, debugging runtime errors, logic bugs, performance issues, security vulnerabilities, and systematic code analysis.\n---\n\n# Test Specialist\n\n## Overview\n\nApply systematic testing methodologies and debugging techniques to JavaScript\u002FTypeScript applications. This skill provides comprehensive testing strategies, bug analysis frameworks, and automated tools for identifying coverage gaps and untested code.\n\n## Core Capabilities\n\n### 1. Writing Test Cases\n\nWrite comprehensive tests covering unit, integration, and end-to-end scenarios.\n\n#### Unit Testing Approach\n\nStructure tests using the AAA pattern (Arrange-Act-Assert):\n\n```typescript\ndescribe('ExpenseCalculator', () => {\n  describe('calculateTotal', () => {\n    test('sums expense amounts correctly', () => {\n      \u002F\u002F Arrange\n      const expenses = [\n        { amount: 100, category: 'food' },\n        { amount: 50, category: 'transport' },\n        { amount: 25, category: 'entertainment' }\n      ];\n\n      \u002F\u002F Act\n      const total = calculateTotal(expenses);\n\n      \u002F\u002F Assert\n      expect(total).toBe(175);\n    });\n\n    test('handles empty expense list', () => {\n      expect(calculateTotal([])).toBe(0);\n    });\n\n    test('handles negative amounts', () => {\n      const expenses = [\n        { amount: 100, category: 'food' },\n        { amount: -50, category: 'refund' }\n      ];\n      expect(calculateTotal(expenses)).toBe(50);\n    });\n  });\n});\n```\n\n**Key principles:**\n- Test one behavior per test\n- Cover happy path, edge cases, and error conditions\n- Use descriptive test names that explain the scenario\n- Keep tests independent and isolated\n\n#### Integration Testing Approach\n\nTest how components work together, including database, API, and service interactions:\n\n```typescript\ndescribe('ExpenseAPI Integration', () => {\n  beforeAll(async () => {\n    await database.connect(TEST_DB_URL);\n  });\n\n  afterAll(async () => {\n    await database.disconnect();\n  });\n\n  beforeEach(async () => {\n    await database.clear();\n    await seedTestData();\n  });\n\n  test('POST \u002Fexpenses creates expense and updates total', async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fexpenses')\n      .send({\n        amount: 50,\n        category: 'food',\n        description: 'Lunch'\n      })\n      .expect(201);\n\n    expect(response.body).toMatchObject({\n      id: expect.any(Number),\n      amount: 50,\n      category: 'food'\n    });\n\n    \u002F\u002F Verify database state\n    const total = await getTotalExpenses();\n    expect(total).toBe(50);\n  });\n});\n```\n\n#### End-to-End Testing Approach\n\nTest complete user workflows using tools like Playwright or Cypress:\n\n```typescript\ntest('user can track expense from start to finish', async ({ page }) => {\n  \u002F\u002F Navigate to app\n  await page.goto('\u002F');\n\n  \u002F\u002F Add new expense\n  await page.click('[data-testid=\"add-expense-btn\"]');\n  await page.fill('[data-testid=\"amount\"]', '50.00');\n  await page.selectOption('[data-testid=\"category\"]', 'food');\n  await page.fill('[data-testid=\"description\"]', 'Lunch');\n  await page.click('[data-testid=\"submit\"]');\n\n  \u002F\u002F Verify expense appears in list\n  await expect(page.locator('[data-testid=\"expense-item\"]')).toContainText('Lunch');\n  await expect(page.locator('[data-testid=\"total\"]')).toContainText('$50.00');\n});\n```\n\n### 2. Systematic Bug Analysis\n\nApply structured debugging methodology to identify and fix issues.\n\n#### Five-Step Analysis Process\n\n1. **Reproduction**: Reliably reproduce the bug\n   - Document exact steps to trigger\n   - Identify required environment\u002Fstate\n   - Note expected vs actual behavior\n\n2. **Isolation**: Narrow down the problem\n   - Binary search through code path\n   - Create minimal reproduction case\n   - Remove unrelated dependencies\n\n3. **Root Cause Analysis**: Determine underlying cause\n   - Trace execution flow\n   - Check assumptions and preconditions\n   - Review recent changes (git blame)\n\n4. **Fix Implementation**: Implement solution\n   - Write failing test first (TDD)\n   - Implement the fix\n   - Verify test passes\n\n5. **Validation**: Ensure completeness\n   - Run full test suite\n   - Test edge cases\n   - Verify no regressions\n\n#### Common Bug Patterns\n\n**Race Conditions:**\n```typescript\n\u002F\u002F Test concurrent operations\ntest('handles concurrent updates correctly', async () => {\n  const promises = Array.from({ length: 100 }, () =>\n    incrementExpenseCount()\n  );\n\n  await Promise.all(promises);\n  expect(getExpenseCount()).toBe(100);\n});\n```\n\n**Null\u002FUndefined Errors:**\n```typescript\n\u002F\u002F Test null safety\ntest.each([null, undefined, '', 0, false])\n  ('handles invalid input: %p', (input) => {\n    expect(() => processExpense(input)).toThrow('Invalid expense');\n  });\n```\n\n**Off-by-One Errors:**\n```typescript\n\u002F\u002F Test boundaries explicitly\ndescribe('pagination', () => {\n  test('handles empty list', () => {\n    expect(paginate([], 1, 10)).toEqual([]);\n  });\n\n  test('handles single item', () => {\n    expect(paginate([item], 1, 10)).toEqual([item]);\n  });\n\n  test('handles last page with partial items', () => {\n    const items = Array.from({ length: 25 }, (_, i) => i);\n    expect(paginate(items, 3, 10)).toHaveLength(5);\n  });\n});\n```\n\n### 3. Identifying Potential Issues\n\nProactively identify issues before they become bugs.\n\n#### Security Vulnerabilities\n\nTest for common security issues:\n\n```typescript\ndescribe('security', () => {\n  test('prevents SQL injection', async () => {\n    const malicious = \"'; DROP TABLE expenses; --\";\n    await expect(\n      searchExpenses(malicious)\n    ).resolves.not.toThrow();\n  });\n\n  test('sanitizes XSS in descriptions', () => {\n    const xss = '\u003Cscript>alert(\"xss\")\u003C\u002Fscript>';\n    const expense = createExpense({ description: xss });\n    expect(expense.description).not.toContain('\u003Cscript>');\n  });\n\n  test('requires authentication for expense operations', async () => {\n    await request(app)\n      .post('\u002Fapi\u002Fexpenses')\n      .send({ amount: 50 })\n      .expect(401);\n  });\n});\n```\n\n#### Performance Issues\n\nTest for performance problems:\n\n```typescript\ntest('processes large expense list efficiently', () => {\n  const largeList = Array.from({ length: 10000 }, (_, i) => ({\n    amount: i,\n    category: 'test'\n  }));\n\n  const start = performance.now();\n  const total = calculateTotal(largeList);\n  const duration = performance.now() - start;\n\n  expect(duration).toBeLessThan(100); \u002F\u002F Should complete in \u003C100ms\n  expect(total).toBe(49995000);\n});\n```\n\n#### Logic Errors\n\nUse parameterized tests to catch edge cases:\n\n```typescript\ntest.each([\n  \u002F\u002F [input, expected, description]\n  [[10, 20, 30], 60, 'normal positive values'],\n  [[0, 0, 0], 0, 'all zeros'],\n  [[-10, 20, -5], 5, 'mixed positive and negative'],\n  [[0.1, 0.2], 0.3, 'decimal precision'],\n  [[Number.MAX_SAFE_INTEGER], Number.MAX_SAFE_INTEGER, 'large numbers'],\n])('calculateTotal(%p) = %p (%s)', (amounts, expected, description) => {\n  const expenses = amounts.map(amount => ({ amount, category: 'test' }));\n  expect(calculateTotal(expenses)).toBeCloseTo(expected);\n});\n```\n\n### 4. Test Coverage Analysis\n\nUse automated tools to identify gaps in test coverage.\n\n#### Finding Untested Code\n\nRun the provided script to identify source files without tests:\n\n```bash\npython3 scripts\u002Ffind_untested_code.py src\n```\n\nThe script will:\n- Scan source directory for all code files\n- Identify which files lack corresponding test files\n- Categorize untested files by type (components, services, utils, etc.)\n- Prioritize files that need testing most\n\n**Interpretation:**\n- **API\u002FServices**: High priority - test business logic and data operations\n- **Models**: High priority - test data validation and transformations\n- **Hooks**: Medium priority - test stateful behavior\n- **Components**: Medium priority - test complex UI logic\n- **Utils**: Low priority - test as needed for complex functions\n\n#### Analyzing Coverage Reports\n\nRun the coverage analysis script after generating coverage:\n\n```bash\n# Generate coverage (using Jest example)\nnpm test -- --coverage\n\n# Analyze coverage gaps\npython3 scripts\u002Fanalyze_coverage.py coverage\u002Fcoverage-final.json\n```\n\nThe script identifies:\n- Files below coverage threshold (default 80%)\n- Statement, branch, and function coverage percentages\n- Priority files to improve\n\n**Coverage targets:**\n- Critical paths: 90%+ coverage\n- Business logic: 85%+ coverage\n- UI components: 75%+ coverage\n- Utilities: 70%+ coverage\n\n### 5. Test Maintenance and Quality\n\nEnsure tests remain valuable and maintainable.\n\n#### Test Code Quality Principles\n\n**DRY (Don't Repeat Yourself):**\n```typescript\n\u002F\u002F Extract common setup\nfunction createTestExpense(overrides = {}) {\n  return {\n    amount: 50,\n    category: 'food',\n    description: 'Test expense',\n    date: new Date('2024-01-01'),\n    ...overrides\n  };\n}\n\ntest('filters by category', () => {\n  const expenses = [\n    createTestExpense({ category: 'food' }),\n    createTestExpense({ category: 'transport' }),\n  ];\n  \u002F\u002F ...\n});\n```\n\n**Clear test data:**\n```typescript\n\u002F\u002F Bad: Magic numbers\nexpect(calculateDiscount(100, 0.15)).toBe(85);\n\n\u002F\u002F Good: Named constants\nconst ORIGINAL_PRICE = 100;\nconst DISCOUNT_RATE = 0.15;\nconst EXPECTED_PRICE = 85;\nexpect(calculateDiscount(ORIGINAL_PRICE, DISCOUNT_RATE)).toBe(EXPECTED_PRICE);\n```\n\n**Avoid test interdependence:**\n```typescript\n\u002F\u002F Bad: Tests depend on execution order\nlet sharedState;\ntest('test 1', () => {\n  sharedState = { value: 1 };\n});\ntest('test 2', () => {\n  expect(sharedState.value).toBe(1); \u002F\u002F Depends on test 1\n});\n\n\u002F\u002F Good: Independent tests\ntest('test 1', () => {\n  const state = { value: 1 };\n  expect(state.value).toBe(1);\n});\ntest('test 2', () => {\n  const state = { value: 1 };\n  expect(state.value).toBe(1);\n});\n```\n\n## Workflow Decision Tree\n\nFollow this decision tree to determine the testing approach:\n\n1. **Adding new functionality?**\n   - Yes → Write tests first (TDD)\n     - Write failing test\n     - Implement feature\n     - Verify test passes\n     - Refactor\n   - No → Go to step 2\n\n2. **Fixing a bug?**\n   - Yes → Apply bug analysis process\n     - Reproduce the bug\n     - Write failing test demonstrating bug\n     - Fix the implementation\n     - Verify test passes\n   - No → Go to step 3\n\n3. **Improving test coverage?**\n   - Yes → Use coverage tools\n     - Run `find_untested_code.py` to identify gaps\n     - Run `analyze_coverage.py` on coverage reports\n     - Prioritize critical paths\n     - Write tests for untested code\n   - No → Go to step 4\n\n4. **Analyzing code quality?**\n   - Yes → Systematic review\n     - Check for security vulnerabilities\n     - Test edge cases and error handling\n     - Verify performance characteristics\n     - Review error handling\n\n## Testing Frameworks and Tools\n\n### Recommended Stack\n\n**Unit\u002FIntegration Testing:**\n- Jest or Vitest for test runner\n- Testing Library for React components\n- Supertest for API testing\n- MSW (Mock Service Worker) for API mocking\n\n**E2E Testing:**\n- Playwright or Cypress\n- Page Object Model pattern\n\n**Coverage:**\n- Istanbul (built into Jest\u002FVitest)\n- Coverage reports in JSON format\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run with coverage\nnpm test -- --coverage\n\n# Run specific test file\nnpm test -- ExpenseCalculator.test.ts\n\n# Run in watch mode\nnpm test -- --watch\n\n# Run E2E tests\nnpm run test:e2e\n```\n\n## Reference Documentation\n\nFor detailed patterns and techniques, refer to:\n\n- `references\u002Ftesting_patterns.md` - Comprehensive testing patterns, best practices, and code examples\n- `references\u002Fbug_analysis.md` - In-depth bug analysis framework, common bug patterns, and debugging techniques\n\nThese references contain extensive examples and advanced techniques. Load them when:\n- Dealing with complex testing scenarios\n- Need specific pattern implementations\n- Debugging unusual issues\n- Seeking best practices for specific situations\n\n## Scripts\n\n### analyze_coverage.py\n\nAnalyze Jest\u002FIstanbul coverage reports to identify gaps:\n\n```bash\npython3 scripts\u002Fanalyze_coverage.py [coverage-file]\n```\n\nAutomatically finds common coverage file locations if not specified.\n\n**Output:**\n- Files below coverage threshold\n- Statement, branch, and function coverage percentages\n- Priority files to improve\n\n### find_untested_code.py\n\nFind source files without corresponding test files:\n\n```bash\npython3 scripts\u002Ffind_untested_code.py [src-dir] [--pattern test|spec]\n```\n\n**Output:**\n- Total source and test file counts\n- Test file coverage percentage\n- Untested files categorized by type (API, services, components, etc.)\n- Recommendations for prioritization\n\n## Best Practices Summary\n\n1. **Write tests first** (TDD) when adding new features\n2. **Test behavior, not implementation** - tests should survive refactoring\n3. **Keep tests independent** - no shared state between tests\n4. **Use descriptive names** - test names should explain the scenario\n5. **Cover edge cases** - null, empty, boundary values, error conditions\n6. **Mock external dependencies** - tests should be fast and reliable\n7. **Maintain high coverage** - 80%+ for critical code\n8. **Fix failing tests immediately** - never commit broken tests\n9. **Refactor tests** - apply same quality standards as production code\n10. **Use tools** - automate coverage analysis and gap identification\n","# Test Specialist\n\n## Overview\n\nApply systematic testing methodologies and debugging techniques to JavaScript\u002FTypeScript applications. This skill provides comprehensive testing strategies, bug analysis frameworks, and automated tools for identifying coverage gaps and untested code.\n\n## Core Capabilities\n\n### 1. Writing Test Cases\n\nWrite comprehensive tests covering unit, integration, and end-to-end scenarios.\n\n#### Unit Testing Approach\n\nStructure tests using the AAA pattern (Arrange-Act-Assert):\n\n```typescript\ndescribe('ExpenseCalculator', () => {\n  describe('calculateTotal', () => {\n    test('sums expense amounts correctly', () => {\n      \u002F\u002F Arrange\n      const expenses = [\n        { amount: 100, category: 'food' },\n        { amount: 50, category: 'transport' },\n        { amount: 25, category: 'entertainment' }\n      ];\n\n      \u002F\u002F Act\n      const total = calculateTotal(expenses);\n\n      \u002F\u002F Assert\n      expect(total).toBe(175);\n    });\n\n    test('handles empty expense list', () => {\n      expect(calculateTotal([])).toBe(0);\n    });\n\n    test('handles negative amounts', () => {\n      const expenses = [\n        { amount: 100, category: 'food' },\n        { amount: -50, category: 'refund' }\n      ];\n      expect(calculateTotal(expenses)).toBe(50);\n    });\n  });\n});\n```\n\n**Key principles:**\n- Test one behavior per test\n- Cover happy path, edge cases, and error conditions\n- Use descriptive test names that explain the scenario\n- Keep tests independent and isolated\n\n#### Integration Testing Approach\n\nTest how components work together, including database, API, and service interactions:\n\n```typescript\ndescribe('ExpenseAPI Integration', () => {\n  beforeAll(async () => {\n    await database.connect(TEST_DB_URL);\n  });\n\n  afterAll(async () => {\n    await database.disconnect();\n  });\n\n  beforeEach(async () => {\n    await database.clear();\n    await seedTestData();\n  });\n\n  test('POST \u002Fexpenses creates expense and updates total', async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fexpenses')\n      .send({\n        amount: 50,\n        category: 'food',\n        description: 'Lunch'\n      })\n      .expect(201);\n\n    expect(response.body).toMatchObject({\n      id: expect.any(Number),\n      amount: 50,\n      category: 'food'\n    });\n\n    \u002F\u002F Verify database state\n    const total = await getTotalExpenses();\n    expect(total).toBe(50);\n  });\n});\n```\n\n#### End-to-End Testing Approach\n\nTest complete user workflows using tools like Playwright or Cypress:\n\n```typescript\ntest('user can track expense from start to finish', async ({ page }) => {\n  \u002F\u002F Navigate to app\n  await page.goto('\u002F');\n\n  \u002F\u002F Add new expense\n  await page.click('[data-testid=\"add-expense-btn\"]');\n  await page.fill('[data-testid=\"amount\"]', '50.00');\n  await page.selectOption('[data-testid=\"category\"]', 'food');\n  await page.fill('[data-testid=\"description\"]', 'Lunch');\n  await page.click('[data-testid=\"submit\"]');\n\n  \u002F\u002F Verify expense appears in list\n  await expect(page.locator('[data-testid=\"expense-item\"]')).toContainText('Lunch');\n  await expect(page.locator('[data-testid=\"total\"]')).toContainText('$50.00');\n});\n```\n\n### 2. Systematic Bug Analysis\n\nApply structured debugging methodology to identify and fix issues.\n\n#### Five-Step Analysis Process\n\n1. **Reproduction**: Reliably reproduce the bug\n   - Document exact steps to trigger\n   - Identify required environment\u002Fstate\n   - Note expected vs actual behavior\n\n2. **Isolation**: Narrow down the problem\n   - Binary search through code path\n   - Create minimal reproduction case\n   - Remove unrelated dependencies\n\n3. **Root Cause Analysis**: Determine underlying cause\n   - Trace execution flow\n   - Check assumptions and preconditions\n   - Review recent changes (git blame)\n\n4. **Fix Implementation**: Implement solution\n   - Write failing test first (TDD)\n   - Implement the fix\n   - Verify test passes\n\n5. **Validation**: Ensure completeness\n   - Run full test suite\n   - Test edge cases\n   - Verify no regressions\n\n#### Common Bug Patterns\n\n**Race Conditions:**\n```typescript\n\u002F\u002F Test concurrent operations\ntest('handles concurrent updates correctly', async () => {\n  const promises = Array.from({ length: 100 }, () =>\n    incrementExpenseCount()\n  );\n\n  await Promise.all(promises);\n  expect(getExpenseCount()).toBe(100);\n});\n```\n\n**Null\u002FUndefined Errors:**\n```typescript\n\u002F\u002F Test null safety\ntest.each([null, undefined, '', 0, false])\n  ('handles invalid input: %p', (input) => {\n    expect(() => processExpense(input)).toThrow('Invalid expense');\n  });\n```\n\n**Off-by-One Errors:**\n```typescript\n\u002F\u002F Test boundaries explicitly\ndescribe('pagination', () => {\n  test('handles empty list', () => {\n    expect(paginate([], 1, 10)).toEqual([]);\n  });\n\n  test('handles single item', () => {\n    expect(paginate([item], 1, 10)).toEqual([item]);\n  });\n\n  test('handles last page with partial items', () => {\n    const items = Array.from({ length: 25 }, (_, i) => i);\n    expect(paginate(items, 3, 10)).toHaveLength(5);\n  });\n});\n```\n\n### 3. Identifying Potential Issues\n\nProactively identify issues before they become bugs.\n\n#### Security Vulnerabilities\n\nTest for common security issues:\n\n```typescript\ndescribe('security', () => {\n  test('prevents SQL injection', async () => {\n    const malicious = \"'; DROP TABLE expenses; --\";\n    await expect(\n      searchExpenses(malicious)\n    ).resolves.not.toThrow();\n  });\n\n  test('sanitizes XSS in descriptions', () => {\n    const xss = '\u003Cscript>alert(\"xss\")\u003C\u002Fscript>';\n    const expense = createExpense({ description: xss });\n    expect(expense.description).not.toContain('\u003Cscript>');\n  });\n\n  test('requires authentication for expense operations', async () => {\n    await request(app)\n      .post('\u002Fapi\u002Fexpenses')\n      .send({ amount: 50 })\n      .expect(401);\n  });\n});\n```\n\n#### Performance Issues\n\nTest for performance problems:\n\n```typescript\ntest('processes large expense list efficiently', () => {\n  const largeList = Array.from({ length: 10000 }, (_, i) => ({\n    amount: i,\n    category: 'test'\n  }));\n\n  const start = performance.now();\n  const total = calculateTotal(largeList);\n  const duration = performance.now() - start;\n\n  expect(duration).toBeLessThan(100); \u002F\u002F Should complete in \u003C100ms\n  expect(total).toBe(49995000);\n});\n```\n\n#### Logic Errors\n\nUse parameterized tests to catch edge cases:\n\n```typescript\ntest.each([\n  \u002F\u002F [input, expected, description]\n  [[10, 20, 30], 60, 'normal positive values'],\n  [[0, 0, 0], 0, 'all zeros'],\n  [[-10, 20, -5], 5, 'mixed positive and negative'],\n  [[0.1, 0.2], 0.3, 'decimal precision'],\n  [[Number.MAX_SAFE_INTEGER], Number.MAX_SAFE_INTEGER, 'large numbers'],\n])('calculateTotal(%p) = %p (%s)', (amounts, expected, description) => {\n  const expenses = amounts.map(amount => ({ amount, category: 'test' }));\n  expect(calculateTotal(expenses)).toBeCloseTo(expected);\n});\n```\n\n### 4. Test Coverage Analysis\n\nUse automated tools to identify gaps in test coverage.\n\n#### Finding Untested Code\n\nRun the provided script to identify source files without tests:\n\n```bash\npython3 scripts\u002Ffind_untested_code.py src\n```\n\nThe script will:\n- Scan source directory for all code files\n- Identify which files lack corresponding test files\n- Categorize untested files by type (components, services, utils, etc.)\n- Prioritize files that need testing most\n\n**Interpretation:**\n- **API\u002FServices**: High priority - test business logic and data operations\n- **Models**: High priority - test data validation and transformations\n- **Hooks**: Medium priority - test stateful behavior\n- **Components**: Medium priority - test complex UI logic\n- **Utils**: Low priority - test as needed for complex functions\n\n#### Analyzing Coverage Reports\n\nRun the coverage analysis script after generating coverage:\n\n```bash\n# Generate coverage (using Jest example)\nnpm test -- --coverage\n\n# Analyze coverage gaps\npython3 scripts\u002Fanalyze_coverage.py coverage\u002Fcoverage-final.json\n```\n\nThe script identifies:\n- Files below coverage threshold (default 80%)\n- Statement, branch, and function coverage percentages\n- Priority files to improve\n\n**Coverage targets:**\n- Critical paths: 90%+ coverage\n- Business logic: 85%+ coverage\n- UI components: 75%+ coverage\n- Utilities: 70%+ coverage\n\n### 5. Test Maintenance and Quality\n\nEnsure tests remain valuable and maintainable.\n\n#### Test Code Quality Principles\n\n**DRY (Don't Repeat Yourself):**\n```typescript\n\u002F\u002F Extract common setup\nfunction createTestExpense(overrides = {}) {\n  return {\n    amount: 50,\n    category: 'food',\n    description: 'Test expense',\n    date: new Date('2024-01-01'),\n    ...overrides\n  };\n}\n\ntest('filters by category', () => {\n  const expenses = [\n    createTestExpense({ category: 'food' }),\n    createTestExpense({ category: 'transport' }),\n  ];\n  \u002F\u002F ...\n});\n```\n\n**Clear test data:**\n```typescript\n\u002F\u002F Bad: Magic numbers\nexpect(calculateDiscount(100, 0.15)).toBe(85);\n\n\u002F\u002F Good: Named constants\nconst ORIGINAL_PRICE = 100;\nconst DISCOUNT_RATE = 0.15;\nconst EXPECTED_PRICE = 85;\nexpect(calculateDiscount(ORIGINAL_PRICE, DISCOUNT_RATE)).toBe(EXPECTED_PRICE);\n```\n\n**Avoid test interdependence:**\n```typescript\n\u002F\u002F Bad: Tests depend on execution order\nlet sharedState;\ntest('test 1', () => {\n  sharedState = { value: 1 };\n});\ntest('test 2', () => {\n  expect(sharedState.value).toBe(1); \u002F\u002F Depends on test 1\n});\n\n\u002F\u002F Good: Independent tests\ntest('test 1', () => {\n  const state = { value: 1 };\n  expect(state.value).toBe(1);\n});\ntest('test 2', () => {\n  const state = { value: 1 };\n  expect(state.value).toBe(1);\n});\n```\n\n## Workflow Decision Tree\n\nFollow this decision tree to determine the testing approach:\n\n1. **Adding new functionality?**\n   - Yes → Write tests first (TDD)\n     - Write failing test\n     - Implement feature\n     - Verify test passes\n     - Refactor\n   - No → Go to step 2\n\n2. **Fixing a bug?**\n   - Yes → Apply bug analysis process\n     - Reproduce the bug\n     - Write failing test demonstrating bug\n     - Fix the implementation\n     - Verify test passes\n   - No → Go to step 3\n\n3. **Improving test coverage?**\n   - Yes → Use coverage tools\n     - Run `find_untested_code.py` to identify gaps\n     - Run `analyze_coverage.py` on coverage reports\n     - Prioritize critical paths\n     - Write tests for untested code\n   - No → Go to step 4\n\n4. **Analyzing code quality?**\n   - Yes → Systematic review\n     - Check for security vulnerabilities\n     - Test edge cases and error handling\n     - Verify performance characteristics\n     - Review error handling\n\n## Testing Frameworks and Tools\n\n### Recommended Stack\n\n**Unit\u002FIntegration Testing:**\n- Jest or Vitest for test runner\n- Testing Library for React components\n- Supertest for API testing\n- MSW (Mock Service Worker) for API mocking\n\n**E2E Testing:**\n- Playwright or Cypress\n- Page Object Model pattern\n\n**Coverage:**\n- Istanbul (built into Jest\u002FVitest)\n- Coverage reports in JSON format\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run with coverage\nnpm test -- --coverage\n\n# Run specific test file\nnpm test -- ExpenseCalculator.test.ts\n\n# Run in watch mode\nnpm test -- --watch\n\n# Run E2E tests\nnpm run test:e2e\n```\n\n## Reference Documentation\n\nFor detailed patterns and techniques, refer to:\n\n- `references\u002Ftesting_patterns.md` - Comprehensive testing patterns, best practices, and code examples\n- `references\u002Fbug_analysis.md` - In-depth bug analysis framework, common bug patterns, and debugging techniques\n\nThese references contain extensive examples and advanced techniques. Load them when:\n- Dealing with complex testing scenarios\n- Need specific pattern implementations\n- Debugging unusual issues\n- Seeking best practices for specific situations\n\n## Scripts\n\n### analyze_coverage.py\n\nAnalyze Jest\u002FIstanbul coverage reports to identify gaps:\n\n```bash\npython3 scripts\u002Fanalyze_coverage.py [coverage-file]\n```\n\nAutomatically finds common coverage file locations if not specified.\n\n**Output:**\n- Files below coverage threshold\n- Statement, branch, and function coverage percentages\n- Priority files to improve\n\n### find_untested_code.py\n\nFind source files without corresponding test files:\n\n```bash\npython3 scripts\u002Ffind_untested_code.py [src-dir] [--pattern test|spec]\n```\n\n**Output:**\n- Total source and test file counts\n- Test file coverage percentage\n- Untested files categorized by type (API, services, components, etc.)\n- Recommendations for prioritization\n\n## Best Practices Summary\n\n1. **Write tests first** (TDD) when adding new features\n2. **Test behavior, not implementation** - tests should survive refactoring\n3. **Keep tests independent** - no shared state between tests\n4. **Use descriptive names** - test names should explain the scenario\n5. **Cover edge cases** - null, empty, boundary values, error conditions\n6. **Mock external dependencies** - tests should be fast and reliable\n7. **Maintain high coverage** - 80%+ for critical code\n8. **Fix failing tests immediately** - never commit broken tests\n9. **Refactor tests** - apply same quality standards as production code\n10. **Use tools** - automate coverage analysis and gap identification\n",{"name":5,"description":7},"main","f4cb2d49f7667e79ef7804f50396d5aaffdf1f56","代码质量与测试\u002Ftest-specialist",1,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification","https:\u002F\u002Fgithub.com\u002FKernel8901","a little little little dobe in life but science geek","2026-04-05 16:43:56",{"source":8,"skillName":5,"commands":52,"prompt":62,"zipAvailable":63},[53,56,59],{"tool":54,"command":55},"npx","npx skills add Kernel8901\u002Fai-agent-skills-classification --skill test-specialist",{"tool":57,"command":58},"bunx","bunx skills add Kernel8901\u002Fai-agent-skills-classification --skill test-specialist",{"tool":60,"command":61},"pnpm","pnpm dlx skills add Kernel8901\u002Fai-agent-skills-classification --skill test-specialist","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002FSKILL.md",true,[65,71,77,81,85,89,93],{"path":66,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":69,"sourceHtmlUrl":70},"_meta.json","REFERENCE","参考文档",294,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002F_meta.json",{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"index.js","SCRIPT","脚本",252,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Findex.js",{"path":78,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":79,"sourceHtmlUrl":80},"package.json",220,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Fpackage.json",{"path":82,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":83,"sourceHtmlUrl":84},"references\u002Fbug_analysis.md",13759,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Freferences\u002Fbug_analysis.md",{"path":86,"resourceType":67,"resourceTypeDesc":68,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Ftesting_patterns.md",7677,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Freferences\u002Ftesting_patterns.md",{"path":90,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":91,"sourceHtmlUrl":92},"scripts\u002Fanalyze_coverage.py",4896,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Fscripts\u002Fanalyze_coverage.py",{"path":94,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":95,"sourceHtmlUrl":96},"scripts\u002Ffind_untested_code.py",6154,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F代码质量与测试\u002Ftest-specialist\u002Fscripts\u002Ffind_untested_code.py",[98,122,145,153,160,187],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":38},"01M6Q5R6WZ06RRB9RQTW54B34B","zyfai","Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit\u002Fwithdraw anytime.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzyfai-sdk\u002FSKILL.md",[],[100,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121],"safe","ethereum","defi","Optimization","user","use","Wallet","base","deposit","withdraw","yield","arbitrum","non-custodial","passive","defi yield","earn","yield optimization",{"skillNo":123,"name":124,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":127,"publishedAt":38},"01M6Q5R337B5JSNER4P4YS03TN","zerion-api","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api\u002FSKILL.md",[],[128,129,130,131,132,133,134,107,135,111,136,137,138,139,140,141,142,143,144],"api","zerion api","zerion","MCP","mcp server","server","blockchain","transactions","crypto wallet","crypto","evm","solana","query","across","positions","token","prices",{"skillNo":146,"name":147,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":38},"01M6Q5QZFYTDAZMZ27BN5VZXAR","zerion-api-skill","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-skill\u002FSKILL.md",[],[128,151,152,129,130,131,132,133,134,107,135,111,137,138,139,140,141,142,143,144],"api skill","zerion api skill",{"skillNo":154,"name":155,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":38},"01M6Q5QW17QW98RA3FE45E4RD8","zerion-api-mcp","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-mcp\u002FSKILL.md",[],[131,128,159,129,130,132,133,107,135,111,136,137,138,139,140,141,142,143,144],"zerion api mcp",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":38},"01M6Q5QQYZB7A501BDEQWKGSJT","yahoo-finance-forex","Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR\u002FUSD, GBP\u002FUSD, USD\u002FJPY, etc.). Analyzes sentiment and provides trading context.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-forex\u002FSKILL.md",[],[167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186],"finance","yahoo finance","forex","yahoo","yahoo finance forex","github","https","sentiment","real-time","python3","install","Market","usd","news","time","currency","gbp","pip","market data","for",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":191,"categories":192,"keywords":193,"publishedAt":38},"01M6Q5QM6VS84WZVM7BKXXPF32","yahoo-finance","This skill should be used when the user asks to \"get stock prices\", \"check stock quotes\", \"look up earnings\", \"get financial data\", \"find trending stocks\", or needs stock market data from Yahoo Finance.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-cli\u002FSKILL.md",[],[167,168,170,194,195,196,197,198,199,178,200,201,202,203,204,205,206,207,144,185],"cli","homebrew","find","check","brew","up","local","get","stock","link","trending","sf","quotes","ln"]