一键导入
upsert-case
// 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 or modify an existing one. Covers both creation and modification scenarios, including dialog class structure, registration in APIExampleDlg, localization wiring, and ARCHITECTURE.md updates.
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 file structure, per-example storyboard creation, registration, and ARCHITECTURE.md updates.
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 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.
| name | upsert-case |
| description | 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. |
| compatibility | ["Cursor","Kiro","Windsurf","Claude","Copilot"] |
| license | MIT |
| metadata | {"author":"APIExample Team","version":"1.0.0","platform":"Windows"} |
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/.h and .cpp files for the dialog classAPIExampleDlg.h and APIExampleDlg.cppLanguage.h, stdafx.cpp, and language .ini filesARCHITECTURE.md Case IndexTrigger: User requests changes to an existing example (e.g., "Update JoinChannelVideo to support token")
Steps:
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/.h and .cpp filesAPIExampleDlg.cpp if routing or lifecycle hooks changedARCHITECTURE.md Case Index if APIs changed| File | Action | Notes |
|---|---|---|
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.h | Create | Dialog class header |
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.cpp | Create | Dialog class implementation |
APIExample/APIExample/APIExampleDlg.h | Modify | Add include and dialog member pointer |
APIExample/APIExample/APIExampleDlg.cpp | Modify | Register, create, show, and release the dialog |
APIExample/APIExample/Language.h | Modify | Declare the localized scene label |
APIExample/APIExample/stdafx.cpp | Modify | Initialize the localized scene label in InitKeyInfomation() |
APIExample/APIExample/en.ini | Modify | Add English display text |
APIExample/APIExample/zh-cn.ini | Modify | Add Chinese display text |
APIExample/APIExample/APIExample.vcxproj | Modify if needed | Add new source/header files when not using the Visual Studio UI |
APIExample/APIExample/APIExample.vcxproj.filters | Modify if needed | Keep Solution Explorer grouping correct |
ARCHITECTURE.md | Modify | Add entry to Case Index |
| File | Action | Notes |
|---|---|---|
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.h | Modify | Update dialog class |
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.cpp | Modify | Update implementation |
APIExample/APIExample/APIExampleDlg.cpp | Modify if routing changes | Update show/hide or scene selection behavior if needed |
ARCHITECTURE.md | Modify | Update Case Index if APIs changed |
mkdir APIExample\APIExample\[Basic|Advanced]\<ExampleName>
Example folder name must be PascalCase.
Create APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.h
Use the template from references/example-template.h as a starting point. Replace <ExampleName> with your example name.
Create APIExample/APIExample/[Basic|Advanced]/<ExampleName>/C<ExampleName>Dlg.cpp
Use the template from references/example-template.cpp as a starting point. Replace <ExampleName> with your example name.
Do not edit CSceneDialog.cpp for case registration. In this project, scene ownership lives in the main dialog:
APIExample/APIExample/APIExampleDlg.h
Add the example header include and a member pointer such as C<ExampleName>Dlg* m_p<ExampleName>Dlg = nullptr;APIExample/APIExample/APIExampleDlg.cpp
Mirror an existing example across:
InitSceneDialog() to push the localized label into m_vecBasic or m_vecAdvanced, create the dialog, and position itCreateScene() to call the dialog's init/show path when the tree item is selectedReleaseScene() to call the dialog's cleanup/hide path when the tree item is leftInitSceneList() reads from m_vecBasic and m_vecAdvanced, so the tree updates automatically once the vectors are populated in InitSceneDialog().
Register the example name used by the tree view:
extern wchar_t ...[INFO_LEN]; declaration to APIExample/APIExample/Language.hAPIExample/APIExample/stdafx.cpp inside InitKeyInfomation()APIExample/APIExample/en.ini and APIExample/APIExample/zh-cn.iniFollow the existing naming pattern such as Basic.JoinChannelVideoByToken or Advanced.ScreenCap.
Add a new row to the Case Index table in ARCHITECTURE.md:
| ExampleName | `[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 release() are called on closeen.ini and zh-cn.iniSee references/ directory for code patterns:
lifecycle-pattern.cpp — Proper engine lifecyclemessage-map-pattern.cpp — Message map pattern for thread-safe UI updatesevent-handler-pattern.cpp — Event handler patternDo NOT:
release() — this causes engine leaksC prefix, m_ prefix)CConfigIRtcEngineEventHandler for event handlingleaveChannel() firstCSceneDialog.cpp — registration lives in APIExampleDlg.h and APIExampleDlg.cppAPIExample/APIExample/[Basic|Advanced]/ structureARCHITECTURE.md Case Index after adding/modifying an exampleAfter completing the upsert, verify:
APIExample/APIExample/[Basic|Advanced]/<ExampleName>/)C<ExampleName>Dlg.h (with C prefix)C<ExampleName>Dlg.cppCDialogEx or CDialogIRtcEngineEventHandlerBEGIN_MESSAGE_MAP / END_MESSAGE_MAPAPIExampleDlg.h and APIExampleDlg.cppLanguage.h and initialized in stdafx.cppen.ini and zh-cn.iniInitializeAgoraEngine() creates engine with correct configJoinChannel() uses token from CConfigLeaveChannel() and release() are called in PostNcDestroy()PostMessage()APIExample.vcxproj and .filters include the new files when they were added outside the IDEARCHITECTURE.md Case Index includes new/updated examplereferences/ directory for C++ code templatesAPIExample/APIExample/Basic/JoinChannelVideoByToken/ for reference implementation