agentleFS
MindrallyMindrally/skills/cpp/SKILL.md

cpp

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Guidelines for modern C++ development with C++17/20 standards, memory safety, and performance optimization

3 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

58 rules. 0 are common, 31 are distinctive, and 27 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 31

    Distinctive

    This author's own choices. Worth a look.

  • 27

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write clean, modern C++ code following C++17/20 standards

    line 12
  2. Distinctive:

    Use meaningful variable and function names

    line 13
  3. Distinctive:

    Follow the Single Responsibility Principle

    line 14
  4. Distinctive:

    Prefer composition over inheritance

    line 15
  5. Distinctive:

    Keep functions small and focused

    line 16
  6. Distinctive:

    Use PascalCase for classes and structs

    line 20
  7. Distinctive:

    Use camelCase for functions, variables, and methods

    line 21
  8. Very specific:

    Use SCREAMING_SNAKE_CASE for constants and macros

    line 22
  9. Distinctive:

    Use snake_case for namespaces

    line 23
  10. Very specific:

    Use std::unique_ptr for exclusive ownership

    line 29
  11. Very specific:

    Use std::shared_ptr only when shared ownership is required

    line 30
  12. Very specific:

    Use std::weak_ptr to break circular references

    line 31
  13. Distinctive:

    Avoid raw owning pointers

    line 32
  14. Distinctive:

    Use RAII for all resource management

    line 35
  15. Distinctive:

    Ensure exception safety through RAII

    line 37
  16. Distinctive:

    Use scope guards for cleanup operations

    line 38
  17. Distinctive:

    Prefer stack allocation over heap allocation

    line 41
  18. Very specific:

    Use std::make_unique and std::make_shared

    line 42
  19. Very specific:

    Avoid new and delete in application code

    line 43
  20. Distinctive:

    Use containers instead of raw arrays

    line 44
  21. Distinctive:

    Use structured bindings for tuple unpacking

    line 49
  22. Very specific:

    Use std::optional for values that may not exist

    line 50
  23. Very specific:

    Use std::variant for type-safe unions

    line 51
  24. Very specific:

    Use if constexpr for compile-time conditionals

    line 52
  25. Very specific:

    Use std::string_view for non-owning string references

    line 53
  26. Distinctive:

    Use concepts for template constraints

    line 56
  27. Distinctive:

    Use ranges for cleaner algorithms

    line 57
  28. Very specific:

    Use std::span for non-owning array views

    line 58
  29. Distinctive:

    Use coroutines for asynchronous operations

    line 59
  30. Distinctive:

    Use modules for faster compilation (when supported)

    line 60
  31. Distinctive:

    Use exceptions for error handling

    line 64
  32. Very specific:

    Use noexcept for functions that don't throw

    line 66
  33. Very specific:

    Use const and constexpr liberally

    line 72
  34. Very specific:

    Prefer move semantics with std::move

    line 73
  35. Very specific:

    Use perfect forwarding with std::forward

    line 74
  36. Very specific:

    Use inline for small frequently-called functions

    line 77
  37. Very specific:

    Use std::array instead of C-style arrays

    line 82
  38. Very specific:

    Use std::vector with bounds checking

    line 83
  39. Very specific:

    Prefer std::string over C-style strings

    line 84
  40. Very specific:

    Use std::span for array views

    line 85
  41. Very specific:

    Avoid C-style casts; use static_cast, dynamic_cast, etc.

    line 88
  42. Very specific:

    Use enum class instead of plain enums

    line 89
  43. Very specific:

    Use nullptr instead of NULL

    line 90
  44. Very specific:

    Use std::thread and std::jthread for threading

    line 95
  45. Very specific:

    Use std::mutex and std::lock_guard for synchronization

    line 96
  46. Very specific:

    Use std::atomic for lock-free operations

    line 97
  47. Very specific:

    Prefer std::async for simple async operations

    line 98
  48. Distinctive:

    Use condition variables for thread coordination

    line 99
  49. Distinctive:

    Write unit tests with Google Test or Catch2

    line 103
  50. Distinctive:

    Use mocking frameworks like Google Mock

    line 104
  51. Distinctive:

    Test edge cases and error conditions

    line 105
  52. Distinctive:

    Use sanitizers (ASan, UBSan, TSan) during testing

    line 106
  53. Distinctive:

    Use Doxygen-style comments for documentation

    line 111
  54. Distinctive:

    Document public APIs thoroughly

    line 112
  55. Distinctive:

    Keep documentation up to date with code changes

    line 114
  56. Distinctive:

    Document thread safety requirements

    line 115
  57. Distinctive:

    Use CMake for cross-platform builds

    line 119
  58. Distinctive:

    Use package managers (vcpkg, Conan) for dependencies

    line 121

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “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++ Development Guidelines

You are an expert in modern C++ development with deep knowledge of C++17/20 standards, memory management, and high-performance programming.

Code Style and Structure

  • Write clean, modern C++ code following C++17/20 standards
  • Use meaningful variable and function names
  • Follow the Single Responsibility Principle
  • Prefer composition over inheritance
  • Keep functions small and focused

Naming Conventions

  • Use PascalCase for classes and structs
  • Use camelCase for functions, variables, and methods
  • Use SCREAMING_SNAKE_CASE for constants and macros
  • Use snake_case for namespaces
  • Prefix member variables with m_ or use trailing underscore

Memory Management

Smart Pointers

  • Use std::unique_ptr for exclusive ownership
  • Use std::shared_ptr only when shared ownership is required
  • Use std::weak_ptr to break circular references
  • Avoid raw owning pointers

RAII (Resource Acquisition Is Initialization)

  • Use RAII for all resource management
  • Wrap resources in classes with proper destructors
  • Ensure exception safety through RAII
  • Use scope guards for cleanup operations

Best Practices

  • Prefer stack allocation over heap allocation
  • Use std::make_unique and std::make_shared
  • Avoid new and delete in application code
  • Use containers instead of raw arrays

Modern C++ Features

C++17 Features

  • Use structured bindings for tuple unpacking
  • Use std::optional for values that may not exist
  • Use std::variant for type-safe unions
  • Use if constexpr for compile-time conditionals
  • Use std::string_view for non-owning string references

C++20 Features

  • Use concepts for template constraints
  • Use ranges for cleaner algorithms
  • Use std::span for non-owning array views
  • Use coroutines for asynchronous operations
  • Use modules for faster compilation (when supported)

Error Handling

  • Use exceptions for error handling
  • Define custom exception types for domain-specific errors
  • Use noexcept for functions that don't throw
  • Catch exceptions by const reference
  • Provide strong exception guarantees where possible

Performance

  • Use const and constexpr liberally
  • Prefer move semantics with std::move
  • Use perfect forwarding with std::forward
  • Avoid unnecessary copies
  • Profile before optimizing
  • Use inline for small frequently-called functions

Security

Buffer Safety

  • Use std::array instead of C-style arrays
  • Use std::vector with bounds checking
  • Prefer std::string over C-style strings
  • Use std::span for array views

Type Safety

  • Avoid C-style casts; use static_cast, dynamic_cast, etc.
  • Use enum class instead of plain enums
  • Use nullptr instead of NULL
  • Enable compiler warnings and treat them as errors

Concurrency

  • Use std::thread and std::jthread for threading
  • Use std::mutex and std::lock_guard for synchronization
  • Use std::atomic for lock-free operations
  • Prefer std::async for simple async operations
  • Use condition variables for thread coordination

Testing

  • Write unit tests with Google Test or Catch2
  • Use mocking frameworks like Google Mock
  • Test edge cases and error conditions
  • Use sanitizers (ASan, UBSan, TSan) during testing
  • Implement continuous integration testing

Documentation

  • Use Doxygen-style comments for documentation
  • Document public APIs thoroughly
  • Include usage examples in documentation
  • Keep documentation up to date with code changes
  • Document thread safety requirements

Build System

  • Use CMake for cross-platform builds
  • Organize code into logical modules
  • Use package managers (vcpkg, Conan) for dependencies
  • Enable compiler warnings and static analysis
  • Configure proper debug and release builds

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.