qt-port
Skill0 starsChanged 19 days agoMITView on GitHub
Port an existing desktop UI to an idiomatic Qt 6 / C++20 application with the same behavior: Qt 5, QML-only, PySide/PyQt, Electron, or a web screen. Use this skill whenever the user asks to migrate, convert, rewrite, or port an app or window to Qt 6, modernize a Qt 5 app, or move a web/Electron UI to a native desktop app. Trigger on port, migrate, convert to Qt 6, "turn this PySide app into C++ Qt", "move this Electron screen to Qt", or a pasted Qt5/PySide/Electron file. Port the original tests first, keep behavior identical, and write a PORTING.md.
In this repository24 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- add-linux-packagingSkill
- add-sliceSkill
- add-viewSkill
- claim-checkSkill
- clean-room-rebuildSkill
- corpus-retrievalSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- graphifySkill
- grillingSkill
- learnSkill
- planSkill
- platform-portSkill
- researchSkill
- reviewSkill
- shipSkill
- specSkill
- tddSkill
- verified-statusSkill
- visual-reviewSkill
- qt-best-practicesSkill
- qt-reviewSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 34
Write
PORTING.md: Every deliberate difference, every framework feature not reproduced, every dependency dropped, and why. - Distinctive: line 111
Do not drop accessibility: If the source was a mouse-only control, the port is a keyboard-reachable action with a name.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Qt port
A port preserves behavior while changing the implementation. The output is not a Qt 5 app with new includes; it is a Qt 6 app a Qt developer would have written, with the same observable behavior and tests proving it.
1. The order of work
- Read the source and its tests. The tests are the specification. If there are none, write characterization tests against the current behavior first.
- Port the tests first. Same cases, same assertions, expressed in Qt Test
or a ViewModel test with
QSignalSpy. A port without a failing test is a rewrite with hope. - Map every screen, signal, command, network call and storage key.
- Define the target layers. domain/application/adapters/presentation/ platform/contracts; the ViewModels and ports come first.
- Port one screen at a time, with the closed status enum.
- Run the gates. CMake build, ctest, clang-format/tidy, a release run on the reference floor.
- Write
PORTING.md. Every deliberate difference, every framework feature not reproduced, every dependency dropped, and why.
2. Qt 5 → Qt 6 mapping
| Qt 5 | Qt 6 |
QRegExp | QRegularExpression (PCRE2) |
QStringRef/QStringView-era APIs | QStringView/QLatin1StringView |
QDesktopWidget | QScreen/QGuiApplication::primaryScreen |
QGLWidget | QOpenGLWidget (or raster Widgets) |
QVariant implicit conversions | Explicit QVariant::value<T>()/to… |
QMouseEvent::pos() | position()/globalPosition() |
QTextCodec | QStringConverter/QTextDecoder |
QNetworkConfiguration | Removed; use QNetworkAccessManager directly |
qmake project | CMake target graph |
Q_FOREACH/foreach | Range-based for |
QSignalMapper | Lambdas with the context-object connection |
QMetaObject::invokeMethod string args | Functor overload |
Q_FALLTHROUGH | [[fallthrough]] |
- High-DPI is always on in Qt 6; remove the Qt 5 attributes and test scaling.
QStringis UTF-16 and implicit conversions are narrower; use explicitQStringLiteral/u"..."_sand avoidconst char*round trips.- Container/algorithm changes (
QVectorisQList,qAsConst→std::as_const): port the types, not just the names.
3. PySide/PyQt → C++ Qt
- Keep the ViewModel contract, not the Python class shape. A Python service becomes a use case + port; a Python signal becomes a ViewModel property/command.
- Move the SDK into the C++ adapter; no Python network calls in a view.
- Port the tests to Qt Test or a C++ ViewModel test; keep the same behaviors.
- Do not embed a Python runtime to keep the old code; that defeats the memory/startup budget.
4. Electron/web → Qt
- Replace the DOM with Widgets (data-dense) or Quick (motion-heavy); one ViewModel per screen.
- Replace
fetch/localStoragewith the SDK and the SQLite projection; tokens go to the keystore. - Replace the JS event bus with typed signals/slots and use cases.
- Replace CSS layout with Qt layouts; test scaling, long translations and keyboard navigation.
- Drop the Chromium runtime unless a feature genuinely needs WebEngine; if it does, isolate it in an optional component and budget it.
5. Behavior parity checklist
- Every screen, command, shortcut and menu action exists.
- Every status is rendered: loading, ready, empty, forbidden, not-found, offline, error, policy-blocked.
- Every network call has the same method, path, payload and headers.
- Every list uses a model and survives a reset/reorder.
- Keyboard navigation and accessibility names match or improve.
- The GUI thread never blocks; long work is off-thread.
- Tokens are in the keystore; no secret in config/SQLite/logs.
- The outbox is persisted and idempotent.
- The release build meets the startup/scroll budgets on the floor.
- The original tests pass, ported; new tests cover the Qt-only paths.
PORTING.mdlists every deliberate difference.
6. What not to do
- Do not keep the source framework's shape. A web page rendered in a
QWebEngineView, a Python service locator, or a Qt 5 event filter chain is a port that will be rewritten again. - Do not block the GUI thread because the old app did; that is the bug the port exists to fix.
- Do not skip the tests. A port validated only by clicking through it ships the source's bugs plus new ones.
- Do not silently change behavior. Reproduce the source quirk, pin it with a test, and list the fix as a follow-up — or fix it deliberately and say so.
- Do not drop accessibility. If the source was a mouse-only control, the port is a keyboard-reachable action with a name.
7. Cross-skill contract
qt-best-practicesis the target style; every ported screen follows it.qt-reviewreviews the port before release and ranks a broken architecture contract above every other finding.- The
lints/config is the machine-checkable half; a port that needs a lint exception is a port that has not finished.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

