Test Mac Appのロゴ

Test Mac App

コミュニティ
daveebbelaar
test-mac-app

Test a macOS app at three levels, from Swift Testing unit tests and an in-app self-test to a debug bridge that lets an agent drive the running app and read its state, plus computer use for real clicks. Use when adding logic, fixing a bug, before a release, or when the user asks for tests, end-to-end checks, or "make sure it works".

概要

公開者daveebbelaar
リポジトリbama
スキル名test-mac-app
スター
952
フォーク
136
同梱ファイル
1
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 1個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    daveebbelaarがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキルTest Mac AppをTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/daveebbelaar/bama/tree/main/skills/ship/test-mac-app
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/daveebbelaar/bama.git /tmp/bama
mkdir -p .claude/skills
cp -r /tmp/bama/skills/ship/test-mac-app .claude/skills/test-mac-app
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTest Mac Appを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあると、モデルが自動的にTest Mac Appを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Test Mac Appは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、未使用のスキルにはコストがかかりません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Test a Mac app

Three levels, cheapest first. Each new story gets the cheapest level that can prove its acceptance criteria. A bug fix starts with a test that fails.

LevelProvesSpeed
Unit tests (Swift Testing)Rules, parsing, dataSeconds
Self-test (--selftest)The app's real functions on a test storeSeconds
Key events and menu audit (inside the self-test)Keyboard flows and every shortcut, without the screenSeconds
Debug bridge + computer useGlobal shortcuts, panels, permissions, other appsMinutes

Snapshots (build-and-verify skill) prove how it looks. This skill proves how it behaves.

1. Unit tests

Logic lives in a library target (<App>Kit) with no SwiftUI, so tests run without the app.

swift
import Testing
@testable import AppKitCore

@Test("Natural dates", arguments: [("tomorrow 9am", 1, 9), ("next fri", 5, nil)])
func parses(_ phrase: String, dayOffset: Int, hour: Int?) throws {
    let result = try #require(DateParser.parse(phrase, now: .fixed))
    #expect(result.dayOffset == dayOffset)
    #expect(result.hour == hour)
}
bash
swift test --scratch-path ~/Library/Developer/<App>/test-build
  • Fix the clock (now: parameter) and the store path in every test.
  • A parser that removes text from what the user typed needs at least 20 negative rows: real titles that contain date or time words ("Watch Friday Night Lights"). Add consistency rows for related phrases ("next week" and "next friday"), and a tested way to undo a parsed part.
  • Table tests for anything with many cases. Keep the table in docs/research/<topic>.md too, and add a row there before changing behavior. A date parser easily needs 100 rows.

2. Self-test

A launch flag that runs the same functions the UI calls, prints PASS or FAIL per step, and exits 0 or 1:

bash
APP_STORE=/tmp/<App>-self.store ~/Applications/<App>.app/Contents/MacOS/<App> --selftest
# PASS add task
# PASS complete task
# PASS undo

Always point it at a store in /tmp. Never at the user's data.

Checks worth adding to any self-test:

  • Every action's Shortcuts title equals its menu title.
  • Every SF Symbol name exists (NSImage(systemSymbolName:accessibilityDescription:)).
  • Every URL action round-trips.
  • For every page: New Item creates a row that is visible and focused on that page. After an action removes the selected row, selection moves to the next row.
  • Smoke step: start every background timer, sampler, and observer for a few seconds, then print PASS. It is the only check that catches crashes on background queues.

A single-instance app (menu bar utility) cannot launch a second copy with --selftest. Make it a bridge command instead. Xcode and XcodeGen apps without a library target: see ../build-and-verify/existing-app.md for a test target with no host app.

Key events and menu audit

The self-test can press real keys without computer use:

swift
let event = NSEvent.keyEvent(with: .keyDown, location: .zero, modifierFlags: [],
    timestamp: 0, windowNumber: window.windowNumber, context: nil,
    characters: "\r", charactersIgnoringModifiers: "\r", isARepeat: false, keyCode: 36)!
window.sendEvent(event)                               // Return in the focused list
NSApp.mainMenu?.performKeyEquivalent(with: commandK)  // a menu shortcut

Walk NSApp.mainMenu and check every command's title, key equivalent, modifiers, and symbol against the command map. One loop turns "every action has a menu item and a shortcut" into a check per item.

Focus the list after making the window key (window.makeKey(), then makeFirstResponder(list)). A search field in the toolbar can take focus first, and then list keys and menu items miss the list.

Menu check (from outside)

Do not test SwiftUI menu state from inside the app. Its items carry no action selector, isEnabled updates on SwiftUI's schedule, and the checks fail whenever another app is in front, which is always true while an agent works. In the self-test, check what the commands receive (the selection passed into them) and run the actions the items call.

Check the real menu from outside, through Accessibility, on a seeded test copy. Computer use app_menu works in the background:

  1. Nothing selected: To-Do > Complete is reported disabled.
  2. Click a row (app_click), then To-Do > Complete: the row is done and the next row is selected (app_screenshot).

Write these steps into the app's CLAUDE.md, so every agent runs them after touching commands.

Runs that never hang

  • Quit through NSApp.terminate, with the exit code set in applicationWillTerminate. Close open sheets first, or terminate is refused and the run waits forever.
  • Before each run, delete ~/Library/Saved Application State/<bundle id>.savedState. After a crash, the next launch shows a "reopen windows?" alert that blocks every later run with no output. Do not use -ApplePersistenceIgnoreState: SwiftUI then opens no window at all.
  • Delete the old test store and its -wal and -shm files before a seeded run. Seed data only fills an empty store.
  • Print line-buffered (setvbuf(stdout, nil, _IOLBF, 0)), so a crash keeps the PASS lines before it.

3. Debug bridge

For behavior a self-test cannot reach: global shortcuts, floating panels, window control, permissions, timing. The running app listens for commands and writes its state to a file. Code shape: ../../code/os-integrations/recipes.md (Debug bridge).

bash
swift scripts/<app>ctl.swift status            # writes and prints status.json
swift scripts/<app>ctl.swift windowLeft        # runs an action by name
swift scripts/<app>ctl.swift snapshot:launcher # draws a window to a PNG
swift scripts/<app>ctl.swift captureProbe:/tmp/a.png   # runs, logs timing, cancels

Commands worth adding:

  • status: permissions, feature flags, open panels, counts, last error.
  • One command per action, by the same name as the menu item and URL.
  • snapshot:<window>: captures one of the app's windows with ScreenCaptureKit (code in ../build-and-verify/existing-app.md).
  • appearance:light|dark|system: switches the app's appearance for snapshots.
  • selftest: the self-test as a command, for an app that is already running.
  • <feature>File:<path>: opens an editor or card on a test file, with no clipboard or data change.
  • <feature>Probe: runs a slow path and logs the time of each step (see the performance skill).

Compile the bridge in debug builds, or behind a launch flag in release.

4. Computer use

Last resort, for what only a person can do: a real key press in another app, drag and drop from Finder, a permission prompt. See the clone skill for setup. Tell the user to keep off the mouse while it runs. Capture your own window, never the full screen.

Debug output

A GUI app's print is buffered and lost when the process is killed. Write debug lines to stderr (FileHandle.standardError.write) behind an environment flag (APP_DEBUG=1).

Done when every acceptance line of the story maps to a passing test, self-test step, bridge command, or a named manual check, and the bug fix has a test that failed before the fix.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Test Mac App」では何ができますか?

Test a macOS app at three levels, from Swift Testing unit tests and an in-app self-test to a debug bridge that lets an agent drive the running app and read its state, plus computer use for real clicks. Use when adding logic, fixing a bug, before a release, or when the user asks for tests, end-to-end checks, or "make sure it works".

TypingMindでTest Mac Appを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Test Mac Appはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTest Mac Appをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/daveebbelaar/bama/tree/main/skills/ship/test-mac-appを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Test Mac Appを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストが合致したときにこのスキルを読み込めます。

Test Mac Appは何個のAIモデルで使えますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTest Mac Appを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Test Mac App」は無料ですか?

はい。daveebbelaarがGitHubでMITライセンスの下で公開しています。支払いが必要なのは、利用したトークンに対する、ご自身が契約するAIプロバイダーへの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇