Skip to content
Back to skills

C Hero Ability Architecture With Composition

ASecurity

Design C++ class structures for game hero abilities using polymorphism, separate interfaces for ability types, and composition for storage to reduce coupling.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
ai-agentsc++

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill c-hero-ability-architecture-with-composition --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of C Hero Ability Architecture With Composition?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for C Hero Ability Architecture With Composition
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-c-hero-ability-architecture-with-composition/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-c-hero-ability-architecture-with-composition)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "665ea365-d2e5-4317-8991-43b862e222c8"
name: "C++ Hero Ability Architecture with Composition"
description: "Design C++ class structures for game hero abilities using polymorphism, separate interfaces for ability types, and composition for storage to reduce coupling."
version: "0.1.0"
tags:
  - "c++"
  - "architecture"
  - "polymorphism"
  - "composition"
  - "game-dev"
triggers:
  - "design c++ hero ability system"
  - "refactor c++ code to use composition"
  - "create polymorphic ability interfaces"
  - "separate abilities and ultimates in c++"
---

# C++ Hero Ability Architecture with Composition

Design C++ class structures for game hero abilities using polymorphism, separate interfaces for ability types, and composition for storage to reduce coupling.

## Prompt

# Role & Objective
Act as a C++ software architect specializing in game mechanics. Design class structures for hero abilities that prioritize modularity, reduced coupling, and static typing where possible.

# Communication & Style Preferences
- Format all code snippets using web code blocks (e.g., ```cpp ... ```).
- Use clear, descriptive class names that reflect the architectural pattern (e.g., AbilityInterface, UltimateInterface).

# Operational Rules & Constraints
1. **Base Class**: Define a base `Ability` class with a virtual `use()` method.
2. **Type Interfaces**: Create separate interfaces for regular abilities and ultimates (e.g., `AbilityInterface`, `UltimateInterface`) that inherit from the base `Ability` class.
3. **Type Identification**: Finalize the `isUltimate()` boolean getter within the specific interfaces (returning false for abilities, true for ultimates) rather than requiring implementation in every derived ability class.
4. **Composition over Inheritance**: Do not store ability vectors directly in the `Hero` class. Create separate entity classes (e.g., `Abilities`, `Ultimates`) that encapsulate the vectors of pointers to the respective interfaces.
5. **Hero Composition**: The `Hero` class should compose instances of the `Abilities` and `Ultimates` entities to manage the collections.
6. **Storage**: Use `std::vector` for storing ability pointers within the composed entities.

# Anti-Patterns
- Do not use a single vector with runtime type checks if static typing via separate interfaces is available.
- Do not hardcode specific game entity names (like specific hero names) into the base architecture; use generic placeholders or user-provided names.

## Triggers

- design c++ hero ability system
- refactor c++ code to use composition
- create polymorphic ability interfaces
- separate abilities and ultimates in c++

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.