Agent SkillsDimillian/PokeSwift › pokeswift-tuist-refactor-guard

pokeswift-tuist-refactor-guard

GitHub

指导在 PokeSwift Tuist 工作区中进行安全的代码重构,包括文件移动、拆分及模块边界维护。确保不破坏目标图结构,并在操作后重新生成项目配置以验证完整性。

.agents/skills/pokeswift-tuist-refactor-guard/SKILL.md Dimillian/PokeSwift

触发场景

移动或重命名 Swift 源文件 拆分大型运行时或 UI 文件 重新组织 Sources/ 或 App/ 目录结构 清理功能切片 检查重构对 Tuist 工作区的安全性

安装

npx skills add Dimillian/PokeSwift --skill pokeswift-tuist-refactor-guard -g -y
更多选项

非标准路径

npx skills add https://github.com/Dimillian/PokeSwift/tree/main/.agents/skills/pokeswift-tuist-refactor-guard -g -y

不安装直接使用

npx skills use Dimillian/PokeSwift@pokeswift-tuist-refactor-guard

指定 Agent (Claude Code)

npx skills add Dimillian/PokeSwift --skill pokeswift-tuist-refactor-guard -a claude-code -g -y

安装 repo 全部 skill

npx skills add Dimillian/PokeSwift --all -g -y

预览 repo 内 skill

npx skills add Dimillian/PokeSwift --list

SKILL.md

Frontmatter
{
    "name": "pokeswift-tuist-refactor-guard",
    "description": "Plan, review, and execute PokeSwift refactors without breaking the Tuist workspace, target graph, or module ownership boundaries. Use when moving or splitting Swift files, reorganizing `Sources\/` or `App\/`, decomposing large runtime or UI files, cleaning up feature slices, or checking whether a proposed refactor is safe for PokeSwift's Tuist-based workspace."
}

PokeSwift Tuist Refactor Guard

Read AGENTS.md and SWIFT_PORT.md before changing milestone-sensitive code.

Optimize for safe structure changes, not broad churn. Keep public behavior stable unless the user explicitly asked for behavior changes.

Workflow

  1. Map the refactor boundary first. Start with git status --short. Identify which layer owns the change: PokeExtractCLI, PokeContent, PokeDataModel, PokeCore, PokeUI, PokeTelemetry, or App/PokeMac. Prefer one ownership slice at a time.

  2. Preserve the target graph. Do not invent new targets unless the user explicitly needs an architectural change. Prefer moving logic inside existing targets and files that already compile under the current Project.swift. Keep façade APIs stable when splitting oversized files so downstream call sites do not drift unnecessarily.

  3. Refactor by feature slice. Split large files along existing seams: app shell into coordinator, router, path, scene, or input bridge pieces; runtime into state, title, field, dialogue, scripts, battle, telemetry, or save extensions; UI into scene, shared view, render, and props-builder files. Keep extracted helpers close to the current target-owned boundary.

  4. Regenerate Tuist immediately after moves or deletions. After renames, deletions, or new source files, run tuist generate --no-open before deeper validation. In this repo, stale generated project references are a common failure mode after file moves.

  5. Validate in layers. Run the smallest relevant focused tests first. Then run the broader workspace or app build that matches the refactor surface. If scripts mutate generated metadata, restore or regenerate it before final staging.

Refactor Patterns

  • GameRuntime-scale changes Keep the façade stable. Extract extensions by domain such as +State, +Title, +Field, +Dialogue, +Scripts, +Battle, +Telemetry, or +Save.

  • PokeUI scene cleanup Separate scene props, stage views, overlays, and shared primitives. Do not move gameplay logic from PokeCore into SwiftUI views.

  • PokeMac shell changes Split host concerns such as lifecycle, commands, launch orchestration, and activation behavior without changing gameplay ownership.

  • PokeExtractCLI and content-loading changes Keep extraction deterministic and runtime consumption explicit. Do not let a refactor hide a schema change.

File Checklist

Validation Matrix

  • After file moves, deletes, or additions: Run tuist generate --no-open.

  • For runtime or shared logic refactors: Prefer xcodebuild -workspace PokeSwift.xcworkspace -scheme PokeSwift-Workspace -derivedDataPath .build/DerivedData test.

  • For UI-only refactors: Run the smallest relevant PokeUITests or PokeRenderTests, then build PokeMac.

  • For app-shell changes: Build with ./scripts/build_app.sh. Use ./scripts/launch_app.sh only when native run behavior is part of the refactor risk.

  • For extractor-adjacent refactors: Run ./scripts/extract_red.sh and focused extractor/content tests if the change could affect generated artifacts or content loading.

Failure Shields

  • Do not hand-edit generated Content/Red/** files to compensate for refactor fallout.
  • Do not trust swift test; this repo validates through the workspace.
  • Do not leave file moves unverified; regenerate Tuist immediately.
  • Do not widen a refactor into behavior changes unless the user asked for both.
  • Do not move code across target boundaries casually; check dependencies in Project.swift first.
  • Do not edit generated Xcode artifacts as a source of truth.

Review Mode

When reviewing a proposed refactor:

  • Check whether the write set crosses too many targets at once.
  • Look for hidden contract changes in schemas, save models, telemetry, or generated content.
  • Confirm the public API remains stable where the refactor claims behavior preservation.
  • Ask whether tuist generate --no-open was run after moves.
  • Treat stale project references, missing target membership, and broken workspace builds as first-class findings.

Output Expectations

Report these points clearly:

  • refactor boundary
  • target ownership
  • whether the Tuist graph stayed stable
  • validation run
  • residual risks, especially around moved files, generated content, and unverified runtime paths

版本历史

  • 8fc87c2 当前 2026-07-25 10:53

同 Skill 集合

.agents/skills/pokeswift-extractor-contract-change/SKILL.md
.agents/skills/pokeswift-parity-fix/SKILL.md

元信息

文件数
0
版本
8fc87c2
Hash
9e0ad841
收录时间
2026-07-25 10:53

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 19:01
浙ICP备14020137号-1 $访客地图$