doc-detective/.github/tdd-coverage

Claude Code and agent skill by doc-detective/.github

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Install

npx vskill@latest install doc-detective/.github/tdd-coverage

SKILL.md

TDD and Coverage Skill

Type: Rigid (follow exactly)

When to Use

Use this skill when:

  • Creating new functionality
  • Modifying existing code
  • Fixing bugs
  • Refactoring

Mandatory Process

1. Test First (TDD)

Before writing or modifying any implementation code:

  1. Write the test(s) that describe the expected behavior
  2. Run the test - it should FAIL (red)
  3. Write the implementation to make the test pass
  4. Run the test - it should PASS (green)
  5. Refactor if needed, keeping tests passing
2. Coverage Verification

After any code change:

bash
# Run tests with coverage
npm run test:coverage
# Verify coverage hasn't decreased
npm run test:coverage:ratchet

Coverage must not decrease. If ratchet check fails:

  1. Add tests for uncovered code
  2. Re-run coverage until ratchet passes
3. Coverage Thresholds

Current thresholds are in coverage-thresholds.json. These values must only increase:

MetricThreshold
Lines100%
Statements100%
Functions100%
Branches100%
4. Test Location
CodeTest File
src/validate.jstest/validate.test.js
src/resolvePaths.jstest/resolvePaths.test.js
src/files.jstest/files.test.js
Schema validationtest/schema.test.js
5. Test Structure Pattern
javascript
const sinon = require("sinon");
(async () => {
const { expect } = await import("chai");
const { functionUnderTest } = require("../src/module");
describe("functionUnderTest", function () {
describe("input validation", function () {
it("should throw error when required param missing", function () {
expect(() => functionUnderTest()).to.throw();
});
});
describe("happy path", function () {
it("should return expected result for valid input", function () {
const result = functionUnderTest({ validInput: true });
expect(result).to.deep.equal(expectedOutput);
});
});
describe("edge cases", function () {
it("should handle boundary condition", function () {
// test edge case
});
});
});
})();
6. Checklist

Before completing any code change:

  • [ ] Tests written BEFORE implementation (or for existing code: tests added)
  • [ ] All tests pass (npm test)
  • [ ] Coverage hasn't decreased (npm run test:coverage:ratchet)
  • [ ] New code has corresponding test coverage
  • [ ] Error paths are tested (not just happy paths)

Commands Reference

bash
# Run all tests
npm test
# Run tests with coverage report
npm run test:coverage
# Run coverage ratchet check
npm run test:coverage:ratchet
# Generate HTML coverage report
npm run test:coverage:html

Common Patterns

Testing async functions
javascript
it("should handle async operation", async function () {
const result = await asyncFunction();
expect(result).to.exist;
});
Mocking with Sinon
javascript
const stub = sinon.stub(fs, "readFileSync").returns("mock content");
try {
const result = functionUnderTest();
expect(result).to.equal("expected");
} finally {
stub.restore();
}
Testing error handling
javascript
it("should throw on invalid input", function () {
expect(() => functionUnderTest(null)).to.throw(/error message/);
});
Testing transformations
javascript
it("should transform v2 object to v3", function () {
const result = transformToSchemaKey({
currentSchema: "schema_v2",
targetSchema: "schema_v3",
object: v2Object,
});
expect(result.newProperty).to.equal(expectedValue);
});

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/doc-detective/.github/tdd-coverage/badge)](https://verified-skill.com/skills/doc-detective/.github/tdd-coverage)

Something wrong with this skill or its page? Tell us.