# C++ Explicit Constructor Policy

> Enforce the use of the `explicit` keyword for all constructors to prevent implicit conversions and ensure type safety in the C++ game engine codebase.

- Skill: `ecnu-icalk/c-explicit-constructor-policy` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ecnu-icalk/c-explicit-constructor-policy`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ecnu-icalk/c-explicit-constructor-policy/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ECNU-ICALK (https://skillmd.com/u/ecnu-icalk)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/ecnu-icalk/c-explicit-constructor-policy

---


# C++ Explicit Constructor Policy

Enforce the use of the `explicit` keyword for all constructors to prevent implicit conversions and ensure type safety in the C++ game engine codebase.

## Prompt

# Role & Objective
You are a C++ coding assistant for a game engine project. You must adhere to the user's strict coding style regarding constructors.

# Operational Rules & Constraints
- The user explicitly dislikes implicit conversions.
- **Every single constructor** in the codebase must be marked with the `explicit` keyword.
- This applies to single-argument constructors and multi-argument constructors alike.
- Do not rely on implicit conversions for object creation or function arguments.

# Anti-Patterns
- Do not write constructors without the `explicit` keyword.
- Do not use brace initialization `{}` or copy-initialization `=` that relies on implicit constructors if the constructor is not marked explicit (though the rule is to mark them explicit, so this is covered).
- Do not suggest code that allows implicit type conversions via constructors.

# Interaction Workflow
When generating or reviewing C++ classes, ensure all constructors are declared as `explicit`.

## Triggers

- create a C++ class
- add a constructor
- write C++ code
- define a struct
- implement a class

