graph-quality-assurance
Code quality audit using Clean Code (Uncle Bob), SOLID principles, DRY analysis, McCabe complexity, and project convention checks
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Code quality audit using Clean Code (Uncle Bob), SOLID principles, DRY analysis, McCabe complexity, and project convention checks
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | graph-quality-assurance |
| description | Code quality audit using Clean Code (Uncle Bob), SOLID principles, DRY analysis, McCabe complexity, and project convention checks |
| triggers | ["graph-quality-assurance"] |
| version | 1.1.0 |
| author | Diego Nogueira |
| date | "2026-06-21T00:00:00.000Z" |
Code quality audit using Clean Code (Uncle Bob), SOLID principles, DRY analysis, McCabe cyclomatic complexity, and project convention checks. Produces a scored report across 7 quality dimensions.
Scope split:
graph-quality-assurancefocuses on human-reviewable quality — readability, naming, conventions, review checklist.graph-qualityfocuses on automated metrics — SQALE score, duplication %, complexity distribution.
lint → typecheck → code smells → SOLID → DRY → complexity → conventions → report → write_memory
Run npm run lint. Verify zero errors, warnings ≤ 9 threshold, no new violations.
Score: 100 baseline, -10 per error, -2 per warning over threshold.
Run npm run typecheck. Verify zero TypeScript errors, no @ts-ignore without approval, no any in production.
Score: 100 baseline, -5 per error, -10 per any in production code.
Analyze modified/new files for common code smells:
| Smell | Threshold | Severity |
|---|---|---|
| Long functions | > 50 lines | High |
| Deep nesting | > 3 levels | High |
| God classes | > 300 lines | High |
| Feature envy | Method uses more data from another class than its own | Medium |
| Data clumps | Same group of params repeated in 3+ functions | Medium |
| Primitive obsession | Using primitives instead of domain types | Low |
| Dead code | Unused exports, unreachable branches | Medium |
| Commented-out code | Code blocks in comments | Low |
Score: 100 baseline, -5 per low, -10 per medium, -15 per high smell found.
Not all smells are equal. Prioritize by cost:
| Priority | Smells | Action |
|---|---|---|
| Fix immediately | Long functions, deep nesting, dead code, god classes | Block merge if new; fix before next sprint if existing |
| Fix in current sprint | Feature envy, data clumps, commented-out code | Address in same PR or follow-up within sprint |
| Accept or defer | Primitive obsession, magic numbers in tests | Track as low-priority debt; revisit during refactoring cycles |
Trigger: if a "fix immediately" smell appears in code written this session, it must be resolved before writing the quality report.
Evaluate modified modules against SOLID:
| Principle | Check | How to Verify |
|---|---|---|
| S — Single Responsibility | One reason to change per module | Count distinct responsibilities; flag if > 1 |
| O — Open/Closed | Extend via composition, not modification | Check for switch/if chains that grow with new types |
| L — Liskov Substitution | Subtypes substitutable for base types | Verify interface implementations don't throw unexpected errors |
| I — Interface Segregation | No fat interfaces | Flag interfaces with > 7 methods or unused method implementations |
| D — Dependency Inversion | Depend on abstractions, not concretions | Check for direct instantiation of dependencies vs injection |
Score: 20 points per principle adhered to (100 max). -10 per violation found.
Scan modified files for identical/near-identical blocks (> 5 lines), copy-paste candidates, and string literals repeated > 3 times without constants. Score: 100 if no duplication, -10 per duplicated block, -5 per repeated literal.
Count decision points (if, else if, case, while, for, &&, ||, catch, ?:) per function:
| Range | Rating | Action |
|---|---|---|
| 1-5 | Low | No action |
| 6-10 | Moderate | Monitor |
| 11-20 | High | Flagged — simplify |
| > 20 | Very High | Required decomposition |
Score: 100 if all ≤ 10, -5 per function 11-20, -15 per function > 20.
Auto-enforced (linter/formatter catches these — do not spend review time here):
| Convention | Rule |
|---|---|
| Formatting | Prettier / eslint --fix |
| Import order | ESLint import plugin |
| File naming | Kebab-case enforced by linter rule |
Manual-check (human review required):
| Convention | Rule | Check |
|---|---|---|
| Type naming | PascalCase | GraphNode, NodeStatus |
| Function naming | camelCase | findNextTask(), buildTaskContext() |
| Zod imports | From 'zod/v4' | Never from 'zod' |
| Exports | Named only | No export default |
| Logging | Project logger | No console.log in production code |
| Errors | Typed errors | No raw throw "string" or throw new Error("msg") without custom class |
Principle (SWE@Google ch8): Rules that can be automatically checked must be automatically checked. Human review time is too expensive to spend on formatting debates.
Score: 100 baseline, -5 per manual-check violation (auto-enforced items are not scored here — the linter gate handles them).
Apply the four-pillar review before marking work complete. From [[swe-at-google]] ch9:
| Pillar | Questions to Answer |
|---|---|
| Correctness | Does the code do what it claims? Are edge cases handled? Are errors propagated, not swallowed? |
| Tests | Do tests exist for every new behavior? Do they fail when the code is wrong? Are they testing behavior, not implementation? |
| Design | Is the change self-contained? Could it be smaller? Does it introduce a layering violation? |
| Documentation | Can a new team member understand this in 5 minutes? Are public APIs commented? Are non-obvious decisions explained inline? |
Readability standard (SWE@Google readability program): Three-question test before approving:
- Would a new team member understand what this module does without asking the author?
- Would they know where to add the next piece of related logic?
- Would they understand why this approach was chosen over the alternatives?
If any answer is "no," request clarification or restructuring — not just a comment.
Calculate overall score and grade:
| Dimension | Weight | Score |
|---|---|---|
| Lint | 15% | 0-100 |
| Type Safety | 15% | 0-100 |
| Code Smells | 15% | 0-100 |
| SOLID | 15% | 0-100 |
| DRY | 10% | 0-100 |
| Complexity | 15% | 0-100 |
| Conventions | 15% | 0-100 |
Grades: A (85-100), B (70-84), C (55-69), D (40-54), F (< 40).
Score it with the deterministic gates before writing any prose — a grade you measured beats a grade you argued:
agf harness --violations --select data.breakdown # 9 dims: types tests fitness docs naming errors context provenance connectivity
agf lint-files # 800-line ceiling; exit 1 on violation
agf quality # 95/95 gate
agf memory write quality-audit-<date> --content "<scores per dimension, overall grade, top issues>"
@ts-ignore without explicit user approval — fix the type error insteadconsole.log — use the project logger from src/core/utils/logger.tsany type — use unknown with type guards or proper genericsEconomia de tokens. Os levers compartilhados por todas as skills —
--select,agf retrieve-command,agf exec chain, reuso antes de criação — vivem em_shared.md→ Token Economy. Fonte única: um parágrafo repetido em trinta arquivos é o trigésimo primeiro que envelhece sozinho.
Não precisa de flags. CLI gerencia compressão automaticamente com --ai ativo.
Consulte comandos com agf retrieve-command "<intenção>".
Ver _agf-rag.md para detalhes.
Accessibility compliance audit using WCAG 2.2 AA standards, ARIA validation, screen reader testing, keyboard navigation, color contrast analysis, and i18n readiness
Execute the ANALYZE phase of the lifecycle via the `agf` CLI — PRD creation, requirements, Definition of Ready (7 checks), cross-project learning
API governance and design audit using OpenAPI/Swagger spec generation, REST maturity model, contract validation, and breaking change detection
Architecture governance using C4 Model, ADR lifecycle, Architecture Fitness Functions, layer boundary enforcement, and drift detection
Human-in-the-loop PLANNING skill — investigates the project (graph + git + harness/gaps) and runs the whole ANALYZE→DESIGN→PLAN chain in one faceted loop to produce a COMPLETE PRD injected as graph backlog (epics, tasks, testable AC) for a separate agent to implement. Applies the project's planning methodologies — Impact Mapping + OKR per epic, JTBD, MoSCoW, WSJF/Cost-of-Delay, User Story Mapping, Example Mapping (Rules/Examples → Given-When-Then AC), SPIDR splitting, INVEST, Definition of Ready, Risk Matrix; the full catalogue lives in the skill body. Stops for the human after each complete PRD and iterates the next cycle from the project's own findings (dogfood). Does NOT implement. Triggers — graph-backlog-generation, gerar backlog, criar PRD, planejar feature, detalhar épico, novo ciclo, "plan the next thing", "what should we build next".
Automated bug discovery through static analysis, LSP diagnostics, pattern detection, regression hotspot analysis, and error catalog mining