شعار Duo Lint

Duo Lint

المجتمع
Kimeur
duo-lint

The fold linter for iPhone Duo, Apple's foldable with an outer display and an inner display. Run it to find code Apple says to remove before an app runs on the foldable; it reports each finding with the fix for its rule. Catches UIScreen.main and UIScreen.screens, UIDevice.current.orientation, statusBarOrientation, the deprecated interfaceOrientation properties and effectiveGeometry.interfaceOrientation, userInterfaceIdiom == .pad, horizontalSizeClass == .regular treated as iPad, hard-coded screen sizes (bounds.height == 844), GeometryReader sizes matched to devices, .frame(width: 390) and fixed width constraints, and UIRequiresFullScreen. Use it before a review or release, in CI (GitHub annotations), after editing SwiftUI or UIKit layout code, or when a screen breaks when the phone folds, unfolds or resizes. It reads code only; for a full iPhone Duo audit that also checks screenshots, use /duo-audit or the duo-design-review checklist.

نظرة عامة

الناشرKimeur
المستودعduology
اسم المهارةduo-lint
النجوم
40
التفريعات
2
الملفات المرفقة
4
الترخيصMIT
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 4

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها Kimeur على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Duo Lint في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/Kimeur/duology/tree/main/plugins/duology-ship/skills/duo-lint
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Kimeur/duology.git /tmp/duology
mkdir -p .claude/skills
cp -r /tmp/duology/plugins/duology-ship/skills/duo-lint .claude/skills/duo-lint
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Duo Lint في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Duo Lint تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Duo Lint بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

duo-lint

duo-lint scans Swift (and optionally Objective-C) code, Info.plist files and build settings for patterns that break on iPhone Duo. Each finding names the rule, the code, a fix and the Apple page behind it.

It is one Python 3 file with no dependencies. It runs locally and sends nothing anywhere.

Most rules come from Step 2 of Apple's Three steps to make your app shine on iPhone Duo. Xcode 27.1 also ships an App Resizability agent skill that looks for the same patterns (prepare page). duo-lint doesn't replace it. Use duo-lint where you need a repeatable check: CI, the lint hook, or another coding agent.

duo-lint reads code. It can't see the screen. For a full iPhone Duo audit, run /duo-audit (in the duology-ship plugin): it runs duo-lint, then the 15-point duo-design-review checklist on screenshots from the Duo simulator, and ranks everything in one list. Without Claude Code, run duo-lint, then follow the duo-design-review skill.

Related skills: duo-layout (size classes, reserved regions, arrangements), duo-continuity (state through a fold), duo-testing (tests on the Duo simulator).

Run it

The command depends on how you installed this skill:

Installed withRun
The duology-ship plugin in Claude Codeduo-lint. The plugin puts its bin/ folder on the Bash tool's PATH.
npx skills add, or copied by hand<skill-folder>/scripts/duo-lint. <skill-folder> is the folder that holds this SKILL.md.

In Claude Code, <skill-folder> is ${CLAUDE_SKILL_DIR}. If duo-lint is not found or not allowed, run ${CLAUDE_SKILL_DIR}/scripts/duo-lint instead. If scripts/duo-lint can't be executed, run python3 <skill-folder>/scripts/duo-lint.py. The examples below say duo-lint; use the script path when the plugin isn't installed.

bash
# Whole project
duo-lint .

# One folder or file
duo-lint Sources/Feed/FeedView.swift

# With the fix and the Apple link under each finding
duo-lint -v Sources/

In folders it skips build/, DerivedData/, Pods/, Carthage/, .build/, SourcePackages/, .claude/, .agents/ and its own tests/fixtures/, wherever this skill is installed. Name a skipped folder on the command line to check it anyway.

It needs Python 3.9 or later. On a Mac with Xcode 27.1, /usr/bin/python3 is Xcode's Python 3.9, which is enough.

OptionWhat it does
PATH ...Files or folders. Default: the current folder.
-v, --verbosePrints fix: and see: lines under each finding.
--jsonJSON output. Same as --format json.
--format githubGitHub Actions annotations.
--strictExit 1 on warnings too, not only errors.
--objcAlso scan .m, .mm and .h files in folders. Files you name are always scanned.
--select DUO001,DUO004Run only these rules.
--ignore DUO007Skip these rules.
--exclude 'Tests/*'Skip matching paths. Repeat it for more patterns.
--list-rulesPrint the rules. Add --json for machine-readable output.

Exit codes: 0 no errors, 1 errors (or any finding with --strict), 2 a bad option or a missing path.

Read the output

Real output on the four-file sample in tests/fixtures/sample, run from that folder:

text
$ duo-lint Sources/
Sources/App/RootView.swift:7           DUO004  warning  userInterfaceIdiom == .pad  layout picked by device type; pick it by size class or space
Sources/Feed/FeedView.swift:8          DUO001  error    UIScreen.main.bounds        your window is not the screen on a two-display phone; size from the view or window
Sources/Player/Controls.swift:9        DUO007  warning  frame(width: 390)           fixed width of 320 pt or more; let the container size it
Sources/Settings/SettingsView.swift:6  DUO009  warning  <= 667                      GeometryReader size compared to a device size; use size class or ViewThatFits
4 findings · 1 error · 3 warnings (4 files checked)

Each line is path:line RULE severity code message. The last line counts findings and files.

  • error: an API the SDK already deprecates and Apple tells you to remove. Fix it.
  • warning: a pattern that is almost always wrong on iPhone Duo. Fix it, or silence it with a reason if the code is not about layout.

--json gives each finding as an object with path, line, column, rule, name, severity, snippet, message, fix, source (an Apple URL) and code (the source line). Use it when you need to sort or group findings.

Fix each finding

RuleSeverityCatchesFix
DUO001errorUIScreen.main, UIScreen.screens, .main where the file shows Swift infers UIScreenview.bounds, GeometryReader, onGeometryChange; traitCollection.displayScale; UIWindow(windowScene:)
DUO002warningUIDevice.current.orientation, its notification, effectiveGeometry.interfaceOrientation, an interfaceOrientation whose owner it can't seeCompare width with height. Camera: AVCaptureDevice.RotationCoordinator.
DUO003errorstatusBarOrientation, interfaceOrientation on a UIWindowScene or view controllerCompare width with height.
DUO004warninguserInterfaceIdiom compared with .pad or .phoneSize class, NavigationSplitView, ViewThatFits.
DUO005warninghorizontalSizeClass == .regular next to "iPad"Treat regular as "wide", not as iPad.
DUO006warningbounds.height == 844, lists of device sizesSize class, ViewThatFits, width vs height.
DUO007warning.frame(width: 390), width constraints of 320 pt or more.frame(maxWidth:), containerRelativeFrame, readable content guide.
DUO008warningUIRequiresFullScreen = trueRemove it, or add UIRequiresFullScreenIgnoredStartingWithVersion.
DUO009warningproxy.size.width == 393Width vs height, size class, even column counts.

Bad and good code for every rule, with the Apple source: references/rules.md.

The three fixes you will write most often:

swift
import SwiftUI

// DUO001, DUO002, DUO003, DUO009: size from the space you have.
struct MediaScreen: View {
    var body: some View {
        GeometryReader { proxy in
            let isWide = proxy.size.width > proxy.size.height
            let layout = isWide ? AnyLayout(HStackLayout()) : AnyLayout(VStackLayout())
            layout {
                Color.black
                Text("Up next")
            }
        }
    }
}

// DUO004, DUO005: pick the layout by size class, and name it after the space.
struct InboxScreen: View {
    @Environment(\.horizontalSizeClass) private var sizeClass

    var body: some View {
        let isWide = sizeClass == .regular
        Text(isWide ? "List and message side by side" : "List, then message")
    }
}

// DUO007: cap a width instead of fixing it.
struct PromoBanner: View {
    var body: some View {
        Text("Try the new editor")
            .frame(maxWidth: 600)
            .padding()
    }
}

AnyLayout keeps view identity when the layout switches, so state survives the fold (AnyLayout).

Workflow

  1. Run duo-lint -v . from the project root (or the script path, see Run it). Add --objc for mixed projects.
  2. Fix every error first. They are deprecated APIs. If one is a bare .main on your own type, not UIScreen, silence it with a reason.
  3. Fix the warnings, one rule at a time. Read the rule in references/rules.md before changing code you don't own.
  4. Re-run until the summary shows 0 errors. Aim for 0 findings.
  5. Silence only code that is not layout, with a reason (see below). Never silence a finding just to get a clean run.
  6. Build with Xcode 27.1 and check the screens on the iPhone Duo simulator, closed and open. A clean lint does not prove the layout works.
  7. Report what you changed, and any finding you silenced, with its reason.

Silence a finding on purpose

swift
import UIKit

@MainActor
func crashReportScale() -> CGFloat {
    // duo-lint:disable-next-line DUO001 -- crash reports need the device scale, not layout
    UIScreen.main.scale
}
  • // duo-lint:disable-next-line DUO001 skips that rule on the next line.
  • // duo-lint:disable-line DUO001 skips it on the same line.
  • // duo-lint:disable-file DUO004 skips it in the whole file.
  • No rule id means every rule. Name the rule anyway.
  • In a plist: <!-- duo-lint:disable-next-line DUO008 -->.

In CI

yaml
# .github/workflows/duo-lint.yml
name: duo-lint
on: [pull_request]
jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: python3 tools/duo-lint/duo-lint.py --format github --strict .

Copy scripts/duo-lint.py into the repo first (the path above is an example). The linter is plain Python, so a Linux runner is fine. GitHub shows each finding as an annotation on the pull request. Drop --strict to fail only on errors.

The lint hook (Claude Code)

The duology-ship plugin has an optional hook. After Claude edits or writes a .swift file, it runs duo-lint on that file and passes the findings back to Claude, with the fix for each. It never blocks an edit.

  • It is off by default. Turn it on with export DUOLOGY_LINT_HOOK=1 before you start Claude Code. Unset it to turn it off.
  • After an edit, it reports only findings in the lines that changed, plus a count of the rest of the file. After a full write, it reports the whole file (up to 15 findings).
  • It stays silent when there is nothing to report, when the file isn't Swift, and when Python 3 is missing.
  • Files: hooks/hooks.json and hooks/lint-hook.sh in the plugin.

When the hook reports a finding, fix it in your next edit, or silence it with a reason if the code is not layout.

What it doesn't catch

duo-lint finds patterns in code. It can't see controls sitting in the fold, state lost on a fold, a UIScreen kept in a property, sizes read once at launch, or window bounds used as the screen size. The full list is at the end of references/rules.md. For what only a screenshot shows, run /duo-audit or the duo-design-review checklist.

duo-lint reads text, not types. So these are heuristics: DUO001 on a bare .main (it looks for UIScreen in the file), the split between DUO003 and DUO002, and DUO004, DUO005 and DUO006. They can flag code that is fine, and miss code that hides a device size or type behind a name. references/rules.md says how each one decides. Read each finding before you change it.

Checklist

  • Ran duo-lint -v on the whole project (with --objc if it has Objective-C).
  • Fixed every error (DUO001, DUO003).
  • Fixed or justified every warning; each silenced line has a -- reason.
  • Re-ran duo-lint: 0 errors in the summary.
  • If the app set UIRequiresFullScreen: removed it, or added UIRequiresFullScreenIgnoredStartingWithVersion.
  • Built with Xcode 27.1 and looked at the changed screens on the iPhone Duo simulator, closed and open.
  • Told the user which findings were fixed, which were silenced, and why.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Duo Lint؟

The fold linter for iPhone Duo, Apple's foldable with an outer display and an inner display. Run it to find code Apple says to remove before an app runs on the foldable; it reports each finding with the fix for its rule. Catches UIScreen.main and UIScreen.screens, UIDevice.current.orientation, statusBarOrientation, the deprecated interfaceOrientation properties and effectiveGeometry.interfaceOrientation, userInterfaceIdiom == .pad, horizontalSizeClass == .regular treated as iPad, hard-coded screen sizes (bounds.height == 844), GeometryReader sizes matched to devices, .frame(width: 390) and...

لماذا تستخدم Duo Lint على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Duo Lint عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Duo Lint في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/Kimeur/duology/tree/main/plugins/duology-ship/skills/duo-lint. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Duo Lint؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Duo Lint؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Duo Lint معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Duo Lint مجانية؟

نعم. نشرها Kimeur على GitHub بموجب ترخيص MIT. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇