implement-input-handler
Use when you have an input mapping spec (input_mapping.md) and need to generate the ActionID enum, platform binding tables, and InputHandler abstraction.
SKILL.mdskills/game_dev/builder/implement-input-handler/SKILL.md
GitHub1. Overview
Generates cross-platform input abstraction layer: translates raw hardware (KBM, Gamepad, Touch) to semantic ActionIDs from input_mapping.md. Gameplay queries independent of device handling; analog signals pass through standardized filtering.
2. When to Use
Use when:
- You have an
input_mapping.mdand need the ActionID enum, platform binding tables, and InputHandler abstraction generated. - Your game supports multiple input devices (keyboard/mouse, gamepad, touch) and you want a single abstraction.
- Gameplay code is checking raw keys/buttons instead of semantic actions.
Do not use when:
- The input mapping spec doesn't exist yet — define player controls first with
define-player-controls. - You're building a single-platform prototype with no plan to support other inputs.
3. Core Pattern
- Environment Analysis: Scan config for target platforms/language.
- Semantic Definition: Single
ActionIDenum + typed hardware enums (Key, Button, Stick, DPad, TouchInput). - Binding Synthesis: Platform-specific tables (KBM, Xbox, PS, Touch) mapping
ActionIDs → physical inputs per spec. - Abstraction: Analog signal processing (DeadZone filtering/curve shaping) + core
InputHandlerinterface +MockInputHandlerfor testing.
3. Interaction Protocol
- [Hardware Leakage]: Raw key check in game logic → "Use semantic ActionIDs instead of raw keys. Refactor to InputHandler abstraction?"
- [Platform Ambiguity]: Target unclear → "Need target platform (Mobile vs PC) for binding tables. Default to [Platform X] or specific requirements?"
4. Quality Gates - STOP
- Hardware Abstraction: Use semantic ActionIDs exclusively in gameplay logic
- Platform Alignment: Hardware assumptions translate across touch/controller via abstraction layer
- Filtered Analog: Apply deadzone/filtering for smooth, responsive analog controls
5. Final Integrity Audit
- All semantic actions in unique
ActionIDenum entries - Binding tables for every target platform
- Analog signals include deadzone + response curve
- Gameplay code uses only ActionIDs, not raw hardware constants
-
MockInputHandleravailable for testing