ワンクリックで
typescript-as-go
Enforce agents to write TypeScript as if it were Go; simple, explicit, boring
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Enforce agents to write TypeScript as if it were Go; simple, explicit, boring
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | typescript-as-go |
| description | Enforce agents to write TypeScript as if it were Go; simple, explicit, boring |
| license | MIT |
| compatibility | Designed for Claude Code (or similar products) |
| metadata | {"author":"revett","repo":"https://github.com/revett/typescript-as-go","version":"0.5.1"} |
Write TypeScript as if it were Go: simple, explicit, boring. When you are unsure how to write something, ask what the dullest Go programmer would do, and do that. The goal is code that is fast to read and review, not clever to write. No magic.
As an agent working in this project, you must follow the following allowed and banned rules when writing Typescript, as well as the strict file layout rules.
settings-tab.ts), graduating to
package folders (settings/tab.ts) only once a concern outgrows a single production file
(tests always sit beside their code, so they never on their own trigger the split); the folder's
primary file repeats the package name (vault/vault.ts, like Go's bytes/bytes.go), never an
index.ts barrelget (owner(), not getOwner()), never stuttering the enclosing
package name in an exported symbol (vault.Reader, not vault.VaultReader), always camelCase or
PascalCase and never snake_casetype over interface for data shapes, since they are structs not contracts and a type cannot
be reopened by declaration merging; use interface only when a framework contract leaves no
choicetype Status = "open" | "closed"), keeping the
syntax erasable at build timeswitch that ends in a default asserting the union is exhausted (assertNever(x))satisfies to check a value conforms to a type at compile time without widening it, the
equivalent of Go's compile time interface checkDEFAULT_X constant) usable
as is without further initialization, never undefined shaped holesmap.has(k), k in obj,
x === undefined), never reading a falsy default as "missing"{ ok, value }), never a sentinel like -1, NaN, null, or "" folded into the normal
returnsettings: unknown theme "$name")if, even a one line bodytry/finally or a using declaration placed right where the resource is
acquired, so cleanup sits beside setup and cannot be forgotten on an early return// doc comment above every exported symbol, Go style
(// normalizeSettings returns ...)node:test and node:assert/strict and no test framework dependency,
each test sitting beside the code it covers as name.test.ts, mirroring Go's _test.go patternreturn from the block above it with a blank line, so the final result of a
function reads as its own beat rather than crowding the guard or loop that precedes it?? or ||; write the if, or reach for a
file local helper such as stringOr(v, fallback) or numberOr(v, fallback), so the fallback is
an explicit branch and not folded into an operator (|| stays fine inside a boolean condition)else after a returnswitch case fallthrough, every case ending in return or break, with stacked labels to
share a branchthrow (Go's panic) for impossible states and programmer
errors and never exposing it across a module boundary as an API-1, null, NaN, "") to signal failure or absenceinterface for plain data shapes/** */ blocks, use // commentsutils.ts (or any grab bag dumping ground)extends chains), compose instead.filter().map(), .map().filter()) and no .reduce; Go has no
map or filter, so write an explicit for...of that guards with continue and pushes into a
result, one readable loop over a pipeline (a single .map on an already clean list is fine)Every file declares its symbols in the same order, so a reader always knows where to look and a diff never argues about placement. Sort by kind first, then by export status within a kind, then alphabetically (case insensitive) within that:
Notes:
DEFAULT_X constant will therefore sit above the type it is annotated with; this is fine,
types hoist, and predictable placement is worth more than local reading order