Coding Guidelines
Language-specific coding conventions and environment expectations are maintained as standalone AGENTS.md files that you can drop directly into a project root for human contributors and coding agents.
Download AGENTS.md
| Language | Download | View Raw | Quick Fetch |
|---|---|---|---|
| C++ | Download AGENTS.md | View | curl -fsSL https://jifengwu2k.github.io/static/coding-guidelines/cpp/AGENTS.md -o AGENTS.md |
| Python | Download AGENTS.md | View | curl -fsSL https://jifengwu2k.github.io/static/coding-guidelines/python/AGENTS.md -o AGENTS.md |
| Shell | Download AGENTS.md | View | curl -fsSL https://jifengwu2k.github.io/static/coding-guidelines/shell/AGENTS.md -o AGENTS.md |
Overview by Language
C++
- Philosophy: Prioritize modularity, clarity, and accelerator portability (GPU/FPGA/HLS) over manual low-level hacks; treat C++ as a platform-level language with explicit POSIX + Itanium ABI expectations.
- Naming & Layout: 4-space indentation;
snake_casefor functions, variables, and filenames (.c,.m,.mm,.cpp,.h,.hpp);CamelCasewithout underscores for types/structs/classes;#ifndef FILENAME_EXTinclude guards. - Types & Idioms: Plain-data
structs vs. RAII resource-owningclasses; C++20 concepts (<concepts>,<ranges>) over inheritance;std::variantstate machines and coroutines over scattered flags; exceptions by default and fail-fast assertions.
Python
- Compatibility: Dual Python 2/3 and POSIX/NT support (
sys.version_info,posix-or-nt,%string formatting, PEP 484# type: ...type comments,six.with_metaclass, explicitobjectbase classes with__slots__). - System & Path Boundaries: Separate user-facing paths from canonical internal paths via
fspathverbs(nopathlib); avoidsubprocess,platform, andmultiprocessingin favor of focused cross-platform packages or PyQt/PySide. - Structure & Packaging: One file = one module = one purpose; preserve requested single-file shapes; publish general helpers as standalone PyPI packages instead of
utils.py; include copyright headers,README.md,requirements.txt,pyproject.toml, andsetup.cfg.
Shell
- POSIX String & Pipeline Idioms: Parameter expansion suffix stripping (
${s%%"$sep"*},${s%"$sep"*}),{ cmd1; cmd2; } | nextgrouping, andfind ... -print0 | xargs -0for arbitrary filenames. - Concurrency & Process Management: GNU
parallel(--ungroup,-j,--halt soon,fail=1,bash -c ::: ...),ps aux | grep ... | grep -v grep | awk '{print $2}'process cleanup, andcat ... | dd of=... status=progressstreaming. - CLI Parsing: Standard POSIX
getoptswith leading:optstrings (while getopts ':abc:d:' name).
Coding Guidelines
https://jifengwu2k.github.io/2025/09/28/Coding-Guidelines/