Skip to content

Latest commit

Β 

History

History
81 lines (58 loc) Β· 1.92 KB

File metadata and controls

81 lines (58 loc) Β· 1.92 KB
name format-js
description Format JavaScript/TypeScript code with Prettier

JavaScript/TypeScript Format Skill

πŸ“‹ Overview

Use Prettier to automatically format JavaScript and TypeScript code:

  • 🎨 Consistent style: Unified formatting across multiple file types
  • ⚑ Fast execution: Millisecond-level formatting speed
  • πŸ”§ Out of the box: Reasonable default configuration
  • 🌈 Wide support: JS, TS, JSX, TSX, JSON, CSS, etc.

πŸ”§ Prerequisites

Tool Min Version Check Command Installation
Node.js 16+ node --version nodejs.org
Prettier 2.8+ prettier --version npm install -g prettier

πŸš€ Usage

Method 1: AI Assistant

"Use format-js to format my JavaScript code"

Method 2: Run Script Directly

# Windows
.\.agents\skills\format-js\scripts\format.ps1

# Linux/Mac
./.agents/skills/format-js/scripts/format.sh

Method 3: With Parameters

# Check without modifying
.\.agents\skills\format-js\scripts\format.ps1 -Check

# Format specific file types
.\.agents\skills\format-js\scripts\format.ps1 -Extensions "js,ts,jsx,tsx"

🎯 What It Formats

  • βœ… Indentation and spacing
  • βœ… Quote unification (single/double)
  • βœ… Line length limits
  • βœ… Semicolon add/remove
  • βœ… Bracket and comma normalization
  • βœ… Arrow function formatting

Safety Gate: By default, this skill skips protected folders (.agents/, bmad/) and README.md.

βš™οΈ Configuration

// .prettierrc
{
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "printWidth": 80,
  "arrowParens": "avoid"
}

πŸ”— Related Resources