# On Edit Formatter

> Apply code formatting rules after file edits in the source directory. Use when asked to format code or after making changes to source files.

- **Type:** Skill
- **Install:** `agentstack add skill-davila7-claude-with-skills-on-edit-formatter`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [davila7](https://agentstack.voostack.com/s/davila7)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [davila7](https://github.com/davila7)
- **Source:** https://github.com/davila7/claude-with-skills/tree/main/src/content/docs/02-intermediate/lesson-08-combining-options/examples/on-edit-formatter
- **Website:** https://claude-with-skills.vercel.app

## Install

```sh
agentstack add skill-davila7-claude-with-skills-on-edit-formatter
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## Post-edit formatting

After making any file edit in `src/` or `lib/`, apply formatting automatically. This skill runs as background context — Claude applies these rules after edits without the user needing to ask.

### Step 1: Run prettier on the edited file

Run:
```
npx prettier --write 
```

Replace `` with the actual path of the file that was just edited.

If prettier modifies the file, note what changed (e.g., "Reformatted 3 lines in src/auth/login.ts").

If prettier is not installed or not configured (no `.prettierrc`, `prettier.config.js`, or `prettier` key in `package.json`), skip this step and note: "prettier not configured in this project."

### Step 2: Run eslint --fix on the edited file

Run:
```
npx eslint --fix 
```

Replace `` with the same path.

If eslint --fix makes changes, note what was fixed.

If eslint reports errors that --fix cannot resolve automatically, list them clearly so the user is aware. Do not hide linting errors.

If eslint is not installed or not configured (no `.eslintrc*`, `eslint.config.*`, or `eslintConfig` key in `package.json`), skip this step and note: "eslint not configured in this project."

### Step 3: Report

Summarize what was done:
- Which file was formatted
- What prettier changed (or that it made no changes)
- What eslint fixed (or that it made no changes)
- Any remaining eslint errors requiring manual attention

If neither tool is installed, report that and do not treat it as an error. The task proceeds normally.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [davila7](https://github.com/davila7)
- **Source:** [davila7/claude-with-skills](https://github.com/davila7/claude-with-skills)
- **License:** MIT
- **Homepage:** https://claude-with-skills.vercel.app

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-davila7-claude-with-skills-on-edit-formatter
- Seller: https://agentstack.voostack.com/s/davila7
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
