unreal-engine-cpp

A set of C++ naming and coding rules for Unreal Engine 5.7, a game-development engine. It covers Unreal-specific class prefixes, macros, properties, and naming styles.

In plain words
What is it for?
It guides naming classes, functions, variables, constants, interfaces, enums, and Unreal macros such as UCLASS, USTRUCT, UENUM, and UPROPERTY.
Why use it?
It helps keep Unreal Engine code consistent and recognizable, especially when working with engine-managed classes and features.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/stramp/lost-mines-phandelver/unreal-engine-cpp
Clone the repo
git clone --depth 1 https://github.com/Stramp/Lost-Mines-Phandelver

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,296 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01296
Opus 5 $0.00000 $0.00648
Sonnet 5 $0.00000 $0.00259
Haiku 4.5 $0.00000 $0.00130

Measured 2d ago against content hash d91f09c97855, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

unreal-engine-cpp scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/unreal-engine-cpp.mdc · 129 lines

How it starts

The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C++ Code Conventions - Unreal Engine 5.7

Naming (CRITICAL)

  • Classes: PascalCase with appropriate prefix:
    • A for Actors (ex: AMyProject2Character, APlayerController)
    • U for UObjects (ex: UMyGameInstance, UMyComponent)
    • F for Structs (ex: FPlayerStats, FWeaponData)
    • E for Enums (ex: EPlayerState, EWeaponType)
    • I for Interfaces (ex: IInteractable, IDamageable)
    • T for Templates (ex: TArray, TMap, TSet)
  • Functions: PascalCase (ex: BeginPlay(), Tick(), OnHit())
  • Variables: PascalCase with prefixes:
    • Booleans: b (ex: bIsRunning, bIsActive, bHasWeapon)
    • Floats: no prefix (ex: Health, MaxHealth, Speed)
    • Integers: no prefix (ex: AmmoCount, Level)
    • Enums: E (ex: EPlayerState CurrentState)
    • Interfaces: I (ex: IInteractable* InteractableObject)
  • Constants: const with PascalCase (ex: const float MaxSpeed = 1000.0f;)

Macros and Annotations (ESSENTIAL)

  • ALWAYS use Unreal macros for classes:
    • UCLASS() for classes that inherit from UObject
    • USTRUCT() for structs
    • UENUM() for enums
    • UINTERFACE() for interfaces
  • UPROPERTY() - Use for:
    • UPROPERTY(BlueprintReadWrite) - Read/write in Blueprint
    • UPROPERTY(BlueprintReadOnly) - Read-only in Blueprint
    • UPROPERTY(VisibleAnywhere) - Visible in editor, not editable
    • UPROPERTY(EditAnywhere) - Editable in editor
    • UPROPERTY(EditDefaultsOnly) - Editable only in defaults
    • UPROPERTY(EditInstanceOnly) - Editable only in instances
    • UPROPERTY(Replicated) - Network replication
  • UFUNCTION() - Use for:
    • UFUNCTION(BlueprintCallable) - Callable from Blueprint
    • UFUNCTION(BlueprintImplementableEvent) - Implemented in Blueprint
    • UFUNCTION(BlueprintNativeEvent) - Default implementation in C++, can be overridden in Blueprint
    • UFUNCTION(Server, Reliable) - Server RPC
    • UFUNCTION(Client, Reliable) - Client RPC

Headers and Includes

  • ALWAYS use #include "CoreMinimal.h" at the top of .cpp files
  • Use #pragma once in all headers (don't use include guards)
  • Use forward declarations in headers when possible:
    // In header (.h)
    class APlayerController;
    class UWidget;
    
    // In cpp
    #include "PlayerController.h"
    #include "Components/Widget.h"
    
  • Organize includes in this order:
    1. Corresponding header (ex: #include "MyClass.h")
    2. Engine headers (ex: #include "Engine/Engine.h")
    3. Project headers
    4. Plugin headers
    5. STL (avoid when possible)

Read the full file on GitHub · 129 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 129 lines · 0 tokens per session scan A d91f09c97855

Subscribe to this mod's changes

unreal-engine-cpp is a cursor rule published in the GitHub repository Stramp/Lost-Mines-Phandelver (2 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,296 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.