.claude/skills/ast-quality-gate/SKILL.md
Language-agnostic code quality verification for AI-generated code. Runs native AST tools per language, detects 12 universal LLM error patterns, normalizes output to unified JSON. Integrates into SDD PostToolUse pipeline.
npx skillsauth add gonzalezpazmonica/pm-workspace ast-quality-gateInstall 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.
Sistema de quality gates para verificar código generado por IA en los 16 language packs de pm-workspace. Detecta los 5 patrones de error más comunes en código LLM-generado y 7 criterios universales adicionales.
/ast-quality-gate {fichero-o-directorio} — bajo demandaPostToolUse hook async tras Edit|Write en SDD sessionsCapa 1: Herramienta nativa del lenguaje (máxima precisión)
→ eslint/ruff/golangci-lint/cargo clippy/dotnet build/phpstan/...
→ Output: JSON nativo normalizado
Capa 2: Semgrep (cobertura universal de patrones LLM)
→ rules/llm-antipatterns.yaml (8+ lenguajes simultáneos)
→ Output: semgrep JSON normalizado
Capa 3: LSP Claude Code (semántica real-time)
→ 11 lenguajes (dic 2025)
→ tipo nulo, símbolo no resuelto, import no usado
| Gate | Patrón | Severidad | |------|--------|-----------| | QG-01 | Async/concurrencia sin manejo de errores | error | | QG-02 | N+1 queries / acceso DB en loop | error | | QG-03 | Null/nil/None dereference sin check | error | | QG-04 | Magic numbers/strings sin nombre | warning | | QG-05 | Exception handling vacío o excesivamente amplio | error | | QG-06 | Complejidad ciclomática > 15 | warning | | QG-07 | Función/método > 50 líneas | warning | | QG-08 | Duplicación de código > 15% | warning | | QG-09 | Credenciales/secrets hardcodeados | error | | QG-10 | Logging excesivo en producción | warning | | QG-11 | Código muerto / imports no usados | info | | QG-12 | Lógica nueva sin tests | error |
scripts/ast-quality-gate.sh detecta por extensión/fichero de proyecto (16 lenguajes).
Ver comandos por lenguaje en references/language-commands.md.
semgrep --config .claude/skills/ast-quality-gate/references/semgrep-rules.yaml \
--json --no-git-ignore "$TARGET"
Ver references/unified-schema.md para el schema completo.
Output en output/quality-gates/YYYYMMDD-HHMMSS-{lenguaje}.json
score = 100 - (errores × 10) - (warnings × 3) - (infos × 1) [min 0]
| Score | Grade | Veredicto | |-------|-------|-----------| | 90-100 | A | PASS: listo para PR | | 75-89 | B | PASS_WITH_WARNINGS: PR con advisory | | 60-74 | C | REVIEW: requiere revisión human | | 40-59 | D | FAIL: corregir antes de PR | | 0-39 | F | BLOCK: bloquear commit |
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"command": ".claude/hooks/ast-quality-gate-hook.sh",
"async": true
}]
}
}
Gates QG-01, QG-03, QG-05, QG-09, QG-12 son bloqueantes (exit 1). Gates QG-02, QG-04, QG-06, QG-07, QG-08, QG-10, QG-11 son advisory.
bash scripts/ast-quality-gate.sh src/ # completo
bash scripts/ast-quality-gate.sh src/ --semgrep-only # solo Semgrep
bash scripts/ast-quality-gate.sh src/ --native-only # solo nativo
bash scripts/ast-quality-gate.sh src/ --advisory # sin bloqueo
semgrep ≥ 1.60.0 (pip install semgrep)references/language-commands.md)jq para normalización JSONreferences/unified-schema.md — Schema JSON unificado y jq transformationsreferences/semgrep-rules.yaml — 20 reglas Semgrep por lenguajereferences/language-commands.md — Comandos CLI por lenguajetesting
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
tools
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
tools
Sistema proactivo de bienestar individual
development
Search the web to resolve context gaps — documentation, versions, CVEs, best practices. Auto-starts SearxNG Docker if available, falls back to WebSearch.