maintainable-typescript
Installation
SKILL.md
Maintainable TypeScript
Use this skill when the project needs maintainability doctrine, not just local code changes.
Layout
doctrine/contains the portable rules and supporting guidance that should hold across strict TypeScript repos.stack/contains stack-specific doctrine for the opinionated Vite+ / Drizzle / oRPC / Cloudflare setup.prompts/contains reusable prompt text for cleanup and review tasks when you need to steer another model away from wrapper-heavy refactors.scripts/contains runnable TypeScript-repo audit helpers for dead code, duplicate code, and import-boundary problems in the current project.assets/tooling-templates/contains copyable config templates for target repos.
Reading order
Do not read the whole skill directory by default.
- Read this file first.
- Decide whether the task needs only portable rules or the full house stack.
- Load only the doctrine files relevant to the task.
- Treat the rest of the skill as reference material, not required context.
Default portable backbone:
doctrine/foundations/maintainability-equals-correctness.mddoctrine/abstractions/ssot-or-die.mddoctrine/testing/integration-first-testing.mddoctrine/testing/external-boundary-mocks-only.mddoctrine/testing/assert-observable-outcomes.md
If the repo matches the house stack, read stack/start-here.md before any stack-specific files.
Task Router
Use the smallest relevant set.
Cleanup, deletion, and refactor
doctrine/foundations/maintainability-equals-correctness.mddoctrine/foundations/write-for-the-agent-era.mddoctrine/deletion/clean-up-what-you-touch.mddoctrine/deletion/delete-obsolete-code.mddoctrine/deletion/no-backwards-compat-shims.mddoctrine/deletion/delete-fake-layers.mddoctrine/deletion/edit-real-owners.mddoctrine/abstractions/split-by-stable-seam.mddoctrine/foundations/your-pattern-will-be-copied.md- Prompt text for another model:
prompts/cleanup-module-rewrite.mdorprompts/review-structural-slop.md
Package boundaries and shared runtime code
doctrine/abstractions/split-by-stable-seam.mddoctrine/deletion/delete-fake-layers.mddoctrine/packages/monorepo-package-boundaries.mddoctrine/foundations/treat-critical-code-like-a-library.mddoctrine/foundations/naming-is-navigation.mddoctrine/packages/no-re-exports.mddoctrine/packages/no-barrel-exports.md
API, schemas, and OpenAPI
doctrine/abstractions/ssot-or-die.mdstack/design-openapi-for-inference.mdstack/errors-are-schema.mdstack/document-fields-in-derived-zod-schemas.mdstack/use-canonical-named-types.md
Types, constants, and documentation
doctrine/abstractions/ssot-or-die.mdstack/jsdoc-with-first-party-sources.mdstack/no-magic-values.mdstack/use-branded-scalar-types.mdstack/use-canonical-named-types.md
Testing and high-risk logic
doctrine/testing/integration-first-testing.mddoctrine/testing/external-boundary-mocks-only.mddoctrine/testing/contract-gate-synthetic-fixtures.mddoctrine/testing/assert-observable-outcomes.mddoctrine/testing/test-ai-apps-by-artifacts-not-prose.mddoctrine/foundations/treat-critical-code-like-a-library.mddoctrine/boundaries/no-type-casts.mddoctrine/boundaries/boundaries-validate-internals-trust.md
Frontend and React state
stack/do-not-synchronize-state-with-useeffect.mddoctrine/testing/external-boundary-mocks-only.mddoctrine/testing/contract-gate-synthetic-fixtures.mdstack/use-the-design-system-not-ad-hoc-tailwind.mdstack/test-react-apps-in-real-browsers.md
Toolchain, dependencies, and database workflow
stack/stack-overview.mdstack/catalog-dependencies.mdstack/schema-migrations-are-generated.mddoctrine/packages/use-mature-dependencies-dont-roll-your-own.mddoctrine/tooling/maintainability-tooling.md
Full doctrine review or editing this skill itself
Audit workflow
When the task is cleanup or review, resolve the skill directory first and then run:
skill_dir="<path-to-this-skill>"
bash "$skill_dir/scripts/audit-typescript-repo.sh" .
Treat audit output as signal, not authority. Check real usage before deleting API surface or collapsing a pattern.
If the target repo is Vite+, use vp for the normal toolchain entrypoint: vp lint, vp test, vp fmt, vp pack, vp add, and vp dlx.
Defaults
- Code is cheap. Structure is expensive.
- Preserve contracts, tests, and invariants, not stale decomposition.
- Prefer deletion over shims.
- Prefer stable subsystem files over one-helper-per-file trees.
- Prefer derived types and schemas over handwritten duplicates.
- Prefer durable tests that attach regressions to real product boundaries.
- Prefer slice integration tests over internally mocked unit tests.
- Prefer mocking only external systems you do not control.
- Prefer contract-gated synthetic fixtures over handwritten unchecked JSON.
- Prefer assertions on rendered output, HTTP behavior, persisted state, and published artifacts over helper call order.
- Prefer mature tooling for dead code, duplication, and dependency boundaries over manual inspection.
- Prefer making the codebase more coherent now over promising to clean it up later.
Related skills