[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C57NA3DK9CEFNAF2GQ6TE7":3,"skill-same:01M6C57NA3DK9CEFNAF2GQ6TE7":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":34,"frontMatter":35,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":15,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M6C57NA3DK9CEFNAF2GQ6TE7","audit","Ditto 应用代码审查与审计","Reviews code or a pull request in an app that uses the Ditto SDK against the best practices guide: scans for known anti-patterns, checks per collection the assumptions that fail across devices (locks, uniqueness, empty results, subscription coverage), marks schema changes additive or breaking, and reports findings by severity with fixes. Use to review or audit Ditto code, a pull request or diff of a Ditto app, or a Ditto app before a release.","对照最佳实践指南审查使用 Ditto SDK 的应用中的代码或拉取请求（PR）：扫描已知的反模式，逐集合检查跨设备时可能失效的假设（锁、唯一性、空结果、订阅覆盖情况），将 schema 变更标记为增量式或破坏性，并按严重程度报告发现的问题及修复建议。用于审查或审计 Ditto 代码、Ditto 应用的拉取请求或差异（diff），或审查发布前的 Ditto 应用。","ditto-examples\u002Fditto-cookbook","ditto-examples","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F192611150?v=4","01M6C57F0Y1W6S5D9RD8GHE3YB","Ditto Examples","01M6C57F52Z11DDMBC0ZJ7FJPG",0,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BR5V701HCN066VEP7H4812","代码仓库协作管理","SCENARIO","使用场景",[5],"2026-11-10 10:12:30",false,"---\nname: audit\ndescription: \"Reviews code or a pull request in an app that uses the Ditto SDK against the best practices guide: scans for known anti-patterns, checks per collection the assumptions that fail across devices (locks, uniqueness, empty results, subscription coverage), marks schema changes additive or breaking, and reports findings by severity with fixes. Use to review or audit Ditto code, a pull request or diff of a Ditto app, or a Ditto app before a release.\"\n---\n\n# Ditto Code Audit\n\nA repeatable review of an app that uses the Ditto SDK 5.2.0 in Flutter, JavaScript, Kotlin, or Swift: a pattern scan, a cross-device review of each collection, and a manual checklist, with the rules in the topic skills. The scan finds what one line shows; assumptions carried over from a single database or a server API show in no single line, and the cross-device review looks for them.\n\n## Before You Apply\n\n- Identify the project's SDK and version: Flutter (`ditto_live` in `pubspec.yaml` \u002F `pubspec.lock`), JavaScript (`@dittolive\u002Fditto` in `package.json`), Kotlin (`com.ditto:ditto-kotlin` in Gradle files), or Swift (`DittoSwift` in `Package.swift`, `Package.resolved`, or the Xcode project). The rules target 5.2.0. **Note (SDK 5.1.0 and 5.2.0)** marks easy-to-miss behavior confirmed on both releases; **Note (SDK 5.1.0)** marks 5.1.0 behavior that 5.2.0 no longer shows, and **Note (SDK 5.2.0)** behavior observed on 5.2.0. Issues that only 5.1.0 has are in `§ Known Issues in SDK 5.1.0`; they apply wherever any device still runs 5.1.0. On a later version, confirm a note (release notes, docs.ditto.live) before reporting it as a defect. If the version cannot be found, apply the 5.2.0 rules, say so in the report, and mark findings that rest on a **Note (SDK ...)** as version-specific.\n- In that SDK's page, `${CLAUDE_SKILL_DIR}\u002F..\u002Fguide\u002Freference\u002Fbest-practices\u002Fplatforms\u002F\u003Csdk>.md` (`flutter`, `javascript`, `kotlin`, `swift`), read the *Behavior Specific to the \u003CSDK> SDK* section at its end, not the whole page (Grep the heading for its line): it lists what only that SDK does. `§ Specific to One SDK` in the guide's Anti-Pattern Checklist lists the mistakes to look for in that SDK. Open the topic skills' `examples\u002F\u003Csdk>\u002F` only when you write a fix.\n- `§ \u003CHeading>` cites a section of the full guide: Grep the heading as a fixed string (headings contain `(`, `)`, and `+`) in `best-practices\u002F` and `knowledge\u002F` under `${CLAUDE_SKILL_DIR}\u002F..\u002Fguide\u002Freference\u002F`, by those names (in the Ditto Cookbook repository they are symbolic links, which a search of their parent does not enter). If `best-practices\u002FREADME.md` is not there, the guide was not installed with the plugin (for example, a checkout without symbolic links): say so in the report, and rank and cite from the topic skills instead.\n- Read and search files with Read, Glob, and Grep; use the shell only for the scanner, `git`, and `gh`.\n- Review only; do not change code unless the user asks for fixes. When asked, apply fixes that leave stored data unchanged or change it additively, and ask before a breaking one (step 8).\n\n## Workflow\n\nCopy this checklist and work through it:\n\n```\nDitto audit progress:\n- [ ] 1. Scope: paths, a diff, or a snippet (see below); list the files that use Ditto (imports of ditto_live, @dittolive\u002Fditto, DittoSwift, com.ditto)\n- [ ] 2. Context: SDK version, platforms, connection mode (Ditto Server or small peers only), and whether the app is deployed or a sample\n- [ ] 3. Scan: run scripts\u002Fscan.py on the source directories, as a command of its own, even if another shell command was refused\n- [ ] 4. Triage: confirm or discard every scanner hit by reading the code around it\n- [ ] 5. Inventory: per collection, its subscriptions, reads, writes, and removals, with file:line\n- [ ] 6. Cross-device review: ask the eight questions of every collection in the inventory\n- [ ] 7. Manual review: walk the table below for the areas the app uses\n- [ ] 8. Schema changes: classify each change to stored data, in the code under review and in each fix, as additive or breaking\n- [ ] 9. Report: findings by severity, then what was checked and what was not\n```\n\nDo not stop after step 4: a clean scan misses steps 5 to 8.\n\n### Step 1: Scope\n\nDecide what is under review from the request or the arguments the skill was invoked with:\n\n- **Paths, or nothing**: audit those directories, or the whole repository.\n- **A pull request, a branch, a base ref, or \"my changes\"**: read the diff (`gh pr diff \u003Cnumber>`, `git diff \u003Cbase>...HEAD`, or `git diff HEAD` for uncommitted work), and scan only the changed source files (`git diff --name-only --diff-filter=d \u003Cbase>...HEAD`). Review the changed lines, but build the inventory in step 5 from the whole repository for every collection that the diff touches: the cross-device questions need every reader and writer, not only the changed ones. Report what the change introduces as findings, and list problems that the unchanged code already had separately and briefly, unless the change makes them worse. Step 8 always applies.\n- **A snippet with no repository**: skip steps 3 and 5, ask the eight questions of what the snippet shows, and list what it does not show under what was not checked.\n\n### Step 3: Scan\n\nRun it unchained: a permission rule for `python3` can allow it when other commands are refused.\n\n```bash\npython3 ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fscan.py lib\u002F test\u002F\n```\n\nPass the project's existing source and test directories, such as `lib\u002F test\u002F` (Flutter), `src\u002F` (JavaScript), `app\u002Fsrc\u002F` (Android), or `Sources\u002F Tests\u002F` (Swift), or for a diff the changed files. (If `${CLAUDE_SKILL_DIR}` is not substituted, use this file's directory.) It skips build output, dependencies, and generated files; `--exclude GLOB` skips more. Exit code 2 means nothing was scanned: fix the paths. Lines marked `ditto-scan: ignore[rule]` are not reported. The `ditto-scan:` summary line on stderr means the scan ran, even after warnings such as macOS `xcrun` cache errors. The script needs only Python 3.8+; without Python, Grep for the patterns in [reference\u002Fscanner-rules.md](reference\u002Fscanner-rules.md).\n\nEvery hit is a candidate, not a finding: the scanner cannot tell a test fixture, a deliberate counter-example, or a validated identifier from a defect.\n\n### Step 4: Triage\n\nFor each hit:\n1. Read the surrounding function and its callers.\n2. Check whether the code really breaks the rule: Grep the `§` heading that the hit names in the guide and read that section, or the rule of the same name in the skill the hit names (`query-sync`, `data-modeling`, `storage-lifecycle`, `transactions-attachments`, `performance-observability`, `sdk-setup`, `testing`).\n3. For a hit whose message says it applies to SDK 5.1.0 only (fixed in 5.2.0), such as `delete-evict-use-ids` and `composite-index-mixed-direction`, check the version from step 2. If the project uses 5.1.0, or the version is unknown, report it at its severity. If it uses 5.2.0, keep it as a lower-severity note that the code breaks on devices still running 5.1.0 (the code cannot show which releases run in the field), and say so in the finding.\n4. Keep confirmed hits. Report every finding, also from steps 6 and 7, at the severity of its item in `§ Anti-Pattern Checklist` (`best-practices\u002Fanti-patterns.md`), which the scanner already uses: Grep a distinctive phrase of the item there instead of reading the page; its severity is the `##` section above it, or its bold label under `§ Specific to One SDK`. Where several items match, use the highest. For a finding with no checklist item, use the definitions in step 9 and say that you ranked it yourself. Drop false positives silently unless the pattern is worth a comment (for example a validated key spliced into a backtick identifier).\n\n### Steps 5 and 6: Inventory and cross-device review\n\nRead [reference\u002Fcross-device-review.md](reference\u002Fcross-device-review.md) and follow it: build the inventory (per collection: subscriptions, reads, writes, removals, and how `_id` is made, each with file:line and with which devices run it), then ask every question of every collection. The evidence for these defects is in different files, so they are found only by putting the entries side by side.\n\n| # | Question | Typical finding |\n|---|---|---|\n| 1 | Which devices can write this document, and what does the merge keep? | A value read, changed in code, and written back; a `save()` that writes every field; a `status` that devices overwrite |\n| 2 | What does a check before a write prove? | A conditional `UPDATE` or a transaction used as a lock; uniqueness by a local query; `COUNT(*) + 1`; \"never below zero\" |\n| 3 | What does an empty or small result mean? | Defaults or \"not found\" from an empty result; `execute` right after subscribing |\n| 4 | Which subscription brings every document that this query reads? | A query, total, or `JOIN` wider than the subscriptions; a subscription on a field that changes, with stale copies |\n| 5 | What does the code assume once a write has returned? | \"Sent\" after a local write; close or sign-out before the write is confirmed; presence as proof |\n| 6 | What if one device removes the document while another edits it, or was offline for weeks? | Husks, data that comes back, a soft-delete filter missing from one query, an `_id` used again |\n| 7 | What happens when this code runs on every device at once? | Defaults without `INITIAL DOCUMENTS`; cleanup, closing jobs, and migrations on every device; an observer that writes a per-device value or runs a side effect per change |\n| 8 | What does the screen show while related documents are on their way? | A forced unwrap of a referenced document; a parent without children; an attachment not yet fetched |\n\nFor each candidate, write the shortest sequence of events on two devices that produces the defect. If you cannot, it is not a finding; if the code does not show who writes or how long devices stay offline, report it with that condition stated. Report one finding per root cause, at the line where the fix goes, with the other places it touches under `Also:`.\n\n### Step 7: Manual review\n\nThe remaining design and lifecycle problems, by area. Walk the rows for the areas that the app uses; each row is the list to check. Open the named skill only for a row where something looks wrong, and do not report again what step 6 found:\n\n| Area | What to look for | Skill |\n|---|---|---|\n| Subscriptions | Scoped by stable keys; owned by a long-lived service; registered again every time Ditto opens (also on a cold start that skips login); not re-registered per screen, filter, or search, and not registered twice with one copy left uncancelled; no `!=`, `NOT IN`, or `clock()` in their filters; no personal data as a filter value; relays subscribe to what devices behind them need; soft-deleted documents stay in scope | `query-sync` |\n| Observers | Registered once per owner, outside render code; released when the owner goes away (Flutter: `changes` consumed once, stream subscription and observer cancelled in `dispose()`; Kotlin: `close()`, or cancelling the coroutine that collects `observe`); no result objects kept in state; narrow observers per screen region; backpressure for slow work; no counting, logging, or side effect per callback (intermediate states are skipped); no error escaping a callback | `query-sync`, `performance-observability` |\n| Data model | Arrays edited by several devices; whole-document rewrites; stored totals; sequential or timestamp-only IDs; consistent type declarations; documents that can grow without bound; counters written by `SET`, an upsert, or `RESTART WITH`, or removed with `DELETE` or `UNSET`; `UNSET` of map entries that others edit; own timestamps that decide a winner; timestamps of varying precision; renamed or retyped fields | `data-modeling` |\n| Deletion | Strategy per collection (DELETE, soft delete, EVICT); offline periods vs tombstone TTL; `DELETE` not used to free local storage; no `WHERE` built from optional filters that can end up empty; the flag and `deletedAt` set together; eviction complementary to subscriptions, at most daily | `storage-lifecycle` |\n| Transactions | Only the transaction object's `execute` inside, each awaited; no nesting, including through helper methods; no I\u002FO or dialogs inside; `isReadOnly` for transactions that only read; an error caught inside is either rolled back or continued on purpose; pending work awaited before closing | `transactions-attachments` |\n| Attachments | Explicit, lazy, cancellable fetches with a stall timeout; ATTACHMENT declarations; no binaries in documents; a state for a blob that no peer can deliver yet | `transactions-attachments` |\n| Startup and lifecycle | One instance per persistence directory; auth handler set before sync starts, login result checked the SDK's way, no error escaping the handler; system parameters passed in `DittoConfig` on every open (SDK 5.2+; on 5.1, `ALTER SYSTEM` after open and before sync starts); no close on background; writes that must reach another device confirmed before closing; transports changed with `updateTransportConfig` | `sdk-setup` |\n| Security | No development token or keyless small-peers mode in production; no hardcoded keys; permissions in the webhook based on immutable `_id` fields; nothing sensitive in peer metadata; users signed out of shared devices as in `§ Switching users on a shared device` | `sdk-setup` |\n| Indexes and queries | Indexes created at startup for hot filters, sorts, and JOIN keys; no mixed `ASC`\u002F`DESC` composite keys while devices run 5.1.0; no functions on indexed fields; `ORDER BY` with a tie-breaker where order matters | `performance-observability` |\n| Tests | Local-store tests for DQL statements, soft-delete filters, observer cleanup, and subscription registration | `testing` |\n| SDK-specific behavior | The items for the app's SDK in `§ Specific to One SDK` (for example, Flutter `onChange` with an unconsumed `changes` stream, `async` observer handlers in JavaScript, Kotlin results read after their handler returns, a Swift `Ditto` instance without a strong reference), and *Behavior Specific to the \u003CSDK> SDK* on the SDK page | `guide` |\n| SDK version | Where devices still run 5.1.0: `USE IDS` in `DELETE`\u002F`EVICT`, mixed-direction composite indexes (including ones from `ADVISE`), `ANY ... SATISFIES` on several properties, sorted index queries with projections, constants on the left of comparisons; values that Kotlin, Java, Swift, or C# stored incorrectly before 5.2 (`§ Known Issues in SDK 5.1.0`) | `guide` |\n\nThe complete severity-ranked list is the guide's `§ Anti-Pattern Checklist`, with the mistakes of each SDK in `§ Specific to One SDK`; the security-specific list is `§ Security Checklist`.\n\nIn a sample or demo, a simplification that its README or a code comment states on purpose (for example, one device type assumed per collection) is not a defect of the sample: list each once under \"Documented simplifications\", with the severity it would have in a deployed app, so that readers who copy the code know what to change.\n\n### Step 8: Schema changes\n\nDevices on older app versions keep reading and writing the same documents, so a change to what is stored is a release decision. For a diff, a pull request, or a branch, and for any fix that changes stored data, read [reference\u002Fschema-changes.md](reference\u002Fschema-changes.md) and follow it: it finds every change to stored data and classifies it with `§ Breaking and additive changes`. In short:\n\n- Decide from evidence (the README, the user; not a directory name alone) whether the app is deployed, or unreleased or a sample or demo that shares its database with no released app; if unknown, assume deployed and say so. In a sample, a breaking change is not a defect: note that every peer, including a Ditto Server, needs an empty store.\n- Classify the fixes too: a fix that, for example, turns an array into a map, a register into a counter, `status` into a log, or `DELETE` into soft delete changes stored data. In a deployed app, write it as a new field or collection next to the old one, marked breaking with the conditions in `§ A field that replaces another` (a collection: `§ Rolling out a breaking change`); never as a conversion in place.\n\n### Step 9: Report\n\nReaders may not know Ditto. Start with a summary:\n\n```\nVerdict: \u003Cone sentence: for example, \"two CRITICAL defects lose data when tills work offline; fix before release\">\nFindings: \u003Cn> CRITICAL, \u003Cn> HIGH, \u003Cn> MEDIUM (for a diff: \u003Cn> introduced by the change)\nFirst actions: \u003Cup to three fixes, most important first>\nBreaking changes to stored data: \u003Ceach, or \"none\">\n```\n\nThen order findings by severity (CRITICAL: data loss, wrong results, crashes, security; HIGH: sync cost, memory, performance; MEDIUM: maintainability). For each finding:\n\n```\n[SEVERITY] file:line - \u003Cone-line problem>\nAlso: \u003Cother places of the same root cause, file:line each; omit if none>\nScenario: \u003Cfor a finding that needs two devices or two app versions: the shortest sequence of events that produces it; omit otherwise>\nImpact: \u003Cwhat goes wrong at runtime, and when>\nFix: \u003Cthe concrete change, with a short code or DQL snippet if useful>\nSchema: \u003Cadditive or breaking, and why, when the problem or the fix changes stored data; omit otherwise>\nReference: \u003Cskill name> \u002F § \u003Cguide heading> (\u003Clink>)\n```\n\nThe link lets readers in the app's repository open the section: `https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002F\u003Cpage>#\u003Canchor>`, where `\u003Cpage>` is the page's path in the repository, such as `best-practices\u002Fdql.md`, and `\u003Canchor>` is the heading in lowercase, with spaces turned into `-` and other punctuation except `-` removed. When the user asks you to post the review on a pull request, make each finding one review comment at its `file:line`, and the summary the review body.\n\nEnd with: the guide version (the `Version` line of `best-practices\u002FREADME.md`), the SDK version and platforms reviewed, whether the app was taken as deployed or a sample and why, the changes to stored data in the code under review (each additive or breaking), the inventory in compact form (per collection: subscriptions, reads, writes, removals), the areas checked with no findings, and anything not checked (for example code that was not available, which devices write a collection, how long devices stay offline, or behavior that needs a multi-device test). When a fact that the code cannot show, such as the platforms or the connection mode in step 2, is unknown, say so there instead of guessing. Mark findings that depend on a **Note (SDK ...)** behavior or on `§ Known Issues in SDK 5.1.0` as version-specific, and name the releases they apply to.\n\n## Scanner Limits\n\n- Line-based: string literals joined across lines are read as one statement, but DQL built in another function can be missed.\n- Not detectable: everything in steps 5, 6, and 8 (checks used as locks, values written back after a read in app code, results taken as complete, queries wider than their subscriptions), nested transactions through helper methods, observers or subscriptions registered in render code (except in a JavaScript component body: `register-in-render`), subscription scope design, array-vs-map decisions, eviction that overlaps an active subscription, missing indexes.\n- Example and test code that demonstrates anti-patterns on purpose produces hits; treat them as such.\n\n## More\n\n- The inventory, the eight questions with what to look for in code, when a question does not apply, and how to report: [reference\u002Fcross-device-review.md](reference\u002Fcross-device-review.md)\n- Deployed or sample, finding and classifying changes to stored data, fixes, and the `Schema` line: [reference\u002Fschema-changes.md](reference\u002Fschema-changes.md)\n- Scanner rules, patterns, and the guide section behind each: [reference\u002Fscanner-rules.md](reference\u002Fscanner-rules.md)\n- Scanner source: [scripts\u002Fscan.py](scripts\u002Fscan.py)\n- Full guide search: the `guide` skill\n","# Ditto Code Audit\n\nA repeatable review of an app that uses the Ditto SDK 5.2.0 in Flutter, JavaScript, Kotlin, or Swift: a pattern scan, a cross-device review of each collection, and a manual checklist, with the rules in the topic skills. The scan finds what one line shows; assumptions carried over from a single database or a server API show in no single line, and the cross-device review looks for them.\n\n## Before You Apply\n\n- Identify the project's SDK and version: Flutter (`ditto_live` in `pubspec.yaml` \u002F `pubspec.lock`), JavaScript (`@dittolive\u002Fditto` in `package.json`), Kotlin (`com.ditto:ditto-kotlin` in Gradle files), or Swift (`DittoSwift` in `Package.swift`, `Package.resolved`, or the Xcode project). The rules target 5.2.0. **Note (SDK 5.1.0 and 5.2.0)** marks easy-to-miss behavior confirmed on both releases; **Note (SDK 5.1.0)** marks 5.1.0 behavior that 5.2.0 no longer shows, and **Note (SDK 5.2.0)** behavior observed on 5.2.0. Issues that only 5.1.0 has are in `§ Known Issues in SDK 5.1.0`; they apply wherever any device still runs 5.1.0. On a later version, confirm a note (release notes, docs.ditto.live) before reporting it as a defect. If the version cannot be found, apply the 5.2.0 rules, say so in the report, and mark findings that rest on a **Note (SDK ...)** as version-specific.\n- In that SDK's page, `${CLAUDE_SKILL_DIR}\u002F..\u002Fguide\u002Freference\u002Fbest-practices\u002Fplatforms\u002F\u003Csdk>.md` (`flutter`, `javascript`, `kotlin`, `swift`), read the *Behavior Specific to the \u003CSDK> SDK* section at its end, not the whole page (Grep the heading for its line): it lists what only that SDK does. `§ Specific to One SDK` in the guide's Anti-Pattern Checklist lists the mistakes to look for in that SDK. Open the topic skills' `examples\u002F\u003Csdk>\u002F` only when you write a fix.\n- `§ \u003CHeading>` cites a section of the full guide: Grep the heading as a fixed string (headings contain `(`, `)`, and `+`) in `best-practices\u002F` and `knowledge\u002F` under `${CLAUDE_SKILL_DIR}\u002F..\u002Fguide\u002Freference\u002F`, by those names (in the Ditto Cookbook repository they are symbolic links, which a search of their parent does not enter). If `best-practices\u002FREADME.md` is not there, the guide was not installed with the plugin (for example, a checkout without symbolic links): say so in the report, and rank and cite from the topic skills instead.\n- Read and search files with Read, Glob, and Grep; use the shell only for the scanner, `git`, and `gh`.\n- Review only; do not change code unless the user asks for fixes. When asked, apply fixes that leave stored data unchanged or change it additively, and ask before a breaking one (step 8).\n\n## Workflow\n\nCopy this checklist and work through it:\n\n```\nDitto audit progress:\n- [ ] 1. Scope: paths, a diff, or a snippet (see below); list the files that use Ditto (imports of ditto_live, @dittolive\u002Fditto, DittoSwift, com.ditto)\n- [ ] 2. Context: SDK version, platforms, connection mode (Ditto Server or small peers only), and whether the app is deployed or a sample\n- [ ] 3. Scan: run scripts\u002Fscan.py on the source directories, as a command of its own, even if another shell command was refused\n- [ ] 4. Triage: confirm or discard every scanner hit by reading the code around it\n- [ ] 5. Inventory: per collection, its subscriptions, reads, writes, and removals, with file:line\n- [ ] 6. Cross-device review: ask the eight questions of every collection in the inventory\n- [ ] 7. Manual review: walk the table below for the areas the app uses\n- [ ] 8. Schema changes: classify each change to stored data, in the code under review and in each fix, as additive or breaking\n- [ ] 9. Report: findings by severity, then what was checked and what was not\n```\n\nDo not stop after step 4: a clean scan misses steps 5 to 8.\n\n### Step 1: Scope\n\nDecide what is under review from the request or the arguments the skill was invoked with:\n\n- **Paths, or nothing**: audit those directories, or the whole repository.\n- **A pull request, a branch, a base ref, or \"my changes\"**: read the diff (`gh pr diff \u003Cnumber>`, `git diff \u003Cbase>...HEAD`, or `git diff HEAD` for uncommitted work), and scan only the changed source files (`git diff --name-only --diff-filter=d \u003Cbase>...HEAD`). Review the changed lines, but build the inventory in step 5 from the whole repository for every collection that the diff touches: the cross-device questions need every reader and writer, not only the changed ones. Report what the change introduces as findings, and list problems that the unchanged code already had separately and briefly, unless the change makes them worse. Step 8 always applies.\n- **A snippet with no repository**: skip steps 3 and 5, ask the eight questions of what the snippet shows, and list what it does not show under what was not checked.\n\n### Step 3: Scan\n\nRun it unchained: a permission rule for `python3` can allow it when other commands are refused.\n\n```bash\npython3 ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fscan.py lib\u002F test\u002F\n```\n\nPass the project's existing source and test directories, such as `lib\u002F test\u002F` (Flutter), `src\u002F` (JavaScript), `app\u002Fsrc\u002F` (Android), or `Sources\u002F Tests\u002F` (Swift), or for a diff the changed files. (If `${CLAUDE_SKILL_DIR}` is not substituted, use this file's directory.) It skips build output, dependencies, and generated files; `--exclude GLOB` skips more. Exit code 2 means nothing was scanned: fix the paths. Lines marked `ditto-scan: ignore[rule]` are not reported. The `ditto-scan:` summary line on stderr means the scan ran, even after warnings such as macOS `xcrun` cache errors. The script needs only Python 3.8+; without Python, Grep for the patterns in [reference\u002Fscanner-rules.md](reference\u002Fscanner-rules.md).\n\nEvery hit is a candidate, not a finding: the scanner cannot tell a test fixture, a deliberate counter-example, or a validated identifier from a defect.\n\n### Step 4: Triage\n\nFor each hit:\n1. Read the surrounding function and its callers.\n2. Check whether the code really breaks the rule: Grep the `§` heading that the hit names in the guide and read that section, or the rule of the same name in the skill the hit names (`query-sync`, `data-modeling`, `storage-lifecycle`, `transactions-attachments`, `performance-observability`, `sdk-setup`, `testing`).\n3. For a hit whose message says it applies to SDK 5.1.0 only (fixed in 5.2.0), such as `delete-evict-use-ids` and `composite-index-mixed-direction`, check the version from step 2. If the project uses 5.1.0, or the version is unknown, report it at its severity. If it uses 5.2.0, keep it as a lower-severity note that the code breaks on devices still running 5.1.0 (the code cannot show which releases run in the field), and say so in the finding.\n4. Keep confirmed hits. Report every finding, also from steps 6 and 7, at the severity of its item in `§ Anti-Pattern Checklist` (`best-practices\u002Fanti-patterns.md`), which the scanner already uses: Grep a distinctive phrase of the item there instead of reading the page; its severity is the `##` section above it, or its bold label under `§ Specific to One SDK`. Where several items match, use the highest. For a finding with no checklist item, use the definitions in step 9 and say that you ranked it yourself. Drop false positives silently unless the pattern is worth a comment (for example a validated key spliced into a backtick identifier).\n\n### Steps 5 and 6: Inventory and cross-device review\n\nRead [reference\u002Fcross-device-review.md](reference\u002Fcross-device-review.md) and follow it: build the inventory (per collection: subscriptions, reads, writes, removals, and how `_id` is made, each with file:line and with which devices run it), then ask every question of every collection. The evidence for these defects is in different files, so they are found only by putting the entries side by side.\n\n| # | Question | Typical finding |\n|---|---|---|\n| 1 | Which devices can write this document, and what does the merge keep? | A value read, changed in code, and written back; a `save()` that writes every field; a `status` that devices overwrite |\n| 2 | What does a check before a write prove? | A conditional `UPDATE` or a transaction used as a lock; uniqueness by a local query; `COUNT(*) + 1`; \"never below zero\" |\n| 3 | What does an empty or small result mean? | Defaults or \"not found\" from an empty result; `execute` right after subscribing |\n| 4 | Which subscription brings every document that this query reads? | A query, total, or `JOIN` wider than the subscriptions; a subscription on a field that changes, with stale copies |\n| 5 | What does the code assume once a write has returned? | \"Sent\" after a local write; close or sign-out before the write is confirmed; presence as proof |\n| 6 | What if one device removes the document while another edits it, or was offline for weeks? | Husks, data that comes back, a soft-delete filter missing from one query, an `_id` used again |\n| 7 | What happens when this code runs on every device at once? | Defaults without `INITIAL DOCUMENTS`; cleanup, closing jobs, and migrations on every device; an observer that writes a per-device value or runs a side effect per change |\n| 8 | What does the screen show while related documents are on their way? | A forced unwrap of a referenced document; a parent without children; an attachment not yet fetched |\n\nFor each candidate, write the shortest sequence of events on two devices that produces the defect. If you cannot, it is not a finding; if the code does not show who writes or how long devices stay offline, report it with that condition stated. Report one finding per root cause, at the line where the fix goes, with the other places it touches under `Also:`.\n\n### Step 7: Manual review\n\nThe remaining design and lifecycle problems, by area. Walk the rows for the areas that the app uses; each row is the list to check. Open the named skill only for a row where something looks wrong, and do not report again what step 6 found:\n\n| Area | What to look for | Skill |\n|---|---|---|\n| Subscriptions | Scoped by stable keys; owned by a long-lived service; registered again every time Ditto opens (also on a cold start that skips login); not re-registered per screen, filter, or search, and not registered twice with one copy left uncancelled; no `!=`, `NOT IN`, or `clock()` in their filters; no personal data as a filter value; relays subscribe to what devices behind them need; soft-deleted documents stay in scope | `query-sync` |\n| Observers | Registered once per owner, outside render code; released when the owner goes away (Flutter: `changes` consumed once, stream subscription and observer cancelled in `dispose()`; Kotlin: `close()`, or cancelling the coroutine that collects `observe`); no result objects kept in state; narrow observers per screen region; backpressure for slow work; no counting, logging, or side effect per callback (intermediate states are skipped); no error escaping a callback | `query-sync`, `performance-observability` |\n| Data model | Arrays edited by several devices; whole-document rewrites; stored totals; sequential or timestamp-only IDs; consistent type declarations; documents that can grow without bound; counters written by `SET`, an upsert, or `RESTART WITH`, or removed with `DELETE` or `UNSET`; `UNSET` of map entries that others edit; own timestamps that decide a winner; timestamps of varying precision; renamed or retyped fields | `data-modeling` |\n| Deletion | Strategy per collection (DELETE, soft delete, EVICT); offline periods vs tombstone TTL; `DELETE` not used to free local storage; no `WHERE` built from optional filters that can end up empty; the flag and `deletedAt` set together; eviction complementary to subscriptions, at most daily | `storage-lifecycle` |\n| Transactions | Only the transaction object's `execute` inside, each awaited; no nesting, including through helper methods; no I\u002FO or dialogs inside; `isReadOnly` for transactions that only read; an error caught inside is either rolled back or continued on purpose; pending work awaited before closing | `transactions-attachments` |\n| Attachments | Explicit, lazy, cancellable fetches with a stall timeout; ATTACHMENT declarations; no binaries in documents; a state for a blob that no peer can deliver yet | `transactions-attachments` |\n| Startup and lifecycle | One instance per persistence directory; auth handler set before sync starts, login result checked the SDK's way, no error escaping the handler; system parameters passed in `DittoConfig` on every open (SDK 5.2+; on 5.1, `ALTER SYSTEM` after open and before sync starts); no close on background; writes that must reach another device confirmed before closing; transports changed with `updateTransportConfig` | `sdk-setup` |\n| Security | No development token or keyless small-peers mode in production; no hardcoded keys; permissions in the webhook based on immutable `_id` fields; nothing sensitive in peer metadata; users signed out of shared devices as in `§ Switching users on a shared device` | `sdk-setup` |\n| Indexes and queries | Indexes created at startup for hot filters, sorts, and JOIN keys; no mixed `ASC`\u002F`DESC` composite keys while devices run 5.1.0; no functions on indexed fields; `ORDER BY` with a tie-breaker where order matters | `performance-observability` |\n| Tests | Local-store tests for DQL statements, soft-delete filters, observer cleanup, and subscription registration | `testing` |\n| SDK-specific behavior | The items for the app's SDK in `§ Specific to One SDK` (for example, Flutter `onChange` with an unconsumed `changes` stream, `async` observer handlers in JavaScript, Kotlin results read after their handler returns, a Swift `Ditto` instance without a strong reference), and *Behavior Specific to the \u003CSDK> SDK* on the SDK page | `guide` |\n| SDK version | Where devices still run 5.1.0: `USE IDS` in `DELETE`\u002F`EVICT`, mixed-direction composite indexes (including ones from `ADVISE`), `ANY ... SATISFIES` on several properties, sorted index queries with projections, constants on the left of comparisons; values that Kotlin, Java, Swift, or C# stored incorrectly before 5.2 (`§ Known Issues in SDK 5.1.0`) | `guide` |\n\nThe complete severity-ranked list is the guide's `§ Anti-Pattern Checklist`, with the mistakes of each SDK in `§ Specific to One SDK`; the security-specific list is `§ Security Checklist`.\n\nIn a sample or demo, a simplification that its README or a code comment states on purpose (for example, one device type assumed per collection) is not a defect of the sample: list each once under \"Documented simplifications\", with the severity it would have in a deployed app, so that readers who copy the code know what to change.\n\n### Step 8: Schema changes\n\nDevices on older app versions keep reading and writing the same documents, so a change to what is stored is a release decision. For a diff, a pull request, or a branch, and for any fix that changes stored data, read [reference\u002Fschema-changes.md](reference\u002Fschema-changes.md) and follow it: it finds every change to stored data and classifies it with `§ Breaking and additive changes`. In short:\n\n- Decide from evidence (the README, the user; not a directory name alone) whether the app is deployed, or unreleased or a sample or demo that shares its database with no released app; if unknown, assume deployed and say so. In a sample, a breaking change is not a defect: note that every peer, including a Ditto Server, needs an empty store.\n- Classify the fixes too: a fix that, for example, turns an array into a map, a register into a counter, `status` into a log, or `DELETE` into soft delete changes stored data. In a deployed app, write it as a new field or collection next to the old one, marked breaking with the conditions in `§ A field that replaces another` (a collection: `§ Rolling out a breaking change`); never as a conversion in place.\n\n### Step 9: Report\n\nReaders may not know Ditto. Start with a summary:\n\n```\nVerdict: \u003Cone sentence: for example, \"two CRITICAL defects lose data when tills work offline; fix before release\">\nFindings: \u003Cn> CRITICAL, \u003Cn> HIGH, \u003Cn> MEDIUM (for a diff: \u003Cn> introduced by the change)\nFirst actions: \u003Cup to three fixes, most important first>\nBreaking changes to stored data: \u003Ceach, or \"none\">\n```\n\nThen order findings by severity (CRITICAL: data loss, wrong results, crashes, security; HIGH: sync cost, memory, performance; MEDIUM: maintainability). For each finding:\n\n```\n[SEVERITY] file:line - \u003Cone-line problem>\nAlso: \u003Cother places of the same root cause, file:line each; omit if none>\nScenario: \u003Cfor a finding that needs two devices or two app versions: the shortest sequence of events that produces it; omit otherwise>\nImpact: \u003Cwhat goes wrong at runtime, and when>\nFix: \u003Cthe concrete change, with a short code or DQL snippet if useful>\nSchema: \u003Cadditive or breaking, and why, when the problem or the fix changes stored data; omit otherwise>\nReference: \u003Cskill name> \u002F § \u003Cguide heading> (\u003Clink>)\n```\n\nThe link lets readers in the app's repository open the section: `https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002F\u003Cpage>#\u003Canchor>`, where `\u003Cpage>` is the page's path in the repository, such as `best-practices\u002Fdql.md`, and `\u003Canchor>` is the heading in lowercase, with spaces turned into `-` and other punctuation except `-` removed. When the user asks you to post the review on a pull request, make each finding one review comment at its `file:line`, and the summary the review body.\n\nEnd with: the guide version (the `Version` line of `best-practices\u002FREADME.md`), the SDK version and platforms reviewed, whether the app was taken as deployed or a sample and why, the changes to stored data in the code under review (each additive or breaking), the inventory in compact form (per collection: subscriptions, reads, writes, removals), the areas checked with no findings, and anything not checked (for example code that was not available, which devices write a collection, how long devices stay offline, or behavior that needs a multi-device test). When a fact that the code cannot show, such as the platforms or the connection mode in step 2, is unknown, say so there instead of guessing. Mark findings that depend on a **Note (SDK ...)** behavior or on `§ Known Issues in SDK 5.1.0` as version-specific, and name the releases they apply to.\n\n## Scanner Limits\n\n- Line-based: string literals joined across lines are read as one statement, but DQL built in another function can be missed.\n- Not detectable: everything in steps 5, 6, and 8 (checks used as locks, values written back after a read in app code, results taken as complete, queries wider than their subscriptions), nested transactions through helper methods, observers or subscriptions registered in render code (except in a JavaScript component body: `register-in-render`), subscription scope design, array-vs-map decisions, eviction that overlaps an active subscription, missing indexes.\n- Example and test code that demonstrates anti-patterns on purpose produces hits; treat them as such.\n\n## More\n\n- The inventory, the eight questions with what to look for in code, when a question does not apply, and how to report: [reference\u002Fcross-device-review.md](reference\u002Fcross-device-review.md)\n- Deployed or sample, finding and classifying changes to stored data, fixes, and the `Schema` line: [reference\u002Fschema-changes.md](reference\u002Fschema-changes.md)\n- Scanner rules, patterns, and the guide section behind each: [reference\u002Fscanner-rules.md](reference\u002Fscanner-rules.md)\n- Scanner source: [scripts\u002Fscan.py](scripts\u002Fscan.py)\n- Full guide search: the `guide` skill\n",{"name":5,"description":7},"main","b67d1a0bc891c9b2a952f8beb0a6dce7d449717c","plugins\u002Fditto\u002Fskills\u002Faudit","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook","https:\u002F\u002Fdocs.ditto.live\u002Fhome\u002Fintroduction","https:\u002F\u002Fgithub.com\u002Fditto-examples","https:\u002F\u002Fdocs.ditto.live","Example Apps and Information for Ditto","2026-11-13 17:08:48",{"source":9,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add ditto-examples\u002Fditto-cookbook --skill audit",{"tool":51,"command":52},"bunx","bunx skills add ditto-examples\u002Fditto-cookbook --skill audit",{"tool":54,"command":55},"pnpm","pnpm dlx skills add ditto-examples\u002Fditto-cookbook --skill audit","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002FSKILL.md",true,[59,65,69,73],{"path":60,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":63,"sourceHtmlUrl":64},"reference\u002Fcross-device-review.md","REFERENCE","参考文档",15707,"https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002Freference\u002Fcross-device-review.md",{"path":66,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":67,"sourceHtmlUrl":68},"reference\u002Fscanner-rules.md",14421,"https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002Freference\u002Fscanner-rules.md",{"path":70,"resourceType":61,"resourceTypeDesc":62,"sizeBytes":71,"sourceHtmlUrl":72},"reference\u002Fschema-changes.md",10446,"https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002Freference\u002Fschema-changes.md",{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"scripts\u002Fscan.py","SCRIPT","脚本",85235,"https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Faudit\u002Fscripts\u002Fscan.py",[80,96,130,155,170,185],{"skillNo":81,"name":82,"nameZh":83,"description":84,"descriptionZh":85,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":86,"categories":87,"keywords":92,"publishedAt":31},"01M6C58EAD92WQKNE74549PXEW","transactions-attachments","Ditto 事务与附件处理","Ditto SDK transactions and attachments (Flutter, JavaScript, Kotlin, Swift): ditto.store.transaction with tx.execute only, no nesting, short scopes, rollback, close(); newAttachment, ATTACHMENT declarations, lazy fetchAttachment with a stall timeout, immutability, thumbnails, and blob availability. Use when writing or reviewing ditto.store.transaction, newAttachment, or fetchAttachment code, or when displaying photos or files stored in Ditto.","Ditto SDK 的事务与附件（Flutter、JavaScript、Kotlin、Swift）：ditto.store.transaction 仅使用 tx.execute、不嵌套、作用域要短、回滚、close()；newAttachment、ATTACHMENT 声明、带停顿超时（stall timeout）的惰性 fetchAttachment、不可变性、缩略图以及 blob 可用性。适用于编写或审查 ditto.store.transaction、newAttachment 或 fetchAttachment 代码，或展示存储在 Ditto 中的照片或文件。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Ftransactions-attachments\u002FSKILL.md",[88,89],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":90,"categoryName":91,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BS1P4QM1G70C9FKMTZ88VK","数据库管理",[93,94,95],"transactions attachments","attachments","transactions",{"skillNo":97,"name":98,"nameZh":99,"description":100,"descriptionZh":101,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":102,"categories":103,"keywords":110,"publishedAt":31},"01M6C58B0PQHV5WXMQRP9DEPX1","testing","Ditto SDK 测试策略与实现","Ditto SDK testing strategies in Flutter, JavaScript, Kotlin, or Swift: local-store test helper, tests for DQL statements, MISSING\u002FNULL filters, merge-sensitive writes, soft delete, observer lifecycle, subscription rules, and multi-peer sync tests in one process. Use when writing or reviewing tests for code that uses Ditto, setting up a Ditto test harness, or reproducing a Ditto sync or merge bug.","Flutter、JavaScript、Kotlin 或 Swift 中的 Ditto SDK 测试策略：本地存储测试辅助工具、DQL 语句测试、MISSING\u002FNULL 过滤、合并敏感写入、软删除、观察者（observer）生命周期、订阅规则，以及在单进程中运行的多节点同步测试。适用于为使用 Ditto 的代码编写或审查测试、搭建 Ditto 测试框架（test harness），或复现 Ditto 同步或合并缺陷。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Ftesting\u002FSKILL.md",[104,107],{"categoryNo":105,"categoryName":106,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":108,"categoryName":109,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[98,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129],"writing","up","filters","code","delete","merge","sync","local","strategies","bug","missing","tests","testing strategies","when","test harness","swift","for","harness","lifecycle",{"skillNo":131,"name":132,"nameZh":133,"description":134,"descriptionZh":135,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":136,"categories":137,"keywords":140,"publishedAt":31},"01M6C587HJC1SVAPYEZHJBV1C7","storage-lifecycle","Ditto 数据删除与存储管理","Ditto SDK data removal and local storage management covering DELETE vs soft delete vs EVICT, tombstones and their TTL, husk documents, eviction with complementary subscriptions, retention cleanup, and storage monitoring. Use when writing Ditto DELETE or EVICT statements, soft-delete flags or retention cleanup for Ditto documents, or TOMBSTONE_TTL_HOURS, or when deleted Ditto data came back or evicted documents sync back.","Ditto SDK 的数据删除与本地存储管理，涵盖 DELETE、软删除与 EVICT 之间的区别、墓碑（tombstone）及其 TTL、空壳文档（husk document）、配合补充订阅的驱逐（eviction）、保留期清理以及存储监控。适用于编写 Ditto 的 DELETE 或 EVICT 语句、为 Ditto 文档设置软删除标记或保留清理、处理 TOMBSTONE_TTL_HOURS，或处理已删除的 Ditto 数据重新出现、被驱逐的文档又同步回来的情况。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Fstorage-lifecycle\u002FSKILL.md",[138,139],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":90,"categoryName":91,"taxonomyType":28,"taxonomyTypeDesc":29},[129,141,142,118,117,143,111,144,145,146,147,148,149,150,151,152,124,153,154,115],"storage","storage lifecycle","cleanup","use","documents","monitoring","back","evict","retention","sdk","with","subscriptions","ttl","ditto",{"skillNo":156,"name":157,"nameZh":158,"description":159,"descriptionZh":160,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":161,"categories":162,"keywords":167,"publishedAt":31},"01M6C5845MAD3AEBNSN3BT61WH","sdk-setup","Ditto SDK 初始化配置与安全","Ditto SDK setup, lifecycle, and production security (Flutter, JavaScript, Kotlin, Swift): DittoConfig, the authentication expiration handler, system parameters, sync start and stop, close, transports, presence, keys, permissions, revocation. Use when initializing Ditto, writing Ditto login, startup, shutdown, or background code, configuring Ditto transports, reviewing Ditto security, or when Ditto sync never starts or devices do not connect.","Ditto SDK 的设置、生命周期与生产环境安全（Flutter、JavaScript、Kotlin、Swift）：DittoConfig、认证过期处理器、系统参数、同步启动与停止、关闭、传输（transports）、在线状态（presence）、密钥、权限、撤销。适用于初始化 Ditto、编写 Ditto 登录、启动、关闭或后台代码、配置 Ditto 传输、审查 Ditto 安全，或当 Ditto 同步始终无法启动、设备无法连接时。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Fsdk-setup\u002FSKILL.md",[163,164],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":165,"categoryName":166,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C36CP2J9CRK1B6PYRXVHPN","应用配置管理",[168,169,150],"setup","sdk setup",{"skillNo":171,"name":172,"nameZh":173,"description":174,"descriptionZh":175,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":176,"categories":177,"keywords":182,"publishedAt":31},"01M6C580SCSJK0E5Z54AJTV242","query-sync","Ditto DQL 查询与数据同步","Ditto SDK DQL reads and writes, subscriptions, and store observers (Flutter, JavaScript, Kotlin, Swift): query parameters, MISSING vs NULL, membership filters, subscription and observer lifecycle, ON ID CONFLICT upserts, JOIN, RETURNING. Use when writing or reviewing ditto.store.execute, ditto.sync.registerSubscription, registerObserver, or DQL in an app that uses Ditto, or when Ditto data does not sync or a Ditto query returns nothing.","Ditto SDK 的 DQL 读写、订阅和存储观察器（Flutter、JavaScript、Kotlin、Swift）：查询参数、MISSING 与 NULL 的区别、成员资格过滤器、订阅与观察器的生命周期、ON ID CONFLICT 更新插入（upsert）、JOIN、RETURNING。适用于在使用 Ditto 的应用中编写或审查 ditto.store.execute、ditto.sync.registerSubscription、registerObserver 或 DQL，或当 Ditto 数据无法同步、Ditto 查询返回空结果时。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Fquery-sync\u002FSKILL.md",[178,179],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":180,"categoryName":181,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C7B262C3NBH17S93KFN7JG","数据集成与同步",[117,183,184],"query sync","query",{"skillNo":186,"name":187,"nameZh":188,"description":189,"descriptionZh":190,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":191,"categories":192,"keywords":197,"publishedAt":31},"01M6C57X4C3TQSWZJC882ECQV2","performance-observability","Ditto 观察器性能诊断","Ditto SDK store observer performance and diagnostics (Flutter, JavaScript, Kotlin, Swift): observer lifecycle, backpressure (registerObserverV2, signalNext, suspending handlers), narrow UI updates, differs, redundant writes, indexes, ADVISE, EXPLAIN, PROFILE, logging, and system: collections. Use when a Ditto query is slow, a screen showing Ditto data janks, Ditto observers grow memory, Ditto upserts repeat, or when setting up Ditto logging.","Ditto SDK 存储观察器的性能与诊断（Flutter、JavaScript、Kotlin、Swift）：观察器生命周期、背压（registerObserverV2、signalNext、挂起处理器）、精细 UI 更新、差异比较（differs）、冗余写入、索引、ADVISE、EXPLAIN、PROFILE、日志记录，以及 system: 集合。当 Ditto 查询缓慢、显示 Ditto 数据的界面卡顿、Ditto 观察器内存增长、Ditto upsert 重复执行，或需要设置 Ditto 日志记录时使用。","https:\u002F\u002Fgithub.com\u002Fditto-examples\u002Fditto-cookbook\u002Fblob\u002Fmain\u002Fplugins\u002Fditto\u002Fskills\u002Fperformance-observability\u002FSKILL.md",[193,194],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":195,"categoryName":196,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C796JZ1YCTM2B2X7TKEWZZ","性能剖析与优化",[198,199,200],"performance","observability","performance observability"]