agentleFS
ROCmROCm/rocprofiler-systems-skills/skills/programming-cpp-naming-rules/SKILL.md

programming-cpp-naming-rules

Skill5 starsChanged 16 days agoMITView on GitHub

C++ file and class naming conventions - folder structure matches namespaces, no redundant prefixes

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when creating new C++ files or refactoring file structure.

    line 8
  2. Very specific:

    No redundant prefixes: If file is in amd_smi/, don't name it amd_smi_driver.hpp - use driver.hpp

    line 28
  3. Distinctive:

    Use nested namespace syntax when declaring:

    line 44
  4. Distinctive:

    Folder = namespace context: - don't repeat it in filenames

    line 84

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

C++ Naming Rules

Use this skill when creating new C++ files or refactoring file structure.

Folder Structure = Namespace

Folder structure should correspond to namespaces. Don't repeat namespace prefixes in filenames.

// ❌ BAD: amd_smi/amd_smi_driver.hpp
namespace amd_smi {
class amd_smi_driver {};  // Redundant prefix
}

// ✅ GOOD: amd_smi/driver.hpp
namespace amd_smi {
class driver {};  // Clean, folder provides context
}

Rules

  1. No redundant prefixes: If file is in amd_smi/, don't name it amd_smi_driver.hpp - use driver.hpp
  2. Namespace = folder path: foo/bar/baz.hpp → namespace foo::bar { class baz {} }
  3. Class name = file name: driver.hpp contains class driver or struct driver
  4. One class per file (when practical): Easier to find and maintain

Examples

Folder PathFile NameNamespaceClass/Struct
amd_smi/driver.hppamd_smidriver
amd_smi/gpu/metrics.hppamd_smi::gpumetrics
core/utils/string_helper.hppcore::utilsstring_helper
network/http/client.hppnetwork::httpclient

Nested Namespaces (C++17)

Use nested namespace syntax when declaring:

// ✅ GOOD: C++17 nested namespace
namespace network::http {
class client {
    // ...
};
}  // namespace network::http

// ❌ AVOID: Old style (more verbose)
namespace network {
namespace http {
class client {
    // ...
};
}  // namespace http
}  // namespace network

Include Guards / #pragma once

Match the full path in include guards:

// File: amd_smi/gpu/metrics.hpp

#pragma once  // Preferred

// OR traditional include guard matching full path:
#ifndef AMD_SMI_GPU_METRICS_HPP
#define AMD_SMI_GPU_METRICS_HPP

// ...

#endif  // AMD_SMI_GPU_METRICS_HPP

Summary

  • Folder = namespace context - don't repeat it in filenames
  • Filename = class name - easy to find
  • Path tells the full story: project/module/submodule/class.hpp

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.