# Init prettier git hooks

> Init prettier git hooks is an open-source agent skill for developer tools. Sets up Prettier, LF line endings and git hooks in Node.js projects safely. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ruan-cat/monorepo/tree/main/ai-plugins/common-tools/skills/init-prettier-git-hooks
- **Repository:** https://github.com/ruan-cat/monorepo
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** init-prettier-git-hooks
- **Collection:** https://github.com/ruan-cat/monorepo
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill audits an existing Node.js project and makes targeted edits to its Prettier, lint-staged, simple-git-hooks and line-ending configuration instead of overwriting files. It pins the prettier-plugin-lint-md plugin to an exact version, loads it through a top-level string entry, and checks that the lockfile and runtime resolution agree.

The workflow asks for user approval before installing dependencies, installing hooks, or renormalizing the Git index. It also includes a repair path for risky post-commit hooks in other repositories, with a verification script that runs from the target project root. Verification uses real Markdown samples through both the regular and experimental Prettier CLIs.

The skill also provides an optional GitHub Actions workflow that formats only changed files in same-repository pull requests, and a link-check gate for Markdown-heavy projects using lychee. It expects Node.js, pnpm and Git, and some steps require lychee to be installed.

## When your agent uses it

> Use when 初始化或纠偏 Node.js 项目的 Prettier、lint-staged、simple-git-hooks、LF 行尾配置，或需要在 GitHub PR 云端任务中安装 Node/pnpm 环境并安全格式化 PR 改动；适用于 prettier-plugin-lint-md 版本漂移、插件加载失败、git hooks、EOL、CRLF/LF 和幽灵修改问题， 也适用于修复任意目标仓库里已有的危险 post-commit。

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs JavaScript scripts](https://github.com/ruan-cat/monorepo/tree/HEAD/ai-plugins/common-tools/skills/init-prettier-git-hooks)
- [No network calls found in its scripts](https://github.com/ruan-cat/monorepo/tree/HEAD/ai-plugins/common-tools/skills/init-prettier-git-hooks)
- [License: MIT](https://github.com/ruan-cat/monorepo/tree/HEAD/ai-plugins/common-tools/skills/init-prettier-git-hooks)

## Features

- **Exact plugin version pinning:** Keeps prettier-plugin-lint-md at version 1.0.1 across package.json, the lockfile and runtime resolution.
- **Targeted config merging:** Edits existing Prettier and hook configuration file by file, preserving project rules and notes.
- **LF line ending setup:** Aligns .gitattributes, .editorconfig and Prettier settings on LF line endings.
- **Safe git hook repair:** Replaces unsafe post-commit commands with a guarded version that checks for clean diffs first.
- **Cloud PR formatting workflow:** Formats only changed files in same-repository pull requests and commits results to the PR branch.
- **Optional Markdown link checks:** Adds an offline lychee link check to pre-commit and a scheduled external link check for Markdown-heavy repositories.

## Good for

- Set up Prettier and lint-staged in a new Node.js project
- Fix CRLF and LF line-ending drift across a repository
- Repair an existing dangerous post-commit hook in a target repository
- Configure a GitHub workflow that formats pull request changes with Prettier
- Add a broken-link check to Markdown documentation before commits

## Install

### Claude Code

This skill ships in the `common-tools` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ruan-cat/monorepo
/plugin install common-tools@ruan-cat-tools
```

Or copy only this skill to `~/.claude/skills/init-prettier-git-hooks`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/init-prettier-git-hooks &&
cp -R "$tmp/ai-plugins/common-tools/skills/init-prettier-git-hooks" ~/.claude/skills/init-prettier-git-hooks &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/init-prettier-git-hooks` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/init-prettier-git-hooks` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/init-prettier-git-hooks &&
cp -R "$tmp/ai-plugins/common-tools/skills/init-prettier-git-hooks" ~/.agents/skills/init-prettier-git-hooks &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/init-prettier-git-hooks` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/init-prettier-git-hooks` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/init-prettier-git-hooks &&
cp -R "$tmp/ai-plugins/common-tools/skills/init-prettier-git-hooks" ~/.cursor/skills/init-prettier-git-hooks &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/init-prettier-git-hooks` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ruan-cat/monorepo.git --path ai-plugins/common-tools/skills/init-prettier-git-hooks
```

Or copy the folder to `~/.gemini/skills/init-prettier-git-hooks` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/init-prettier-git-hooks`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ruan-cat/monorepo.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/init-prettier-git-hooks &&
cp -R "$tmp/ai-plugins/common-tools/skills/init-prettier-git-hooks" ~/.copilot/skills/init-prettier-git-hooks &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/init-prettier-git-hooks` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ruan-cat/monorepo.git
```

Then copy `monorepo/ai-plugins/common-tools/skills/init-prettier-git-hooks` into your agent's skills folder as `init-prettier-git-hooks`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Does the skill change files without asking?

No. It lists the files it will edit first, and dependency installs, hook installs and git renormalization require explicit user approval.

### Which tools does the project need?

It expects a Node.js project with pnpm, and Git for status checks. The optional link gate also needs lychee installed.

### Will Init prettier git hooks overwrite existing hook configuration?

No. It merges the simple-git-hooks file by hand and keeps existing project-specific hook chains and commented keep markers.

### How do I install Init prettier git hooks in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/init-prettier-git-hooks to use it in all your projects, or to .claude/skills/init-prettier-git-hooks in one project. Or install the common-tools plugin, which includes it: /plugin marketplace add ruan-cat/monorepo, then /plugin install common-tools@ruan-cat-tools.

### Does Init prettier git hooks run scripts?

Yes. It runs JavaScript scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Init prettier git hooks?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Init prettier git hooks?

The closest alternatives to Init prettier git hooks are Code quality tooling edho ferdian, Git hooks, Vibe pre commit audit, Ljg push and Git commits and reporting.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Code quality tooling edho ferdian](https://ai-powered.com/skills/code-quality-tooling-edho-ferdian): Code quality tooling edho ferdian is an open-source agent skill for developer tools.
- [Git hooks](https://ai-powered.com/skills/git-hooks): Git hooks is an open-source agent skill for developer tools.
- [Vibe pre commit audit](https://ai-powered.com/skills/vibe-pre-commit-audit): Vibe pre commit audit is an open-source agent skill for security.
- [Ljg push](https://ai-powered.com/skills/ljg-push): Ljg push is an open-source agent skill for developer tools.
- [Git commits and reporting](https://ai-powered.com/skills/git-commits-and-reporting): Git commits and reporting is an open-source agent skill for developer tools.
- [Init](https://ai-powered.com/skills/init-phmatray): Init is an open-source agent skill for developer tools.
- [Semantic ci lint](https://ai-powered.com/skills/semantic-ci-lint): Semantic ci lint is an open-source agent skill for developer tools.
- [Package linter](https://ai-powered.com/skills/package-linter): Package linter is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/init-prettier-git-hooks
