원클릭으로
unit-tests
// Guardrails for adding unit tests in bklit-ui without over-testing. Use when the user mentions unit test, unit tests, tests, test coverage, add tests, write tests, vitest, jest, or asks whether something should be tested.
// Guardrails for adding unit tests in bklit-ui without over-testing. Use when the user mentions unit test, unit tests, tests, test coverage, add tests, write tests, vitest, jest, or asks whether something should be tested.
bklit-ui monorepo contributors only — ship a chart or component from playground prototype to production in packages/ui with docs and registry.
bklit-ui monorepo contributors only. Use automatically when building a new chart, editing an existing chart, prototyping chart props or animation, or working on apps/web/app/playground/. Scaffolds the editor playground with left motion pane, right controls pane, and center chart frame.
Bklit UI charts and data visualization for any project using the @bklit shadcn registry. Install, compose, theme, and animate charts correctly. Triggers when working with @bklitui/ui/charts, @bklit components, data visualization, dashboards, or chart theming. Also invoke manually for chart tasks.
Open a pull request the bklit-ui way: stage and commit with pre-commit hooks, run ultracite from the repo root, run a production test build, fix failures, push, and create a PR with a structured summary. Use when the user asks to commit, push, open a PR, "ship it", or run the full pre-PR checklist.
Add X (Twitter) testimonials to the bklit homepage. Fetches username, avatar, and tweet text from a status URL and appends an entry to apps/web/lib/testimonials.ts. Use when the user shares an x.com/twitter.com tweet URL to add or replace a testimonial.
Generates llms.txt and llms-full.txt files for LLM-friendly project documentation following the llms.txt specification. Use when the user wants to create LLM-readable summaries, llms.txt files, or make their wiki accessible to language models.
| name | unit-tests |
| description | Guardrails for adding unit tests in bklit-ui without over-testing. Use when the user mentions unit test, unit tests, tests, test coverage, add tests, write tests, vitest, jest, or asks whether something should be tested. |
Read this skill before proposing or writing tests. Default stance: fewer, higher-signal tests.
Add tests when they lock in behavior that is easy to break silently:
| Worth testing | Why |
|---|---|
| Pure functions / modules | Stable inputs → outputs; fast; no DOM |
| Formatters, parsers, scale math, bounds | Regression on string/number output is user-visible |
| Codegen / export / registry helpers | Output shape is the contract |
| Non-obvious edge cases | Empty data, reversed ranges, clamping |
Examples in this repo: chart-formatters.test.ts, highlight-segment-bounds.test.ts, animation.test.ts, apps/web/lib/studio/__tests__/*.
Do not add tests just to increase coverage or “be thorough”:
| Skip | Why |
|---|---|
| React component render smoke tests | visx, motion, portals → brittle; manual/docs check is cheaper |
memo() / guard extractions (#65-style) | Structural perf refactors; output unchanged; RTL mount assertions are heavy |
| Default prop passthrough | formatValue = intFmt — types + formatter tests cover it |
| Third-party library behavior | Don’t re-test d3, visx, or React |
| Trivial getters / one-line wrappers | No regression signal |
| Snapshot entire chart SVG/JSX | High churn, low signal |
If the user asks “should we test X?” — say no when X falls in this table, and suggest a lighter alternative (pure helper test, manual check, CI build).
Runner: Node built-in test runner + tsx (not Jest/Vitest unless the repo adopts them later).
pnpm test # root — turbo runs packages with a test script
pnpm --filter @bklitui/ui test
cd apps/web && pnpm test
Place tests: **/__tests__/**/*.test.ts next to the code under test.
Pattern:
import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { myFn } from "../my-module";
describe("myFn", () => {
it("handles empty input", () => {
assert.equal(myFn([]), expected);
});
});
Equivalence tests (preferred for formatters): assert shared module output matches the previous inline call (e.g. toLocaleDateString with same locale/options) so tests stay timezone-safe and prove no visual regression.
New package test script: add to package.json:
"test": "node scripts/run-tests.mjs"
Use a small scripts/run-tests.mjs that collects *.test.ts from __tests__ and invokes node --import tsx --test — shell globs break on Linux CI. Add tsx as a devDependency if missing. Wire into root turbo.json test task; CI runs pnpm test.
When recommending tests, be explicit:
chart-formatters.ts — pure, high regression value.”pnpm test in PR test plan when adding or changing tests.useMemo call countsexpect(typeof x).toBe('function'))