Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计异常

coverage-strategist覆盖策略师

Agent Skill

coverage-strategist 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,088

周安装

87

GitHub Stars

33

下载量

696
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/patricio0312rev/skills --skill coverage-strategist

简介

coverage-strategist 用于制定务实且有 ROI 导向的测试覆盖策略,强调关键路径优先而非追求 100% 覆盖,适合在 Codex、Claude、Cursor、Gemini CLI 中需要平衡质量与开发效率时使用。

  • 它识别认证、结账等 P0 级路径必须全覆盖,其他区域按需分配资源,避免过度测试。
  • 输出包括优先级矩阵、覆盖目标和理由说明,助力团队聚焦高价值区域。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Coverage Strategist

Define pragmatic, ROI-focused test coverage strategies.

Coverage Philosophy

Goal: Maximum confidence with minimum tests

Principle: 100% coverage is not the goal. Test what matters.

Critical Path Identification

// Critical paths that MUST be tested
const criticalPaths = {
  authentication: {
    priority: "P0",
    coverage: "100%",
    paths: [
      "User login flow",
      "User registration",
      "Password reset",
      "Token refresh",
      "Session management",
    ],
    reasoning: "Security critical, impacts all users",
  },

  checkout: {
    priority: "P0",
    coverage: "100%",
    paths: [
      "Add to cart",
      "Update cart",
      "Apply coupon",
      "Process payment",
      "Order confirmation",
    ],
    reasoning: "Revenue critical, business essential",
  },

  dataIntegrity: {
    priority: "P0",
    coverage: "100%",
    paths: [
      "User data CRUD",
      "Order creation",
      "Inventory updates",
      "Database transactions",
    ],
    reasoning: "Data corruption would be catastrophic",
  },
};

// Important but not critical
const importantPaths = {
  userProfile: {
    priority: "P1",
    coverage: "80%",
    paths: ["Profile updates", "Avatar upload", "Preferences"],
    reasoning: "Important UX, but not business critical",
  },

  search: {
    priority: "P1",
    coverage: "70%",
    paths: ["Product search", "Filters", "Sorting"],
    reasoning: "Enhances experience, not essential",
  },
};

Layer-Specific Targets

# Coverage Targets by Layer

## Business Logic / Core Functions: 90-100%

**Why**: High ROI - complex logic, many edge cases
**What to test**:

- Calculations
- Validations
- State machines
- Algorithms
- Data transformations

## API Endpoints: 80-90%

**Why**: Critical integration points
**What to test**:

- Happy paths
- Error cases
- Validation
- Authentication
- Authorization

## Database Layer: 70-80%

**Why**: Data integrity matters
**What to test**:

- CRUD operations
- Transactions
- Constraints
- Migrations

## UI Components: 50-70%

**Why**: Lower ROI - visual changes, less critical
**What to test**:

- User interactions
- State changes
- Error states
- Critical flows only

## Utils/Helpers: 80-90%

**Why**: Reused everywhere, high impact
**What to test**:

- All public functions
- Edge cases
- Error handling

"Don't Test This" List

// Explicit list of what NOT to test

const dontTestThese = {
  externalLibraries: {
    examples: ["React internals", "Next.js router", "Lodash functions"],
    reasoning: "Already tested by library authors",
  },

  trivialCode: {
    examples: [
      "Simple getters/setters",
      "Constants",
      "Type definitions",
      "Pass-through functions",
    ],
    reasoning: "No logic to test, waste of time",
  },

  presentationalComponents: {
    examples: ["Simple buttons", "Icons", "Layout wrappers"],
    reasoning: "Visual regression testing more appropriate",
  },

  configurationFiles: {
    examples: ["webpack.config.js", "next.config.js"],
    reasoning: "Configuration, not logic",
  },

  mockData: {
    examples: ["Fixtures", "Test data", "Storybook stories"],
    reasoning: "Not production code",
  },
};

// Example: Don't test trivial code
// ❌ Don't test this
class User {
  constructor(private name: string) {}
  getName() {
    return this.name;
  } // Trivial getter
}

// ✅ But DO test this
class User {
  constructor(private name: string) {}

  getDisplayName() {
    // Business logic
    return this.name
      .split(" ")
      .map((n) => n.charAt(0).toUpperCase() + n.slice(1))
      .join(" ");
  }
}

Test Priority Matrix

interface TestPriority {
  feature: string;
  businessImpact: "high" | "medium" | "low";
  complexity: "high" | "medium" | "low";
  changeFrequency: "high" | "medium" | "low";
  priority: "P0" | "P1" | "P2" | "P3";
  targetCoverage: string;
}

const testPriorities: TestPriority[] = [
  {
    feature: "Payment processing",
    businessImpact: "high",
    complexity: "high",
    changeFrequency: "low",
    priority: "P0",
    targetCoverage: "100%",
  },
  {
    feature: "User authentication",
    businessImpact: "high",
    complexity: "medium",
    changeFrequency: "low",
    priority: "P0",
    targetCoverage: "100%",
  },
  {
    feature: "Product search",
    businessImpact: "medium",
    complexity: "medium",
    changeFrequency: "medium",
    priority: "P1",
    targetCoverage: "80%",
  },
  {
    feature: "UI themes",
    businessImpact: "low",
    complexity: "low",
    changeFrequency: "high",
    priority: "P3",
    targetCoverage: "30%",
  },
];

// Priority calculation
function calculatePriority(
  businessImpact: number, // 1-10
  complexity: number, // 1-10
  changeFrequency: number // 1-10
): number {
  return businessImpact * 0.5 + complexity * 0.3 + changeFrequency * 0.2;
}

Coverage Configuration

// jest.config.js
module.exports = {
  collectCoverageFrom: [
    "src/**/*.{ts,tsx}",
    "!src/**/*.d.ts",
    "!src/**/*.stories.tsx", // Don't count stories
    "!src/mocks/**", // Don't count mocks
    "!src/**/__tests__/**", // Don't count tests
  ],

  coverageThresholds: {
    global: {
      statements: 70,
      branches: 65,
      functions: 70,
      lines: 70,
    },
    // Critical paths: 90%+
    "./src/services/payment/**/*.ts": {
      statements: 90,
      branches: 85,
      functions: 90,
      lines: 90,
    },
    "./src/services/auth/**/*.ts": {
      statements: 90,
      branches: 85,
      functions: 90,
      lines: 90,
    },
    // Utils: 80%+
    "./src/utils/**/*.ts": {
      statements: 80,
      branches: 75,
      functions: 80,
      lines: 80,
    },
    // UI components: 50%+ (lower bar)
    "./src/components/**/*.tsx": {
      statements: 50,
      branches: 45,
      functions: 50,
      lines: 50,
    },
  },
};

Test Investment ROI

// Calculate ROI of testing
interface TestROI {
  feature: string;
  testingCost: number; // hours
  bugPreventionValue: number; // estimated $ saved
  roi: number; // ratio
}

const testROI: TestROI[] = [
  {
    feature: "Payment processing",
    testingCost: 40, // hours
    bugPreventionValue: 50000, // Could lose $50k revenue
    roi: 1250, // $1,250 per hour invested
  },
  {
    feature: "Authentication",
    testingCost: 20,
    bugPreventionValue: 10000, // Security breach cost
    roi: 500,
  },
  {
    feature: "Theme switcher",
    testingCost: 5,
    bugPreventionValue: 100, // Minor UX issue
    roi: 20,
  },
];

// Focus on high ROI tests
const sortedByROI = testROI.sort((a, b) => b.roi - a.roi);

Pragmatic Testing Strategy

# Testing Strategy Document

## Principles

1. **Business value first**: Test what breaks the business
2. **Edge cases over happy path**: Happy path is obvious
3. **Integration over unit**: Test how pieces work together
4. **Critical flows end-to-end**: User journeys matter most

## Test Types Distribution

- 70% Unit tests (fast, isolated)
- 20% Integration tests (API + DB)
- 10% E2E tests (critical flows only)

## Coverage Goals

- Overall: 70% (pragmatic goal)
- Critical business logic: 90%+
- API endpoints: 80%+
- UI components: 50%+ (user interactions only)

## What NOT to Test

- Third-party libraries
- Trivial getters/setters
- Pure presentational components
- Configuration files
- Mock data and fixtures

## Review Criteria

Before writing a test, ask:

1. What bug would this test prevent?
2. How likely is that bug?
3. How costly would that bug be?
4. Is this already covered by integration tests?

If ROI is low, skip the test.

Team Guidelines

// Code review checklist for test coverage

const reviewChecklist = {
  criticalPath: {
    question: "Does this change affect a critical path?",
    ifYes: "MUST have comprehensive tests (90%+)",
  },

  businessLogic: {
    question: "Is this complex business logic?",
    ifYes: "MUST have unit tests with edge cases",
  },

  apiEndpoint: {
    question: "Is this a new API endpoint?",
    ifYes: "MUST have integration tests",
  },

  uiComponent: {
    question: "Is this a UI component?",
    ifYes: "Optional - test interactions only",
  },

  bugFix: {
    question: "Is this a bug fix?",
    ifYes: "MUST have regression test",
  },
};

Best Practices

  1. Focus on risk: Test what could go wrong
  2. Diminishing returns: 100% coverage has low ROI
  3. Integration over unit: Test behavior, not implementation
  4. Critical paths first: Payment, auth, data integrity
  5. Explicit "don't test": Be intentional about skipping
  6. Review regularly: Adjust targets quarterly
  7. Measure bugs: Track if tests catch real issues

Output Checklist

  • Critical paths identified
  • Layer-specific targets defined
  • "Don't test this" list created
  • Priority matrix established
  • Coverage thresholds configured
  • ROI analysis performed
  • Testing strategy documented
  • Team guidelines defined

适合场景

01

研究助手

02

事实核查

03

知识库问答

04

带来源的搜索总结

能力概览

能力 1

组合搜索和大模型调用

能力 2

支持多来源检索和总结

能力 3

强调引用来源和事实核查

能力 4

适合研究型 Agent 流程

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

平台分布

Claude Code

26.09%
按下载量换算182

Gemini CLI

23.58%
按下载量换算164

Antigravity

15.55%
按下载量换算108

windsurf

12.77%
按下载量换算89

github-copilot

7.2%
按下载量换算50

Codex

3.44%
按下载量换算24

安全审计

Gen Agent Trust Hub

未通过

Socket

可疑

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills