算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
cleanup-swift【设计与创意】End-of-session cleanup pass for Swift code. Use this skill whenever the user asks to "clean up", "polish", "tidy", "refactor", or "review" Swift work at the end of a coding session, or when they invoke this skill by name. Performs a holistic review of session changes — correctness, behavioral test relevance, simplification, type-driven design, macOS …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Evaluate the work done in this session and refactor it to a pristine state.
Resolve one authoritative session change set before dispatching subagents. Do not let each subagent independently decide what to review.
Use this order:
HEAD, then confirm the range does not include unrelated work.Use commit hashes, not movable branch names, for committed ranges. If tracked or untracked working-tree content is in scope, materialize one immutable review bundle outside the repository before dispatch: a unified patch, copies of in-scope untracked files, and a path/content-hash manifest. All subagents read that same bundle. Remove it after review.
Print the frozen review manifest before dispatch:
Review target: <commit range plus working-tree state>
Files: <exact paths>
Pass this exact target and file list to every subagent. The manifest bounds findings and proposed edits, not read-only context: reviewers may inspect callers, callees, and existing tests outside it, but every finding must anchor to a changed line or newly added file in the manifest.
Verify every skill in the review table is available before dispatch. If any is unavailable, stop and report the cleanup as incomplete, naming the missing skill. Do not silently substitute a generic review or treat a failed subagent as an empty finding set.
Track every lens as completed, failed, or unavailable.
Each skill below represents a review lens. Every lens gets its own sub-agent.
| Lens | Skill | Focus |
|---|---|---|
| Simplification | simplify | Dead code, needless abstractions, unused params, and helpers whose names do not add meaning. Do not inline single-use helpers that clarify call sites or hide non-trivial conditions. |
| Type-driven design | parse-dont-validate | Push checks into types; make invalid states unrepresentable |
| Design patterns | design-patterns-gof | Patterns only where they earn their weight |
| Platform conventions | macos-swift-desktop | Naming, ARC, AppKit/SwiftUI boundaries, threading, main-actor isolation |
| Behavioral tests | behavioral-testing | Tests exercise the changed production boundary and observable outcome; post-fix tests fail when the defect is restored |
| Comment hygiene | code-comments | Strip "what" comments and AI narration; keep "why" comments only |
| Correctness | adversarial-review | Concrete regressions, return-value loss, generic/actor-hop type flow, type erasure, concurrency hazards, swallowed errors, stale callers |
Before lens review, rank changed production files by risk. Prioritize new or heavily changed code that combines concurrency, generic closures, overloaded APIs, type erasure, serialization, persistence, IPC, external protocols, or irreversible side effects.
If the change exceeds roughly 1,000 changed lines or adds more than five production files, assign concentrated correctness review to each high-risk file or subsystem. Do not imply uniform deep coverage of a large diff.
Dispatch one subagent per review lens in parallel. Each subagent:
Sub-agent prompt template (adapt the lens name and skill name per row):
You are reviewing Swift code changes from this session through the {lens} lens.
First, load the
{skill}skill using the Skill tool — read it fully before reviewing.Review exactly this frozen target: {target}. Findings and proposed edits must anchor to changed lines or newly added files within: {files}. You may read callers, callees, and tests outside that list as context. Do not infer a different diff.
For each finding, return: file path + line range, proposed change (before/after), the principle motivating it, and any trade-off. If nothing needs changing for your lens, say so plainly.
Do not apply changes. Propose only.
The correctness reviewer must preserve adversarial-review's output contract. For each high-risk changed function:
Any, serialization, IPC, persistence, and plugin boundaries.Correctness findings use this schema: changed location; violated contract; concrete trigger and observed behavior; severity and confidence; suggested fix and trade-off. Preserve every field during aggregation.
At every consumed result from a multi-statement closure passed to a generic wrapper, determine whether a concrete non-Void context constrains the result. If not, verify value-producing paths use explicit returns. When the result crosses a type-erased or external boundary, prefer a concrete expected type that turns accidental Void inference into a compile error. Do not apply ordinary closure rules to result builders.
The behavioral-testing reviewer should read changed external entry points and their corresponding tests, then answer:
"Add more tests" is not a finding without a concrete missing behavior.
Present the aggregated review as a single batch:
completed, failed, unavailable)Wait for the user to approve before applying any edits.