principle-type-system-discipline
Skill2 starsChanged 29 days agoMITView on GitHub
Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas.
Files
Type System Discipline
Make the compiler reject impossible states, mismatched primitives, and unhandled variants. For TypeScript syntax, see typescript-best-practices.
- Make illegal states unrepresentable. Model variants as sum types (discriminated unions, enums with payloads, sealed classes) instead of optional-field bags that admit contradictory combinations:
{ kind: 'open' } | { kind: 'done'; at: Date }. - Types are constructions, not restrictions. Build valid shapes instead of carving values out of a looser type with checks. A non-empty list is a head plus a rest; a valid time range is a start plus a duration. Expose the interface callers need.
- Brand semantic primitives. Give
UserIdandOrderIddistinct brands or newtypes even if both are strings. If arguments share a primitive type but mean different things, brand them. Validate once at creation; trust the type downstream. - External data is untyped until parsed. Parse RPC payloads, JSON, IPC messages, CLI args, config, environment variables, and database rows into domain types at every boundary. See boundary-discipline for validation placement.
- Don't lie to the type system. Validate, narrow, or refine the model instead of bypassing the compiler with unsafe casts, coercions, or assertions. Trace each
any,as, orassertNotNullto the boundary and validate there. - Exhaustive matching is the compiler's job. Matches on sum types must fail compilation when a new variant is unhandled. Use the language's exhaustiveness idiom, such as a
never-typed binding in TypeScript. - Derive types from authoritative schemas. Derive from whichever protocol, API schema, database migration, or design-token file owns the shape instead of maintaining a parallel type. See encode-lessons-in-structure.
- Strengthen a type only where partiality appears. Push runtime assertions, null checks, or impossible-state throws into the type, then stop. Track cases callers must handle, not maximum data precision. Prefer total functions:
sumof an empty list is 0, so it takes a plain list;headneeds a non-empty one. If nothing would otherwise panic, keep the plain type.
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 41
- backnotprop/pstack★ 3.3k33% same
- jtaroreh/agystack★ 12816% same
- uzairansaruzi/p3-stack★ 12617% same
- dsebban/skills★ 7132% same
- Scino/fstack★ 1816% same
- creedants/pstack-t3★ 1729% same
- kkgogogo17/pi-pstack★ 916% same
- mariusflorescu/pstack-t3★ 929% same
- adjohn/pstack★ 417% same
- alexnthnz/keel★ 429% same
31 more not listed
Wrote their own version · 3
- TheOnlyFusionCube/potetos-for-everyone★ 18same name
- maxatwork/skills★ 1same name
- 3metaJun/mstack★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use poteto-mode, setup-pstack and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
jtarorehSkillpoteto-mode
poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work. Use for poteto, /poteto-mode, or requests to work in this style.
Also in 5 projects that use this
bnemaSkillsetup-pstack
Configure which Pi models pstack uses per role. Detects available provider/model specs and writes pstack's user configuration. Use for /setup-pstack, "configure pstack models", or changing pstack model choices.
Also in 22 projects that use this
Xia-AtaraxiaSkillmake-bot-ui
Builds a small web page whose buttons wake an agent over a webhook: a local server keeps the sender key server-side and POSTs JSON to a webhook-triggered routine, and the page is exposed on the existing Tailscale node. Use for \"make a bot UI\", \"a dashboard with buttons that trigger the agent\", \"wake the bot from a page\", handing a webhook sender key to the server without pasting it in chat, or putting that UI on the tailnet. Not for general frontend work - use principle-frontend; not for tailnet health or reachability - use tailscale.
Also in 15 projects that use this
ianclearySkillpoteto-help
Guides users through pstack setup, /poteto-mode, and picking the skill, playbook, or principle for a task. Type /poteto-help with a question.
Also in 8 projects that use this
In this repository57 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architectSkill
- arenaSkill
- automate-meSkill
- benchmark-checklistSkill
- blast-radiusSkill
- broSkill
- correctSkill
- create-formal-verification-skillSkill
- create-verification-skillSkill
- figure-it-outSkill
- herdr-workflowSkill
- howSkill
- interrogateSkill
- in-your-own-wordsSkill
- ketchupSkill
- maintain-formal-verification-skillSkill
- maintain-verification-skillSkill
- no-commentsSkill
- principle-attack-the-premiseSkill
- principle-boundary-disciplineSkill
- principle-build-the-leverSkill
- principle-encode-lessons-in-structureSkill
- principle-exhaust-the-design-spaceSkill
- principle-experience-firstSkill
- principle-explain-the-numberSkill
- principle-fix-root-causesSkill
- principle-foundational-thinkingSkill
- principle-guard-the-context-windowSkill
- principle-laziness-protocolSkill
- principle-make-operations-idempotentSkill
- principle-migrate-callers-then-delete-legacy-apisSkill
- principle-minimize-reader-loadSkill
- principle-model-the-domainSkill
- principle-never-block-on-the-humanSkill
- principle-outcome-oriented-executionSkill
- principle-prove-it-worksSkill
- principle-redesign-from-first-principlesSkill
- principle-separate-before-serializing-shared-stateSkill
- principle-sequence-verifiable-unitsSkill
- principle-subtract-before-you-addSkill
- principle-test-behavior-not-implementationSkill
- python-best-practicesSkill
- recallSkill
- reflectSkill
- setup-zstackSkill
- sharpenSkill
- show-me-your-workSkill
- statechartSkill
- swarmSkill
- tddSkill
- teachSkill
- technical-writingSkill
- typescript-best-practicesSkill
- unslopSkill
- whySkill
- z-modeSkill
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.

