ue-trefcountptr-member-needs-complete-type

ue-trefcountptr-member-needs-complete-type is a skill for Claude Code, Codex from chen3feng/agent-skills. It costs 38 tokens per session (1,548 once invoked), scanned A, original, Apache-2.0.

A C++ guidance note for Unreal Engine classes that store smart pointers to another class. It explains when a forward declaration is not enough and the full class definition must be included.

In plain words
What is it for?
Use it when adding TRefCountPtr, TSharedPtr, or TUniquePtr members to Unreal Engine headers, especially when errors mention sizeof, destructors, or incomplete types.
Why use it?
It helps diagnose compile errors that appear when Unreal creates or destroys an object whose smart-pointer member refers to an incomplete type.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding TRefCountPtr, TSharedPtr, or TUniquePtr members to Unreal Engine headers, especially when errors mention sizeof, destructors, or incomplete types.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type
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.

Any agent
npx skills add chen3feng/agent-skills --skill ue-trefcountptr-member-needs-complete-type
Clone the repo
git clone --depth 1 https://github.com/chen3feng/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ue-trefcountptr-member-needs-complete-type

README.md
[![agentmods](https://agentmods.dev/badge/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type/github.svg)](https://agentmods.dev/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type)
Your own site
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ue-trefcountptr-member-needs-complete-type

Your own site · 80×15
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/ue-trefcountptr-member-needs-complete-type.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,548 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00038 $0.01548
Opus 5 $0.00019 $0.00774
Sonnet 5 $0.00008 $0.00310
Haiku 4.5 $0.00004 $0.00155

Measured 9d ago against content hash f724d8fe2fa4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

ue-trefcountptr-member-needs-complete-type 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 9d 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.

skills/ue-trefcountptr-member-needs-complete-type/SKILL.md · 152 lines

How it starts

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

TRefCountPtr<T> / TSharedPtr<T> members need T's complete type

When to use

You added a data member like this to a UE module header:

// Pb4ueTrpcServerConnection.h
class FPb4ueTrpcServerStream;           // forward decl

class FPb4ueTrpcServerConnection : public TSharedFromThis<...>
{
    ...
    TMap<uint32, TRefCountPtr<FPb4ueTrpcServerStream>> ServerStreams;
};

The header itself parses. Then the first TU that constructs the enclosing class — typically via MakeShared<FPb4ueTrpcServerConnection>() or a TUniquePtr<FPb4ueTrpcServerConnection> reset — fails to compile with errors pointing at the smart pointer's destructor:

error: invalid application of 'sizeof' to an incomplete type 'FPb4ueTrpcServerStream'
note: in instantiation of member function 'TRefCountPtr<FPb4ueTrpcServerStream>::~TRefCountPtr' requested here
note: in instantiation of member function 'TMap<unsigned int, TRefCountPtr<FPb4ueTrpcServerStream>>::~TMap' requested here
note: in instantiation of member function 'FPb4ueTrpcServerConnection::~FPb4ueTrpcServerConnection' requested here

Same pattern with TSharedPtr<T>, TUniquePtr<T>, and TArray<TRefCountPtr<T>>.

Problem

TRefCountPtr<T>, TSharedPtr<T>, TUniquePtr<T> all call into T's destructor from their own destructor. That requires T to be a complete type at the point the smart pointer's destructor is instantiated. When the smart pointer is a class member, the enclosing class's implicit destructor instantiates the member destructors, so the completeness requirement propagates out to every TU that destroys the enclosing class — including the one that calls MakeShared<...>().

A forward declaration in the header is enough to parse the member declaration (you're only taking a pointer-sized field), but not enough to destroy it. The compiler doesn't fire at the header; it fires at the first caller that forces instantiation.

This is the same root cause as the classic "pimpl needs out-of-line destructor" rule, but UE's TRefCountPtr has no std::unique_ptr-style defaulted-dtor escape hatch, so the workaround is narrower.

Read the full file on GitHub · 152 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. 9d ago First seen · 152 lines · 38 tokens per session scan A f724d8fe2fa4

Subscribe to this mod's changes

ue-trefcountptr-member-needs-complete-type is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 38 tokens to every session and 1,548 once invoked, about $0.0002 per session on Opus 5. 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.

Related

Other skills, from other repositories

unreal-cpp

A safety guide for writing Unreal Engine C++ and Blueprint code involving engine objects, memory cleanup, reflection, and frame updates.

Wade-DevCode/awesome-coding-skills-cn · 33 tokens

zoom-meeting-sdk-unreal

Zoom Meeting SDK for Unreal Engine wrapper integrations. Use when building Unreal projects that embed Zoom meetings with C++ and Blueprint wrappers, including wrapper-to-SDK mapping concerns.

anthropics/knowledge-work-plugins · 41 tokens

unreal-cpp-gameplay

Write Unreal Engine 5 C++ gameplay code: the UCLASS/UPROPERTY/UFUNCTION reflection macros, the Gameplay Framework (GameMode, Pawn, Character, PlayerController, Actor components), and the module Build.cs. Use when writing or debugging UE C++, deriving from AActor/ACharacter/ AGameModeBase, exposing properties to the…

gamedev-skills/awesome-gamedev-agent-skills · 105 tokens

unreal-development

Unreal Engine development: C++/Blueprint patterns, Gameplay Framework, Niagara, Lumen/Nanite, multiplayer, and packaging.

CoWork-OS/CoWork-OS · 31 tokens

ue-mcp-native-cpp

Use when writing or modifying native C++ UCLASSes in an Unreal project via ue-mcp. Covers createcppclass → writecppfile → livecodingcompile loop, when to use build vs Live Coding, and the addmoduledependency workflow. Pulls in any time the user asks to write a new native class, add a UPROPERTY, or implement a…

db-lyon/ue-mcp · 83 tokens

unreal-live-coding

Trigger Live Coding compilation via UCP. Use when the user asks to recompile C++ code, trigger live coding, hot reload C++ changes, or check compilation status in Unreal Engine.

Italink/UnrealClientProtocol · 44 tokens