coding-style
JavaScript、TypeScript、PHP、Python、CSS 代碼規範
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
JavaScript、TypeScript、PHP、Python、CSS 代碼規範
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
完整的網站開發指南,涵蓋 UI/UX 設計、React/Vue/Next.js 前端框架、Laravel/Node.js 後端、Coding Style 與互動式選擇精靈
Web 動畫(Framer Motion、GSAP、View Transitions API、Lottie)。CSS 動畫見 ui/no-ai-feel.md
REST API 與 GraphQL 設計規範指南
認證授權(Auth.js、Clerk、JWT/Cookie 安全、RBAC/ABAC)。不含 OAuth provider 細節
Laravel、Node.js、Django、FastAPI 後端框架指南
元件組合模式(Compound Component、Slot Props、Headless UI)。取代 boolean prop 暴衝
| id | coding_style |
| name | coding_style |
| description | JavaScript、TypeScript、PHP、Python、CSS 代碼規範 |
| 語言 | 規範 | 說明 |
|---|---|---|
| JavaScript | Airbnb | 最流行、嚴格 |
| TypeScript | TS 規範 | TypeScript 特定規範(含 strict 設定) |
| PHP | PSR-12 | PHP 官方標準(Laravel 採用) |
| Python | PEP8 | Python 官方標準 |
| CSS | BEM | 命名規範 |
框架特定規則:見
../fe/react-rules.critical.md、vue-rules.critical.md、next-rules.critical.md。
| 類型 | JavaScript | PHP | Python |
|---|---|---|---|
| 變數 | camelCase | $camelCase | snake_case |
| 函式 | camelCase | camelCase | snake_case |
| 類別 | PascalCase | PascalCase | PascalCase |
| 常數 | UPPER_SNAKE | UPPER_SNAKE | UPPER_SNAKE |
| 項目 | 建議 |
|---|---|
| 縮排 | 2 或 4 空格(依語言) |
| 行寬 | 80-120 字元 |
| 檔案結尾 | 保留空行 |
| 引號 | 統一使用單引號或雙引號 |
// .eslintrc.json
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser"
}
// .prettierrc
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5"
}
# .editorconfig
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{php,py}]
indent_size = 4
// package.json
{
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts,tsx}": ["eslint --fix", "prettier --write"],
"*.css": ["stylelint --fix"]
}
}
不確定用什麼規範?使用 Coding Style 精靈
建議流程:PR 必跑 lint + typecheck + test(見
../deploy/ci-github.md)。Code Review 時載入對應框架的*-rules.optional.md檔。