agentleFS
k3ybladewielderk3ybladewielder/skills/quality-test/SKILL.md

quality-testing

Skill7 starsChanged 53 days agoApache-2.0View on GitHub

Master guide and objective code quality metrics index. Covers coverage, mutation, regression, E2E, architecture, dependencies, coupling, Martin metrics, connascence, module size, cyclomatic and cognitive complexity, hotspots, duplication, maintainability index, performance, property-based tests, dead code, SAST, linting, type-checking (TypeScript and Python), formal mechanical verification (Bend), and CI quality gates.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Actionable: When an indicator degrades, root cause and remedy are immediate.

    line 16
  2. Distinctive:

    Consult the dedicated subskill document: before implementing tests or metrics in a specific technical area.

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Quality Testing — Objective Measurement of Code Quality

Philosophy

This skill guides the creation of tests and metrics that yield objective, verifiable numbers regarding the health of a codebase. The goal is not blindly pursuing 100%, but creating continuous visibility, establishing dependable baselines, detecting degradation before deployment, and driving data-informed refactoring.

Each quality dimension must be:

  • Automatable: Collected in CI/locally without manual intervention.
  • Trackable: Comparable across sprints and commits (trend > absolute).
  • Actionable: When an indicator degrades, root cause and remedy are immediate.
  • Contextual: Thresholds vary by architectural layer and domain criticality.

Complete Index of Quality Subskills

1. Formal Verification

  • Formal Code Verification: Mechanical mathematical certainty of correctness by construction. Guides property declarations in LAWS.bend, demonstrations in PROOF.bend, and verification via the bend compiler.

2. Static Analysis, Linters & Typing

  • Linting and Type Checking: Strict validation of type contracts and code standards in TypeScript (tsc --noEmit, ESLint Flat Config, Biome) and Python (mypy --strict, ruff).
  • Static Application Security Testing (SAST): Scanning for known vulnerabilities (OWASP Top 10, CWEs) with Bandit, Semgrep, SpotBugs, and ESLint Security.
  • Dead Code Detection: Identifying and eliminating orphan functions, variables, and exports with Vulture, autoflake, ts-prune, and knip.
  • Code Duplication (DRY): Detecting code clones and duplicated snippets with jscpd, pylint --enable=duplicate-code, and PMD CPD.

3. Complexity, Hotspots & Maintainability

  • Cyclomatic Complexity: Quantifying McCabe control flow paths, correlating with required test cases, and refactoring using guard clauses and polymorphism.
  • Cognitive Complexity: Measuring code readability with nesting penalties via SonarQube and flake8 plugins.
  • Module Size and Granularity: Thresholds for lines per file, lines per function, parameters, and classes to preserve the Single Responsibility Principle.
  • Maintainability Index (MI): Composite score from 0 to 100 based on Halstead Volume, cyclomatic complexity, and LOC via Radon.
  • Code Churn and Hotspots: Intersecting Git revision history with static complexity to prioritize refactoring where bugs actually occur.

4. Architecture, Coupling & Code Design

  • Layer and Dependency Analysis: Preventing circular dependencies and safeguarding architectural boundaries with import-linter, ArchUnit, and dependency-cruiser.
  • Afferent and Efferent Coupling: Analyzing coupling types (Content, Control, Stamp, Data), calculating $C_a$ and $C_e$, and extracting dependency graphs via AST.
  • Martin Metrics (Abstraction, Instability, and Distance): Diagnosing Risk Zones (Zone of Pain and Zone of Uselessness) and distance $D$ from the Main Sequence.
  • Connascence: Assessing coupling strength (Name, Type, Meaning, Position, Algorithm, Execution, Timing, Value, Identity) and applying strength reduction rules.

5. Dynamic & Executable Tests

  • Code Coverage: Configuring branch coverage, layer-specific targets, and preventing coverage gaming (pytest-cov, vitest, JaCoCo).
  • Mutation Testing: Evaluating actual test effectiveness by injecting synthetic faults via mutmut, Stryker, and PITest.
  • Regression Testing: Snapshot testing for API contracts, consumer-driven contract testing with Pact, and Test Impact Analysis.
  • End-to-End (E2E) Testing: Balanced testing pyramid, API-first scenarios, and browser automation with Playwright.
  • Property-Based Testing: Validating universal invariants, roundtrip tests, and failure shrinking with Hypothesis and fast-check.
  • Performance Testing & Benchmarks: Statistical micro-benchmarks (pytest-benchmark), performance budgets, and load testing with k6.

6. Governance & Continuous Integration

  • Quality Gate & Dashboard: Weighted unified quality score (0-100) and consolidated GitHub Actions pipeline with fail-fast policies.

Decision Matrix: When to Apply Each Subskill

Project ContextHighly Recommended Subskills
Project Kickoff / New ModuleLint & Typecheck, Coverage, Dependencies
Prior to Complex RefactoringChurn & Hotspots, Coupling, Regression
Critical Business Rules / Invariant CalculationsProperty-Based, Formal Verification (Bend), Mutation
Critical Production BugsRegression (Snapshots), Mutation on the affected module
Preparing for Scale / High ConcurrencyPerformance, E2E, Dependencies
Audit and PR ReviewQuality Gate, Cyclomatic Complexity, SAST

Recommended Implementation Phases

Phase 1 (Quick Wins)       ───► Lint, Type Check, Coverage, Dead Code, CC <= 10
Phase 2 (Architecture)    ───► Coupling (Ca/Ce), Dependencies, Martin Metrics (D)
Phase 3 (Depth)           ───► Mutation on Core, Connascence, Hotspots
Phase 4 (Rigor & Scale)   ───► Benchmarks/Load, Property-Based, Formal Verification (Bend)

Agent Instructions

  1. Consult the dedicated subskill document before implementing tests or metrics in a specific technical area.
  2. Type Check and Linter come first: Any static typing breakdown invalidates higher-level metric reliability.
  3. Use the Bend skill when formal mathematical proof of critical algorithms is required.
  4. Automate everything in the CI pipeline: Any test or metric that is not automatically executed on each PR will eventually be abandoned by the team.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.