SuperAPI AI Directory

codeguard-fix

Coding & development

View repository

Updated 10-15 21:47

About this skill

codeguard fix

Capability Boundaries

✅ Strengths

  1. One-click fix for formatting issues (format command for each language)
  2. --dry-run Preview the fixes to be executed
  3. Run only the format tool, do not touch business logic

⚠️ Prerequisites

  1. The corresponding format tool is installed (same as check)

❌ Out of Scope

  1. Fixes that require "writing content", such as missing javadoc → manual/AI writing (codeguard-java)
  2. Security exemptions (changing thresholds/deleting rules) → prohibited, see the codeguard main entry gating rules

Command

fix Only exists under the Legacy Python engine. Rust codeguard The component currently has no auto-fix command; when a Rust engine is detected, do not construct codeguard fix。

bin/codeguard fix --dry-run       # 预览(不实际修改)
bin/codeguard fix                 # 执行修复
bin/codeguard fix --lang python   # 只修 Python

For engine determination and comparison of the two command sets, see codeguard Skill's references/operations/engine-contract.md。

Workflow

  1. bin/codeguard check Confirm failures
  2. bin/codeguard fix --dry-run Preview
  3. bin/codeguard fix Execute
  4. bin/codeguard check Re-scan until all green
  5. git diff Review the changes made by auto-fix, confirm no business logic changes

Gotchas

  1. npm audit fix May introduce breaking upgrades — regression testing is required after fix
  2. eslint --fix Only fix auto-fixable rules; complexity/unused require manual work

Out of scope (when not to use)

  • No reproducible lint failure has been obtained yet; first use codeguard-check to establish a baseline.
  • The violation involves business semantics, concurrency, security, or API compatibility; it should be manually reviewed.
  • The fix requires upgrading dependencies, deleting files, changing rules, or large-scale rewriting; separate authorization is required.

Data and Security

This skill does not upload, send, or store source code or credentials. Before fixing, check Git status and protect the user's uncommitted changes; it is not allowed to overwrite existing work with reset/checkout, and it is not allowed to hide failures with suppression.

Standard Workflow

Step 1: Save the baseline

Record the failing command, exit code, tool version, failure count, and git status --short。

Step 2: Classify fixability

Distinguish formatting, deterministic static rules, business semantics, configuration, and environment issues. Only hand the clearly reversible items among the first two categories to auto-fix.

Step 3: Preview the scope

Run bin/codeguard fix --dry-run [--lang <name>], and check the tools, directories, and exclusion scope to be executed.

Step 4: Execute the minimal fix

Only run formatter/autofix on the authorized scope; do not conveniently refactor, upgrade dependencies, or change business code.

Step 5: Review the diff

Use git diff --stat and git diff -- <scope> to view the scale of the fix. Stop and report if generated files, lock files, or out-of-scope changes appear.

Step 6: Re-run the original gate

Re-verify using exactly the same check command as the baseline; do not substitute a narrower-scope command.

Step 7: Regression verification

Run the affected tests and builds, and report lint, test, and build evidence separately.

Rules

  1. Do not auto-fix without a failing baseline.
  2. Every fix must have its diff reviewed and the original command re-run.
  3. When a tool is missing, output UNVERIFIED, do not silently install.
  4. Do not expand a post-fix lint PASS into functional correctness.
  5. Do not modify the user's existing uncommitted content; overlapping files must be reviewed hunk by hunk.

Output templates

Codeguard fix 结果
- 基线:<command / exit / count>
- 授权范围:<paths/languages>
- 修复命令:<actual command>
- 改动:<files and categories>
- diff 审查:<safe / stopped / needs decision>
- 复验:<same command / exit>
- 回归:<tests/build or not run>

More common gotchas

  1. The formatter can rewrite the entire file: even small issues can produce a large diff, so the scope needs to be limited.
  2. Lockfile drift: some tools trigger dependency resolution, and unauthorized lockfile changes should not be accepted during format fixes.
  3. Generated code: fix the source template and regenerate, rather than editing the artifact directly.
  4. Semantic autofix: unused/import fixes can change side effects, so the rule type and tests must be reviewed.

Load resources on demand

  • When determining the current engine and available commands, read the codeguard skill's references/operations/engine-contract.md. Installation:npx skills add full-stack-skills/codeguard-skills --skill codeguard。
  • When judging whether automatic fixing is possible, read references/rules/autofix-boundary.md。
  • When designing batched fixes, read references/operations/recheck-playbook.md。
  • Based on the user scenario, only read the corresponding example in examples/ .