Architectural Invariant Design: Compose Multiplatform Skiko VSync Pipeline Synchronization Standard
Compose Multiplatform Skiko VSync Pipeline Synchronization Standard defines an industrial-grade behavioral standard for mobile engineering. Enforces strict alignment between Skiko's Skia rendering loop and native platform refresh hardware via iOS CADisplayLink and Android Choreographer. Prevents unsynchronized frame pumping, thread contention, and display pipeline desynchronization that causes frame hitching and jank on heterogeneous refresh displays (e.g., Apple ProMotion 120Hz and Android variable refresh rate). Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Decoupled Render-Loop Free-Running and Unbound Frame Dispatching | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS hook the Skiko render dispatcher directly to the platform VSync driver
Engineers MUST ALWAYS hook the Skiko render dispatcher directly to the platform VSync driver: CADisplayLink on iOS and Choreographer.postFrameCallback on Android.
Engineers MUST NOT use unconstrained coroutine loops (e.g., `while(isActive) { delay(16)
Engineers MUST NOT use unconstrained coroutine loops (e.g., `while(isActive) { delay(16); render(); }`) to drive Skiko canvas repaints.
Engineers MUST configure target CADisplayLink `preferredFrameRateRange` explicitly to support dynamic ProMotion refresh rates (e.g., min
Engineers MUST configure target CADisplayLink `preferredFrameRateRange` explicitly to support dynamic ProMotion refresh rates (e.g., min: 10, preferred: 120, max: 120) instead of hardcoding 60 FPS intervals.
Code SHOULD ensure frame invalidation requests (`needRedraw()`) coalesce within the current VSync cycle and avoid multiple rasterization passes per platform hardware tick.
Code SHOULD ensure frame invalidation requests (`needRedraw()`) coalesce within the current VSync cycle and avoid multiple rasterization passes per platform hardware tick.
Services MUST route all Skia canvas surface flush calls on the dedicated rendering thread synchronized to the frame boundary to prevent back-pressure stalls on the main dispatch queue.
Services MUST route all Skia canvas surface flush calls on the dedicated rendering thread synchronized to the frame boundary to prevent back-pressure stalls on the main dispatch queue.
Components NEVER execute long-running CPU blocking or heavy I/O operations inside the Skiko redraw lifecycle callback.
Components NEVER execute long-running CPU blocking or heavy I/O operations inside the Skiko redraw lifecycle callback.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is Compose Multiplatform Skiko VSync Pipeline Synchronization Standard critical for AI coding assistants?
Enforces strict alignment between Skiko's Skia rendering loop and native platform refresh hardware via iOS CADisplayLink and Android Choreographer. Prevents unsynchronized frame pumping, thread contention, and display pipeline desynchronization that causes frame hitching and jank on heterogeneous refresh displays (e.g., Apple ProMotion 120Hz and Android variable refresh rate). Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Decoupled Render-Loop Free-Running and Unbound Frame Dispatching) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.