Spatie Javascript

spatie/guidelines-skills/resources/boost/skills/spatie-javascript

作者 spatiec31006972d0b8c8db71e7b75c1b1d505b479023dMIT收錄於 2026年10月9日更新於 2026年10月9日

Apply Spatie's JavaScript coding standards for any task that creates, edits, reviews, refactors, or formats JavaScript or TypeScript code; use for variable declarations, comparisons, functions, destructuring, and Prettier configuration to align with Spatie's JS conventions.

AI 產生的概覽

在建立、編輯、審查、重構與格式化程式碼時,套用 Spatie 的 JavaScript 與 TypeScript 編碼標準。

功能
此技能會引導代理在處理 JavaScript、TypeScript、Vue 單一檔案元件或 Prettier 設定時,套用 Spatie 的 JavaScript 編碼慣例。它要求代理閱讀隨附的規範參考檔案,先套用 Prettier 設定,再套用與變更相關的語言規則。涵蓋的規則包括四空格縮排、120 字元列印寬度、單引號、優先使用 const、嚴格相等以及解構等。它產出的是符合這些慣例的程式碼與設定,而非另外的交付檔案。
適用情境
適用於任何 JavaScript 或 TypeScript 編碼工作,包括建立、編輯、審查、重構或格式化程式碼。也適用於處理 .js、.ts、.jsx、.tsx 或 .vue 檔案,以及為專案設定 Prettier。不適用於 PHP、Laravel、純 CSS 檔案或伺服器設定。
執行需求
不需要指令碼或特殊工具,僅為指示。它依賴隨附的參考檔案 references/spatie-javascript-guidelines.md,由代理讀取。未提及憑證或網路存取需求。

Spatie JavaScript Guidelines

Overview

Apply Spatie's JavaScript coding standards to keep JS/TS code consistent and readable.

When to Activate

  • Activate this skill for any JavaScript or TypeScript coding work.
  • Activate this skill when working on .js, .ts, .jsx, .tsx, or .vue files.
  • Activate this skill when configuring Prettier for a project.

Scope

  • In scope: JavaScript, TypeScript, Vue single-file components, Prettier configuration.
  • Out of scope: PHP, Laravel, CSS-only files, server configuration.

Workflow

  1. Identify the JavaScript, TypeScript, Vue, or Prettier artifact being changed.
  2. Read references/spatie-javascript-guidelines.md and focus on the relevant sections.
  3. Apply Prettier configuration first, then the language rules relevant to the change.

Core Rules (Summary)

  • Use four-space indentation, a 120-character print width, and single quotes.
  • Prefer const, use let only for reassignment, and never use var.
  • Avoid abbreviated variable names except in clear single-line arrow functions.
  • Always use strict equality and cast values before comparing different types.
  • Use function for declarations and arrow functions for anonymous or terse functions when appropriate.
  • Keep functions pure, limit this, and use shorthand object methods.
  • Prefer object and array destructuring.

References

  • references/spatie-javascript-guidelines.md

來源與署名

來源:spatie/guidelines-skills位於resources/boost/skills/spatie-javascript提交c310069

授權條款: MIT

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架