.claude/skills/pool-module/SKILL.md
PoolModule reference — object pooling with DI, MessagePipe events, O(1) return, diagnostics, async preloading, and IPoolable callbacks. Use when working with object pooling, spawn/despawn, or performance optimization.
npx skillsauth add punkfuncgames/tetris-clone pool-moduleInstall 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.
Package: com.punkfuncgames.pool | Define: PUNKFUNC_POOL
Location: Packages/com.punkfuncgames.pool/Runtime/PunkFuncGames.Pool/
Namespace: PunkFuncGames.Pool
Get:
T Get<T>(string poolId) — get typed component from pool (null if at max)GameObject Get(string poolId) — get GameObject from poolReturn:
Return<T>(T obj) / Return(GameObject obj) — return to pool (O(1) via instance map, O(n) fallback, destroys foreign objects)Return(string poolId, GameObject obj) / Return<T>(string poolId, T obj) — O(1) return with known poolIdUniTask ReturnAfterDelayAsync(string poolId, GameObject obj, float delay, ct) — delayed return (VFX/particles)ReturnAll(string poolId) — return all active objects in a poolPool Management:
CreatePool(string poolId, GameObject prefab, int initialSize = 10, int maxSize = 100) — throws on null/empty argsClearPool(string poolId), ClearAll()UniTask PreloadAsync(string poolId, int count, ct) — async preload, yields every 10 instancesDiagnostics:
PoolInfo GetPoolInfo(string poolId) — pool stats (counts, utilization)bool HasPool(string poolId) — existence checkImplement on any component attached to pooled prefabs:
OnGetFromPool() — called when object is retrievedOnReturnToPool() — called when object is returnedPoolId, PrefabName, TotalCount, ActiveCount, AvailableCount, MaxSizefloat Utilization (computed), bool IsExhausted (computed), bool IsValid (computed)| Event | Key Fields |
|-------|------------|
| PoolCreatedEvent | PoolId, PrefabName, InitialSize, MaxSize |
| PoolClearedEvent | PoolId, DestroyedCount |
| PoolExhaustedEvent | PoolId |
| PoolWarningEvent | PoolId, Message (fires at 80% utilization) |
Dependencies: 4 MessagePipe publishers (constructor DI), optional PoolConfig
IPoolService, IAsyncStartable, IDisposable[PoolService] root (DontDestroyOnLoad) with Pool_{prefabName} childrenPool class: Queue<GameObject> (available) + HashSet<GameObject> (in-use)Dictionary<GameObject, string> for O(1) instance-to-pool mappingStartAsync processes PoolConfig entries, optionally preloadingPoolExhaustedEventPoolWarningEventArgumentException/ArgumentNullException on null prefab/empty poolIdPoolConfig (ScriptableObject): Thin wrapper with public PoolConfigData data;
Access fields via _config.data.pools.
PoolConfigData ([Serializable] public struct):
List<PoolEntryData> poolsPoolEntryData ([Serializable] public struct, camelCase fields): poolId, prefab, initialSize (10), maxSize (50), preloadOnStart
Extension method: IsValid() on PoolEntryData — validates non-empty poolId, non-null prefab, valid sizes
PoolInstaller.Install(builder, options, config);
// Registers: PoolService as EntryPoint with .As<IPoolService>()
// Registers: 4 event brokers (Created, Cleared, Exhausted, Warning)
Note: Installed in ProjectLifetimeScope.RegisterModules() with optional _poolConfig serialized field.
// Create pool at startup (or via PoolConfig ScriptableObject)
_poolService.CreatePool("Bullet", bulletPrefab, initialSize: 20, maxSize: 100);
// Async preload
await _poolService.PreloadAsync("Bullet", 50, ct);
// Spawn
GameObject bullet = _poolService.Get("Bullet");
bullet.transform.position = spawnPoint;
// Or get typed component
BulletComponent bulletComp = _poolService.Get<BulletComponent>("Bullet");
// Return to pool (O(1) auto-tracked)
_poolService.Return(bullet);
// Return with known poolId (fastest)
_poolService.Return("Bullet", bullet);
// Delayed return for VFX
await _poolService.ReturnAfterDelayAsync("Bullet", bullet, 2f, ct);
// Return all active bullets
_poolService.ReturnAll("Bullet");
// Query diagnostics
PoolInfo info = _poolService.GetPoolInfo("Bullet");
Debug.Log($"Utilization: {info.Utilization:P0}");
// Implement IPoolable for lifecycle hooks
public sealed class BulletComponent : MonoBehaviour, IPoolable
{
public void OnGetFromPool() => _trail.Clear();
public void OnReturnToPool() => _rigidbody.velocity = Vector3.zero;
}
// Subscribe to pool events
_poolExhaustedSubscriber.Subscribe(e =>
Debug.LogWarning($"Pool {e.PoolId} exhausted!")).AddTo(_disposables);
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.