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 从公开仓库中收录这些内容。

举报或申请下架