Token导航 LogoToken导航TokenDH.com
AI 工具需要联网github未标认证来源可访问clear审计通过

qa-refactoring质量保证重构

Agent Skill

qa-refactoring 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,235

周安装

96

GitHub Stars

60

下载量

783
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill qa-refactoring

简介

qa-refactoring 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合围绕仓库状态、变更或协作事项进行整理。

  • 它支持查询项目动态、分析代码差异或跟踪协作进展。
  • 通过安装命令 npx skills add https://github.com/vasilyu1983/ai-agents-public --skill qa-refactoring 添加技能,具体用法可参考仓库中的 SKILL.md。
  • 安装前请确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

QA Refactoring Safety

Use this skill to refactor safely: preserve behavior, reduce risk, and keep CI green while improving maintainability and delivery speed.

Defaults: baseline first, smallest safe step next, and proof via tests/contracts/observability instead of intuition.

Quick Start (10 Minutes)

  • If key context is missing, ask for: what must not change (invariants), risk level (money/auth/migrations/concurrency), deployment constraints, and the smallest boundary that can be protected by tests.
  • Confirm baseline: main green; reproduce the behavior you must preserve.
  • Choose a boundary: API surface, module boundary, DB boundary, or request handler.
  • Add a safety net: characterization/contract/integration tests at that boundary.
  • Refactor in micro-steps: one behavior-preserving change per commit/PR chunk.
  • Prove: run the smallest relevant suite locally, then full CI; keep failures deterministic.

Core QA (Default)

Safe Refactor Loop (Behavior First)

  • Establish baseline: get main green; reproduce the behavior you must preserve.
  • Define invariants: inputs/outputs, error modes, permissions, data shape, performance budgets.
  • Add a safety net: write characterization/contract/integration tests around the boundary you will touch.
  • Create seams: introduce injection points/adapters to isolate side effects and external dependencies.
  • Refactor in micro-steps: one behavior-preserving change at a time; keep diffs reviewable.
  • Prove: run the smallest relevant suite locally, then full CI; keep failures debuggable and deterministic.
  • Ship safely: use canary/dark launch/feature flags when refactors touch production-critical paths.

Risk Levels (Choose Safety Net)

RiskExamplesMinimum required safety net
Lowrename, extract method, formatting-onlyunit tests + lint/type checks
Mediummoving logic across modules, dependency inversionunit + integration/contract tests at boundary
Highauth/permission paths, concurrency, migrations, money/data-loss pathsintegration + contract tests, observability checks, canary + rollback plan

Test Strategy for Refactors

  • Prefer contract and integration tests around boundaries to preserve behavior.
  • Use snapshots/golden masters only when outputs are stable and reviewed (avoid "approve everything" loops).
  • For invariants, consider property-based tests or table-driven cases (inputs, edge cases, error modes).
  • Avoid making E2E/UI tests the primary safety net for refactors; keep most safety below the UI.
  • For flaky areas: fix determinism first (seeds, time, ordering, network) before trusting results.

CI Economics and Debugging Ergonomics

  • Keep refactor PRs small and reviewable; avoid refactor + feature in one PR.
  • Require failure artifacts for tests guarding refactors (logs, trace IDs, deterministic seeds, repro steps).
  • Reduce diff noise: isolate formatting-only changes (or apply formatting repo-wide once with buy-in).
  • Keep git bisect viable: avoid mixed "mechanical + semantic" changes unless necessary.

Do / Avoid

Do:

  • Add missing tests before refactoring high-risk areas.
  • Add guardrails (linters, type checks, contract checks, static analysis/security checks) so refactors don't silently break interfaces.
  • Prefer "branch by abstraction" / adapters when you need to swap implementations safely.

Avoid:

  • Combining large structural refactors with behavior changes.
  • Using flaky E2E as the primary safety net for refactors.

Quick Reference

TaskTool/PatternCommand/ApproachWhen to Use
Long method (>50 lines)Extract MethodSplit into smaller functionsSingle method does too much
Large class (>300 lines)Split ClassCreate focused single-responsibility classesGod object doing too much
Duplicated codeExtract Function/ClassDRY principleSame logic in multiple places
Complex conditionalsReplace Conditional with PolymorphismUse inheritance/strategy patternSwitch statements on type
Long parameter listIntroduce Parameter ObjectCreate DTO/config objectFunctions with >3 parameters
Legacy code modernizationCharacterization Tests + Strangler FigWrite tests first, migrate incrementallyNo tests, old codebase
Automated quality gatesESLint, SonarQube, Prettiernpm run lint, CI/CD pipelinePrevent quality regression
Technical debt trackingSonarQube, CodeClimateTrack trends + hotspotsPrioritize refactoring work

Decision Tree: Refactoring Strategy

Code issue: [Refactoring Scenario]
    ├─ Code Smells Detected?
    │   ├─ Duplicated code? → Extract method/function
    │   ├─ Long method (>50 lines)? → Extract smaller methods
    │   ├─ Large class (>300 lines)? → Split into focused classes
    │   ├─ Long parameter list? → Parameter object
    │   └─ Feature envy? → Move method closer to data
    │
    ├─ Legacy Code (No Tests)?
    │   ├─ High risk? → Write characterization tests first
    │   ├─ Large rewrite needed? → Strangler Fig (incremental migration)
    │   ├─ Unknown behavior? → Characterization tests + small refactors
    │   └─ Production system? → Canary deployments + monitoring
    │
    ├─ Quality Standards?
    │   ├─ New project? → Setup linter + formatter + quality gates
    │   ├─ Existing project? → Add pre-commit hooks + CI checks
    │   ├─ Complexity issues? → Set cyclomatic complexity limits (<10)
    │   └─ Technical debt? → Track in register, 20% sprint capacity

Related Skills

Scope Boundaries (Handoffs)

  • Pure test flake cleanup (timers, ordering, retries): ../qa-debugging/SKILL.md
  • Pure performance tuning (SQL, indexing, query plans): ../data-sql-optimization/SKILL.md
  • Architecture redesign decisions (service boundaries, eventing): ../software-architecture-design/SKILL.md

Operational Deep Dives

Shared Foundation

Skill-Specific

See references/operational-patterns.md for detailed refactoring catalogs, automated quality gates, technical debt playbooks, and legacy modernization steps.

Templates

Use copy-paste templates in assets/ for checklists and quality-gate configs:

Resources

Use deep-dive guides in references/ (load only what you need):

Optional: AI / Automation

Do:

  • Use AI to propose mechanical refactors (rename/extract/move) only when you can prove behavior preservation via tests and contracts.
  • Use AI to summarize diffs and risk hotspots; verify by running targeted characterization tests.
  • Prefer tool-assisted refactors (IDE/compiler-aware, codemods) over freeform text edits when available.

Avoid:

  • Accepting refactors that change behavior without an explicit requirement and regression tests.
  • Letting AI "fix tests" by weakening assertions to make CI green.

See data/sources.json for curated external references.

Fact-Checking

  • Use web search/web fetch to verify current external facts, versions, pricing, deadlines, regulations, or platform behavior before final answers.
  • Prefer primary sources; report source links and dates for volatile information.
  • If web access is unavailable, state the limitation and mark guidance as unverified.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

27.16%
按下载量换算213

Cursor

21.66%
按下载量换算170

Antigravity

18.45%
按下载量换算144

OpenCode

12.73%
按下载量换算100

Gemini CLI

7.5%
按下载量换算59

Codex

3.43%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills