typescript-clean-code by bmad-labs/skills
npx skills add https://github.com/bmad-labs/skills --skill typescript-clean-code面向 TypeScript 开发者的原则、实践和工作流程。
在应用任何原则或提出任何建议之前,务必加载并查阅参考文件。 本技能中的参考资料包含了来自 Robert C. Martin 书籍的精选权威知识,并针对 TypeScript 进行了调整。当此技能激活时:
references/ 目录加载相关的 rules.md 和 examples.md 文件。不要仅依赖通用知识。references/functions/rules.md 规则 1:保持函数短小,2-5 行最佳"),以便用户可以追溯指导的来源。references/[topic]/examples.md 中的坏/好代码示例,而不是自己生成。这些示例是针对 TypeScript 精选的,并展示了预期的确切模式。不要跳过加载参考资料。 即使你"知道"整洁代码原则,参考文件也包含特定的 TypeScript 调整、阈值、检查清单和代码异味目录,这些可能与你的通用知识不完全匹配。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
guidelines.md → 找到正确的工作流程 → 加载它 → 遵循每个步骤(加载引用的文件)rules.md 和 examples.md 文件 → 应用它们常见任务的逐步流程:
| 工作流程 | 何时使用 |
|---|---|
workflows/code-review/workflow.md | 审查代码质量 |
workflows/pr-review/workflow.md | 审查拉取请求 |
workflows/tdd.md | 测试驱动开发周期 |
workflows/refactoring/workflow.md | 使用测试进行安全重构 |
workflows/new-feature.md | 构建新功能 |
workflows/bug-fix.md | 正确修复错误 |
workflows/test-strategy.md | 规划测试覆盖 |
workflows/estimation.md | 估算任务(PERT) |
workflows/deadline-negotiation.md | 处理不切实际的截止日期 |
代码审查、PR 审查和重构工作流程使用步骤-文件架构来实现上下文安全的执行:
workflow.md 入口点,描述步骤并加载 steps/step-01-init.mdsteps/ 目录中的一个单独文件,按顺序加载stepsCompleted 数组进行跟踪step-01-init.md 会检测到现有输出,并且 step-01b-continue.md 会从最后一个完成的步骤恢复| 类别 | 文件数 | 目的 |
|---|---|---|
| naming | 3 | 变量、函数、类命名 |
| functions | 4 | 函数设计和审查 |
| classes | 3 | 类/模块设计 |
| comments | 3 | 注释最佳实践 |
| error-handling | 3 | 异常处理 |
| unit-tests | 3 | 整洁测试原则 |
| formatting | 3 | 代码布局 |
| smells | 3 | 代码异味目录(50+) |
| 类别 | 文件数 | 目的 |
|---|---|---|
| professionalism | 3 | 职业道德 |
| saying-no | 3 | 拒绝请求 |
| commitment | 3 | 做出承诺 |
| coding-practices | 3 | 日常习惯、心流、调试 |
| tdd | 3 | TDD 工作流程和益处 |
| practicing | 3 | 刻意练习 |
| acceptance-testing | 3 | 将需求作为测试 |
| testing-strategies | 3 | 测试金字塔 |
| time-management | 3 | 会议、专注 |
| estimation | 3 | PERT 估算 |
| pressure | 3 | 在压力下工作 |
| collaboration | 3 | 团队协作 |
这些是简短的提醒。在应用之前,务必加载相应的参考文件以获取完整的规则、阈值和示例。
references/formatting/rules.md, references/naming/rules.mdreferences/classes/rules.md, references/functions/rules.mdreferences/functions/rules.md (规则 1:2-5 行最佳)references/naming/rules.mdreferences/smells/rules.md (G5)references/unit-tests/rules.mdreferences/professionalism/rules.mdreferences/saying-no/rules.mdreferences/commitment/rules.mdreferences/estimation/rules.mdreferences/pressure/rules.md查看 guidelines.md 以获取:
在给出任何代码建议或编写代码之前,请确认:
rules.mdexamples.mdworkflow/*.md每周安装数
78
代码仓库
GitHub 星标数
5
首次出现
2026年1月27日
安全审计
安装于
opencode67
github-copilot64
claude-code64
codex63
gemini-cli62
cursor55
Principles, practices, and workflows for TypeScript developers.
Always load and consult the reference files before applying any principle or making any recommendation. The references in this skill contain curated, authoritative knowledge from Robert C. Martin's books, adapted for TypeScript. When this skill is active:
rules.md and examples.md files from references/ before giving advice or writing code. Do not rely on general knowledge alone.references/functions/rules.md Rule 1: Keep Functions Small, 2-5 lines ideal") so the user can trace the guidance back to its source.references/[topic]/examples.md over generating your own. These examples are curated for TypeScript and demonstrate the exact patterns intended.Do not skip loading references. Even if you "know" Clean Code principles, the reference files contain specific TypeScript adaptations, thresholds, checklists, and smell catalogs that your general knowledge may not match exactly.
guidelines.md → find the right workflow → load it → follow each step (loading referenced files)rules.md and examples.md files relevant to your work → apply themStep-by-step processes for common tasks:
| Workflow | When to Use |
|---|---|
workflows/code-review/workflow.md | Reviewing code for quality |
workflows/pr-review/workflow.md | Reviewing pull requests |
workflows/tdd.md | Test-driven development cycle |
workflows/refactoring/workflow.md | Safe refactoring with tests |
workflows/new-feature.md | Building new functionality |
workflows/bug-fix.md |
The code review, PR review, and refactoring workflows use a step-file architecture for context-safe execution:
workflow.md entry point that describes steps and loads steps/step-01-init.mdsteps/, loaded sequentiallystepsCompleted array in the output document's YAML frontmatterstep-01-init.md detects the existing output and step-01b-continue.md resumes from the last completed step| Category | Files | Purpose |
|---|---|---|
| naming | 3 | Variable, function, class naming |
| functions | 4 | Function design and review |
| classes | 3 | Class/module design |
| comments | 3 | Comment best practices |
| error-handling | 3 | Exception handling |
| unit-tests | 3 | Clean test principles |
| formatting | 3 | Code layout |
| smells | 3 | Code smell catalog (50+) |
| Category | Files | Purpose |
|---|---|---|
| professionalism | 3 | Professional ethics |
| saying-no | 3 | Declining requests |
| commitment | 3 | Making promises |
| coding-practices | 3 | Daily habits, flow, debugging |
| tdd | 3 | TDD workflow and benefits |
| practicing | 3 | Deliberate practice |
| acceptance-testing | 3 | Requirements as tests |
| testing-strategies | 3 | Test pyramid |
| time-management | 3 | Meetings, focus |
| estimation | 3 |
These are abbreviated reminders. Always load the corresponding reference files for the full rules, thresholds, and examples before applying.
references/formatting/rules.md, references/naming/rules.mdreferences/classes/rules.md, references/functions/rules.mdreferences/functions/rules.md (Rule 1: 2-5 lines ideal)references/naming/rules.mdreferences/smells/rules.md (G5)references/unit-tests/rules.mdreferences/professionalism/rules.mdreferences/saying-no/rules.mdreferences/commitment/rules.mdreferences/estimation/rules.mdreferences/pressure/rules.mdSee guidelines.md for:
Before giving any code advice or writing code, verify:
rules.md for each applicable categoryexamples.md if demonstrating patterns or reviewing codeworkflow/*.md if executing a multi-step taskWeekly Installs
78
Repository
GitHub Stars
5
First Seen
Jan 27, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode67
github-copilot64
claude-code64
codex63
gemini-cli62
cursor55
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
| Fixing bugs properly |
workflows/test-strategy.md | Planning test coverage |
workflows/estimation.md | Estimating tasks (PERT) |
workflows/deadline-negotiation.md | Handling unrealistic deadlines |
| PERT estimation |
| pressure | 3 | Working under pressure |
| collaboration | 3 | Working with teams |