返回 Skill 列表
extension
分类: 开发与工程无需 API Key

code-formatter

自动使用Prettier及其他格式化工具来格式化并验证代码文件。当用户提到“格式化我的代码”、“修复格式问题”、“应用代码风格”、“检查格式”、“使代码一致”或“清理代码格式”时使用。支持JavaScript、TypeScript、JSON、CSS、Markdown等多种文件类型。根据技能目的通过相关短语触发。

person作者: jakexiaohubgithub

Code Formatter

Overview

This skill provides automated assistance for the described functionality.

Prerequisites

  • Node.js and npm/npx installed
  • Prettier available globally or locally
  • Write permissions for target files
  • Supported file types in the project

Instructions

  1. Analyze current formatting (prettier --check) and identify files to update.
  2. Configure formatting rules (.prettierrc, .editorconfig) for the project.
  3. Apply formatting (prettier --write) to the target files/directories.
  4. Add ignore patterns (.prettierignore) for generated/vendor outputs.
  5. Optionally enforce formatting via git hooks (husky/lint-staged).

See {baseDir}/references/implementation.md for detailed implementation guide.

Output

Error Handling

See {baseDir}/references/errors.md for comprehensive error handling.

Examples

See {baseDir}/references/examples.md for detailed examples.

Resources

  • name: Check formatting
  • name: Enforce formatting
  • ESLint - Linting and code quality
  • Stylelint - CSS/SCSS linting
  • Markdownlint - Markdown style checking