# Messaging Game Over

> Ensures games created have a lose condition and send a message to the parent iframe in a standardized manner. Use when creating or modifying a game.

- Skill: `googlecloudplatform/messaging-game-over` (Agent Skill)
- Install (CLI): `npx skillmds@latest add googlecloudplatform/messaging-game-over`
- Raw SKILL.md: https://api.skillmd.com/api/skills/googlecloudplatform/messaging-game-over/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: GoogleCloudPlatform (https://skillmd.com/u/googlecloudplatform)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/googlecloudplatform/messaging-game-over

---


# Game Structure and iframe messaging

Follow these steps when creating a new game:

1. **Lose condition**
   Ensure the game loop always has a "lose condition" that can be reached in which the player has failed.

2. **Iframe message**
   When the failure state is reached, use the iframe post message feature to send a message from the current page up to the parent page of the site in the following format:

   window.parent.postMessage({
    type: 'game-over',
    score: this.score,
   }, '*');


