本文へ移動
cccskills
無料GitHub で公開

testing

Authoritative reference for deciding whether a test should exist and what it must assert. Use before writing or changing tests, and when investigating a test failure.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/laguneスター 173(GitHub 173 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Testing

This skill is the specialized, authoritative description of why a test exists: what deserves one, what it must assert, and what to do when it fails.

Follow the project's established conventions wherever they differ from these defaults. For code conventions and test execution, use the engineering skill when it is installed.

Criteria

Answer these questions before writing a test. If any answer is missing, there is no test to write.

  • What promise does it protect? State the behavior, contract, or rule in the domain's terms.
  • What regression would it catch? Describe an incorrect change that would otherwise go unnoticed.
  • Would an equivalent implementation still pass? A refactor must not invalidate the assertions when the promise is unchanged.

The test's name states the promise in the domain's terms, stays valid after a rename, and identifies what broke when it fails.

What deserves a test

  • A behavior the product promises. Cover rules that can be stated independently of the implementation, such as when an operation is allowed or how a failure is handled.
  • A contract between two parties. When systems exchange data or delegate work, test their agreed obligations. A literal table is valid when it records that agreement, not a copy of the code.
  • A barrier against hostile input. Exercise every validation or parser of untrusted data with hostile input, not only valid input.
  • A rule that holds for a whole set. When the project requires every item in a set to satisfy a rule, check the set in one test so new items are covered automatically.
  • An intentional constraint. Cover the effects of agreed limits, rounding rules, or required formats.

What never gets a test

  • The language, the runtime, or a library. Do not re-test behavior they already guarantee. A wrapper around a call needs a test only if it adds a promise of its own.
  • The shape of a module. Do not test that a function is exported, can be called, or matches its declaration. Leave statically guaranteed properties to static checks.
  • A constant or fixed text read back. Repeating a declared value or label as the expected result proves nothing. Test its effect or, for text generated from other data, the composition rule.
  • The structure of the implementation. Do not assert which internal helper ran, how often, in what order, or with which arguments.
  • A snapshot of the markup. A rendered tree records structure, not interface behavior. Test what the interface promises instead.

Resilience to change

  • Mock only external dependencies. Replace the network, the clock, storage, or the file system, never the project's own modules.
  • Write the expected value by hand. State the literal value the promise requires. Do not derive it from the formula or helper under test, which could carry the same error as the result.
  • Assert the complete promise. Check the required values, not merely that a result exists or has a type. Presence is enough only when it is the entire promise, such as flagging an invalid field regardless of the message.
  • Deterministic or removed. A test whose verdict depends on the real clock, network availability, execution order, or uncontrolled randomness must be made repeatable or removed.
  • Organize cases in a table. When several inputs follow the same rule, use one named case per row (parameterized tests) instead of duplicating test logic.
  • One file per subject, not per source file. Group a subject's promises in one file, regardless of where their implementation lives. A source file does not need a corresponding test file.

When a test fails

A failure asks one question: did the promise change on purpose?

  • Yes: update the test with the intended behavior change so both are reviewed together.
  • No, and the behavior changed: the code is wrong, so fix it.
  • No, and the behavior did not change: investigate the test and its setup. Correct implementation coupling or uncontrolled inputs instead of changing the expectation.

Never make a test pass by weakening its assertion or widening its mocks.

Review

After writing or changing tests, check every test touched by the work against this skill. Rewrite or remove any that no longer meet its criteria.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Authoritative architecture reference for Lagune, covering repository layout, the three owners, the published skills, the catalog, the engine command and its fallback, and the tracking-map model. Use when a decision depends on repo shape.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

cdp

無料

Visual verification of a running page through Chrome's DevTools Protocol, capturing screenshots and measuring the rendered DOM. Use when a frontend change can only be confirmed once rendered, for layout, spacing, alignment, overflow, or theme tokens.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

dashboard

無料

Authoritative reference for the Lagune dashboard, a live view of a project's .lagune/ chain with a locked-down local action surface. Use before changing anything under src/dashboard/ or src/types/dashboard/.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

Authoritative engineering reference covering code conventions, comments, TypeScript type rules, testing, and commit messages. Use before writing or changing any source file, and when suggesting a commit message.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

lagune

無料

Do the work the prompt asks for, with security guarding the build as it happens. Loads the charter, matches the security knowledge the work touches, builds safe-by-default, then checks its own result against what it used.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

Establish or update the project's security charter, the safe-by-default principles every later phase must respect. Reads the project's files to learn what it is and uses, weighs any description you give against them, and asks when something is unclear.

日本語の概要は準備中です。原文の説明を表示しています。

wellwelwel/lagune1732026年10月26日 更新

wellwelwel のスキルをすべて見る

このスキルの問題を報告する