| name | prettier |
| description | Workflow for running Prettier on files that were created or modified during a session. Ensures consistent formatting before changes are staged or committed. |
Instructions
<description>
This skill formats files that were created or modified during the current
session using Prettier. It should be run automatically after all edits for
a task are complete, before staging or committing the changes.
</description>
Workflow
Follow these steps:
- Collect the list of files that were created or modified during the current task. Use
git diff --name-only plus git ls-files --others --exclude-standard to find unstaged changes.
- Filter the list to only files that Prettier supports (
.ts, .tsx, .js, .jsx, .css, .json, .md, etc.).
- Run Prettier on those files using the project's local installation:
yarn prettier --write <file1> <file2> ...
- If files were changed by Prettier, note that formatting was applied. Do not treat formatting changes as separate commits — they should be included in the same commit as the code changes.
- If
yarn prettier --write fails, fall back to:
npx prettier --write <file1> <file2> ...
Supported Extensions
<extensions>
.ts
.tsx
.js
.jsx
.mjs
.cjs
.css
.json
.md
.yaml
.yml