一键导入
coding-quality-loop
Use when a coding agent must turn a software goal, bug, issue, or refactor into a small, verified, independently reviewed code change.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when a coding agent must turn a software goal, bug, issue, or refactor into a small, verified, independently reviewed code change.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | coding-quality-loop |
| description | Use when a coding agent must turn a software goal, bug, issue, or refactor into a small, verified, independently reviewed code change. |
| license | MIT |
| compatibility | Portable Markdown skill with optional Python helper scripts. Requires git for diff checks; Python 3.10+ for bundled validation utilities. |
| metadata | {"author":"zaingz","version":"6.4.0"} |
Goal: the smallest correct change, with evidence a human can trust, review, revert, or merge. This file is the only always-loaded text. Load references/ only when needed. Workers never load either.
The main session is the orchestrator. It thinks hard and makes every decision; workers only execute.
.quality-loop/.Risk trumps size: any change touching a risk boundary (auth, payments, secrets, PII, migrations, upload/download, network, shell, dependencies) is medium+ regardless of diff size. This is the canonical risk-boundary list; every other surface points here.
PLAN -> EXECUTE -> REVIEW, each phase closed by its gate.
Machine sub-steps (records/configs): INTAKE, EXPLORE, MINIMALITY_GATE, PLAN | IMPLEMENT_SLICE, VERIFY | REVIEW, PACKAGE, RETROSPECT.
PLAN — Contract: one-sentence goal, acceptance criteria, constraints, non-goals, assumptions, risk tier, task class, verification plan. Ask only if the answer changes architecture, data safety, security, or user-visible behavior. Map narrowly: entry points, callers, tests, config — findings, not a tour. Medium+: validation contract pairs each acceptance criterion (as an object: {"criterion": ..., "proving_command": ...}) with the concrete check that proves it.
Right-size gate — choose the highest valid rung (machine enum in parentheses):
1 no change (skip) · 2 delete (delete) · 3 reuse (reuse) · 4 stdlib (stdlib) · 5 native (native) · 6 installed dependency (existing_dependency) · 7 one-liner (one_liner) · 8 minimal new code (minimal_new_code)
A new dependency, framework, queue, cache, service, migration, or abstraction must justify why every lower rung fails. Never traded away: security, trust-boundary validation, authorization, accessibility, data-loss protection, required behavior (canonical non-negotiables list). Minimal diff is not minimal architecture — do not monolith; benchmarked hot paths get a worst-case-complexity and p50/p95 commitment at plan time.
EXECUTE — one coherent slice at a time. Boring code, existing conventions, small diffs, no speculative abstraction, no unrelated cleanup. Tests move with the behavior. Mark known shortcuts inline with a cql: comment naming the ceiling and upgrade path. Verify: smallest sufficient checks first; record exact commands and results; add each command to .quality-loop/allowed-commands (one command per line, matched exactly; # comments and glob patterns allowed) so run-evidence can re-execute it. Bug fix = RED then GREEN. Never weaken, skip, or delete tests to reach green. If a helper script is broken, report and stop — never repair the gate.
REVIEW — medium+: a fresh-context reviewer checks the diff against the contract, executes tests when possible (ran_checks: true|false), and flags stubs as blocking. Use a different model family by default; an explicit higher-level harness may use the same model only in a separate host/session. The implementer is never the final validator. Security review at any risk boundary (canonical list: §Task Class). User-facing work carries a product floor: keyboard operable, labeled inputs, no prompt()/confirm() primary flows. Bridge: in-scope findings become fix tasks; out-of-scope findings become follow-ups, not blockers. Before attestation, re-run the right-size gate on the final diff to confirm nothing crept in. attest-review is the final act on the diff; any later code edit requires re-attestation. Package: goal, files changed, right-size decision, evidence, risks, rollback, follow-ups. Teardown: PACKAGE archives the record to docs/records/vX.Y.Z-agent-record.json and removes the live file, so a record left identical to its content at the resolved base ref is closed and the Stop gate does not re-verify it. After the change merges, record the shipped outcome with record outcome <clean|regressed|reverted> — advisory, never a gate, and tallied back into brief so the loop learns which releases held.
RETROSPECTIVE — every repeated mistake becomes a durable harness change (a rule, a test, a hook, an eval case), never a repeated chat correction. On recurring verification failure, record repeated_failure: true and the fix in harness_update. A lesson is promoted into a shipped checklist only after it recurs across >=2 distinct tasks; a single-incident lesson goes to project memory, not the checklist.
Each hard rule has a deterministic owner; see references/enforcement-matrix.md.
| Role | Capability class |
|---|---|
| plan / orchestrate | frontier reasoning |
| implement | strong code-specialized |
| independent + security review | strong reasoning, different family |
| map / summarize | fast / cheap |
Escalate a model tier only on a recorded failing check — never on a "stuck" or "done" self-report. Record per-role models in models_used. Dated model menu and pre-validated variants: assets/routing/README.md (apply with setup-models, validate with check-config).
memory-recall at INTAKE; memory-commit at RETROSPECTIVE. Retrieval, not context stuffing; secrets never stored. See references/memory.md.
Run brief at session start; update .quality-loop/progress.md at PACKAGE/RETROSPECT.
python3 scripts/quality_loop.py verify .quality-loop/agent-record.json --red-green
--base defaults to the auto merge-base of the origin/main ladder (override with the config base key or the QUALITY_LOOP_BASE env var); pass the flag only to override those. Full command catalog (incl. memory-*): references/tool-contracts.md. Control plane: opt-in add-on installed via install.py --with-control-plane; see docs/control-plane.md. Drop-in prompt for skill-less agents: assets/prompts/drop-in-prompt.md.
references/lifecycle.md — detailed states, risk gates, quality gates by task type.references/agentic-orchestration.md — roles, model heuristics, mission topology, per-platform mapping.references/reviewer-checklists.md — fresh-context, simplicity, security review prompts.references/tool-contracts.md — helper command catalog and tool contracts.references/memory.md — persistent per-project lessons memory.references/enforcement-matrix.md — deterministic vs advisory enforcement per rule.