본문으로 건너뛰기
cccskills
무료GitHub에 공개

add-unit-tests

Add focused Bun unit tests for mission-critical behavior and edge cases — not blanket coverage.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.8 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

add-unit-tests

Adds high-signal unit tests using the Bun test runner (bun test). Optimize for correctness on critical paths, invariants, and failure modes — not chasing 100% line coverage.

When to Use

  • Implementing or changing logic that must not regress (parsers, validators, hooks, scripts, auth, money, concurrency boundaries)
  • Fixing a bug — add a test that fails without the fix
  • A PR or quality gate expects test evidence for the touched surface

When Not to Use

  • Purely cosmetic or copy-only changes with no executable behavior
  • Integration/E2E suites — use the repo’s existing patterns instead
  • Generated code — test the generator or hand-written seams, not every generated line

Principles

  1. Mission-critical first — pure functions, validation, state machines, error mapping, JSON envelopes (ok / error), idempotency, security-sensitive branches.
  2. Edge cases that matter — empty input, boundary values, malformed data, null/undefined, duplicate keys, unicode, very large strings when the code promises behavior there.
  3. Deterministic tests — no real network, clock, or filesystem unless the repo already provides fakes; use mock / injected dependencies.
  4. Colocate — foo.ts → foo.test.ts beside it, or __tests__/foo.test.ts if the repo already does that. Match existing layout in the target package.
  5. Strict typing — no any without a // justification: comment (harness rules).
  6. No noise — avoid trivial “it imports” tests; each test should fail for a concrete, plausible mistake.

Before Writing

  1. Read AGENTS.md and the sub-repo’s AGENTS.md if working under repos/<name>/.
  2. Find how tests are run: package.json scripts and any bunfig.toml / Vitest config — default harness expectation is bun test.
  3. Skim the module under test; list public API, invariants, and documented edge behavior to cover.

Steps

1. Pick targets

List 3–8 behaviors worth locking in (happy path + failures + one boundary each). Skip low-value branches.

2. Add test file(s)

Use Bun’s built-in describe / test / expect API (Jest-compatible).

import { describe, expect, test } from "bun:test";
import { parseEnvelope } from "./envelope.ts";

describe("parseEnvelope", () => {
  test("accepts valid ok envelope", () => {
    const input = JSON.stringify({ ok: true, data: { id: 1 }, error: null });
    expect(parseEnvelope(input)).toEqual({ ok: true, data: { id: 1 }, error: null });
  });

  test("rejects malformed JSON", () => {
    expect(() => parseEnvelope("{")).toThrow();
  });
});

3. Run the narrow suite, then full suite

bun test path/to/module.test.ts
bun test

Fix failures before claiming the task is done.

4. Gate with typecheck

bun run typecheck

If the repo defines bun run lint, run it too.

5. Evidence for Beads / PR

  • Note which behaviors are covered (bullet list in PR or worklog: comment).
  • Do not claim “100% coverage”; say critical paths + listed edge cases.

Checklist (self-review)

  • Every new test would catch a real regression or documents an explicit contract
  • No flaky timing or network
  • No console.log left in committed tests
  • bun test passes; TypeScript strict clean for new code

Sub-repos (repos/<name>/)

Follow that repo’s test runner and conventions if they differ from Bun. Still apply the same critical-path-first prioritization.

Optional references

Put long fixtures or golden files in references/ only when it keeps tests readable — prefer small inline data for unit tests.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

add-bead

무료

Capture free-text work as a tracked Beads issue. Use when the user runs /add-bead or wants to quickly file a Beads issue.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

add-repo

무료

Register a new sub-repo in the knowledge base.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

ask

무료

Answer questions about the codebase from knowledge files. Use when the user runs /ask or asks a domain/knowledge question about the repos.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

Meta-skill for creating Agent Forge skills under .claude/skills/ with SKILL.md, optional references/ and scripts/, and Bun scaffolds. Use when the user wants to add or author a skill, scaffold a new skill folder, or align skill docs with harness conventions (JSON script output, Beads for tasks).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

Choose Beads issue priority (P0–P4, numeric, or named) from urgency, impact, and risk when creating or triaging work.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

caveman

무료

Ultra-compressed communication mode that preserves technical accuracy while dropping filler. Use when the user explicitly says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

jupes/agent-forge-harness22026년 10월 19일 업데이트

jupes의 스킬 모두 보기

이 스킬의 문제 신고