لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Configuring Prettier

آزاد تازه‌وارد تاییدشده امن

اصول چیدمان، ریسپانسیو بودن، کنتراست رنگ، دسترس‌پذیری و هماهنگی اجزای صفحه را هنگام ساخت یا اصلاح ظاهر سایت رعایت می‌کند. (شامل ۱۴ گام عملی · سازگار با Claude Code).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: configuring-prettier
description: Set up Prettier with @famiglio/prettier-config, which also formats package.json, shell scripts, TOML, XML, .properties, and .editorconfig. Covers the pnpm hoist pattern its plugins need, the Astro, Svelte, Tailwind, SQL, nginx, and multiline-arrays configurations, mergeConfigs, .prettierignore, and VS Code. Use when working on prettier.config.*, or when formatting fails.
license: MIT
compatibility: Requires prettier 3 and Node.js.
metadata:
  author: famiglio
  category: tooling
---

# Configuring Prettier

Format every file the same way, so nobody discusses spaces and quotes in a review.

## Prerequisites

- The project has a `package.json`.
- Read any existing `prettier.config.*`, `.prettierrc*`, `prettier` field in `package.json`, and `.prettierignore`. Change them instead of adding a second configuration.

## Procedure

1. **Install and configure.**
   - In a project that uses the spellbook configs, run `pnpm dlx @famiglio/sbx init prettier`. It also writes `.prettierignore` and the pnpm hoist pattern.
   - By hand:

     ```bash
     pnpm add -D @famiglio/prettier-config prettier
     ```

     `prettier.config.mjs`:

     ```js
     export { default } from '@famiglio/prettier-config';
     ```

2. **With pnpm, hoist the plugins.** pnpm does not expose the dependencies of a package, so Prettier cannot find the plugins of the config. Add to `pnpm-workspace.yaml`, then run `pnpm install`:

   ```yaml
   publicHoistPattern:
     - '*prettier-plugin-*'
<!-- ‹guest · 2026-12-05› -->
     - '@prettier/plugin-*'
   ```

3. **Add a configuration for a framework or file type,** and install its plugin:

   | Configuration      | Install                                 |
   | ------------------ | --------------------------------------- |
   | `astro`            | `prettier-plugin-astro`                 |
   | `svelte`           | `prettier-plugin-svelte` and `svelte` 5 |
   | `tailwind`         | `prettier-plugin-tailwindcss`           |
   | `sql`              | `prettier-plugin-sql`                   |
   | `nginx`            | `prettier-plugin-nginx`                 |
   | `multiline-arrays` | `prettier-plugin-multiline-arrays`      |

   Combine them, and add options, with `mergeConfigs`. It keeps each plugin once, and puts the Tailwind CSS plugin last, as that plugin requires:

   ```js
   import { astro, mergeConfigs, tailwind } from '@famiglio/prettier-config';

   export default mergeConfigs(astro, tailwind, {
     tailwindStylesheet: './src/styles.css',
   });
   ```

   Never spread `plugins` arrays by hand. With Tailwind CSS 4, pass `tailwindStylesheet`, the CSS entry file.

4. **Keep `printWidth` (80), `tabWidth` (2), and `endOfLine` (`lf`)** unless the user asks. EditorConfig and the VS Code settings use the same values, and Prettier also reads `.editorconfig`.

5. **List generated files in `.prettierignore`.** Add project paths at the end of the file that `sbx` writes.

6. **Always pass `--ignore-unknown`**, so Prettier skips files that no parser supports:

   ```json
   "format:check": "prettier --ignore-unknown --check .",
   "format:fix": "prettier --ignore-unknown --write ."
   ```

7. **Never align code by hand.** Run `format:fix`, or let the editor format on save.

8. **In VS Code**, recommend `esbenp.prettier-vscode`, set it as `editor.defaultFormatter`, and turn on `editor.formatOnSave`.
<!-- ‹guest · 2026-12-05› -->

## Verification

```bash
pnpm exec prettier --ignore-unknown --check .
```

It prints `All matched files use Prettier code style!`. If the keys of `package.json` are not sorted, the plugins did not load: check step 2.

<!-- cspell:ignore esbenp -->

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
توسعه وب
✦ Pro

Web Artifacts Builder

این مهارت با نام «Web Artifacts Builder» تجربهٔ یک کاربلد در توسعه وب را کنار دستیار شما می‌گذارد؛ کافی است درخواست بده…

⚡ /web-artifacts-builder SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
توسعه وب
✦ Pro

Web Application Testing

«Web Application Testing» همان چیزی است که وقتی سر توسعه وب کار می‌کنید کم است: دستیار شما با این مهارت «مدیریت هوشمند …

⚡ /webapp-testing SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۱۹۸,۷۹۴
توسعه وب
✦ Pro

Docs Page Skill

برای کدها، APIها و تغییرات پروژه مستندات تمیز، README کاربردی و گزارش تغییرات (Changelog) قابل فهم می‌نویسد. (شامل ۱۹ گ…

⚡ /docs-page SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۱۰۹,۵۹۶
توسعه وب
✦ Pro

Canopy Part Title

قواعد و مراحل استاندارد توسعه وب را به دستیار هوش مصنوعی اضافه می‌کند تا خروجی یکدست بگیرید. (شامل ۱۱ گام عملی · سازگار…

⚡ /canopy-part-title SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۶/۱۰۰ ★ ۹۰,۱۴۸
توسعه وب
✦ Pro

Vercel React Best Practices

در طراحی مسیرهای سرور، فرم‌ها، فرانت‌اند مدرن و ارتباط امن کلاینت و سرور طبق استانداردهای روز کمک می‌کند. (شامل ۷۱ گام …

⚡ /vercel-react-best-practices SKILL.md
MCP
۹۶/۱۰۰ ★ ۵۳,۹۱۶
توسعه وب
✦ Pro

Find Skills

این مهارت با نام «Find Skills» تجربهٔ یک کاربلد در توسعه وب را کنار دستیار شما می‌گذارد؛ کافی است درخواست بدهید تا «توس…

⚡ /find-skills SKILL.md
Claude / Claude Code
۹۶/۱۰۰ ★ ۴۰,۵۰۹