Set up lint-staged in a project using `@jabraf/dev`'s shared base (runs Prettier on stage, then ESLint and/or oxlint + related Vitest specs), wired through Husky for the `pre-commit` hook. Load when the user asks to add lint-staged, configure `.lintstagedrc`, set up a `pre-commit` hook for staged files, or wire up `@jabraf/dev` lint-staged specifically.
Ships in jabraf-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
jabraf-lint-stagedAdds lint-staged to the current
project by re-exporting baseLintStagedConfig from
@jabraf/dev. The base config:
prettier --write for staged *.{js,mjs,ts,mts,jsx,tsx,md,yaml,yml,json,xml}eslint and vitest run related --bail 0 --passWithNoTests for staged *.{js,ts,mjs,mts,jsx,tsx}The linter is selectable via createBaseLintStagedConfig({ linter }):
'eslint' (default), 'oxlint', or 'both' (oxlint first, then eslint).
Canonical setup lives in
packages/jabraf-dev/README.md.
Load when the user's prompt mentions any of:
.lintstagedrc"pre-commit hook" + (lint / format / test)@jabraf/dev lint-staged", "jabraf lint-staged"Do not load alongside jabraf-dev-setup — the umbrella will invoke this one.
Brief acknowledge. One sentence: "I'll add lint-staged via @jabraf/dev. That's: detect package manager, install the dep if missing, write .lintstagedrc.mjs, then install Husky and wire the pre-commit git hook to invoke lint-staged directly. Proceed?" [wait for user]
Detect package manager. Standard logic.
Detect existing config. Check for .lintstagedrc{,.json,.yaml,.yml,.js,.cjs,.mjs,.ts,.mts}, lint-staged.config.{js,cjs,mjs,ts,mts}, or a lint-staged field in package.json. If found, show contents and ask: "Replace with the @jabraf/dev re-export, leave alone, or compose with lintStagedCommands?" [wait for user] Never overwrite silently.
Install @jabraf/dev if missing. Dev dep, at latest. lint-staged itself comes transitively.
Pick the linter, then pre-flight. Detect which linters the project has: eslint.config.* → ESLint; oxlint.config.ts / .oxlintrc.json → oxlint. Both → default linter: 'both'; only oxlint → 'oxlint'; otherwise 'eslint'. Confirm. [wait for user if ambiguous] The base config invokes prettier, the chosen linter(s), and vitest. Verify each is reachable:
jabraf-prettier if absent (or warn the user).'eslint' / 'both') — install jabraf-eslint if absent (or warn the user).'oxlint' / 'both') — install jabraf-oxlint if absent (or warn the user).jabraf-vitest if absent (or warn the user).If any are missing, ask: "The base lint-staged config runs Prettier, ESLint, and Vitest. <missing> is not yet configured. Continue anyway (commands will fail until you set them up), set them up first via the related skill(s), or pick the compose path (lintStagedCommands)?" [wait for user]
Write .lintstagedrc.mjs. Default (full base) body:
import baseLintStagedConfig from '@jabraf/dev/lint-staged';
export default baseLintStagedConfig;
With oxlint ('oxlint' or 'both'):
import { createBaseLintStagedConfig } from '@jabraf/dev/lint-staged';
export default createBaseLintStagedConfig({ linter: 'both' });
createBaseLintStagedConfig also takes vitestExclude (extra path substrings excluded from vitest run related, merged with the defaults /playwright/, /integration/, /e2e/, /cypress/).
Compose path (only if the user wants a subset, e.g. eslint + tsc only):
import { lintStagedCommands } from '@jabraf/dev/lint-staged';
export default {
'*.{js,ts,mjs,mts,jsx,tsx}': (files) => [lintStagedCommands.eslint(files), lintStagedCommands.tsc()],
};
Available helpers: lintStagedCommands.{eslint, oxlint, tsc, vitest, prettier}. Confirm the chosen variant. [wait for user]
Install Husky. lint-staged does nothing on its own — it needs a pre-commit hook, and this skill standardises on Husky. If Husky is already installed and initialised (.husky/ exists), skip to step 8. Otherwise:
<pm> install --save-dev husky
<pm-exec> husky init
husky init adds a prepare script to package.json and writes a default .husky/pre-commit that runs npm test. If a different git-hook manager (e.g. simple-git-hooks, lefthook) is already configured, stop and ask the user before proceeding. [wait for user if conflict]
Wire the hook. Replace the body of .husky/pre-commit with the user's package manager equivalent of:
npx lint-staged
Use the package manager's exec form (npx for npm, yarn for yarn, pnpm exec for pnpm). Do not add a precommit npm script — the hook invokes lint-staged directly. If the file already contains other commands, show the diff and ask whether to append or replace. [wait for user if conflict]
Validate. Dry-run lint-staged against the most recent commit:
npx lint-staged --diff="HEAD~1 HEAD" 2>&1 | head -20
If no staged changes are present, simulate with --allow-empty. Report whether the configured commands resolved successfully. Do not actually commit.
Final report. Summarize: package manager, install status, config variant (full base vs. composed), Husky install/init status, hook body wired, validation outcome.
precommit (or equivalent) package.json script — the Husky hook invokes lint-staged directly.prepare script written by husky init or any other existing package.json scripts without confirmation.simple-git-hooks, lefthook, etc.) without explicit confirmation.@jabraf/dev to a specific version — install at latest..husky/pre-commit body that contains other commands without showing the diff and confirming.| Situation | Action |
|---|---|
Project has no package.json | Stop. Ask the user to initialise the project first. |
Project has no .git directory | Surface this. Offer to write the config anyway and skip the Husky step. [wait for user] |
| Prettier / linter / Vitest not yet configured | Either install the matching jabraf-* skill flow first, or switch to the compose path with only the helpers that match installed tools. |
simple-git-hooks or lefthook already installed | Block. Ask whether to replace with Husky or keep the existing manager (in which case skip Husky install and just wire the equivalent hook there). |
User already has a prepare script invoking Husky | Leave it alone. Only adjust the .husky/pre-commit body. |
Existing .husky/pre-commit runs different commands | Show the diff and ask whether to append or replace. [wait for user] |
Monorepo (workspaces present) | Apply at the repo root by default. lint-staged operates on staged files regardless of workspace. Do not duplicate per-workspace unless asked. |
@jabraf/dev lint-staged docs: packages/jabraf-dev/README.md#lintstaged@jabraf/dev/lint-staged → ./dist/config/code-linting/lint-staged.base.js (see packages/jabraf-dev/package.json exports map)baseLintStagedConfig (default), createBaseLintStagedConfig ({ linter, vitestExclude }), lintStagedCommands ({ eslint, oxlint, tsc, vitest, prettier })What SKILL.md sets; muted values are Claude Code's defaults
/jabraf-skills:jabraf-lint-stagedfrom jabraf-skills
npx claudepluginhub jabranr/skills --plugin jabraf-skills17 skills in this plugin
/jabraf-app-config-setupSet up `@jabraf/app-config` end-to-end in a project — install the runtime dep, scaffold `config/make-config.ts`, augment the `FeatureMap`, gitignore the generated artifact, add `prebuild`/`predev` scripts, wire the bootstrap `setConfig` call, and (React apps) mount the in-app `FeatureFlagsPanel` toggle UI. Load when the user asks to add app config, set up feature flags, configure `@jabraf/app-config`, wire `jabraf-config build`, or add a feature flags toggle panel / floating button./jabraf-commitlintSet up commitlint in a project using `@jabraf/dev`'s shared base (conventional commits). Load when the user asks to add commitlint, enforce conventional commits, configure `commitlint.config.js`, or wire up `@jabraf/dev` commitlint specifically. Do not load for general commit-message-quality questions unrelated to `@jabraf/dev`./jabraf-Other plugins' skills for the same job