AGENT SKILL

chestertons-fence

Ask why a convention exists, and whether that reason holds here, before copying, keeping or removing it. Record the verdict as an ADR or refusals row. Use when a design, review or PR cites prior art. Use when borrowing a pattern from another tool. Use when someone asks why we do X or proposes deleting it. Repo-only; never shipped.

License 许可
GPL-3.0
所属仓库
egladman/magus
最近更新
2026-11-14
Stars
★ 3
Forks
0

01 前言 Front Matter

name
chestertons-fence
metadata
{ "source": "workspace" }
description
Ask why a convention exists, and whether that reason holds here, before copying, keeping or removing it. Record the verdict as an ADR or refusals row. Use when a design, review or PR cites prior art. Use when borrowing a pattern from another tool. Use when someone asks why we do X or proposes deleting it. Repo-only; never shipped.

03 SKILL.md 正文

Chesterton's fence

Chesterton's fence says: do not remove a fence until you know why it was put up. Here the test runs both ways. Before you keep a convention, or copy one from another tool, find the reason it exists and check that the reason holds in this repo.

Prior art is input, never justification (Capability is not a reason). "Go does it" says the idea exists. It says nothing about the failure it removes here.

The five questions

  1. What does the convention do? State it as one claim.
  2. What failure did it remove where it started? Cite a source you fetched or a file:line you read.
  3. Does that failure exist here? Show it: a file:line, a ./magus run, a test.
  4. What does it cost here: code, a step, a flag, a reader's attention?
  5. What would prove the verdict wrong?

Say unknown for any answer you did not verify. An unknown in question 2 or 3 blocks a keep that rests on it.

Output

One block per convention:

claim:     <one sentence>
evidence:  <URL fetched or file:line, one per fact>
verdict:   keep | change | refuse
falsifier: <the observation that would reverse it>

Where the verdict lands

  • keep or change of a design decision: an ADR under docs/decisions/. Load idiomatic-adrs first.
  • refuse, or a removal: a row in docs/design/refusals.md, with what decided it and where to check.
  • Never only in chat. A verdict nobody can find gets argued again.

Reopen a recorded verdict only with new evidence, and change its page in the same commit.

Worked example: type declarations and error cascades in Buzz

Question: TypeScript shows errors in waves and ships .d.ts files. Should Buzz copy either?

TypeScript:

  • An export's type can be inferred from another file. Emitting a declaration then needs the checker to follow imports and infer (5.5 release notes, Isolated Declarations). So a fix upstream changes what a downstream file sees.
  • tsc -b acts as if noEmitOnError is on for every project (project references). Whether it skips dependents of a failed project: unknown, the page does not say.
  • How tsc suppresses an error after an earlier one (an error type): unknown, not fetched.
  • .d.ts exists to type existing JavaScript, most often "an npm package with no types" (declaration files).
  • TypeScript 7 is the Go port (typescript-go). Whether it changes cascade behavior: unknown.

Go:

  • Every parameter and result carries an explicit type, and := infers only locals inside functions (spec).
  • Compiled packages carry export data, so a client reads only P's output, never P's dependencies (cmd/compile).
  • The compiler stops at 10 errors; -e removes the cap (same page).

Buzz here:

  • Users write no declarations. Host module signatures are generated from Go: internal/spell/gen/decls/fs.buzz:1 reads "Code generated by magus-utils moduledecls", an output of .:spells-generate.
  • The checker has a tracking-failure type, Unknown, compatible with everything (libs/gopherbuzz/types/types.go:29, :210). Member access on it passes silently (libs/gopherbuzz/checker.go:2385).
  • An undefined name returns Any, not Unknown (libs/gopherbuzz/checker.go:1844), and member access on Any is an error (libs/gopherbuzz/checker.go:2387). So missing.name reports BZZ1001 at 4:15 and "any is not field accessible" at 4:22, both from one mistake (./magus buzz --check, observed 2026-10-29).
  • There is no error cap. --check prints every error; a compile reports the first (libs/gopherbuzz/session.go:1054).
claim:     Buzz needs no hand-written declaration files.
evidence:  internal/spell/gen/decls/fs.buzz:1; Go spec (explicit signatures)
verdict:   keep (refuse a .d.ts analogue)
falsifier: a Buzz user has to type a module that magus did not generate

claim:     the checker suppresses cascades after the first error.
evidence:  types.go:210 (Unknown is quiet); checker.go:1844 and :2387 (Any is not)
verdict:   change: an undefined name should yield Unknown
falsifier: a test that pins Any for an undefined name, or upstream Buzz doing the same

04 同仓库更多 Skills