LLM-powered quality verification using prompt hooks. Validates commit messages, code patterns, and conventions using AI before allowing operations. Use to set up intelligent guardrails.
git clone https://github.com/rohitg00/pro-workflow.git--- name: llm-gate description: LLM-powered quality verification using prompt hooks. Validates commit messages, code patterns, and conventions using AI before allowing operations. Use to set up intelligent guardrails. --- # LLM Gate Use Claude Code's `type: "prompt"` hooks to create intelligent quality gates that use AI to verify operations. ## Trigger Use when: - Setting up commit message validation - Enforcing code conventions beyond what linters catch - Creating smart guardrails for specific operations ## How Prompt Hooks Work Claude Code supports hooks with `type: "prompt"` that run a small LLM (Haiku by default) to verify conditions: ```json { "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "prompt", "if": "Bash(git commit*)", "prompt": "Check if this git commit follows conventional commit format (<type>(<scope>): <summary>). The commit command is: $ARGUMENTS. Return {\"ok\": true} if valid, {\"ok\": false, \"reason\": \"...\"} if not.", "model": "haiku", "timeout": 15 }] }] } ``` The hook: 1. Substitutes `$ARGUMENTS` with the JSON hook input 2. Sends to Haiku (fast, cheap) 3. Expects `{"ok": true}` or `{"ok": false, "reason": "..."}` 4. If not ok → blocks the tool call with the reason ## Example Gates ### Conventional Commit Validator ```json { "type": "prompt", "if": "Bash(git commit*)", "prompt": "Verify this git commit follows conventional commits: type(scope): summary. Types: feat,fix,refactor,test,docs,chore,perf,ci. Summary under 72 chars. Input: $ARGUMENTS", "model": "haiku" } ``` ### Destructive Command Guard ```json { "type": "prompt", "if": "Bash(rm *)", "prompt": "Check if this rm command is safe. Flag if it uses -rf on important directories (src/, node_modules/, .git/). Input: $ARGUMENTS", "model": "haiku" } ``` ### API Key Leak Prevention ```json { "type": "prompt", "matcher": "Write", "prompt": "Check if this file write contains hardcoded API keys, secrets, passwords, or tokens. Input: $ARGUMENTS. Return ok:false if secrets found.", "model": "haiku" } ``` ## Agent Hooks For complex verification, use `type: "agent"` (runs a full agent): ```json { "type": "agent", "if": "Bash(git push*)", "prompt": "Review all staged changes for security issues before pushing. Check for: hardcoded secrets, SQL injection, XSS vulnerabilities, exposed internal URLs.", "model": "haiku", "timeout": 60 } ``` ## Setup Guide 1. Choose which operations to gate 2. Write the prompt (keep it focused, under 100 words) 3. Pick the model (haiku for speed, sonnet for accuracy) 4. Set timeout (15s for prompts, 60s for agents) 5. Add to hooks.json under the appropriate event ## Rules - Use Haiku for simple checks (fast, cheap) - Use Sonnet only for complex analysis - Keep prompts under 100 words for reliability - Always include `if` condition to avoid running on every tool call - Set reasonable timeouts (15s prompt, 60s agent) - Test hooks before deploying to avoid blocking workflows
["Install the LLM gate as a pre-commit hook or CI pipeline step using your preferred method (e.g., Husky for Git, GitHub Actions for CI).","Configure the guardrails by specifying your project standards in a `llm-gate-config.json` file with rules for commit messages, code patterns, and conventions.","Run the gate locally before committing or push changes to trigger the CI verification. The system will analyze changes against your configured standards.","Review the JSON output and address violations before proceeding. Use the suggestions to make corrections efficiently.","For advanced setups, integrate with your IDE (e.g., VS Code extension) to get real-time feedback during development. Adjust the LLM's strictness based on your team's maturity level."]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/rohitg00/pro-workflow/tree/main/skills/llm-gateCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Act as an LLM-powered quality gate for [REPOSITORY_NAME]. Review the following [COMMIT_MESSAGE/CODE_CHANGE] for compliance with [PROJECT_STANDARDS]. Flag any violations of [SPECIFIC_RULES] and suggest improvements. Return a JSON response with: { "violations": ["list of issues"], "suggestions": ["specific fixes"], "status": "approved/needs_revision/blocked" }. [COMMIT_MESSAGE/CODE_CHANGE]: [PLACEHOLDER_FOR_INPUT]```json
{
"violations": [
"Commit message does not follow Conventional Commits format (missing type/scope)",
"Function 'calculateTax' uses hardcoded tax rate (should be configurable)",
"Missing JSDoc comment for new 'processOrder' function"
],
"suggestions": [
"Update commit message to: 'feat(api): add tax calculation service with configurable rates'",
"Extract tax rate to environment variable 'TAX_RATE' and document in README",
"Add JSDoc comment explaining parameters and return type for 'processOrder'"
],
"status": "needs_revision"
}
```
**Analysis Context:**
Reviewed changes to `src/services/taxService.js` and `src/controllers/orderController.js` in the e-commerce platform repository. The commit attempted to add tax calculation functionality but missed several project standards:
- The team requires Conventional Commits format with type, scope, and brief description
- All new functions must include JSDoc documentation
- Configuration values must use environment variables with documentation
- Hardcoded values violate the project's security policy
**Impact:** Without these fixes, the changes would introduce technical debt and potential security issues. The suggested improvements align with the team's quality standards documented in `CONTRIBUTING.md` and the security review checklist in `SECURITY.md`.skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan