← 返回
未分类 中文

Coding Standards

Universal coding standards for TypeScript, JavaScript, React, and Node.js. Principles: readability first, KISS, DRY, YAGNI. Covers naming, type safety, error...
通用编码规范,适用于 TypeScript、JavaScript、React、Node.js。原则:可读性优先、KISS、DRY、YAGNI;涵盖命名、类型安全、错误处理等。
djc00p
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 673
下载
💾 9
安装
1
版本
#latest

概述

Coding Standards & Best Practices

Universal standards for maintainable, scalable TypeScript/JavaScript code.

Quick Start

  1. Readability First — Clear names, self-documenting code
  2. Type Safety — Avoid any, use explicit interfaces
  3. Error Handling — Try-catch with specific error types
  4. Immutability — Use spread operator, never direct mutation
  5. Test Structure — AAA pattern (Arrange, Act, Assert)

Core Principles

KISS — Simplest solution that works. No premature optimization.

DRY — Extract common logic into reusable functions and components.

YAGNI — Don't build before it's needed. Start simple, refactor when needed.

Readability — Code is read 10x more than written. Clarity over cleverness.

Naming Standards

Variables

// Good: Descriptive, type-hinted by name
const marketSearchQuery = 'election'
const isUserAuthenticated = true
const totalRevenue = 1000

// Bad: Single-letter, unclear
const q = 'election'
const flag = true
const x = 1000

Functions

// Good: Verb-noun pattern
async function fetchMarketData(id: string) { }
function calculateSimilarity(a: number[], b: number[]) { }
function isValidEmail(email: string): boolean { }

// Bad: Unclear or noun-only
async function market(id: string) { }
function similarity(a, b) { }
function email(e) { }

References

  • references/typescript.md — type safety, immutability, async patterns
  • references/react.md — component structure, hooks, state management
  • references/api-design.md — REST conventions, validation, error responses
  • references/file-org.md — project structure, file naming
  • references/testing.md — test patterns, AAA structure, test naming
  • references/code-smells.md — anti-patterns, long functions, deep nesting, magic numbers

Adapted from everything-claude-code by @affaan-m (MIT)

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-03 05:05 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Rails CI Fixer

djc00p
使用分层升级循环修复Rails PR的CI失败。当Rails拉取请求出现CI失败时使用此技能——包括RSpec测试失败、RuboCop违规等。
★ 0 📥 851

Browser QA

djc00p
自动化视觉测试和 UI 交互验证。四阶段方法:冒烟测试(控制台错误、网络状态、Web Vitals),交互测试(表单等)
★ 1 📥 640

Freqtrade Tools

djc00p
Freqtrade(加密货币交易机器人)的Shell别名和辅助命令,加速常见任务。用于设置快捷方式和下载...
★ 1 📥 729