AgentSkillsCN

codex-execution-quality-gate

在完成前,通过 lint/测试、安全扫描,以及可选的 Bundle 加技术债务分析,执行验证检查。在最终关卡步骤中使用此功能,一旦检测到强制性失败,立即阻止后续流程完成。

SKILL.md
--- frontmatter
name: codex-execution-quality-gate
description: Run verification checks before completion using lint/test, security scanning, and optional bundle plus tech debt analysis. Use at final gate steps and block completion when mandatory failures are detected.

Execution Quality Gate

Activation

  1. Activate during final gate steps.
  2. Activate on explicit $codex-execution-quality-gate.
  3. Run before saying work is complete.
  4. Activate on $pre-commit or "check before commit".
  5. Activate on $smart-test or "which tests to run".
  6. Activate on $suggest or "suggest improvements".
  7. Activate on $impact or "what will this affect".
  8. Activate on $quality-record to record quality trend snapshot.
  9. Activate on $quality-report to generate trend report.
  10. Activate on $ux-audit.
  11. Activate on $a11y-check.
  12. Activate on $lighthouse <url>.
  13. Activate on $e2e check.
  14. Activate on $e2e generate <url>.
  15. Activate on $e2e run.

Phase X Verification Order

PriorityCheckScriptBlocking
P-1impact predictor (pre-edit advisory)scripts/predict_impact.pywarning only
P0security scanscripts/security_scan.pyyes for critical findings
P1lintscripts/run_gate.pyyes when detected lint exits 1
P2testsscripts/run_gate.pyyes when detected tests exit 1
P3bundle/dependency checkscripts/bundle_check.pywarning only
P4tech debt scanscripts/tech_debt_scan.pywarning only
P5improvement suggester (post-task)scripts/suggest_improvements.pywarning only
P6quality trend tracker (periodic)scripts/quality_trend.pywarning only
P7UX static audit (pre-UI delivery)scripts/ux_audit.pywarning only
P8accessibility static checkerscripts/accessibility_check.pywarning only
P9Lighthouse runtime auditscripts/lighthouse_audit.pywarning only
P10Playwright setup/run helperscripts/playwright_runner.pywarning only

Execution

  1. Run run_gate.py with project root.
  2. Run security_scan.py with project root.
  3. Optionally run bundle_check.py with project root.
  4. Optionally run tech_debt_scan.py with project root.
  5. Optionally run suggest_improvements.py after complex tasks.
  6. Optionally run predict_impact.py before high-risk edits.
  7. Optionally run quality_trend.py --record on periodic cadence.
  8. Optionally run ux_audit.py before UI handoff.
  9. Optionally run accessibility_check.py for public-facing surfaces.
  10. Optionally run lighthouse_audit.py before deploy (requires running server URL).
  11. Optionally run playwright_runner.py for E2E setup/check/run flows.
  12. Merge results and decide pass/fail.

Decision Rules

  • Completion allowed only if no blocking failures remain.
  • Blocking failures must be fixed, then checks rerun.
  • Warning-only outcomes may proceed with explicit warning to user.
  • Tech debt scan is advisory in MVP and does not block completion.
  • Improvement suggestions are advisory and do not block completion.
  • Impact prediction is advisory and does not block completion.
  • Quality trend reporting is periodic/advisory and does not block completion.
  • UX static audit is advisory and does not block completion.
  • Accessibility static checker is advisory and does not block completion.
  • Lighthouse wrapper is advisory and must fail gracefully when tool/server is unavailable.
  • Playwright wrapper is advisory and must fail gracefully when tool/setup is unavailable.

Script Paths

  • Windows: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\<script>.py" --project-root <path>
  • macOS/Linux: python "$HOME/.codex/skills/codex-execution-quality-gate/scripts/<script>.py" --project-root <path>

Tech Debt Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\tech_debt_scan.py" --project-root <path>

Pre-Commit Intelligence Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\pre_commit_check.py" --project-root <path>

Smart Test Selector Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\smart_test_selector.py" --project-root <path> --source staged

Improvement Suggester Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\suggest_improvements.py" --project-root <path> --source last-commit
  • In proactive mode, run after complex tasks and present top 3 suggestions.

Impact Predictor Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\predict_impact.py" --project-root <path> --files <file1,file2> --depth 2

Quality Trend Commands

  • Record: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\quality_trend.py" --project-root <path> --record
  • Report: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\quality_trend.py" --project-root <path> --report --days 30

UX Audit Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\ux_audit.py" --project-root <path>

Accessibility Check Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\accessibility_check.py" --project-root <path> --level AA

Lighthouse Audit Command

  • python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\lighthouse_audit.py" --url <http://localhost:3000> --device mobile --runs 1
  • Requires a running URL and Lighthouse availability through npx.

Playwright Runner Commands

  • Check setup: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\playwright_runner.py" --project-root <path> --mode check
  • Generate skeleton: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\playwright_runner.py" --project-root <path> --mode generate --url <http://localhost:3000/page>
  • Run tests: python "$env:USERPROFILE\.codex\skills\codex-execution-quality-gate\scripts\playwright_runner.py" --project-root <path> --mode run --browser chromium

Reference Files

  • references/gate-policy.md: blocking vs warning rules for gate decisions.
  • references/improvement-suggester-spec.md: post-task suggestion behavior and presentation protocol.
  • references/impact-predictor-spec.md: pre-edit blast-radius analysis guidance.
  • references/quality-trend-spec.md: periodic quality trend workflow and interpretation.
  • references/ux-audit-spec.md: static UX audit checks and scoring.
  • references/accessibility-check-spec.md: WCAG static checks and compliance scoring.
  • references/lighthouse-audit-spec.md: Lighthouse wrapper behavior and graceful fallback.
  • references/playwright-runner-spec.md: Playwright check/generate/run behavior.

Override

If user says skip gate or force complete, comply and warn: "Quality gate skipped. Lint/test/security status is unknown."

Output Handling

For each script:

  1. capture output
  2. summarize errors/warnings/passes
  3. ask whether to fix blocking errors when present
  4. rerun after fixes to verify