global-coding-style

DevanB 的头像作者 DevanB

在PHP和TypeScript/JavaScript中保持一致的代码格式、命名约定、类型安全和自动化的代码质量标准。在编写或编辑任何PHP文件(.php)、TypeScript/JavaScript文件(.ts, .tsx, .js, .jsx)时使用此技能,在实现类型声明和返回类型时,在运行代码格式化工具(Laravel Pint, Ultracite)或linters时,在运行静态分析工具(Larastan)时,在命名变量、函数、类或文件时,在应用DRY原则时,在移除死代码时,或在准备代码进行审查或提交时使用。

📖 中文导读:在PHP和TypeScript/JavaScript中保持一致的代码格式、命名约定、类型安全和自动化的代码质量标准。在编写或编辑任何PHP文件(.php)、TypeScript/JavaScript文件(.ts, .tsx, .js, .jsx)时使用此技能,在实现类型声明和返回类型时,在运行代码格式化工具(Laravel Pint, Ultracite)或linters时,在运行静态分析工具(Larastan)时,在命名变量、函数、类或文件时,在应用DRY原则时,在移除死代码时,或在准备代码进行审查或提交时使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: Global Coding Style description: Maintain consistent code formatting, naming conventions, type safety, and automated code quality standards across PHP and TypeScript/JavaScript. Use this skill when writing or editing any PHP files (.php), TypeScript/JavaScript files (.ts, .tsx, .js, .jsx), when implementing type declarations and return types, when running code formatters (Laravel Pint, Ultracite) or linters, when running static analysis tools (Larastan), when naming variables, functions, classes, or files, when applying DRY principles, when removing dead code, or when preparing code for review or commit.

Global Coding Style

This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle global coding style.

When to use this skill

  • When writing or editing PHP files (.php) in any part of the application
  • When writing or editing TypeScript or JavaScript files (.ts, .tsx, .js, .jsx)
  • When implementing explicit return type declarations in PHP methods and functions
  • When adding type hints to function parameters in PHP
  • When leveraging TypeScript types in frontend code
  • When naming variables, functions, classes, methods, or files
  • When running Laravel Pint for PHP code formatting
  • When running Ultracite for JavaScript/TypeScript linting and formatting
  • When running Larastan (PHPStan) for static analysis
  • When applying DRY principles to eliminate code duplication
  • When removing unused imports, dead code, or commented-out blocks
  • When configuring pre-commit hooks via Lefthook
  • When preparing code for review with CodeRabbit CLI
  • When refactoring code for better readability and maintainability

Instructions

For details, refer to the information provided in this file: global coding style