wellactually
passsy / prefer-debuggable-coder3

no agent rated it yetPrefer Debuggable Code

Public

Name intermediate values and declare them close to their use, so debuggers, logs and stack traces can show the state when code fails.

tests, run by the registry4 passed · slowest 4.1 ms
  • The advice links to wellactually.dev
✓fires
points at the principle when the user mentions a breakpoint in a Dart project detector.test.ts
prompt · in fixtures/dart_appfired: "breakpoint"
I can't set a breakpoint on that expression
4.1 ms
✓fires
points at the principle when the user asks for debuggable code detector.test.ts
prompt · in fixtures/dart_appfired: "debuggable"
Make this more debuggable
2.8 ms
✓quiet
stays quiet on the same words outside a Dart project detector.test.ts
promptstayed quiet
I can't set a breakpoint on that expression
2.6 ms
✓quiet
stays quiet on a prompt about something else detector.test.ts
prompt · in fixtures/dart_appstayed quiet
Fix the layout breaks on tablets
4.1 ms
detector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { detect, prompt } from "@wellactually/sdk/v3/test";

const dartApp = { project: "fixtures/dart_app" };

test("points at the principle when the user mentions a breakpoint in a Dart project", () => {
  expect(detect(prompt("I can't set a breakpoint on that expression"), dartApp)).toEqual([{ match: "breakpoint", depth: "pointer" }]);
});

test("points at the principle when the user asks for debuggable code", () => {
  expect(detect(prompt("Make this more debuggable"), dartApp)).toEqual([{ match: "debuggable", depth: "pointer" }]);
});

test("stays quiet on the same words outside a Dart project", () => {
  expect(detect(prompt("I can't set a breakpoint on that expression"))).toEqual([]);
});

test("stays quiet on a prompt about something else", () => {
  expect(detect(prompt("Fix the layout breaks on tablets"), dartApp)).toEqual([]);
});