Capability Boundaries
✅ Strengths
- One-click fix for formatting issues (format command for each language)
--dry-runPreview the fixes to be executed- Run only the format tool, do not touch business logic
⚠️ Prerequisites
- The corresponding format tool is installed (same as check)
❌ Out of Scope
- Fixes that require "writing content", such as missing javadoc → manual/AI writing (codeguard-java)
- 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
bin/codeguard checkConfirm failuresbin/codeguard fix --dry-runPreviewbin/codeguard fixExecutebin/codeguard checkRe-scan until all greengit diffReview the changes made by auto-fix, confirm no business logic changes
Gotchas
npm audit fixMay introduce breaking upgrades — regression testing is required after fixeslint --fixOnly 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-checkto 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
- Do not auto-fix without a failing baseline.
- Every fix must have its diff reviewed and the original command re-run.
- When a tool is missing, output
UNVERIFIED, do not silently install. - Do not expand a post-fix lint PASS into functional correctness.
- 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
- The formatter can rewrite the entire file: even small issues can produce a large diff, so the scope needs to be limited.
- Lockfile drift: some tools trigger dependency resolution, and unauthorized lockfile changes should not be accepted during format fixes.
- Generated code: fix the source template and regenerate, rather than editing the artifact directly.
- 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
codeguardskill'sreferences/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/.