typescript-package
Skill4 starsChanged 4 months agoMITView on GitHub
minpeter's house style for building and reviewing TypeScript packages and monorepos. The locked stack: pnpm (latest) + Turborepo + Changesets + Biome via the ultracite preset with ZERO ignores/overrides/suppressions + tsdown for builds + Vitest, with `tsc --noEmit` for type-checking, the namespaced source-condition for zero-build internal deps, and MANDATORY npm OIDC trusted publishing (no NPM_TOKEN). Use this when scaffolding a new TS library or monorepo, adding a workspace package, choosing build/lint/publish tooling, or reviewing an existing package.json / tsconfig / biome.jsonc / turbo.json / CI for consistency with this style. Copy-paste config lives in references/templates.md; the source-condition deep-dive + external verdict in references/source-condition.md; the OIDC publishing guide in references/publishing-oidc.md.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- capturing-ui-screenshotsSkill
- hermes-agent-consultSkill
- minpeter-skills-maintainerSkill
- tool-schema-designSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 25
Every choice below was distilled from minpeter's own repos and then checked against current ecosystem best practice (see the verdicts in …
- Distinctive: line 92
Instead of overriding it (what the older repos did), expose subpath exports that point at real modules (§5).
- Very specific: line 109
Default to ESM-only ("type": "module", exports use import).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
TypeScript package style (minpeter)
An opinionated, locked toolchain for TypeScript libraries and monorepos.
"Locked" means: don't re-litigate these per project — they are the defaults.
Every choice below was distilled from minpeter's own repos and then checked
against current ecosystem best practice (see the verdicts in references/).
The locked stack
| Concern | Choice (no substitutes) |
| Package manager | pnpm latest, with the resolved version recorded in packageManager |
| Monorepo | pnpm workspaces + Turborepo latest |
| Lint + format | Biome latest via ultracite latest — zero ignores (§3) |
| Type-check | tsc --noEmit only — never emit JS with tsc |
| Build | tsdown latest — not tsup, not raw tsc |
| Internal deps | namespaced source-condition @minpeter/source (§5) |
| Tests | Vitest latest + v8 coverage |
| Versioning | Changesets |
| Publish | npm OIDC trusted publishing, mandatory (§6) |
| TS compiler | TypeScript latest stable |
| Filenames | kebab-case (enforced by ultracite) |
If you find ESLint, Prettier, tsup, npm/yarn lockfiles, a long-lived
NPM_TOKEN, or// biome-ignorecomments → that's not this style. Flag it.
1. Decision: single package vs monorepo
One publishable thing → SINGLE-PACKAGE repo (src/ at root). No turbo, no source-condition.
Several related pkgs → MONOREPO (packages/*, turbo, source-condition for internal deps).2. Scaffold checklist
pnpm-workspace.yamlwithpackages: ["packages/*"](omit for single pkg); put pnpm settings (onlyBuiltDependencies,verifyDepsBeforeRun) here, not.npmrc.- Resolve the toolchain at scaffold time:
corepack use pnpm@latest, install all dev tools with@latest, then keep the resolvedpackageManager, dependency ranges, and lockfile that pnpm writes. tsconfig.base.json(shared strict options) + roottsconfig.json(noEmit,customConditions) +tsconfig.build.json(NO custom condition).biome.jsonc= justextends: ["ultracite/biome/core", "ultracite/biome/vitest"]. Nothing else (§3).- tsdown per package;
tsc --noEmitfor typecheck. - Per-package
package.json:type: module,sideEffects: false,exportswith the source-condition (§5),publishConfig.provenance: true. .changeset/config.json,turbo.json,vitest.config.ts.- CI (
ci.yml: lint → typecheck → test → build → attw) andrelease.yml(Changesets + OIDC, §6).
→ All file contents are in references/templates.md. Copy them verbatim.
3. Biome via ultracite — ZERO ignores (hard rule)
The whole biome.jsonc is two lines of intent:
{
"$schema": "https://biomejs.dev/schemas/<installed-biome-version>/schema.json",
"extends": ["ultracite/biome/core", "ultracite/biome/vitest"]
}No files.includes ignores. No overrides. No rule "off". No
// biome-ignore / // biome-ignore-all comments. ultracite is already very
strict and already relaxes the right things itself (tests, *.config.ts,
*.d.ts, generated/build dirs, noConsole off). Adding exceptions is how a
style guide rots — the rule here is fix the code, not the config.
Practical consequences (this is why zero-ignore works cleanly):
- No barrel files. ultracite's
noBarrelFilefires on re-export-only files. Instead of overriding it (what the older repos did), expose subpath exports that point at real modules (§5). This is also better for tree-shaking — the rule is steering you correctly. - kebab-case filenames,
interfaceovertype, noenum(const objects / unions), noany, no!,node:import protocol, type-onlyimport type/export type— all enforced; just write to them. - Worktree/scratch dirs (
.omx,.omo) → put them in.gitignore; ultracite setsvcs.useIgnoreFile: true, so Biome skips them without a Biome ignore.
See references/templates.md for the full list of what ultracite enforces.
4. Build with tsdown + tsc --noEmit
- tsdown (Rolldown/Oxc based — the modern successor to tsup) is the only
build tool.
dts: true,sourcemap: true,unbundle: truefor file-per-module output (pairs well with subpath exports). tscnever emits."typecheck": "tsc --noEmit". The bundler owns output.- Default to ESM-only (
"type": "module", exports useimport). Ship CJS only if you actually have CJS consumers — and then nesttypescorrectly per branch (.d.tsvs.d.cts); see the dual template.
5. Internal deps: the namespaced source-condition (monorepo only)
Verdict: keep it. It's the Colin McDonnell / TypeScript-endorsed way to get
zero-build "live types" across a monorepo, and unlike publishConfig.exports it's
package-manager-agnostic. But it has sharp edges — wire all four of these or it
silently resolves to stale dist:
// each publishable package's package.json — condition FIRST, then types, then import
"exports": {
"./package.json": "./package.json",
".": {
"@minpeter/source": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
}- Root
tsconfig.json:"customConditions": ["@minpeter/source"](editor +tsc --noEmitresolve to source). - Build config (
tsconfig.build.json, used by tsdown): must NOT carry the condition, or your.d.tsresolves sibling deps to.ts. - tsx:
tsx --conditions @minpeter/source(tsx does not read tsconfig — it'll silently miss otherwise). - Vitest:
resolve: { conditions: ["@minpeter/source"] }.
Guardrails (non-negotiable):
- Namespace the condition (
@minpeter/source, never baresource) so it can't collide. - TypeScript does not error if the
srcfile is missing — it silently falls back. So runattw --pack(@arethetypeswrong/cli) in CI on every publishable package to prove external consumers get correctdisttypes.
Full rationale, the contested history, every footgun, and citations:
references/source-condition.md. (Single-package repos: skip all of this.)
6. Publish: npm OIDC trusted publishing (mandatory)
No NPM_TOKEN. Ever. Releases authenticate via GitHub OIDC; provenance is
attached automatically.
- Release job needs
permissions: { id-token: write, contents: read }, the Node runtime currently recommended by npm's trusted-publishing docs, andnpm@latestinstalled immediately before publishing. - Repo-level gate: Settings → Actions → General → Workflow permissions →
enable "Allow GitHub Actions to create and approve pull requests". New repos
default to read-only with PR creation off; without this, the CI run that opens
the Version Packages PR fails with 403 even when the workflow declares
pull-requests: write. changeset publishworks under OIDC; do not setNODE_AUTH_TOKENon the publish step (npm only uses OIDC when the auth token env is unset).publishConfig: { "access": "public", "provenance": true }per package.- One-time setup: configure the package's Trusted Publisher on npmjs.com (org/user + repo + workflow filename). Caveat: OIDC can't publish a package's first ever version — do the initial publish with a token, then switch to OIDC.
Step-by-step + the release workflow: references/publishing-oidc.md.
7. Review checklist (use when auditing an existing repo)
- pnpm resolved from latest and recorded in
packageManager;pnpm-workspace.yamlholds pnpm settings biome.jsoncextends ultracite and has zero overrides/ignores/biome-ignore- No barrel files; public API via subpath exports
- Build is tsdown;
tscis--noEmitonly - (monorepo) source-condition wired in all 4 places; build tsconfig has none;
attwin CI exportsorder: custom condition →types→import/require(types nested per branch if dual)type: module,sideEffects: false,files: ["dist"],publishConfig.provenance: true- Release uses OIDC (
id-token: write), noNPM_TOKEN, current npm trusted-publishing runtime guidance, andnpm@latest - kebab-case filenames;
interfaceovertype; noenum/any/!;node:imports - Vitest + v8 coverage; Changesets configured
NOT this style (flag in review)
ESLint / Prettier · tsup or raw-tsc library builds · npm/yarn/bun lockfiles ·
NPM_TOKEN secret for publishing · // biome-ignore or biome overrides ·
barrel index.ts re-export files · default-export-heavy modules ·
PascalCase/snake_case filenames · enum · any · non-null !.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

