Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

quality-gates质量门

Agent Skill

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

总安装

256

周安装

11

GitHub Stars

6

下载量

90
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:quality-gates(质量门)
来源仓库:https://github.com/atman36/ai-vibe-prompts
仓库路径:skills/quality-gates
安装命令:
npx skills add https://github.com/atman36/ai-vibe-prompts --skill quality-gates
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/atman36/ai-vibe-prompts --skill quality-gates

简介

quality-gates 设置多层级质量门禁,包括预提交快速检查和发布前全量验证。

  • 它集成 Vitest、Playwright 等工具链,设定覆盖率阈值和性能基准线硬性要求。
  • 任何未通过检查的代码都无法进入主分支,防止低质量代码污染生产环境。
  • Level 2 及以上检查需在独立 runner 执行,避免拖慢日常开发流程。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Quality Gates Skill

Objective

Enforce code quality standards by running automated checks that must pass before code can be committed, merged, or deployed. Acts as a guardian ensuring consistent quality across the codebase.

When to Use This Skill

Auto-invoke when:

  • User completes feature implementation
  • Before creating commits or pull requests
  • User asks to "test", "validate", "check quality", or "verify"
  • Before deployment or release
  • After significant refactoring

Quality Gate Levels

Level 1: Pre-Commit Gates (Fast, < 30 seconds)

Essential checks that run before every commit.

Level 2: Pre-Push Gates (Moderate, < 2 minutes)

Comprehensive checks before pushing to remote.

Level 3: Pre-Deploy Gates (Thorough, < 5 minutes)

Complete validation before production deployment.

Gate Execution Workflow

Gate 1: Linting (JavaScript/TypeScript)

Purpose: Enforce code style and catch common errors

Tools: Bash, Read

Process:

  1. Detect linter by checking for:

- ESLint: .eslintrc*, eslint.config.* - Biome: biome.json - None: Skip this gate

  1. Read package.json to find lint script: "scripts": {"lint": "eslint.", "lint:fix": "eslint. --fix"}
  2. Execute linter: # Try to run lint script npm run lint # If fails, try direct commands npx eslint. || npx biome check.
  3. Parse results:

- Exit code 0: ✅ PASS - Exit code non-zero: ❌ FAIL - Extract error count and file locations

  1. Auto-fix attempt (if failures found): npm run lint:fix || npx eslint. --fix

Success Criteria: Zero linting errors (warnings acceptable)

Gate 2: Type Checking (TypeScript)

Purpose: Verify type safety and catch type errors

Tools: Bash, Read, Grep

Process:

  1. Detect TypeScript by checking for:

- tsconfig.json - TypeScript in dependencies

  1. Read tsconfig.json to check strictness:

- strict: true - noImplicitAny, strictNullChecks, etc.

  1. Execute type checker: # Try to run typecheck script npm run typecheck || npm run type-check # If no script, run directly npx tsc --noEmit
  2. Parse results:

- Exit code 0: ✅ PASS - Exit code non-zero: ❌ FAIL - Extract error count and locations

Success Criteria: Zero type errors

Gate 3: Unit & Integration Tests

Purpose: Verify code functionality and prevent regressions

Tools: Bash, Read, Grep

Process:

  1. Detect test framework:

- Vitest: vitest.config.*, vitest in dependencies - Jest: jest.config.*, jest in dependencies - Native test: --test flag with Node.js 20+

  1. Count test files: # Use Grep to find test files find. -name "*.test.*" -o -name "*.spec.*" | wc -l
  2. Execute tests: # Run unit tests (fast) npm run test || npm run test:unit # Or direct command npx vitest run || npx jest --ci
  3. Parse results:

- Total tests run - Passed / Failed / Skipped - Coverage percentage (if available)

  1. Coverage check (if configured): npm run test:coverage # Check if meets threshold (e.g., 80%)

Success Criteria:

  • All tests pass (100%)
  • Coverage ≥ configured threshold (if set)

Gate 4: Build Verification

Purpose: Ensure code compiles and builds without errors

Tools: Bash

Process:

  1. Detect build system:

- Next.js: next build - Vite: vite build - Webpack: webpack --mode production - TypeScript: tsc

  1. Execute build: npm run build
  2. Check build artifacts:

- Verify output directory exists: dist/, build/, .next/ - Check for build errors in logs

  1. Clean up (optional): # Remove build artifacts to save space rm -rf dist/ build/.next/

Success Criteria: Build completes with exit code 0

Gate 5: Security Audit

Purpose: Identify known vulnerabilities in dependencies

Tools: Bash, Read

Process:

  1. Run npm/pnpm audit: npm audit --json || pnpm audit --json
  2. Parse audit results:

- Critical vulnerabilities: 0 - High vulnerabilities: 0 - Moderate vulnerabilities: < threshold - Low vulnerabilities: informational

  1. Check for specific vulnerabilities:

- Prototype pollution - Remote code execution (RCE) - SQL injection - Cross-site scripting (XSS)

  1. Suggest fixes: npm audit fix # or npm audit fix --force # (if safe)

Success Criteria:

  • Zero critical/high vulnerabilities
  • Moderate vulnerabilities acknowledged or fixed

Gate 6: Code Complexity Analysis (Optional)

Purpose: Flag overly complex code that may need refactoring

Tools: Grep, Bash

Process:

  1. Detect code complexity tools:

- eslint-plugin-complexity - SonarQube - CodeClimate

  1. Basic complexity checks: # Find files with excessive lines find src -name "*.{ts,tsx,js,jsx}" -exec wc -l {} \; | awk '$1 > 500' # Find deeply nested code (>5 levels) grep -rn "^[[:space:]]\{20,\}" src/ # Count TODO/FIXME grep -rn "TODO\|FIXME\|HACK" src/ | wc -l

Success Criteria:

  • No files > 500 lines (warning only)
  • No nesting > 5 levels (warning only)

Gate 7: Git Pre-Commit Checks

Purpose: Ensure commit quality and prevent sensitive data leaks

Tools: Bash, Grep

Process:

  1. Check for sensitive data: # Search for API keys, secrets, tokens git diff --cached | grep -i "api[_-]key\|secret\|password\|token" # Check for.env files being committed git diff --cached --name-only | grep "\.env$"
  2. Validate commit message (if Conventional Commits):

- Format: type(scope): description - Types: feat, fix, docs, style, refactor, test, chore

  1. Check file sizes: # Flag files > 1MB git diff --cached --name-only | xargs ls -lh | awk '$5 > 1000000'

Success Criteria:

  • No secrets in diff
  • No.env files
  • No large files (> 1MB)

Execution Strategy

Sequential Execution (Default)

Run gates in order, stop on first failure:

Lint → TypeCheck → Test → Build → Audit

Parallel Execution (Fast Mode)

Run independent gates simultaneously:

[Lint + TypeCheck + Test] → Build → Audit

Selective Execution

Run only relevant gates based on changes:

  • .ts/.tsx files changed → TypeCheck
  • Dependencies updated → Audit
  • Test files changed → Tests only

Output Format

# Quality Gate Results

## Summary
✅ 5/7 Gates Passed | ❌ 2/7 Gates Failed

## Gate Details

### ✅ Gate 1: Linting
- **Status**: PASS
- **Duration**: 3.2s
- **Details**: 0 errors, 2 warnings

### ❌ Gate 2: Type Checking
- **Status**: FAIL
- **Duration**: 5.1s
- **Errors**: 3 type errors found
  - `src/components/Button.tsx:15` - Property 'onClick' is missing
  - `src/utils/api.ts:42` - Type 'string' is not assignable to type 'number'
  - `src/hooks/useAuth.ts:8` - Cannot find name 'User'

### ✅ Gate 3: Tests
- **Status**: PASS
- **Duration**: 12.4s
- **Tests**: 124 passed, 0 failed, 2 skipped
- **Coverage**: 87% (target: 80%)

### ⏭️ Gate 4: Build
- **Status**: SKIPPED (previous gate failed)

### ⏭️ Gate 5: Security Audit
- **Status**: SKIPPED (previous gate failed)

## Action Required
Fix the 3 type errors in Gate 2 before proceeding.

## Recommendations
1. Run `npm run typecheck` locally to see full error details
2. Consider adding pre-commit hooks to catch these earlier
3. Current code coverage (87%) exceeds target - excellent work!

Integration with Git Hooks

Setup Husky + lint-staged (Recommended)

Check if installed:

test -d .husky && echo "Husky installed" || echo "Husky not found"

Suggest installation if missing:

npm install --save-dev husky lint-staged
npx husky init

Configure.husky/pre-commit:

#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Run quality gates
npm run lint
npm run typecheck
npm run test

Alternative: git commit -m with manual checks

If no hooks, prompt user:

⚠️  No pre-commit hooks detected.
Would you like me to run quality gates before committing? (Recommended)

Progressive Quality Gates

Level 1: Essential (Always Run)

  • Linting
  • Type checking

Level 2: Standard (Pre-Push)

  • Essential +
  • Unit tests
  • Security audit

Level 3: Comprehensive (Pre-Deploy)

  • Standard +
  • Integration tests
  • E2E tests
  • Build verification
  • Performance tests

Error Recovery

Auto-Fix Capability

  • Lint errors: Run eslint --fix or biome check --apply
  • Format errors: Run prettier --write
  • Security vulnerabilities: Run npm audit fix

Manual Fix Required

  • Type errors
  • Test failures
  • Build errors

Bypass (Use with Caution)

# Skip hooks for emergency fixes only
git commit --no-verify -m "emergency: fix critical bug"

Best Practices

  1. Fail Fast: Stop at first critical failure to save time
  2. Clear Feedback: Always show which gate failed and why
  3. Actionable: Provide exact commands to fix issues
  4. Configurable: Respect project's quality thresholds
  5. Performance: Cache results when possible
  6. Incremental: Only check changed files when appropriate

Configuration

Read from package.json

{
  "qualityGates": {
    "coverage": {
      "minimum": 80,
      "enabled": true
    },
    "audit": {
      "level": "moderate",
      "enabled": true
    },
    "complexity": {
      "maxLines": 500,
      "maxDepth": 5
    }
  }
}

Default Settings

If no config found, use sensible defaults:

  • Coverage minimum: 70%
  • Audit level: high/critical only
  • Max file lines: 500
  • Max nesting: 5 levels

Integration with Other Skills

  • codebase-analysis - Use to detect available quality tools
  • git-workflow - Integrate with commit/push process
  • ci-cd-setup - Configure gates for CI pipeline

Version History

  • 1.0.0 (2025-01-03): Initial skill with 7 quality gates and progressive execution

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.18%
按下载量换算30

Claude

32.8%
按下载量换算30

Cursor

20.47%
按下载量换算18

Gemini CLI

9.5%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills