c-basics-practices

c-basics-practices is a cursor rule for Cursor from wangqiqi/cursor-ai-rules. It costs 0 tokens per session (444 once invoked), scanned A, original, MIT.

A set of C programming rules covering Makefiles, CMake, compiler warnings, release builds, and unit tests. C is a compiled programming language often used for systems software.

In plain words
What is it for?
Use it when organizing a C project, creating Makefile or CMake builds, configuring compiler flags, or adding unit tests.
Why use it?
It encourages consistent builds, strict compiler checks, optimized release settings, and automated tests.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/wangqiqi/cursor-ai-rules/c-basics-practices
Clone the repo
git clone --depth 1 https://github.com/wangqiqi/cursor-ai-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for c-basics-practices

README.md
[![agentmods](https://agentmods.dev/badge/rules/wangqiqi/cursor-ai-rules/c-basics-practices.svg)](https://agentmods.dev/rules/wangqiqi/cursor-ai-rules/c-basics-practices)
Your own site
<a href="https://agentmods.dev/rules/wangqiqi/cursor-ai-rules/c-basics-practices"><img src="https://agentmods.dev/badge/rules/wangqiqi/cursor-ai-rules/c-basics-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 444 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00444
Opus 5 $0.00000 $0.00222
Sonnet 5 $0.00000 $0.00089
Haiku 4.5 $0.00000 $0.00044

Measured 4d ago against content hash 9cc065825fbf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

c-basics-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/tech/c-basics-practices.mdc · 61 lines

What it actually says

C 语言实践 (Practices)

本规则由 @c-basics 引用

Makefile

CC = gcc
CFLAGS = -std=c11 -Wall -Wextra -Wpedantic -Werror -O2 -DNDEBUG
SRCS = src/main.c src/core.c src/utils.c
OBJS = $(SRCS:.c=.o)

TARGET = myapp
$(TARGET): $(OBJS)
	$(CC) $(OBJS) -o $@ $(LDFLAGS)

.PHONY: all clean test
all: $(TARGET)
clean: rm -f $(OBJS) $(TARGET)
test: ./$(TEST_TARGET)

CMake

cmake_minimum_required(VERSION 3.10)
project(MyProject LANGUAGES C)
set(CMAKE_C_STANDARD 11)

add_compile_options(-Wall -Wextra -Wpedantic -Werror)
add_executable(${PROJECT_NAME} src/main.c src/core.c src/utils.c)
enable_testing()
add_test(NAME unit_tests COMMAND tests)

单元测试框架

#define TEST_CASE(name) static void test_##name(void)
#define RUN_TEST(name) do { printf("Running %s... ", #name); test_##name(); printf("PASSED\n"); } while (0)
#define ASSERT_TRUE(c) do { if (!(c)) { fprintf(stderr, "FAIL: %s:%d\n", __FILE__, __LINE__); exit(1); } } while (0)
#define ASSERT_EQUAL(a, b) ASSERT_TRUE((a) == (b))

原则

  • MUST 使用 -Wall -Wextra -Wpedantic
  • MUST 为 Release 使用 -O2 -DNDEBUG
  • MUST 编写单元测试

引用: @c-basics

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 61 lines · 0 tokens per session scan A 9cc065825fbf

Subscribe to this mod's changes

c-basics-practices is a cursor rule published in the GitHub repository wangqiqi/cursor-ai-rules (16 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 444 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.