/pm-workspace:ast-quality-gatefrom pm-workspace
Multi-language quality gate system that verifies AI-generated code before PR merge. Runs native linters (14 languages) + Semgrep rules for common LLM error patterns (async, N+1, null deref, magic numbers, empty catch). Produces JSON report with 0-100 score and 12 quality gates.
Ships in pm-workspace. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Sistema de quality gates para verificar código generado por IA. Detecta 16 lenguajes; linter nativo en 14 y reglas Semgrep en 10. Busca los 5 patrones de error más comunes en código LLM-generado y 7 criterios universales más.
/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 (patrones LLM)
→ references/semgrep-rules.yaml (10 lenguajes)
→ Output: semgrep JSON normalizado
Capa 3: LSP Claude Code (semántica real-time)
→ diagnósticos del editor; el script NO la ejecuta
Una capa que no puede correr (herramienta ausente, caída o sin soporte) queda
en meta.tool_chain con status missing|failed|unsupported y nunca cuenta
como "sin hallazgos". Java y COBOL no tienen linter nativo integrado; las reglas
Semgrep cubren TS/JS, Python, Go, Java, Ruby, PHP, C#, Kotlin y Rust (Swift,
Dart, Terraform, VB.NET y COBOL: Semgrep unsupported).
| 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 |
Detectores reales: Semgrep cubre QG-01..05, QG-09 y QG-10. QG-06, 07, 08 y 11
solo aparecen si el linter nativo los reporta (gate asignado por rule_id).
QG-12 no tiene detector todavía.
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}-{pid}-{n}.json
(AST_QG_OUTPUT_DIR lo cambia).
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 |
Un error en un gate bloqueante fuerza BLOCK sea cual sea el score.
Si ninguna capa corrió: UNVERIFIED, score.total: null, meta.coverage: none.
Si corrió solo una: meta.coverage: partial y aviso en la salida.
.opencode/hooks/ast-quality-gate-hook.sh (matcher Edit|Write, async: true)
corre el gate con --advisory y copia el informe a output/quality-gates/latest.json.
Gates QG-01, QG-03, QG-05, QG-09, QG-12 son bloqueantes: un issue de
severidad error en ellos da BLOCK (exit 1). El resto son advisory.
Exit: 0 PASS/PASS_WITH_WARNINGS/REVIEW · 1 FAIL/BLOCK · 2 uso o entorno
(target inexistente, flag desconocido, sin jq; no genera informe) ·
3 UNVERIFIED. --advisory convierte 1 y 3 en 0; el informe conserva el veredicto.
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 JSON (sin jq: exit 2)references/unified-schema.md — Schema JSON unificadoreferences/semgrep-rules.yaml — 22 reglas Semgrep por lenguajereferences/language-commands.md — Comandos CLI por lenguajeWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Python, JavaScript, TypeScript, Go, Rust
Claude Code refuses to install this plugin
.claude-plugin/plugin.json: dependencies: Invalid input: expected array, received object, author: Invalid input: expected object, received string
Checked against Claude Code 2.1.332's install rules. The listing below is what the repository ships; Claude Code cannot install it as published.
139 skills in this plugin
/adversarial-securityUsar cuando se necesita auditar la seguridad de un proyecto con pipeline Red Team / Blue Team./agent-code-mapUsar cuando un agente necesita conocer la arquitectura del proyecto sin leer ficheros completos./agent-file-mapUsar cuando se trabaja con ficheros externos al workspace que los agentes deben localizar./agent-messagingUsar cuando un agente debe enviar un mensaje a otro agente con roles y receipts, sin pasar por el usuario. Triggers: mensaje a otro agente, agent-message, notify agent, inbox.Other plugins' skills for the same job