跳到正文
cccskills
免费在 GitHub 公开

qe-test-generation

Generates durable-first tests — invariants, contracts, and property-based tests at boundaries that survive a reimplementation — plus unit, integration, and e2e coverage. Use when creating tests for new or changed code, filling coverage gaps, or migrating test suites between Jest, Vitest, and Playwright.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe星标 515(GitHub 515 + cccskills 0)
集成工具Playwright

实测评分 未实测

查看安装方法

包含的文件(6)

  • SKILL.md7.5 KB
  • config.json573 B
  • evals/qe-test-generation.yaml4.1 KB
  • schemas/output.json12.1 KB
  • scripts/validate-config.json439 B
  • templates/test-scaffold-jest.md1.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

QE Test Generation

Purpose

Guide the use of v3's AI-powered test generation capabilities including pattern-based test synthesis, multi-framework support, and intelligent test case derivation from code analysis.

Write durable-first (the core rule)

When AI makes code cheap to regenerate, the durable asset is the test that still holds after the implementation is thrown away and rewritten. Generate tests in durability tiers, and lead with the durable ones (ADR-113):

TierWhat it isSurvives a rewrite?When to write
DurableInvariants, contracts/schemas, property-based tests, behavioral e2e — specified at the module's public boundaryYesAlways — ≥1 per target
EphemeralExample-based unit tests, mock-call/interaction tests (TDD-London style)No (coupled to impl)For the red-green loop; label them, delete freely
LiveMonitoring / drift / cost assertions that run against realityContinuouslyFor deployed behavior

The language-swap heuristic: if reimplementing this module in another language would invalidate the test, the test is at the wrong boundary. Push it up a tier — assert on the observable contract, not on how the current code happens to work.

Every generated target MUST include at least one durable assertion (an invariant, a contract check, or a property). Mock-call assertions (toHaveBeenCalledWith) are ephemeral by definition — never let them be the only thing testing a target. Tag each generated test // @tier durable|ephemeral|live so its lifetime is explicit.

These tests are graded as oracles: a good test passes against the real code and fails against a seeded bug (mutant). A test that asserts nothing, or only the happy path, kills no mutants and is rejected — see /mutation-testing and ADR-113.

Activation

  • When generating tests for new code
  • When improving test coverage
  • When migrating tests between frameworks
  • When applying TDD patterns
  • When generating edge case tests

Quick Start

# Generate unit tests for a file
aqe test generate --file src/services/UserService.ts --framework jest

# Generate tests with coverage target
aqe test generate --scope src/api/ --coverage 90 --type unit

# Generate integration tests
aqe test generate --file src/controllers/AuthController.ts --type integration

# Generate from patterns
aqe test generate --pattern repository --target src/repositories/

Agent Workflow

// Spawn test generation agents — durable-first
Task("Generate durable-first tests", `
  Analyze src/services/PaymentService.ts and generate Jest tests in tier order.
  1. DURABLE (write these first, >=1 per public method):
     - Invariants ("a refund never makes a balance negative")
     - Contract/schema checks on inputs and outputs crossing the boundary
     - Property-based tests (fast-check) over input ranges, not single examples
  2. EPHEMERAL (the red-green loop; tag '// @tier ephemeral'):
     - Specific happy-path examples and error paths
     - Mock external dependencies ONLY — never let a mock-call assertion be the
       only test for a method
  Apply the language-swap check: if a Python rewrite of PaymentService would break
  the test, move it up to the durable tier.
  Output to tests/unit/services/PaymentService.test.ts
`, "qe-test-architect")

// Property + contract generation (first-class, not opt-in)
Task("Generate property and contract tests", `
  For src/repositories/, derive:
  - Properties: round-trip (write→read returns same), idempotence, ordering invariants
  - Contracts: the repository interface schema, enforced on every CRUD result
  These survive a storage-engine swap; example-based CRUD tests do not.
`, "qe-property-tester")

Test Generation Strategies

1. Code Analysis Based

await testGenerator.analyzeAndGenerate({
  source: 'src/services/OrderService.ts',
  analysis: {
    methods: true,
    branches: true,
    dependencies: true,
    errorPaths: true
  },
  output: {
    framework: 'jest',
    style: 'describe-it',
    assertions: 'expect'
  }
});

2. Pattern-Based Generation

await testGenerator.applyPattern({
  pattern: 'service-layer',
  targets: ['src/services/*.ts'],
  customizations: {
    mockStrategy: 'jest.mock',
    asyncHandling: 'async-await',
    errorAssertion: 'toThrow'
  }
});

3. Coverage-Driven Generation

await testGenerator.fillCoverageGaps({
  coverageReport: 'coverage/lcov.info',
  targetCoverage: 90,
  prioritize: ['uncovered-branches', 'error-paths'],
  maxTests: 50
});

Framework Support

FrameworkUnitIntegrationE2EMocking
Jest✅✅⚠️jest.mock
Vitest✅✅⚠️vi.mock
Mocha✅✅❌sinon
Pytest✅✅❌pytest-mock
JUnit✅✅❌Mockito

Test Quality Checks

quality_checks:
  durability:                  # the primary check (ADR-113)
    durable_assertions_per_target: 1   # >=1 invariant/contract/property each
    language_swap_safe: true           # would survive a reimplementation
    tier_tags_present: true            # every test tagged durable|ephemeral|live

  fault_detection:             # do the tests actually catch bugs?
    mutation_score_min: 0.6            # kill rate against seeded mutants
    no_assertionless_tests: true       # reject tests that kill 0 mutants

  assertions:
    minimum_per_test: 1
    meaningful: true

  isolation:
    no_shared_state: true
    proper_setup_teardown: true

  naming:
    descriptive: true
    follows_convention: true

  coverage:                    # necessary but NOT sufficient — see fault_detection
    branches: 80
    statements: 85

Skill Composition

  • After generating tests → Run /mutation-testing to verify test quality
  • Before generating → Use /test-automation-strategy to choose framework and patterns
  • Related → /qe-coverage-analysis to find where tests are needed most

Gotchas

  • Agent truncates output on files >3000 lines — scope generation to individual modules, not entire directories
  • Components that pass unit tests individually may have zero integration wiring — always generate at least one integration test per module boundary
  • When generating tests for a new codebase, check which framework is installed (jest vs vitest vs mocha) — they have different mock APIs and Claude will use the wrong one
  • Completion theater: agent may claim "comprehensive tests generated" but leave stubs or hardcoded values — always run the generated tests before accepting
  • Fleet must be initialized before using QE agents: run aqe health to diagnose, or aqe init to re-initialize if you get "Fleet not initialized"

Coordination

Primary Agents: qe-test-generator, qe-pattern-matcher, qe-test-architect Coordinator: qe-test-generation-coordinator Related Skills: qe-coverage-analysis, qe-test-execution

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

a11y-ally

免费

Use when running comprehensive WCAG accessibility audits with axe-core + pa11y + Lighthouse, generating context-aware remediation, or testing video accessibility. Supports 3-tier browser cascade with graceful degradation.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

WCAG 2.2 compliance testing, screen reader validation, and inclusive design verification. Use when ensuring legal compliance (ADA, Section 508), testing for disabilities, or building accessible applications for 1 billion disabled users globally.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

Master advanced AgentDB features including QUIC synchronization, multi-database management, custom distance metrics, hybrid search, and distributed systems integration. Use when building distributed AI systems, multi-agent coordination, or advanced vector search applications.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

Create and train AI learning plugins with AgentDB's 9 reinforcement learning algorithms. Includes Decision Transformer, Q-Learning, SARSA, Actor-Critic, and more. Use when building self-learning agents, implementing RL, or optimizing agent behavior through experience.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

Implement persistent memory patterns for AI agents using AgentDB. Includes session memory, long-term storage, pattern learning, and context management. Use when building stateful agents, chat systems, or intelligent assistants.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

Optimize AgentDB performance with quantization (4-32x memory reduction), HNSW indexing (150x faster search), caching, and batch operations. Use when optimizing memory usage, improving search speed, or scaling to millions of vectors.

中文简介正在准备中。当前显示原文说明。

proffesor-for-testing/agentic-qe5152026年10月26日 更新

查看 proffesor-for-testing 的全部技能

报告此技能的问题