mit einem Klick
upsert-case
// Add a new API example or modify an existing one. Covers both creation and modification scenarios, including file structure, per-example storyboard creation, registration, and ARCHITECTURE.md updates.
// Add a new API example or modify an existing one. Covers both creation and modification scenarios, including file structure, per-example storyboard creation, registration, and ARCHITECTURE.md updates.
| name | upsert-case |
| description | Add a new API example or modify an existing one. Covers both creation and modification scenarios, including file structure, per-example storyboard creation, registration, and ARCHITECTURE.md updates. |
| compatibility | ["Cursor","Kiro","Windsurf","Claude","Copilot"] |
| license | MIT |
| metadata | {"author":"APIExample Team","version":"1.0.0","platform":"macOS"} |
Use this skill when you need to:
Trigger: User requests a new API demo (e.g., "Add a screen sharing example")
Steps:
Basic/ or Advanced/ViewController.swiftARCHITECTURE.md Case IndexTrigger: User requests changes to an existing example (e.g., "Update JoinChannelVideo to support token")
Steps:
APIExample/Examples/[Basic|Advanced]/<ExampleName>/ARCHITECTURE.md Case Index if APIs changed| File | Action | Notes |
|---|---|---|
APIExample/Examples/[Basic|Advanced]/<ExampleName>/<ExampleName>.swift | Create | Main implementation file |
APIExample/Examples/[Basic|Advanced]/<ExampleName>/Base.lproj/<ExampleName>.storyboard | Create | Example UI and controller identifier |
APIExample/ViewController.swift | Modify | Register example in menu/list |
ARCHITECTURE.md | Modify | Add entry to Case Index |
| File | Action | Notes |
|---|---|---|
APIExample/Examples/[Basic|Advanced]/<ExampleName>/<ExampleName>.swift | Modify | Update implementation |
APIExample/Examples/[Basic|Advanced]/<ExampleName>/Base.lproj/<ExampleName>.storyboard | Modify if needed | Keep outlets and controller identifiers aligned |
ARCHITECTURE.md | Modify | Update Case Index if APIs changed |
mkdir -p APIExample/Examples/[Basic|Advanced]/<ExampleName>
Example folder name must be PascalCase and match the class name.
Create APIExample/Examples/[Basic|Advanced]/<ExampleName>/<ExampleName>.swift
Use the template from references/example-template.swift as a starting point. Replace <ExampleName> with your example name.
Create APIExample/Examples/[Basic|Advanced]/<ExampleName>/Base.lproj/<ExampleName>.storyboard.
The storyboard name must match the value passed to NSStoryboard(name:bundle:) from ViewController.swift, and the main controller identifier in the storyboard must match the controller field in MenuItem.
Edit APIExample/ViewController.swift and add the example to the menu/list:
MenuItem(name: "Example Name".localized,
identifier: "menuCell",
controller: "<ExampleName>",
storyboard: "<ExampleName>")
Place it in the correct section (Basic / Advanced).
Add a new row to the Case Index table in ARCHITECTURE.md:
| ExampleName | `Examples/[Basic|Advanced]/ExampleName/` | `api1()`, `api2()`, `api3()` | Brief description of what this example demonstrates |
Key APIs column: List 2-5 core SDK methods used in this example.
leaveChannel() and destroy() are called on closeSee references/ directory for code patterns:
lifecycle-pattern.swift — Proper engine lifecyclethread-safety-pattern.swift — Thread-safe UI updatesDo NOT:
destroy() — this causes engine leaksDispatchQueue.main.asyncKeyCenterAgoraRtcEngineDelegate for event handlingleaveChannel() firstAPIExample/Examples/[Basic|Advanced]/ structureARCHITECTURE.md Case Index after adding/modifying an exampleAfter completing the upsert, verify:
APIExample/Examples/[Basic|Advanced]/<ExampleName>/)<ExampleName>.swift (PascalCase)<ExampleName>Main and extends BaseViewControllerAPIExample/Examples/[Basic|Advanced]/<ExampleName>/Base.lproj/<ExampleName>.storyboardcontroller value registered in ViewController.swiftViewController.swiftinitializeAgoraEngine() creates engine with correct configjoinChannel() uses token from KeyCenterleaveChannel() and destroy() are called in viewWillClose()ARCHITECTURE.md Case Index includes new/updated examplereferences/ directory for Swift code templatesAPIExample/Examples/Basic/JoinChannelVideo/ for reference implementationCode review for API examples. Ensures examples follow project conventions, handle lifecycle correctly, manage threads safely, and use APIs properly.
Code review for API examples. Ensures examples follow project conventions, handle lifecycle correctly, manage threads safely, and use APIs properly.
Add a new API example or modify an existing one. Covers both creation and modification scenarios, including dialog class structure, registration in APIExampleDlg, localization wiring, and ARCHITECTURE.md updates.
Add a new API example case or modify an existing one in the APIExample Android demo — creates or updates Fragment class, XML layout, string resources, and nav_graph registration. Use when: adding a new Agora RTC API demo screen, modifying an existing case's implementation or registration, implementing a new feature example in Java + XML layouts, registering a new case via @Example annotation, subclassing BaseFragment for a new demo screen, or updating an existing case's strings, layout, or nav entry. Keywords: add case, modify case, update case, new fragment, nav_graph, @Example, BaseFragment, APIExample, new screen, demo case, RTC API example.
Add a new audio API example case or modify an existing one in the APIExample-Audio Android demo — creates or updates Fragment class, XML layout, string resources, and nav_graph registration. Use when: adding a new Agora audio API demo screen, modifying an existing case's implementation or registration, implementing a new audio feature example in Java + XML layouts, registering a new case via @Example annotation, subclassing BaseFragment for a new audio demo screen, or updating an existing case's strings, layout, or nav entry. This project uses voice-sdk — no video APIs available. Keywords: add case, modify case, update case, new fragment, nav_graph, @Example, BaseFragment, APIExample-Audio, audio case, voice-sdk, new screen, audio demo, upsert case.
Add a new API example case or modify an existing one in the APIExample-Compose Android demo — creates or updates a Kotlin Composable file, registers or updates it in Examples.kt, and manages string resources. Use when: adding a new Agora RTC API demo screen in Jetpack Compose, modifying an existing case's implementation or registration, porting an existing APIExample case to Compose, implementing a new feature example in Kotlin + Compose UI, registering a new entry in BasicExampleList or AdvanceExampleList, or updating an existing case's strings or Examples.kt entry. Kotlin only — no XML layouts, no Fragments. Keywords: add case, modify case, update case, new composable, Examples.kt, BasicExampleList, AdvanceExampleList, APIExample-Compose, Compose case, new screen, Jetpack Compose, RTC API example, upsert case.