Skip to content
Agentmart
Submit a tool

typescript-clean-code

Clean Code for TypeScript — code smell catalogs (Martin's per-line heuristics, Fowler's change-shape smells, TypeScript-native type smells), a linter-first…

Skill by bmad-labs

IndexedMIT★ 18
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/bmad-labs-typescript-clean-code

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Clean Code for TypeScript — code smell catalogs (Martin's per-line heuristics, Fowler's change-shape smells, TypeScript-native type smells), a linter-first detection policy, and step-by-step review, refactoring, TDD, and estimation workflows. Use when the user: - Writes, reviews, or refactors TypeScript/JavaScript code, or asks whether code is clean, maintainable, or well-designed - Names a smell — Shotgun Surgery, Feature Envy, Data Clumps, Long Method, Divergent Change, Duplicated Code, Large Class, Long Parameter List, Primitive Obsession, Message Chains, Dead Code, Speculative Generality, god class, copy-paste, stringly typed, premature abstraction - Asks about TypeScript type hygiene — `any` leakage, `as` assertions, non-null `!`, discriminated unions, exhaustiveness, strict flags, branded types - Asks what to enforce with lint or tsconfig versus what needs judgment, or names knip, jscpd, dependency-cruiser, typescript-eslint, type-coverage - Runs TDD, fixes a bug with test coverage, or plans test strategy - Estimates tasks, negotiates a deadline, or works through a commitment or team problem

Use cases: testing, data, writing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 26, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/typescript-clean-code

What's inside

Skill name
typescript-clean-code
Description
Clean Code for TypeScript — code smell catalogs (Martin's per-line heuristics, Fowler's change-shape smells, TypeScript-native type smells), a linter-first detection policy, and step-by-step review, refactoring, TDD, and estimation workflows. Use when the user: - Writes, reviews, or refactors TypeScript/JavaScript code, or asks whether code is clean, maintainable, or well-designed - Names a smell — Shotgun Surgery, Feature Envy, Data Clumps, Long Method, Divergent Change, Duplicated Code, Large Class, Long Parameter List, Primitive Obsession, Message Chains, Dead Code, Speculative Generality, god class, copy-paste, stringly typed, premature abstraction - Asks about TypeScript type hygiene — `any` leakage, `as` assertions, non-null `!`, discriminated unions, exhaustiveness, strict flags, branded types - Asks what to enforce with lint or tsconfig versus what needs judgment, or names knip, jscpd, dependency-cruiser, typescript-eslint, type-coverage - Runs TDD, fixes a bug with test coverage, or plans test strategy - Estimates tasks, negotiates a deadline, or works through a commitment or team problem
License
MIT
Instructions
96 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • description: longer than 1024 characters

Files (109)

  • LICENSE
  • SKILL.md
  • guidelines.md
  • progress.md
  • examples.md · references/acceptance-testing/
  • knowledge.md · references/acceptance-testing/
  • rules.md · references/acceptance-testing/
  • examples.md · references/classes/
  • knowledge.md · references/classes/
  • rules.md · references/classes/
  • examples.md · references/coding-practices/
  • knowledge.md · references/coding-practices/
  • rules.md · references/coding-practices/
  • examples.md · references/collaboration/
  • knowledge.md · references/collaboration/
  • rules.md · references/collaboration/
  • examples.md · references/comments/
  • knowledge.md · references/comments/
  • rules.md · references/comments/
  • examples.md · references/commitment/
  • knowledge.md · references/commitment/
  • rules.md · references/commitment/
  • examples.md · references/error-handling/
  • knowledge.md · references/error-handling/
  • rules.md · references/error-handling/
  • examples.md · references/estimation/
  • knowledge.md · references/estimation/
  • rules.md · references/estimation/
  • examples.md · references/formatting/
  • knowledge.md · references/formatting/
  • rules.md · references/formatting/
  • checklist.md · references/functions/
  • examples.md · references/functions/
  • knowledge.md · references/functions/
  • rules.md · references/functions/
  • examples.md · references/naming/
  • knowledge.md · references/naming/
  • rules.md · references/naming/
  • examples.md · references/practicing/
  • knowledge.md · references/practicing/
  • rules.md · references/practicing/
  • examples.md · references/pressure/
  • knowledge.md · references/pressure/
  • rules.md · references/pressure/
  • examples.md · references/professionalism/
  • knowledge.md · references/professionalism/
  • rules.md · references/professionalism/
  • examples.md · references/saying-no/
  • knowledge.md · references/saying-no/
  • rules.md · references/saying-no/
  • examples.md · references/smells/
  • fowler.md · references/smells/
  • knowledge.md · references/smells/
  • rules.md · references/smells/
  • tooling.md · references/smells/
  • typescript.md · references/smells/
  • examples.md · references/tdd/
  • knowledge.md · references/tdd/
  • rules.md · references/tdd/
  • examples.md · references/testing-strategies/
  • …and 49 more

SKILL.md (first lines)

# Clean Code

## The twelve change-shape smells

Shotgun Surgery · Feature Envy · Data Clumps · Long Method · Divergent Change ·
Duplicated Code · Large Class · Long Parameter List · Primitive Obsession ·
Message Chains · Dead Code · Speculative Generality

You know each one and its refactoring. The value is the checklist, not the
definitions — without the names a diff "looks fine"; with them you find the shape.
Run all twelve against any change you review or write.

## The smell catalog has four layers

Each examines a different unit, so each sees what the others miss.

| Load | Unit | For |
|------|------|-----|
| `references/smells/tooling.md` | the repository | **First, in every review.** Which smells a linter decides, so those become one "wire this into CI" finding instead of twenty hand-written ones |
| `references/smells/rules.md` | a line, a function | Per-line heuristics (C/E/F/G/N/T), plus the review posture and severity vocabulary that govern all four layers |
| `references/smells/fowler.md` | a modification | The twelve above — detection question, TypeScript remedy, and **when NOT to fix** for each |
| `references/smells/typescript.md` | a type | TS1-TS10: `any` leakage, assertion versus validation, exhaustiveness, strictness flags, branded types |

A diff can satisfy every rule in `rules.md` and still be badly shaped — that is what
`fowler.md` is for. Reviewing a change means all four.

## Review posture

Three rules that change output more than any catalog entry. Full text in
`references/smells/rules.md` → "Review posture".

1. **Approve when the change improves code health**, not when it is perfect. There
   is no perfect code, only better code.
2. **A correct finding nobody acts on is a false positive.** Scan broadly, report
   selectively — three actionable findings beat twenty true ones.
3. **Mark polish as ignorable.** Conventional Comments labels — `issue`,
   `suggestion`, `nitpick`, `question`, `praise` — with `(blocking)` /
   `(non-blocking)`. An author who cannot tell which comments are optional treats
   all of them as mandatory, or none of them.

**A review is done when** all four layers have run, every surviving finding carries
a label and (for an `issue`) a fix, and the report states how many findings were cut
as unlikely to be acted on.

## Contested rules

Three rules in these references are positions with live counter-arguments, marked
**contested** where they appear. Present both sides and prefer the author's
demonstrated reasoning over the number:

- **Function length** — `references/functions/rules.md` Rule 1. Detect by *"can I
  name each section?"*; the "2-5 lines" figure over-extracts when applied literally.
- **Comments** — `references/comments/rules.md`. Keep rationale, invariants, and
  non-obvious why; delete restatement and stale comments.
- **G23 polymorphism** — `references/smells/rules.md`. An exhaustive `switch` over a
  discriminated union is idiomatic TypeScript, not a smell.

## Workflows

Load the `workflow.md`, then its step files in order. Each step names the references
it needs and updates `stepsCompleted` in the output document's frontmatter, so a
compacted context resumes from the last completed step via `step-01b-continue.md`.

| Workflow | For |
|----------|-----|
| `workflows/code-review/workflow.md` | Reviewing code for quality |
| `workflows/pr-review/workflow.md` | Reviewing pull requests |
| `workflows/refactoring/workflow.md` | Safe refactoring with tests (step 3 sweeps all twelve; steps 5-8 loop) |
| `workflows/tdd.md` | Test-driven development cycle |
| `workflows/new-feature.md` | Building new functionality |
| `workflows/bug-fix.md` | Fixing bugs properly |
| `workflows/test-strategy.md` | Planning test coverage |
| `workflows/estimation.md` | Estimating tasks (PERT) |
| `workflows/deadline-negotiation.md` | Handling unrealistic deadlines |

## References

`references/<topic>/` holds `rules.md` (the rules), `examples.md` (curated
TypeScript bad/good pairs — prefer these over inventing your own), and
`knowledge.md` (concepts).

**Code quality**: naming · functions · classes · comments · error-handling ·
unit-tests · formatting · smells

**Professional practice**: professionalism · saying-no · commitment ·
coding-practices · tdd · practicing · acceptance-testing · testing-strategies ·
time-management · estimation · pressure · collaboration

Load the topic's `rules.md` before advising on it, and cite the rule you applied —
the design problem it names, not the metric that pointed at it. Where a reference
contradicts your general knowledge, the reference wins: it carries this skill's
TypeScript adaptations and thresholds.

`guidelines.md` maps symptom → reference file and task → workflow.

From bmad-labs/skills, MIT.

More from bmad-labs/skills

Signals

Stars
18
Forks
4
Open issues
0
Last commit (this folder)
Sep 15, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from bmad-labs

Cite this page

typescript-clean-code skill. Agent Mart. https://agentmart.dev/skills/bmad-labs-typescript-clean-code (last updated 2026-10-24)