$npx -y skills add TheQtCompanyRnD/agent-skills --skill qt-cpp-reviewInvoke when the user asks to review, check, audit, or look over Qt6 C++ code — or suggest before committing. Runs deterministic linting (60+ rules) then six parallel deep- analysis agents covering model contracts, ownership, threading, API correctness, error handling, and perform
| 1 | # Qt Code Review |
| 2 | |
| 3 | A structured, read-only code review skill for Qt6 C++ code that |
| 4 | combines deterministic linting with parallel agent-driven deep |
| 5 | analysis across six focused domains. |
| 6 | |
| 7 | ## When to use this skill |
| 8 | |
| 9 | - When the user mentions review-related tasks: "review", "check", |
| 10 | "audit", "look over", "code review", "sanity check" |
| 11 | - Suggest running this skill **before committing** code |
| 12 | - When the user asks to validate Qt6 C++ code quality |
| 13 | |
| 14 | ## Arguments |
| 15 | |
| 16 | - `/qt-cpp-review` — review using universal Qt6 C++ rules only |
| 17 | - `/qt-cpp-review framework` — also apply Qt framework/module |
| 18 | development rules (BC, exports, d-pointers, qdoc, QML |
| 19 | versioning) |
| 20 | |
| 21 | ## Framework mode detection |
| 22 | |
| 23 | If `$ARGUMENTS` contains "framework", enable framework mode. |
| 24 | |
| 25 | If the argument is not passed, auto-detect by scanning the first |
| 26 | few files in scope for framework signals. If **two or more** of |
| 27 | the following are found, suggest to the user: |
| 28 | "This looks like Qt framework/module code. Run |
| 29 | `/qt-cpp-review framework` to also apply framework-specific |
| 30 | rules (BC, exports, qdoc, QML versioning)?" |
| 31 | |
| 32 | **Framework signals** (any two = likely framework code): |
| 33 | - `QT_BEGIN_NAMESPACE` / `QT_END_NAMESPACE` |
| 34 | - `Q_CORE_EXPORT`, `Q_GUI_EXPORT`, `Q_WIDGETS_EXPORT`, or any |
| 35 | `Q_*_EXPORT` macro |
| 36 | - `#include <QtModule/private/*_p.h>` (private headers) |
| 37 | - `Q_DECLARE_PRIVATE`, `Q_D()`, `Q_Q()` |
| 38 | - `qt_internal_add_module` or `qt_add_module` in CMakeLists.txt |
| 39 | - `sync.profile` or `.qmake.conf` in the repository root |
| 40 | |
| 41 | Do **not** auto-enable framework mode — only suggest it. Let the |
| 42 | user confirm. |
| 43 | |
| 44 | When framework mode is enabled: |
| 45 | 1. Pass `--framework` to the linter (if supported) |
| 46 | 2. Load `references/qt-framework-checklist.md` alongside the |
| 47 | universal checklist |
| 48 | 3. Include framework rules in each agent's mission context |
| 49 | |
| 50 | ## Scope detection |
| 51 | |
| 52 | Detect the user's intended scope from their language: |
| 53 | |
| 54 | ### Diff/commit scope (narrow) |
| 55 | Triggered by language like: "this commit", "these changes", |
| 56 | "the diff", "what I changed", "my changes", "staged changes", |
| 57 | "outstanding changes", "before I commit" |
| 58 | |
| 59 | **Action**: Run `git diff` (unstaged) and `git diff --cached` |
| 60 | (staged) to obtain the changeset. If the user says "this commit", |
| 61 | use `git diff HEAD~1..HEAD`. Review only the changed lines plus |
| 62 | sufficient surrounding context (±50 lines) for understanding. |
| 63 | Only report issues found in the changed lines — do not report |
| 64 | issues in unchanged surrounding context. |
| 65 | |
| 66 | ### Codebase scope (wide) |
| 67 | Triggered by language like: "review the codebase", "audit the |
| 68 | project", "check the repository", "review src/", or when a specific |
| 69 | file/directory path is given without commit language. |
| 70 | |
| 71 | **Action**: Glob for `*.cpp`, `*.h`, `*.hpp` files in the |
| 72 | specified scope. Review all matched files. |
| 73 | |
| 74 | ## Execution order |
| 75 | |
| 76 | The review proceeds in three phases. **Never skip a phase.** |
| 77 | |
| 78 | ### Phase 1: Deterministic linting (scripts) |
| 79 | |
| 80 | Run the unified Python linter against the target files. Requires |
| 81 | Python 3.6+ (no external dependencies). If Python is not |
| 82 | available, warn the user and skip to Phase 2. |
| 83 | |
| 84 | ```bash |
| 85 | python3 references/lint-scripts/qt_review_lint.py <files...> |
| 86 | # If python3 is not found, fall back to: |
| 87 | python references/lint-scripts/qt_review_lint.py <files...> |
| 88 | ``` |
| 89 | |
| 90 | This single-pass scanner encodes all mechanically-checkable rules |
| 91 | from the Qt review guidelines. It reads each file once and |
| 92 | evaluates all rules per line. Output is deterministic and |
| 93 | repeatable. The linter is authoritative — do not second-guess |
| 94 | its output. |
| 95 | |
| 96 | Collect all output before proceeding to Phase 2. |
| 97 | |
| 98 | **Rule categories** (60+ checks): |
| 99 | - **INC** (Includes) — ordering, qglobal.h, qNN duplication |
| 100 | - **DEP** (Deprecated) — obsolete Qt/std class usage |
| 101 | - **PAT** (Patterns) — anti-patterns (min/max, std::optional, |
| 102 | NRVO, COW detach, etc.) |
| 103 | - **MDL** (Model) — QAbstractItemModel contract (begin/end |
| 104 | balance, dataChanged roles, flags, default: in data()) |
| 105 | - **ERR** (Error Handling) — QFile::open, QJsonDocument::isNull, |
| 106 | QNetworkReply::error, SSL, timeouts, arg() mismatch |
| 107 | - **LCY** (Lifecycle) — deleteLater, Q_ASSERT side effects, |
| 108 | null guards, unbounded containers, qDeleteAll depth |
| 109 | - **API** (Naming) — get-prefix, enum hygiene, QList<QString> |
| 110 | - **HDR/TMO/CND/VAL/TRN** — headers, timeouts, conditionals, |
| 111 | value classes, ternary operator |
| 112 | |
| 113 | ### Phase 2: Agent-driven dee |