|
| 1 | +--- |
| 2 | +name: generate-qoder-hooks |
| 3 | +title: Generate Qoder Hooks |
| 4 | +description: Interactively generate Qoder Hooks command interception scripts. Supports preset security templates (basic, financial compliance, workshop) and custom patterns with audit logging. |
| 5 | +source: community |
| 6 | +author: Lv Zhaobo |
| 7 | +githubUrl: https://github.com/lvzhaobo/ai-coding-skills/tree/main/skills/generate-qoder-hooks |
| 8 | +category: security |
| 9 | +tags: |
| 10 | + - hooks |
| 11 | + - command-filter |
| 12 | + - security |
| 13 | + - audit |
| 14 | + - qoder-config |
| 15 | + - devops |
| 16 | +roles: |
| 17 | + - developer |
| 18 | + - architect |
| 19 | +featured: false |
| 20 | +popular: false |
| 21 | +isOfficial: false |
| 22 | +installCommand: | |
| 23 | + git clone https://github.com/lvzhaobo/ai-coding-skills |
| 24 | + cp -r ai-coding-skills/skills/generate-qoder-hooks ~/.qoder/skills/ |
| 25 | +date: 2026-04-11 |
| 26 | +--- |
| 27 | + |
| 28 | +## Use Cases |
| 29 | + |
| 30 | +- Set up command security policies for new projects |
| 31 | +- Customize command blocklists (e.g., block `rm -rf`, `DROP TABLE`, `git push --force`) |
| 32 | +- Demonstrate Hooks interception in workshops/training |
| 33 | +- Add financial compliance command filtering rules |
| 34 | +- Generate cross-platform scripts (Shell + PowerShell) |
| 35 | + |
| 36 | +## Core Capabilities |
| 37 | + |
| 38 | +- **4 Preset Scenarios**: Basic Security, Financial Compliance, Workshop, Custom |
| 39 | +- **Interactive Q&A**: Collects interception patterns and script type preferences |
| 40 | +- **Dual Script Output**: Shell (.sh) and PowerShell (.ps1) templates |
| 41 | +- **Audit Logging**: Blocked commands logged with timestamp and rule name |
| 42 | +- **settings.json Integration**: Auto-updates `hooks.before_run_command` config |
| 43 | +- **Safe by Design**: Scripts only match patterns — never execute commands themselves |
| 44 | + |
| 45 | +## Example |
| 46 | + |
| 47 | +``` |
| 48 | +User: Help me set up command interception for our project |
| 49 | +
|
| 50 | +Agent: Which security scenario? |
| 51 | + → Basic Security (rm -rf, git push --force, DROP TABLE, etc.) |
| 52 | +
|
| 53 | + Script type? |
| 54 | + → Cross-platform (Shell + PowerShell) |
| 55 | +
|
| 56 | + [Generates .qoder/hooks/block-dangerous.sh + .ps1] |
| 57 | + [Updates .qoder/settings.json] |
| 58 | +
|
| 59 | + ✅ Hooks generated! Try running a blocked command to verify. |
| 60 | +``` |
| 61 | + |
| 62 | +## Notes |
| 63 | + |
| 64 | +- Pure knowledge skill — generates scripts and config, no external API calls |
| 65 | +- Hook scripts use `exit 0` (pass) or `exit 2` (block) — no other exit codes |
| 66 | +- Scripts read Qoder JSON input from stdin via `jq` |
| 67 | +- Read-only commands (`ls`, `cat`, `git status`) are never blocked |
| 68 | +- Existing settings.json entries are preserved — new hooks are appended |
0 commit comments