.claude/skills/extract-to-package/SKILL.md
Extracts a generic system from the game into a reusable UPM package with its own GitHub repo. Use when a module is mature enough to be shared across projects.
npx skillsauth add punkfuncgames/tetris-clone extract-to-packageInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
code-style, patterns, testing, project-overviewIdentify all files belonging to the system:
List every file that will move to the package.
Check dependency safety:
using directives to find external dependenciesread_asmdef_graph (if available) or manually inspect asmdef referencesCreate a dependency report:
| Direction | Assembly/Package | Required? | Action | |-----------|-----------------|-----------|--------| | This module depends on | com.punkfuncgames.log | Optional | Add as optional dependency | | This module depends on | VContainer | Required | Add as dependency | | Game code depends on | This module | Yes | Add #if guards |
Review each file for game-specific references:
If game-specific logic is found, refactor it out before proceeding.
Create the UPM package at Packages/com.punkfuncgames.{name}/:
Packages/com.punkfuncgames.{name}/
package.json
LICENSE
README.md
CHANGELOG.md
Runtime/
PunkFuncGames.{Name}/
{all runtime code, preserving subfolder structure}
PunkFuncGames.{Name}.asmdef
Tests/
EditMode/
{all edit mode tests}
PunkFuncGames.{Name}.Tests.EditMode.asmdef
PlayMode/
{all play mode tests}
PunkFuncGames.{Name}.Tests.PlayMode.asmdef
{
"name": "com.punkfuncgames.{name}",
"version": "0.1.0",
"displayName": "{Display Name}",
"description": "{One-line description}",
"unity": "6000.0",
"author": {
"name": "PunkFunc Games",
"url": "https://github.com/punkfuncgames"
},
"dependencies": {},
"keywords": [],
"repository": {
"type": "git",
"url": "https://github.com/punkfuncgames/com.punkfuncgames.{name}.git"
}
}
{
"name": "PunkFuncGames.{Name}",
"rootNamespace": "PunkFuncGames.{Name}",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.punkfuncgames.{name}",
"expression": "",
"define": "PUNKFUNC_{NAME}"
}
],
"noEngineReferences": false
}
Runtime/PunkFuncGames.{Name}/Tests/EditMode/ and Tests/PlayMode/PunkFuncGames.GameTemplate.* to PunkFuncGames.{Name}.*using statements in moved filesFor any game code that references the extracted module, add preprocessor guards:
#if PUNKFUNC_{NAME}
using PunkFuncGames.{Name};
#endif
public sealed class SomeGameService
{
#if PUNKFUNC_{NAME}
private readonly I{Name}Service _{name}Service;
#endif
public SomeGameService(
#if PUNKFUNC_{NAME}
I{Name}Service {name}Service,
#endif
IOtherService otherService)
{
#if PUNKFUNC_{NAME}
_{name}Service = {name}Service;
#endif
}
}
Run the full test suite to verify nothing is broken:
# Create the repo
gh repo create punkfuncgames/com.punkfuncgames.{name} \
--public \
--description "{One-line description}" \
--clone
# Copy package contents to the repo
cp -r Packages/com.punkfuncgames.{name}/* /path/to/cloned/repo/
# Initialize, commit, tag
cd /path/to/cloned/repo
git add .
git commit -m "feat: initial package extraction from game template"
git tag v0.1.0
git push origin main --tags
Update Packages/manifest.json to reference the package via git URL:
{
"dependencies": {
"com.punkfuncgames.{name}": "https://github.com/punkfuncgames/com.punkfuncgames.{name}.git#v0.1.0"
}
}
Remove the local package from Packages/ since it is now referenced via git.
git add Packages/manifest.json
git add Assets/ # For any #if guard changes
git rm -r Packages/com.punkfuncgames.{name}/ # Remove local copy
git commit -m "refactor: extract {name} module to UPM package"
The GitHub repo URL, package version (v0.1.0), git URL for manifest.json, and test results confirming all tests pass.
development
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
development
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.