implement-asset-loader
Use when generating a type-safe asset loading/streaming system with reference counting, platform-aware load strategies, and ECS asset component integration.
SKILL.mdskills/game_dev/builder/implement-asset-loader/SKILL.md
GitHub1. Core Pattern
- Platform & Language Detection: Scan project config for target platform/language; resolve hardware constraints.
- Type & Strategy Generation: Generate
AssetTypeenums,LoadStrategyenums (AOT/On-Demand/DLC),AssetBundle,AssetRef. - Reference Counting: Implement
Acquire/Releasemechanics, main loading function (all strategies), error handling for missing/invalid assets. - Asset Pool: Generate
AssetPoolfor high-frequency assets to reduce GC pressure; implement progress callback interfaces. - ECS Asset Components (MANDATORY): Generate components referencing loaded assets by string ID (not direct object refs):
SpriteComponent— sprite/texture by ID, UV coords, scale, flip flagsAnimationComponent— animation asset (sprite sequence), current frame, speed, loop flagAudioComponent— audio asset by ID, volume, play state, loop flag- Place in same location as other ECS components (e.g.,
src/core/ecs/components.ts)
- Renderer Integration (MANDATORY): Replace color-based rendering with sprite/texture drawing from
SpriteComponentdata; fallback to colored rectangle when asset unavailable; TODO comments if no asset system exists. - Export: Write implementation to language-appropriate files (
.ts/.rs/.cs).
2. Interaction Protocol
- Platform unclear → ask, default to most constrained target.
- Strategy contradicts platform (e.g., massive AOT on mobile) → warn, suggest On-Demand/DLC.
3. Red Flags
Monolithic loader causing frame drops · Missing Acquire/Release cleanup · Desktop-centric AOT bundles on mobile
4. Integrity Audit
-
Acquire/Releasefor all asset types - Error handling for missing/invalid assets (no crash)
- Platform-specific strategies applied
- ECS components generated (
SpriteComponent/AnimationComponent/AudioComponent) - Renderer uses loaded assets (not just placeholder colors)
- Components store string IDs, not object references
-
AssetPoolimplemented for high-frequency assets to reduce GC pressure - Progress callback interfaces available for async load operations
5. Execution Command
Command: /implement-asset-loader