Pokeswift tuist refactor guard

From Dimillian/PokeSwift · View interactive version

Pokeswift tuist refactor guard is an AI agent skill from the GitHub repository Dimillian/PokeSwift. 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 prop

How to use this skill

Skill file

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.

  1. 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.

  1. 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.

  1. 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.

  1. 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

Keep the façade stable.

Extract extensions by domain such as +State, +Title, +Field, +Dialogue, +Scripts, +Battle, +Telemetry, or +Save.

Separate scene props, stage views, overlays, and shared primitives.

Do not move gameplay logic from PokeCore into SwiftUI views.

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

Keep extraction deterministic and runtime consumption explicit.

Do not let a refactor hide a schema change.

File Checklist

Validation Matrix

Run tuist generate --no-open.

Prefer xcodebuild -workspace PokeSwift.xcworkspace -scheme PokeSwift-Workspace -derivedDataPath .build/DerivedData test.

Run the smallest relevant PokeUITests or PokeRenderTests, then build PokeMac.

Build with ./scripts/build_app.sh.

Use ./scripts/launch_app.sh only when native run behavior is part of the refactor risk.

Run ./scripts/extract_red.sh and focused extractor/content tests if the change could affect generated artifacts or content loading.

Failure Shields

Review Mode

When reviewing a proposed refactor:

Output Expectations

Report these points clearly:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.