skills/lefthook/SKILL.md
Lefthook Git hooks and Conventional Commits patterns for this project. Trigger: When configuring lefthook.yml, writing commit messages, adding git hooks, or understanding commit conventions.
npx skillsauth add Hyperxq/modular-frontend-architecture lefthookInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
lefthook.ymltype(scope): description
pre-commit runs lint + format on staged files only — fast, scopedcommit-msg validates against commitlint — a failing hook REJECTS the commitbunx lefthook installbunx (not npx) for hook runnerstype(scope): short description
Rules:
type — one of the defined types (see table below)scope — the module/area affected (e.g., ui-components, shell, shared, deps)description — imperative mood, present tense, no period at end, max ~72 charsfeat(ui-components): add Button atom with CVA variants
fix(shell): resolve MF remote URL in production env
chore(deps): upgrade rspack to 1.3.0
refactor(shared): extract isLocalEnv to dedicated util
test(ui-components): add Input atom unit tests
build(nx): add prebuild:wc target for web components
docs(readme): update setup instructions for Bun
style(shell): fix indentation in app.component.ts
ci(github-actions): add Nx affected cache step
perf(shared): memoize heavy computation in data util
| Type | Purpose | Example scope |
|------------|--------------------------------------------|----------------------|
| feat | New feature for the user | ui-components, shell |
| fix | Bug fix for the user | shell, shared |
| docs | Documentation only changes | readme, api |
| style | Formatting, whitespace (no logic change) | any |
| refactor | Code change that is neither feat nor fix | shared, core |
| test | Adding or correcting tests | ui-components |
| chore | Tooling, config, build scripts, deps | deps, config |
| build | Build system or external dependency change | nx, rspack |
| ci | CI/CD configuration changes | github-actions |
| perf | Performance improvement | shared, core |
pre-commit:
parallel: true
jobs:
- name: lint
glob: "*.{js,ts,jsx,tsx}"
run: bun run lint:fix {staged_files}
- name: format
glob: "*.{js,ts,jsx,tsx,json,md}"
run: bun run format:fix {staged_files}
commit-msg:
jobs:
- name: commitlint
run: bunx commitlint --edit {1}
Key patterns:
parallel: true — lint and format run concurrently in pre-commitglob — hooks only fire on matching file types{staged_files} — Lefthook injects only the staged files, keeping hooks fast{1} — the path to the commit message temp file (standard for commit-msg)# Install hooks after cloning (required)
bunx lefthook install
# Test hooks manually without committing
bunx lefthook run pre-commit
bunx lefthook run commit-msg
# Run a specific job within a hook
bunx lefthook run pre-commit --jobs lint
# Uninstall hooks
bunx lefthook uninstall
git commit --no-verify -m "chore: emergency fix"
Use --no-verify ONLY when:
NEVER use --no-verify to bypass commit message conventions — the convention enforcement exists for a reason (changelog generation, semantic versioning, blame clarity).
# See verbose output from hooks
LEFTHOOK_VERBOSE=true git commit -m "..."
# Check hook is installed
cat .git/hooks/commit-msg
# Re-install if hooks are missing
bunx lefthook install
module.exports = {
extends: ["@commitlint/config-conventional"]
};
This uses the standard @commitlint/config-conventional ruleset — no custom overrides in this project.
development
Rstest patterns for Rspack-native unit testing with Preact. Trigger: When writing tests with @rstest/core, testing-library/preact, or configuring rstest.config.ts.
tools
Rspack bundler patterns for Rsbuild/Rslib config customization. Trigger: When customizing rspack config via tools.rspack, adding plugins, aliases, or Module Federation setup.
tools
Rslib library build tool patterns for Rspack-based component libraries. Trigger: When configuring rslib.config.ts, library builds, Module Federation remotes, or dynamic entry discovery.
development
Preact 10 patterns with React-compat and Module Federation singleton setup. Trigger: When writing Preact components, hooks, types, or configuring Preact in Rsbuild/Rslib/Rstest.