All skills
openai avatar

/chatgpt-apps

@cb9153a official
by openaiopenai/skills28k stars
1,891

Build, scaffold, refactor, and troubleshoot ChatGPT Apps SDK applications that combine an MCP server and widget UI. Use when Codex needs to design tools, register UI resources, wire the MCP Apps bridge or ChatGPT compatibility APIs, apply Apps SDK metadata or CSP or domain settings, or produce a docs-aligned project scaffold. Prefer a docs-first workflow by invoking the openai-docs skill or OpenAI developer docs MCP tools before generating code.

Use this Skill: https://skilld.dev/gh/openai/skills/chatgpt-apps

This session only. Nothing lands on disk.

referencesinteractive-state-sync-patterns.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Interactive State Sync Patterns

Use this reference when building ChatGPT apps with long-lived widget state, repeated interactions, or component-initiated tool calls (for example: games, boards, maps, dashboards, editors, or realtime-ish UIs).

Do not load this file for simple read-only render apps unless state sync behavior is part of the task.

When This Reference Helps

Read this file when the app needs one or more of these patterns:

  • Repeated actions that may return similar data (retry, refresh, reset, reroll)
  • UI controls that trigger tool calls after the initial render
  • Local widget behavior that should also work outside ChatGPT during development
  • Multiple tool calls updating one mounted widget over time
  • Clear separation between model-visible state and widget-only state

Reusable Patterns

1. Snapshot + Event Token

Return a stable state snapshot in structuredContent and add a monotonic event token for repeated actions that may not change other fields.

Examples:

  • stateVersion
  • refreshCount
  • resetCount
  • lastMutationId

Use this when the widget must detect "same shape, new event" updates reliably.

2. Intent-Focused Tool Surface

Prefer small, explicit tools that map to user-visible actions or data operations.

  • Keep names action-oriented
  • Use enums and bounded schemas where possible
  • Avoid kitchen-sink tools that mix unrelated reads and writes

This improves model tool selection and reduces malformed calls.

3. Idempotent Handlers (or Explicitly Non-Idempotent)

Design handlers to tolerate retries. If a tool is not idempotent, make the side effect explicit and confirm intent in the flow.

  • Reads and pure transforms should usually be idempotent
  • Writes should include clear impact hints and current-turn confirmation where needed
  • Repeated calls with the same input should not corrupt widget state

4. structuredContent / _meta Partitioning

Partition payloads intentionally:

  • structuredContent: concise model-visible state the widget also uses
  • content: short narration/status text
  • _meta: large maps, caches, or sensitive widget-only hydration data

Keep structuredContent small enough for follow-up reasoning and chaining.

5. MCP Apps Bridge First, window.openai Second

For new scaffolds:

  • Prefer MCP Apps bridge notifications and tools/call (portable across hosts)
  • Use window.openai as a compatibility layer plus optional ChatGPT extensions

This keeps the app portable while still enabling ChatGPT-specific capabilities when helpful.

6. Component-Initiated Tool Calls Without Remounting

For interactive widgets, allow the UI to call data/action tools directly and update the existing widget state instead of forcing a full re-render/remount every time.

This is especially useful for:

  • Refresh
  • Retry
  • Rerun
  • Toggle/filter actions
  • Incremental interactions inside one widget session

7. Standalone / No-Host Fallback Mode

When feasible, make the widget usable without ChatGPT during development:

  • If host APIs are unavailable, apply local state directly
  • Preserve basic interactions in a normal browser

This speeds up front-end iteration and reduces dependence on connector setup for every UI tweak.

8. Decouple Data Tools from Render Tools (When Complexity Grows)

Use separate data and render tools when the app has multi-step reasoning or frequent updates.

  • Data tools fetch/compute/mutate and return reusable structuredContent
  • Render tools attach the widget template and focus on presentation

This reduces unnecessary remounts and gives the model a chance to refine data before rendering.

Common Anti-Patterns

  • Putting large widget-only blobs into structuredContent
  • Attaching a widget template to every tool when only one render tool needs it
  • Using hidden client-side state as the source of truth for critical actions
  • Depending only on window.openai APIs for baseline app behavior
  • Using ambiguous tool names that do not match user intent

Example App Types That Benefit From These Patterns

  • Multiplayer or turn-based games
  • Collaborative boards / task views
  • Maps with filters and repeated searches
  • Dashboards with refresh and drill-down actions
  • Editors or builders with iterative tool calls

Source: SKILL.md on GitHub

1 alert16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a robust framework for scaffolding ChatGPT Apps SDK applications, including MCP servers and widget UIs. It includes a built-in scaffolding script and detailed guidance on security best practices like Content Security Policy (CSP) and domain validation.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    4/11 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at cb9153a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Activeupdated 7 months ago

README badge

README badge for openai/skills/chatgpt-apps

Scaffolds ChatGPT Apps SDK implementations with MCP server and widget UI, using a docs-first workflow that references current Apps SDK guidance before generating code. Targets tool planning, MCP server registration, widget scaffolding with the MCP Apps bridge, and validation against the Apps SDK contract. Integrates with the openai-docs skill to keep generated code aligned with official examples and patterns.

Generated from the current SKILL.md.

Does this skill work with Python MCP servers or only Node.js?
The skill supports both. It defaults to Node.js examples and includes a Node fallback scaffold, but explicitly asks about backend language during planning and can scaffold Python MCP servers when requested.
What's the relationship between this skill and the openai-docs skill?
This skill requires a docs-first workflow and must be paired with openai-docs (or the OpenAI docs MCP server directly) before generating code. Always fetch current Apps SDK docs before writing scaffolds.
Does this help with apps already built, or only greenfield projects?
It handles both. The skill can scaffold new apps, refactor existing ones against current docs, validate repos against the minimum working contract, and plan tool surfaces or architecture changes.
What happens if I want to use React for the widget?
The skill can scaffold React widgets. It prefers official OpenAI examples first when they match your stack, or adapts ext-apps React examples, and falls back to vanilla HTML only when no closer match exists.
Can this skill help with submission to the ChatGPT directory?
Yes. The skill includes an `submission-ready` archetype and can generate production-ready scaffolds with tool annotations, CSP, URI versioning, and guides for deployment and submission workflows.

Generated from the current SKILL.md. These answers refresh after source changes.