AgentSkillsCN

qa

质量保证代理,可在提交前运行预提交检查,对各类错误进行分类,并持续循环修复,直至所有检查全部通过。在完成编码后使用 /qa,确保代码质量后再进行提交。

SKILL.md
--- frontmatter
name: qa
description: >-
  Quality assurance agent that runs pre-commit checks, categorizes errors,
  and applies fixes in a cycle until all checks pass. Use /qa after coding
  to ensure code quality before committing.

QA Agent — Quality Check & Fix Cycle

Prerequisites

Before starting, be familiar with:

  • /app/.claude/skills/project-conventions/references/ast-grep-rules.md — 6 custom lint rules
  • /app/.claude/skills/coding/references/common-errors.md — frequent errors and fixes

Workflow

Step 1: Auto-format

Run mise run fmt to fix all auto-fixable formatting issues first. Stage the formatted files.

Step 2: Clippy Strict

Run mise run clippy:strict and categorize warnings:

CategoryExamplesAction
Error handlingunwrap_used, expect_usedAdd .context()/.with_context()
Loggingprint_stdout, dbg_macroReplace with tracing
Namingmodule_name_repetitionsAdd #[allow(...)] or rename
Type safetyas_conversionsUse try_from/try_into
Styleneedless_pass_by_valueFix per suggestion

Fix each warning. If unsure about a fix, read project-conventions/SKILL.md.

Step 3: AST-grep Rules

Run mise run ast-grep and fix rule violations:

Reference: project-conventions/references/ast-grep-rules.md

RuleFix
error-context-requiredAdd .context("msg")?
no-blocking-in-asyncUse tokio equivalents
no-get-prefixRemove get_ prefix
no-hardcoded-credentialsLoad from env/config
secure-random-requiredUse OsRng/ChaCha20Rng
module-size-limitSplit module (< 500 lines, < 10 fns)

Suppression (last resort): // ast-grep-ignore: <rule-id>

Step 4: Pre-commit Final Check

Run mise run pre-commit (runs fmt:check + clippy:strict + ast-grep).

  • All pass → Stage relevant files. Recommend commit.
  • Errors remain → Read coding/references/common-errors.md, fix, return to Step 1.

Step 5: Test Verification

Run mise run test to confirm no regressions.

Subagent Templates

Use Task tool with subagent_type: "general-purpose" for parallel fixes:

TemplatePurpose
prompts/fix-lint.mdFix ast-grep violations
prompts/fix-clippy.mdFix clippy warnings

Workflow Position

Cycle: /coding/qa/review code/docs/review docs This agent follows /coding. After all checks pass, run /review code.