Standardize async asset generation workflow for game development. Use when generating game assets (PixelLab), waiting for async jobs, retrieving URLs, and updating game code. Trigger: "generate asset", "pixel lab", "asset pipeline", "async asset", "wait for job".
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Standardize async asset generation workflow for game development. Use when generating game assets (PixelLab), waiting for async jobs, retrieving URLs, and updating game code. Trigger: "generate asset", "pixel lab", "asset pipeline", "async asset", "wait for job".
Game Asset Pipeline
Standardize async asset generation workflow for game development. Pattern: Generate asset → Wait for Job → Retrieve URL → Update preload() → Verify.
Workflow Pattern
1. Generate asset (PixelLab MCP) → Get job_id
2. Poll job status → Wait for completion
3. Retrieve asset URL → Get download link
4. Update game code → Add to preload()
5. Verify asset loads → Test in game
PixelLab Integration
Character Generation
// 1. Create characterconst result = awaitmcp_pixellab_create_character({
description: "cute wizard with blue robes",
n_directions: 8,
size: 48
});
const { character_id, job_id } = result;
// 2. Wait for job completionlet character = null;
while (!character || character.status !== 'completed') {
awaitsleep(5000); // Wait 5 seconds
character = ({
: character_id
});
(character. === ) {
();
}
}
downloadUrl = character.;
rotations = character.;
await
mcp_pixellab_get_character
character_id
if
status
'failed'
throw
new
Error
`Character generation failed: ${character.error}`
// 3. Retrieve download URL
const
download_url
const
rotations
// { south: url, north: url, ... }
Tile Generation
// 1. Create isometric tileconst result = awaitmcp_pixellab_create_isometric_tile({
description: "grass on top of dirt",
size: 32,
tile_shape: "block"
});
const { tile_id } = result;
// 2. Wait for completionlet tile = null;
while (!tile || tile.status !== 'completed') {
awaitsleep(2000);
tile = awaitmcp_pixellab_get_isometric_tile({
tile_id: tile_id
});
}
// 3. Get tile URLconst tileUrl = tile.image_url || tile.download_url;
// If character has multiple rotations, create spritesheet referencepreload() {
// Store rotation URLs for later usethis.registry.set('wizard-rotations', {
south: 'https://pixellab.ai/characters/abc123/south.png',
north: 'https://pixellab.ai/characters/abc123/north.png',
east: 'https://pixellab.ai/characters/abc123/east.png',
west: 'https://pixellab.ai/characters/abc123/west.png',
// ... other directions
});
}
Verification Checklist
After adding assets to game:
Asset URLs are accessible (not 404)
Assets load in preload() without errors
Assets display correctly in game
Asset dimensions match expected
Spritesheet frames are correct (if applicable)
Asset paths are relative or use CDN (not localhost-only)
Common Pitfalls
❌ Don't: Use Job ID Instead of Asset ID
// Wrongconst character = awaitget_character({ character_id: job_id });
// Correctconst character = awaitget_character({ character_id: character_id });
❌ Don't: Forget to Wait for Completion
// Wrong - asset may not be readyconst character = awaitcreate_character({ description: "wizard" });
const url = character.download_url; // May be null
// Correct - poll until readylet character = awaitcreate_character({ description: "wizard" });
while (character.status !== 'completed') {
awaitsleep(5000);
character = awaitget_character({ character_id: character.character_id });
}
❌ Don't: Hardcode Localhost URLs
// Wrong - won't work in productionthis.load.image('wizard', 'http://localhost:3000/assets/wizard.png');
// Correct - use CDN or relative pathsthis.load.image('wizard', 'https://cdn.example.com/assets/wizard.png');
// Or download and commit to repothis.load.image('wizard', 'assets/characters/wizard.png');
Helper Functions
Poll Until Complete
asyncfunctionwaitForJob(getJob, jobId, maxWait = 60000) {
const startTime = Date.now();
while (Date.now() - startTime < maxWait) {
const job = awaitgetJob({ [jobId.key]: jobId.value });
if (job.status === 'completed') {
return job;
}
if (job.status === 'failed') {
thrownewError(`Job failed: ${job.error || 'Unknown error'}`);
}
// Wait before next pollawaitsleep(job.eta_seconds ? job.eta_seconds * 1000 : 5000);
}
thrownewError(`Job timed out after ${maxWait}ms`);
}
// Usageconst character = awaitwaitForJob(
mcp_pixellab_get_character,
{ key: 'character_id', value: character_id }
);