From ue5-style-guide
Creating new UE5 C++ classes, organizing header and source files
How this skill is triggered — by the user, by Claude, or both
Slash command
/ue5-style-guide:cpp-class-structureThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Organize your C++ classes following Unreal Engine conventions.
Organize your C++ classes following Unreal Engine conventions.
Source/
└── ModuleName/
├── Public/ # Header files (.h)
│ ├── Components/
│ ├── Actors/
│ └── Core/
├── Private/ # Source files (.cpp)
│ ├── Components/
│ ├── Actors/
│ └── Core/
└── ModuleName.Build.cs
Actor.h not AActor.h// HealthComponent.h
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "HealthComponent.generated.h"
// Forward declarations (prefer over #includes)
class ABaseCharacter;
class UDamageType;
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class MYGAME_API UHealthComponent : public UActorComponent
{
GENERATED_BODY() // Required in all UCLASS declarations
public:
UHealthComponent();
// Public interface
UFUNCTION(BlueprintCallable, Category = "Health")
void TakeDamage(float Amount);
protected:
virtual void BeginPlay() override;
private:
// Private by default - enforce encapsulation
UPROPERTY(EditDefaultsOnly, Category = "Health")
float MaxHealth = 100.0f;
UPROPERTY(VisibleAnywhere, Category = "Health")
float CurrentHealth;
};
| Practice | Reason |
|---|---|
| Forward declarations over #includes | Reduces compile times and dependencies |
| GENERATED_BODY() macro | Required for reflection system |
| Private by default | Enforce encapsulation |
| Split large functions | Improves compile time optimization |
| Don't use inline for non-trivial functions | Can increase compile times |
#pragma once
// Engine includes
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
// Generated header (always last)
#include "MyActor.generated.h"
// Forward declarations
class UStaticMeshComponent;
// Delegates
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnDeathSignature);
// Class declaration
UCLASS()
class MYGAME_API AMyActor : public AActor
{
GENERATED_BODY()
// ...
};
Documentation: https://dev.epicgames.com/documentation/en-us/unreal-engine/gameplay-classes-in-unreal-engine
npx claudepluginhub rickym-h/jadefall-marketplace --plugin ue5-style-guideExpert guidelines for Unreal Engine 5.x C++ development covering UObject lifecycle, reflection system, performance patterns, and Epic's naming conventions.
Applies C++ standards tailored to Unreal Engine's lifecycle, reflection, modules, and gameplay framework. Useful for writing or reviewing Unreal C++ code.
Provides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.