Claude-skill-registry coding-standard-c
Enforce C coding standards including snake_case variables and functions, UPPER_SNAKE_CASE macros, and snake_case filenames.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/coding-standard-c" ~/.claude/skills/majiayu000-claude-skill-registry-coding-standard-c && rm -rf "$T"
manifest:
skills/data/coding-standard-c/SKILL.mdsource content
C Coding Standards
When reviewing or generating C code, follow these rules:
File Naming
- Source files: snake_case with
extension (e.g.,.c
,user_service.c
)data_parser.c - Header files: snake_case with
extension (e.g.,.h
,user_service.h
)data_parser.h - Keep names short but descriptive (max ~20 characters)
Header Guards
- Format: UPPER_SNAKE_CASE with
suffix_H - Include path in guard: (e.g.,
)PROJECT_MODULE_FILE_H
#ifndef USER_SERVICE_H #define USER_SERVICE_H // content #endif /* USER_SERVICE_H */
Variable Naming
- Local variables: snake_case (e.g.,
,user_count
,buffer_size
)is_valid - Global variables: snake_case with
prefix (e.g.,g_
,g_config
)g_instance_count - Static variables: snake_case with
prefix (e.g.,s_
,s_initialized
)s_cache - Pointers: Include
orp
suffix when helpful (e.g.,ptr
,user_ptr
)buffer_p
Constant/Macro Naming
- Macros: UPPER_SNAKE_CASE (e.g.,
,MAX_BUFFER_SIZE
)DEFAULT_TIMEOUT - Enum values: UPPER_SNAKE_CASE (e.g.,
,STATUS_OK
)ERROR_INVALID_INPUT - Compile-time constants: UPPER_SNAKE_CASE with
#define
Function Naming
- Functions: snake_case (e.g.,
,calculate_total()
)parse_input() - Module prefix: Use module name prefix (e.g.,
,user_create()
)user_destroy() - Static functions: snake_case, no prefix needed (internal to file)
- Init/cleanup pairs: Use
and_init()
or_cleanup()
and_create()_destroy()
Type Naming
- Structs: snake_case with
suffix or PascalCase (e.g.,_t
oruser_data_t
)UserData - Typedefs: snake_case with
suffix (e.g.,_t
,user_id_t
)callback_fn_t - Enums: snake_case with
suffix for type (e.g.,_e
)status_e
Organization
- Header includes at top (system headers, then project headers)
- Macro definitions after includes
- Type definitions (structs, enums, typedefs)
- Function prototypes
- Global/static variable declarations
- Function implementations