/unreal-dev:unreal-cpp-reflectionfrom unreal-dev
Guides Unreal Engine C++ reflection: UCLASS/UPROPERTY/UFUNCTION macros, specifiers, TObjectPtr, garbage collection, and header linting. Useful for avoiding dangling pointers and build errors.
Ships in unreal-dev. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Reflected C++ is ordinary C++ plus macros that the header tool reads. The build tool runs the header tool first and the compiler after it, so a macro mistake stops the build before any compiler line. Most dangling objects come from an object pointer that reflection never saw.
| The situation | Read |
|---|---|
Writing a UCLASS, USTRUCT or UENUM header | A reflected header, line by line below; templates/ParcelRecord.h, templates/ParcelKind.h |
| Which specifier, on which macro, spelt how; metadata keys | reference/specifiers.md |
| An object freed while in use, a dangling pointer, an object that never goes away | reference/garbage-collection.md |
NewObject, CreateDefaultSubobject, constructors, the class default object, TSubclassOf | reference/object-creation.md |
| Checking headers before a build (or in CI) | Lint before you build; scripts/reflection_lint.py |
A build error naming a .generated.h, GENERATED_BODY or a specifier | Classic failures below; unreal-compile-loop → reference/reading-errors.md |
| Which members a Blueprint sees, native and implementable events | unreal-blueprint-boundary |
Replicated, ReplicatedUsing, RPC specifiers, GetLifetimeReplicatedProps | unreal-replication |
| The module API macro's module, Build.cs dependencies, link errors | unreal-modules-build |
| An API name not in these files | unreal-project → reference/api-lookup.md |
#pragma once
#include "CoreTypes.h"
#include "UObject/NameTypes.h" // what the members use, at the API page's include path
#include "ParcelKind.h"
#include "ParcelRecord.generated.h" // always the last include, named after this file
USTRUCT(BlueprintType)
struct COURIERRUN_API FParcelRecord // the module API macro, then the prefixed name
{
GENERATED_BODY() // first line of every UCLASS and USTRUCT body
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Parcel")
FName ParcelId;
UPROPERTY(EditAnywhere, Category = "Parcel")
EParcelKind Kind = EParcelKind::Standard;
};
#pragma once, then include what you use: CoreTypes.h first, the base class's header at the
path its API page gives (GameFramework/Actor.h for AActor), then each type the members use.
Never a monolithic header (Engine.h, UnrealEd.h). The .cpp includes its own header first.<File>.generated.h is the last #include, spelt after the header's own file name. The header
tool writes it only for a header that declares a reflected type.UCLASS(...), USTRUCT(...), or UENUM() above
enum class EName : uint8.<MODULE>_API (here COURIERRUN_API for module CourierRun) exports the type to other
modules. Leave it off and another module's use of it fails to link. MinimalAPI exports the
type information only.GENERATED_BODY() opens the body. Every object pointer member carries UPROPERTY(), and members
use TObjectPtr<T> rather than a raw T*.UFUNCTION(...). Their specifiers are in
reference/specifiers.md.| Prefix | For | Example |
|---|---|---|
U | classes derived from UObject (not actors) | UParcelData, UParcelComponent |
A | classes derived from AActor | ACourierCharacter, ASentry |
F | structs and other classes | FParcelRecord, FRouteMath |
E | enums | EParcelKind |
I | interfaces | IAbilitySystemInterface |
T | templates | TObjectPtr, TArray |
S | Slate widgets | SWidget |
b | bool members | bCarrying |
A UCLASS takes the prefix of its base: an A class derives from an actor, a U class from any
other object. The header tool requires these prefixes in most cases; the lint fails a mismatch first.
python3 scripts/reflection_lint.py Source/CourierRun # every .h and .cpp below it
python3 scripts/reflection_lint.py Source Plugins --strict # CI: a WARN fails too
python3 scripts/reflection_lint.py --selftest
FAIL rules: the .generated.h include (missing, misnamed, not last, or with no reflected type);
GENERATED_BODY() missing; a prefix that does not match the base; an object pointer member
without UPROPERTY; TStrongObjectPtr as a UPROPERTY; a replicated property with no
GetLifetimeReplicatedProps in the header or its .cpp; new on an object type. WARN rules: a raw
T* UPROPERTY member; a Public/ type without its module API macro; a specifier or metadata key
outside the lists it carries (it may still be valid: look it up); an exposed member without a
Category; GENERATED_BODY() not first in a struct; a bool without b; CreateDefaultSubobject
outside the constructor; a .cpp whose first include is not its own header. The lint reads text: it
does not expand macros or #if blocks. Exit 0 clean, 2 a FAIL, 3 nothing read, 1 usage.
| Member | Collector sees it | Use when |
|---|---|---|
UPROPERTY() TObjectPtr<T> | yes, keeps it alive | the member owns or needs the target |
TWeakObjectPtr<T> | weakly, goes null | it watches what another object owns |
UPROPERTY() TSoftObjectPtr<T> | as a path | it names an asset that is loaded later |
TStrongObjectPtr<T> | yes | the owner is plain C++, never a UPROPERTY |
raw T* member, no UPROPERTY | no: dangles, never nulled | never |
The rest, with structs, containers and destroyed actors: reference/garbage-collection.md.
| What you see | Cause | Fix |
|---|---|---|
| The build stops before any compiler output, on a header line with a reflection macro | a header-tool error: it runs first, so nothing compiled | fix that header first; reflection_lint.py on it |
The compiler cannot open ParcelRecord.generated.h | the header declares no reflected type, the include does not match the file name, or the header-tool step failed earlier | match the name; fix the first error in the log |
Errors point at the GENERATED_BODY() line or into generated code | GENERATED_BODY() missing, or .generated.h not the last include | the lint's generated-body and generated-include rules |
| An unknown-specifier error from the header tool | a misspelt specifier, or one placed on the wrong macro | reference/specifiers.md |
| A clamp, condition or display name is silently ignored | a misspelt meta key: metadata is free text | compare with reference/specifiers.md §3, §4 |
| An unresolved external for a class of another module | no <MODULE>_API on it, or the module missing from Build.cs | unreal-modules-build → reference/link-errors.md |
An unresolved <Name>_Implementation | a BlueprintNativeEvent, Server or Client function with no body | define <Name>_Implementation in the .cpp |
| A crash or garbage a while after start, in code that worked | an object pointer member without UPROPERTY, read after collection | reference/garbage-collection.md §5 |
| A struct shows no Break pins in Blueprint | no member is BlueprintReadOnly or BlueprintReadWrite | expose one; BlueprintType on the struct |
unreal-blueprint-boundary → reference/exposed-surface.md: the Blueprint-facing subset of these
specifiers, and what belongs in C++.unreal-modules-build → reference/build-cs.md: the module that the API macro and each include
belong to.unreal-compile-loop → reference/live-coding.md: which header changes need a closed-editor rebuild.unreal-replication → reference/properties.md: replicated properties registered one by one.unreal-gameplay-framework → reference/actor-lifecycle.md: where constructors end and BeginPlay starts.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
17 skills in this plugin
/unreal-animationUnreal animation: Animation Blueprint or C++ UAnimInstance, NativeUpdateAnimation, montages, slots, sections, notifies and notify states, root motion./unreal-asset-importImport meshes, textures and animation into Unreal by script: AssetImportTask, Interchange pipelines, glTF and FBX options, static or skeletal mesh, budget check./unreal-automation-testsUnreal automation tests: IMPLEMENT_SIMPLE_AUTOMATION_TEST, Automation Spec, latent commands, Automation RunTest on the command line, the JSON report as verdict./unreal-blueprint-boundarySplit Unreal work between C++ and Blueprint: BlueprintCallable, BlueprintNativeEvent, BlueprintImplementableEvent, exposed properties, data assets, soft references./unreal-compile-loopCompile Unreal C++ from a terminal: target, platform and configuration, UnrealBuildTool and compiler errors, Live Coding or a closed-editor rebuild./unreal-config-logsUnreal config and logs: Default*.ini layering, [/Script/...] sections, console variables, UE_LOG categories and verbosity, Saved/Logs, Saved/Crashes.npx claudepluginhub tipoli5890/game-studio --plugin unreal-dev