算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
adversarial-swift-ui【设计与创意】Use this skill to gate SwiftUI code with a pass/fail adversarial review — a single blind reviewer subagent judges a diff or file set against 31 decidable rules — data modeling and observation (@Observable over ObservableObject, @State ownership, task(id:) re-init guards, environment closures and high-frequency values), view update cost (computed-var …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
A SwiftUI architecture review gate — pass/fail: a single blind reviewer subagent judges the work against this gate's rules with an adversarial mandate, and the work passes only when every rule is PASS or N/A. This skill renders verdicts; it never fixes the work.
The rules are filtered down to the checks a reviewer can decide from code evidence alone. The gate judges the failure modes agents and experienced-but-not-expert developers actually produce: legacy observation stacks, identity-destroying conditionals, work attached to the wrong lifecycle point, laziness-defeating list construction, animations that leak across generic content, and controls that opt out of the system's accessibility semantics.
ObservableObject/@StateObject, .onAppear { Task { ... } }, AnyView rows, GeometryReader-to-measure) or identity-resetting conditionals (applyIf helpers, container-type switches).Do not apply to targets with no SwiftUI surface — server-side Swift, CLI tools, non-UI packages (the reviewer prompt's precondition aborts with "GATE NOT APPLICABLE"). General Swift language quality (concurrency structure, API design, control flow) is the sibling adversarial-swift gate's job, not this one's. Rules whose remedy needs a newer toolchain or deployment target than the project's are N/A, not FAIL — the reviewer prompt carries the version-gate table.
Follow these steps exactly — the gate's value is that every review runs the same way.
Two preconditions before step 1 — both exist because their violation is the gate family's recorded field-failure mode (July 2026: gates run as cleanup drivers on a moving target rendered zero verdicts while the diff grew to 33 files):
GATE VOID — target changed in place of a verdict and re-dispatch against the new frozen state. A dispatched gate must always end in a rendered verdict, a GATE NOT APPLICABLE, or a recorded void — never silence, which is indistinguishable from "reviewed".When other agents may mutate the workspace mid-review, the reviewer reads the rules from an immutable snapshot (e.g. git archive <ref> <skill-dir> | tar -x -C "$TMPDIR") rather than the live checkout — and skill directories are read-only infrastructure, excluded from every cleanup or fix scope.
Package.swift, the Xcode project, or availability annotations) — several rules version-gate on them. Include the repo root in the target description — update-pass-minimal-data, state-own-models-in-state, and update-cache-expensive-derivations can require reading whole files beyond the diff hunks.references/ (all state-*.md, update-*.md, identity-*.md, task-*.md, list-*.md, anim-*.md, access-*.md files).@unchecked Sendable, try!, force-unwraps) to satisfy a rule does not flip it. Violations the reviewer noticed outside the target manifest go under the verdict's out-of-scope observations — reported for a future gate invocation, never fixed under this one, never counted in the verdict.If the same rule flips verdicts across re-reviews of an unchanged target, or a human reads the evidence and overrides the verdict, that is a decidability bug in the rule — record it in gotchas.md and sharpen the rule; do not override the gate.
The reviewer returns, per rule: PASS | FAIL | N/A, evidence (file:line or a quote — required for PASS as well as FAIL), and for every FAIL, the fix that flips the rule to PASS once applied — the named change plus its location, never a restatement of the violation. The final report follows assets/templates/verdict.md.
| # | Category | Prefix | Covers |
|---|---|---|---|
| 1 | Data Modeling & Observation | state- | @Observable over ObservableObject, @State ownership of view-created models, no State(initialValue:) from init params, identity guards on .task(id:) model re-creation, callAsFunction wrappers for environment closures, no high-frequency values in EnvironmentValues |
| 2 | View Update Cost | update- | Subview structs over computed some View vars, minimal data per leaf view, no side effects in view init, cached O(n) derivations, no collection-bearing structs on list rows |
| 3 | Structural View Identity | identity- | Branch inside modifier values not around views, no runtime if/else in modifier helpers (applyIf), AnyLayout over container branches |
| 4 | Data Loading & Task Lifecycle | task- | .task over .onAppear+Task, .task(id:) over .onChange+Task, scalar compared values, @concurrent offloading of CPU work in @MainActor observables |
| 5 | Lists & Geometry | list- | Constant per-element view count in ForEach, no AnyView rows, onGeometryChange over measurement GeometryReader, no geometry feedback loops, visualEffect for scroll-driven transforms |
| 6 | Animation Scope | anim- | animation(_:body:) for generic containers over value-based .animation on arbitrary content, built-in animatable attributes over custom Animatable |
| 7 | Platform Conventions & Accessibility | access- | Buttons built with title and icon, Button over onTapGesture, style protocols over rebuilt controls, accessibility representations for bespoke controls, semantic fonts and colors, @ScaledMetric for custom spacing near text |
Read gotchas.md before dispatching the reviewer — it pre-records rule-fidelity guards (patterns this gate's rules endorse that community lore condemns, such as id: \.self on constant collections and view models held in @State) so the reviewer does not import outside rules.
adversarial-swift — the sibling gate for Swift language concerns (concurrency, error propagation, API and type design, control flow); run both on mixed Swift+SwiftUI work.adversarial-ios-design — the sibling gate for rendered design and UX (HIG grammar, motion, mandatory evidence capture); run it too on user-facing work, and run it first when the diff changes gestures or interaction behavior — recognizer arbitration is invisible to this gate's code-only review.ios-taste (curated) — judgment-call iOS design guidance this gate deliberately excludes; use it when the goal is taste, not a verdict.search-ios26-docs / search-macos26-docs — verify current-SDK API availability when a version-gate question decides a rule.| File | Description |
|---|---|
| references/reviewer-prompt.md | Self-contained prompt template for the blind reviewer |
| assets/templates/verdict.md | Verdict report template |
| references/_sections.md | Category definitions and ordering |
| metadata.json | Version and source references |