Code & Dev Compatible: claude

Git Hooks With lint-staged and a Useful Message

Complexity Level: Advanced
Prompt Code Block

Set up a pre-commit hook that lints and formats only the staged files, plus a commit message check that is strict about one thing and quiet about the rest. REPO Package manager: [PNPM | NPM] Lint and format: [ESLINT, PRETTIER, BIOME — NAME OURS] Tests on commit: [NO | UNIT ONLY — DEFAULT NO] Message rule: [CONVENTIONAL COMMITS | A TICKET PREFIX | NONE] DELIVER 1) The hook installer and the exact scripts. lint-staged config that runs the right command per extension and passes filenames safely. 2) Why tests do not run on every commit unless I said yes, and where they run instead (CI). 3) The message check, with two examples that pass and two that fail, and an escape hatch for a WIP that is not going to main (a documented flag, not a secret). 4) CI runs the same lint so a skipped hook cannot merge. Show the command. 5) The failure output a teammate sees, in one line, when a file is wrong. Do not hook into post-checkout in a way that surprises people. Do not format the whole repo on commit.

🌟 Example Output / Preview

### Generated Component Preview: ```typescript // Fully validated modern structure import { z } from 'zod'; export const RequestSchema = z.object({ id: z.string().uuid(), createdAt: z.date().default(() => new Date()), data: z.record(z.string(), z.any()) }); export type ValidatedRequest = z.infer<typeof RequestSchema>; ```

Prompt Metadata

DifficultyAdvanced
Compatibilityclaude

Primary Use Cases:

  • •Legacy code modernization & technical refactoring
  • •Full-stack layout generation & component structuring
  • •CI/CD workflow automation & unit/E2E testing suites

Associated Tags:

#git #husky #lint #dx

💡 Pro Tips & Advice

1. Use bracketed items: Be sure to fill out all [PLACEHOLDER] elements with specific details before sending the prompt to the AI model.

2. Adjust temperature: For creative tasks, set AI temperature higher (e.g., 0.8), or lower (e.g., 0.2) for strict coding/technical tasks.

🔗 Related AI Prompts

Code & Dev
★ Featured

Full SaaS Landing Page Build Spec (SEO + Conversion)

You are a Staff Product Designer + Frontend Engineer + SEO strategist. Build a complete, production-ready marketing landing page f...

Compatible:claudeDiff:Advanced
#landing-page #saas #seo #nextjs #tailwind
Code & Dev
★ Featured 🔥 Trending

SaaS Analytics Dashboard Full Build Spec

You are a Principal Product Designer + Frontend Lead. Design and specify a complete [LIGHT | DARK] analytics dashboard for [PRODUC...

Compatible:claudeDiff:Intermediate
#dashboard #saas #ui #tailwind #seo
Code & Dev

SaaS Admin Panel Dashboard Build Spec

Design a full internal Admin Dashboard for [PRODUCT_NAME] used by [ADMIN_ROLE: support | ops | super-admin]. --- 🎯 CONTEXT Adm...

Compatible:claudeDiff:Intermediate
#admin #dashboard #saas #crud #tailwind