create-cpp-tests
Skill67 starsChanged 58 days agoMITView on GitHub
Create a new cpp_tests entry for validating a C++ interface vtable layout against binary reference YAMLs. Creates the .cpp test file in cpp_tests/ and appends a configs/<GAMEVER>.yaml entry under cpp_tests:. Use when a user asks to add vtable layout validation for a new hl2sdk_cs2 interface class.
In this repository54 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- cleanup-workspaceSkill
- convert-finder-skill-to-preprocessor-scriptsSkill
- create-agent-skill-fallbackSkill
- create-preprocessor-scriptsSkill
- create-prSkill
- dump-vtablesSkill
- find-CBaseEntity_GetChangeAccessorPathInfo_1Skill
- find-CCSBotManager_AddBot_BotNavIgnoreSkill
- find-CCSGameRules__sm_mapGcBanInformationSkill
- find-CCSPlayer_MovementServices_CheckJumpButton_WaterPatchSkill
- find-CCSPlayer_MovementServices_FullWalkMove_SpeedClampSkill
- find-CEntitySystem_Init-decompilesSkill
- find-CEntitySystem_m_entityNamesSkill
- find-CNetworkGameServerBase_CheckTimeouts-decompilesSkill
- find-CNetworkGameServerBase_CreateFakeClientSkill
- find-CNetworkGameServerBase_GetChallengeTypeSkill
- find-CNetworkGameServer_GetFreeClientSkill
- find-CNetworkMessages_dtorSkill
- find-CNetworkMessages_GetIsForServerSkill
- find-CNetworkMessages_GetNetworkSerializationContextDataSkill
- find-CNetworkMessages_vtable-decompilesSkill
- find-CServerSideClientBase_GetUserIDStringSkill
- find-CSource2Server_Shutdown-decompilesSkill
- find-CSteam3ServerS1_InitGameServer-decompilesSkill
- find-INetworkServerService_GetServerSerializersCRCSkill
- find-INetworkServerService_IsActiveInGameSkill
- find-INetworkServerService_IsServerRunningSkill
- find-IVEngineServer2_GetClientSteamIDSkill
- find-OnServerVoiceData_IsPlayingDemo_CalleeSkill
- fix-cppheadersSkill
- generate-reference-yamlSkill
- generate-signature-for-functionSkill
- generate-signature-for-globalvarSkill
- generate-signature-for-patchSkill
- generate-signature-for-structoffsetSkill
- generate-signature-for-vfuncoffsetSkill
- get-func-from-yamlSkill
- get-vtable-addressSkill
- get-vtable-from-yamlSkill
- get-vtable-indexSkill
- init-gamebinSkill
- rename-preprocessor-scriptsSkill
- resolve-pr-conflictSkill
- run-validation-until-no-failureSkill
- run-vcall-finderSkill
- trigger-release-buildSkill
- write-func-as-yamlSkill
- write-globalvar-as-yamlSkill
- write-patch-as-yamlSkill
- write-structoffset-as-yamlSkill
- write-vfunc-as-yamlSkill
- write-vtable-as-yamlSkill
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 12
Create a cpp_tests/<interface_lowercase>.cpp test file and append a matching configs/<GAMEVER>.yaml entry so that run_cpp_tests.py can …
- Distinctive: line 39
Read the header file to understand:
- Distinctive: line 46
Check if the header's transitive includes will compile cleanly with the standard include set:
- Very specific: line 67
Create cpp_tests/<interface_lowercase>.cpp following this template:
- Very specific: line 90
Always start with the platform.h + RESTRICT preamble
- Distinctive: line 97
If the user didn't provide these, discover them:
- Distinctive: line 99
alias_symbols: Search the tracked source-owned vtable artifacts:
- Very specific: line 142
If no alias_symbols, the reference YAML files use the symbol name directly
- Very specific: line 146
After validation passes, ensure the delivery branch is dev.
- Distinctive: line 158
If any branch switch fails, stop and report the error.
- Distinctive: line 166
Never use git add -A. Stop if the staged-path list contains anything unrelated to this task.
- Very specific: line 173
Do not call /create-pr, push the branch, or open a pull request unless the user separately requests it.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create cpp_tests for Interface Vtable Validation
Create a cpp_tests/<interface_lowercase>.cpp test file and append a matching configs/<GAMEVER>.yaml
entry so that run_cpp_tests.py can compile the header with clang, dump the vtable layout,
and compare it against reference YAML files from the binary analysis.
Resolve GAMEVER from the user's explicit request or CS2VIBE_GAMEVER, set the edit target to
configs/$GAMEVER.yaml, and stop if that exact file does not exist.
When to Use
- User asks to create cpp_tests for an interface (e.g., "create cpp_tests for ILoopMode")
- User provides or references a header file from
hl2sdk_cs2/
Inputs
The user will provide some or all of:
| Field | Required | Description | Example |
| Interface name | Yes | The abstract class to validate | ILoopMode |
| Header path | Yes | Path to the header in hl2sdk_cs2 | hl2sdk_cs2/public/iloopmode.h |
| Alias symbols | No | Concrete class name(s) used in binary YAML files | CLoopModeGame |
| Reference modules | No | Modules where vtable YAMLs live | client, server |
Step-by-Step Procedure
Step 1: Read the target header
Read the header file to understand:
- What
#includedirectives it uses - What types are referenced in virtual method signatures
- Whether it inherits from another interface (e.g.,
IAppSystem)
Step 2: Identify compilation dependencies
Check if the header's transitive includes will compile cleanly with the standard include set:
hl2sdk_cs2/game/sharedhl2sdk_cs2/publichl2sdk_cs2/public/tier0hl2sdk_cs2/public/tier1
Common issues to watch for:
- Missing types referenced in method signatures (e.g.,
CSplitScreenSlotneeds<tier1/convar.h>) - Heavy transitive includes that pull in protobuf or other unavailable deps (e.g.,
eiface.h-> protobuf chain)
For heavy transitive includes, pre-define include guards to block them and forward-declare/stub the minimum needed types. See the inetworkmessages.cpp and inetworksystem.cpp examples for this technique:
// Example: blocking heavy include chains
#define EIFACE_H
#define INETCHANNEL_H
enum NetChannelBufType_t : int8 {};Step 3: Create the cpp test file
Create cpp_tests/<interface_lowercase>.cpp following this template:
#include <tier0/platform.h>
#undef RESTRICT
#define RESTRICT
// Add any extra includes needed for types in the interface signatures
// Add any include-guard stubs to block heavy transitive includes
#include <path/to/interface_header.h>
InterfaceName * instanceptr();
int main() {
instanceptr()->SomeMethod();
return 0;
}Key rules:
- Always start with the
platform.h+RESTRICTpreamble - The extern function declaration (e.g.,
ILoopMode * loopmode();) forces the compiler to emit vtable info main()must call at least one virtual method to trigger vtable layout dump- Pick a simple void-returning method with no complex args for the call in
main()
Step 4: Determine alias_symbols and reference_modules
If the user didn't provide these, discover them:
- alias_symbols: Search the tracked source-owned vtable artifacts:
Thebin_artifacts/<GAMEVER>/**/*<ClassName>*vtable*vtable_classfield in those YAMLs gives the alias symbol (typically the concrete class name likeCLoopModeGameforILoopMode). - reference_modules: The subdirectories under
bin_artifacts/<GAMEVER>/where vtable YAMLs exist (e.g.,client,server,engine,networksystem).
Step 5: Append configs/<GAMEVER>.yaml entry
Append a new entry at the end of the cpp_tests: section in configs/<GAMEVER>.yaml:
- name: {InterfaceName}_MSVC
symbol: {InterfaceName}
alias_symbols: # omit this block if no aliases
- {ConcreteClassName}
cpp: cpp_tests/{interface_lowercase}.cpp
headers:
- {header_path} # Used by the fix-cppheaders SKILL
target: x86_64-pc-windows-msvc
include_directories:
- hl2sdk_cs2/game/shared
- hl2sdk_cs2/public
- hl2sdk_cs2/public/tier0
- hl2sdk_cs2/public/tier1
defines:
- COMPILER_MSVC=1
- COMPILER_MSVC64=1
- _MSVC_STL_USE_ABORT_AS_DOOM_FUNCTION
additional_compiler_options:
- fms-extensions
- fms-compatibility
- Xclang
- fdump-vtable-layouts
reference_modules:
- {module1} # bin_artifacts/{gamever}/{module1}/{AliasOrSymbol}_*.{platform}.yaml
- {module2}Notes:
include_directories,defines, andadditional_compiler_optionsare always the same standard setreference_modulescomments should document the YAML file naming pattern- If no
alias_symbols, the reference YAML files use thesymbolname directly
Step 6: Commit Changes to dev
After validation passes, ensure the delivery branch is dev. Never commit directly to main. If the local dev
branch exists, switch to it. Otherwise, switch to main first and create dev from main:
if git show-ref --verify --quiet refs/heads/dev; then
git switch dev
else
git switch main
git switch -c dev
fiIf any branch switch fails, stop and report the error. Review git status --short, then explicitly stage only the
new test and its config entry:
git add -- cpp_tests/{interface_lowercase}.cpp configs/<GAMEVER>.yaml
git diff --cached --name-onlyNever use git add -A. Stop if the staged-path list contains anything unrelated to this task. Commit only the
staged task changes using the repository commit format:
git commit -m "test(cpp-tests): add {InterfaceName} vtable validation" -m "Co-Authored-By: Codex <codex@openai.com>"Do not call /create-pr, push the branch, or open a pull request unless the user separately requests it. Finish by
reporting the commit hash and the validation results.
Checklist
- New cpp test follows the platform/RESTRICT preamble and calls a virtual method
configs/<GAMEVER>.yamlentry contains the correct symbol, aliases, header, and reference modules- The current branch is
dev(created frommainwhen it did not already exist) - Only the new test and config entry are explicitly staged and committed
/create-prwas not called; no push or PR was performed without a separate user request
Reference: Existing Examples
| Test Name | Interface | Header | Has Aliases | Has Include Stubs | Reference Modules |
IGameSystem_MSVC | IGameSystem | igamesystem.h | No | No | server, client |
INetworkMessages_MSVC | INetworkMessages | inetworkmessages.h | CNetworkMessages | Yes (EIFACE_H, INETCHANNEL_H) | networksystem, engine, server, client |
ILoopMode_MSVC | ILoopMode | iloopmode.h | CLoopModeGame | No (just extra convar.h include) | client, server |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

