원클릭으로
code-quality
Code quality and verification: codebase metrics, post-implementation cleanup, and pre-commit verification pipeline.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Code quality and verification: codebase metrics, post-implementation cleanup, and pre-commit verification pipeline.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Healthchecks, SSH access, model switching, and systemd debugging for the Appie fleet. Covers Appie-2 (Hetzner Hermes) and common failure modes.
Direct Google Calendar + Gmail + Contacts REST API access via Python. Use when gws CLI is broken (token cache decrypt failure) or google_api.py wrapper is unreliable. Companion to the bundled google-workspace skill.
State-of-the-art text-to-image generation with Stable Diffusion models via HuggingFace Diffusers. Use when generating images from text prompts, performing image-to-image translation, inpainting, or building custom diffusion pipelines.
Use 21st.dev Agent Elements — 25 shadcn/ui components purpose-built for AI agent UIs. Tool cards (Bash, Edit, Search, Plan, Subagent, MCP), chat, input, streaming. Open source, shadcn-registry install, no runtime lock-in.
Use v0 Design Systems 2.0, Bolt Design System Agents, or Lovable to generate production UI from a client's real design system components — not generic Tailwind. Use when building a client website where brand consistency matters.
Umbrella workflow for delegating coding work to local agent CLIs such as Claude Code, Codex, and OpenCode.
| name | code-quality |
| description | Code quality and verification: codebase metrics, post-implementation cleanup, and pre-commit verification pipeline. |
| version | 1.0.0 |
| author | Hermes Agent Curator |
| license | MIT |
| platforms | ["linux","macos","windows"] |
| metadata | {"hermes":{"tags":["code-quality","code-review","verification","metrics","static-analysis","linting","security","cleanup"],"related_skills":["test-driven-development","development-workflow","github-code-review"]}} |
Three complementary tools for ensuring code quality at different stages of development:
| Mode | When | Tool | What it does |
|---|---|---|---|
| Codebase Metrics | Explore/adopt a repo | pygount | Analyze LOC, language breakdown, code-vs-comment ratios |
| Simplify Code | After implementing changes | 3 parallel subagents | Clean up recent changes for reuse, quality, efficiency |
| Pre-Commit Verification | Before git commit | Automated pipeline | Security scan, quality gates, independent reviewer, auto-fix |
Analyze repositories for lines of code, language breakdown, file counts, and code-vs-comment ratios.
pip install --break-system-packages pygount 2>/dev/null || pip install pygount
cd /path/to/repo
pygount --format=summary \
--folders-to-skip=".git,node_modules,venv,.venv,__pycache__,.cache,dist,build,.next,.tox,.eggs,*.egg-info" \
.
IMPORTANT: Always use --folders-to-skip to exclude dependency/build directories, otherwise pygount will crawl them and hang.
# Python projects
--folders-to-skip=".git,venv,.venv,__pycache__,.cache,dist,build,.tox,.eggs,.mypy_cache"
# JavaScript/TypeScript projects
--folders-to-skip=".git,node_modules,dist,build,.next,.cache,.turbo,coverage"
# Only count Python files
pygount --suffix=py --format=summary .
# Only count Python and YAML
pygount --suffix=py,yaml,yml --format=summary .
pygount --format=summary . # Summary table
pygount --format=json . # JSON for programmatic use
The summary table columns: Language, Files, Code (executable lines), Comment (documentation lines), % (percentage of total).
Special pseudo-languages: __empty__ (empty files), __binary__ (binary), __generated__ (auto-generated), __duplicate__ (identical content), __unknown__ (unrecognized types).
--folders-to-skip, pygount crawls everything and may hangwc -l for accurate JSON line counts--suffix to target specific languages rather than scanning everythingReview recent code changes with three focused reviewers running in parallel, aggregate findings, and apply fixes.
Core principle: Three narrow reviewers beat one broad reviewer. Each deeply searches the codebase for a single class of problem.
Optional modifiers: Focus (reuse/quality/efficiency), Dry run (report only), Scope (last commit / staged / specific file)
# Default: uncommitted working-tree changes
git diff
# If empty, include staged
git diff HEAD
# Scoped variants:
git diff --staged # staged changes
git diff HEAD~1 # last commit
git diff main...HEAD # this branch/PR
git diff -- src/foo.py # specific file
Use delegate_task batch mode — pass all three tasks in one tasks array:
Reviewer 1 — Code Reuse: Search for code that duplicates existing functionality. Check utility modules, shared helpers, adjacent files for existing functions to reuse.
Reviewer 2 — Code Quality: Look for redundant state, parameter sprawl, copy-paste-with-variation, leaky abstractions, stringly-typed code.
Reviewer 3 — Efficiency: Look for unnecessary work, missed concurrency, hot-path bloat, TOCTOU anti-patterns, memory issues, overly broad reads.
Each gets the complete diff plus repo path and toolsets [terminal, file, search].
patch/write_file (or dry run)file:line evidence from reviewersAutomated verification pipeline before code lands. Static scans, baseline-aware quality gates, an independent reviewer subagent, and an auto-fix loop.
Core principle: No agent should verify its own work. Fresh context finds what you miss.
git commit or git pushSkip for: documentation-only changes, pure config tweaks, or explicit "skip verification".
git diff --cached
If empty, try git diff then git diff HEAD~1 HEAD. If diff exceeds 15K chars, split by file.
Scan added lines for hardcoded secrets, shell injection, dangerous eval/exec, unsafe deserialization, SQL injection:
git diff --cached | grep "^+" | grep -iE "(api_key|secret|password|token|passwd)\s*=\s*['\"][^'\"]{6,}['\"]"
git diff --cached | grep "^+" | grep -E "os\.system\(|subprocess.*shell=True"
git diff --cached | grep "^+" | grep -E "\beval\(|\bexec\("
git diff --cached | grep "^+" | grep -E "pickle\.loads?\("
git diff --cached | grep "^+" | grep -E "execute\(f\"|\.format\(.*SELECT|\.format\(.*INSERT"
Detect the project language and run appropriate tools. Capture baseline BEFORE changes (stash changes, run, pop). Only NEW failures block commit.
Test frameworks (auto-detect):
python -m pytest --tb=no -q 2>&1 | tail -5
npm test -- --passWithNoTests 2>&1 | tail -5
cargo test 2>&1 | tail -5
go test ./... 2>&1 | tail -5
Linting (run only if installed):
which ruff && ruff check . 2>&1 | tail -10
which npx && npx eslint . 2>&1 | tail -10
cargo clippy -- -D warnings 2>&1 | tail -10
Call delegate_task with the diff and static scan results. The reviewer gets ONLY the diff. Fail-closed: returns JSON verdict with passed boolean, security_concerns, logic_errors, suggestions.
delegate_task(
goal="""Review this diff. Return ONLY JSON:
{"passed": true/false, "security_concerns": [], "logic_errors": [], "suggestions": [], "summary": "..."}
FAIL-CLOSED: security_concerns non-empty → passed=false; logic_errors non-empty → passed=false.
Cannot parse diff → passed=false.""",
context="Independent code review. Return only JSON verdict.",
toolsets=["terminal"]
)
All passed: Proceed to commit. Any failures: Report what failed, then proceed to auto-fix.
Maximum 2 fix-and-reverify cycles. Spawn a fix agent that fixes ONLY the reported issues:
delegate_task(
goal="Fix ONLY the reported issues. Do not refactor, rename, or add features.",
context="Fix only reported issues.",
toolsets=["terminal", "file"]
)
After fix agent completes, re-run Steps 1-6. Passed → commit. Failed after 2 attempts → escalate to user.
git add -A && git commit -m "[verified] <description>"
# BAD: SQL injection
cursor.execute(f"SELECT * FROM users WHERE id = {user_id}")
# GOOD: parameterized
cursor.execute("SELECT * FROM users WHERE id = ?", (user_id,))
# BAD: shell injection
os.system(f"ls {user_input}")
# GOOD: safe subprocess
subprocess.run(["ls", user_input], check=True)
# BAD: XSS (JS)
element.innerHTML = userInput;
# GOOD: safe
element.textContent = userInput;
git status, tell user nothing to verify| Situation | Use |
|---|---|
| "How big is this repo?" / language breakdown | Codebase Metrics (pygount) |
| "Simplify my changes" / "Review my recent code" | Simplify Code (3-agent cleanup) |
| Before committing / "Verify before push" | Pre-Commit Verification pipeline |
| Full quality workflow | Run Simplify Code first, then Pre-Commit Verification |