Agent skill
forge-lang-c
C development standards including make, gcc/clang, valgrind, and cppcheck. Use when working with C files, Makefiles, or CMakeLists.txt.
Install this agent skill to your Project
npx add-skill https://github.com/martimramos/claude-forge/tree/main/skills/languages/c
SKILL.md
C Development
Building
# With Make
make
# With CMake
mkdir -p build && cd build
cmake ..
make
# Direct compilation
gcc -Wall -Wextra -Werror -o program main.c
Testing
# With Makefile test target
make test
# With CTest (CMake)
cd build && ctest -V
# With Unity or other test frameworks
./run_tests
Static Analysis
# Cppcheck
cppcheck --enable=all --error-exitcode=1 src/
# Clang static analyzer
scan-build make
# GCC warnings as errors
gcc -Wall -Wextra -Werror -pedantic -std=c11
Memory Checking
# Valgrind memory check
valgrind --leak-check=full ./program
# AddressSanitizer (compile with)
gcc -fsanitize=address -g -o program main.c
Formatting
# Format with clang-format
clang-format -i src/*.c src/*.h
# Check without changing
clang-format --dry-run --Werror src/*.c src/*.h
Project Structure
project/
├── src/
│ ├── main.c
│ └── module.c
├── include/
│ └── module.h
├── tests/
│ └── test_module.c
├── Makefile (or CMakeLists.txt)
└── README.md
Makefile Template
CC = gcc
CFLAGS = -Wall -Wextra -Werror -std=c11 -pedantic
LDFLAGS =
SRC = src/main.c src/module.c
OBJ = $(SRC:.c=.o)
TARGET = program
all: $(TARGET)
$(TARGET): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
test: $(TARGET)
./run_tests
clean:
rm -f $(OBJ) $(TARGET)
.PHONY: all test clean
TDD Cycle Commands
# RED: Write test, run to see it fail
make test
# GREEN: Implement, run to see it pass
make test
# REFACTOR: Clean up, ensure tests still pass
make clean && make && make test && cppcheck --enable=all src/
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
forge-lang-terragrunt
Terragrunt wrapper for Terraform with DRY configurations. Enforces plan-before-apply workflow. Use when working with terragrunt.hcl files.
forge-lang-cpp
C++ development standards including make/cmake, g++/clang++, and static analysis. Use when working with C++ files (.cpp, .hpp, .cc, .hh).
forge-lang-rust
Rust development standards including cargo test, clippy, and rustfmt. Use when working with Rust files, Cargo.toml, or Rust tests.
forge-lang-ansible
Ansible automation safety practices. Enforces check-mode-first workflow. Use when working with playbooks, roles, or inventory files.
forge-lang-typescript
TypeScript development standards including type checking, jest/vitest, eslint, and prettier. Use when working with TypeScript files, tsconfig.json, or .ts/.tsx files.
forge-lang-python
Python development standards including pytest, ruff, black, and mypy. Use when working with Python files, tests, or dependencies.
Didn't find tool you were looking for?