ts-code-quality
Skill0 starsChanged 2 months agoMITView on GitHub
Guides agents in applying idiomatic TypeScript architecture: discriminating unions, readonly immutability, branded types, and zero any.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- udohjeremiah/skillstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- udohjeremiah/skills★ 1same 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.
In this repository49 other files it gives its agents.
- bug-reproducerSkill
- claim-checkerSkill
- command-failure-diagnoserSkill
- config-risk-reviewerSkill
- csv-validatorSkill
- deployment-checklist-makerSkill
- diff-reviewerSkill
- factual-summarizerSkill
- field-extractorSkill
- api-contract-testerSkill
- database-migration-helperSkill
- security-vulnerability-fixerSkill
- git-commit-stagerSkill
- git-conflict-resolverSkill
- github-actions-debuggerSkill
- github-issue-triagerSkill
- github-pr-creatorSkill
- github-pr-reviewerSkill
- go-code-qualitySkill
- go-lint-and-vetSkill
- go-testingSkill
- json-schema-converterSkill
- lint-and-typecheckSkill
- meaning-preserving-editorSkill
- meeting-notes-to-actionsSkill
- minimal-bug-fixSkill
- option-comparatorSkill
- py-code-qualitySkill
- py-lint-and-typecheckSkill
- py-testingSkill
- readme-writerSkill
- regression-test-writerSkill
- release-notes-drafterSkill
- repo-inspectorSkill
- research-briefSkill
- reversible-cleanup-plannerSkill
- rust-clippy-checkSkill
- rust-code-qualitySkill
- rust-testingSkill
- small-refactorSkill
- status-updateSkill
- step-by-step-tutorialSkill
- step-decomposerSkill
- tabular-analyzerSkill
- task-briefSkill
- test-runner-debuggerSkill
- ts-lint-and-typecheckSkill
- ts-testingSkill
- skill-templateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use to run unit tests.
- Very specific: line 21
Do not use to fix immediate syntax compiler errors.
- Distinctive: line 28
If no goal is specified: review the file against standard TypeScript code quality invariants.
- Distinctive: line 29
Never introduce runtime overhead or change public function behavior.
- Distinctive: line 32
Follow these numbered actions:
- Very specific: line 34
Search for any, non-null assertions (!), and conflicting booleans.
- Very specific: line 38
Add readonly to interface properties and ReadonlyArray<T> to prevented accidental mutation.
- Very specific: line 40
Use assertNever(value: never) in default branches.
- Very specific: line 42
Run npx tsc --noEmit and npm test.
- Very specific: line 45
If an array is passed as parameter and not mutated: type as readonly T[].
- Very specific: line 46
If an object is configuration data: use as const assertion.
- Distinctive: line 75
Stop and ask the user when:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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 Code Quality & Idioms
Enforces high-standard TypeScript practices: discriminating unions over loose booleans, readonly immutability, unknown over any, and exhaustive pattern matching.
1. Purpose
Elevate TypeScript code quality and maintainability. A "Discriminating Union" uses a literal tag (e.g. type: 'success' | 'error') to guarantee complete type narrowing at compile time.
2. When to Use
Use this skill when:
- Designing API response types, domain models, or state reducers.
- Refactoring complex state objects with multiple conflicting boolean flags (
isLoading,isError,isSuccess). - Removing legacy
anytypes and replacing with safe generic or unknown types.
3. When Not to Use
- Do not use to run unit tests; use
ts-testing. - Do not use to fix immediate syntax compiler errors; use
ts-lint-and-typecheck.
4. Required Inputs
target_file: Path to the TypeScript file to review or improve.improvement_goal: Architectural improvement (e.g. "Model state as discriminating union").
5. Missing-Input Behavior
- If no goal is specified: review the file against standard TypeScript code quality invariants.
- Never introduce runtime overhead or change public function behavior.
6. Procedure
Follow these numbered actions:
- Action 1: Audit for Anti-Patterns
- Search for
any, non-null assertions (!), and conflicting booleans.
- Search for
- Action 2: Apply Discriminating Unions
- Replace conflicting boolean flags with single tagged unions.
- Action 3: Apply Immutability
- Add
readonlyto interface properties andReadonlyArray<T>to prevented accidental mutation.
- Add
- Action 4: Add Exhaustive Switch Checks
- Use
assertNever(value: never)in default branches.
- Use
- Action 5: Verify Type-Check and Tests
- Run
npx tsc --noEmitandnpm test.
- Run
7. Decision Rules
- If an array is passed as parameter and not mutated: type as
readonly T[]. - If an object is configuration data: use
as constassertion.
8. Output Format
Emit the report using this template:
### TypeScript Code Quality Report: [Target File]
- **File Modified**: `[path]`
- **Patterns Applied**: [e.g., Discriminating Unions, Readonly Immutability]
- **Type-Check Status**: PASS
- **Test Status**: PASS
#### Improvements Made
- [Improvement 1 with rationale]
- [Improvement 2 with rationale]9. Verification Checklist
- Zero
anytypes remain in modified code. - Discriminating unions replace loose boolean states.
tsc --noEmitpasses cleanly.- Existing tests pass without regression.
10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
| Missing case in union | Adding new union member | Add default: assertNever(x) to catch unhandled cases at compile time. |
11. Stop or Escalation Conditions
Stop and ask the user when:
- Proposed refactor breaks database serialization formats.
12. Examples
Example 1: Successful Execution
Input:
File: src/state.ts
Issue: State has { isLoading: boolean, error?: string, data?: User }
Goal: Convert to Discriminating UnionOutput:
### TypeScript Code Quality Report: src/state.ts
- **File Modified**: `src/state.ts`
- **Patterns Applied**: Discriminating Unions
- **Type-Check Status**: PASS
- **Test Status**: PASS
#### Improvements Made
- Replaced 3 optional properties with typed union:
```typescript
type AsyncState<T> =
| { status: 'idle' }
| { status: 'loading' }
| { status: 'success'; data: T }
| { status: 'error'; error: Error };- Eliminates impossible states (e.g.
isLoading: truewithdatadefined).
### Example 2: Ambiguous or Missing Input
**Input:**
```text
Make my TS better.Output:
### TypeScript Code Quality Report: Halted - Missing File
- **Status**: Halted
Please specify the TypeScript file you would like to improve.Example 3: Expected Final Output
Output:
### TypeScript Code Quality Report: src/options.ts
- **File Modified**: `src/options.ts`
- **Patterns Applied**: Readonly Immutability & `as const`
- **Type-Check Status**: PASS
- **Test Status**: PASS
#### Improvements Made
- Added `readonly` modifier to configuration options interface.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.

