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_case for functions, variables, and filenames (.c, .m, .mm, .cpp, .h, .hpp); CamelCase without underscores for types/structs/classes; #ifndef FILENAME_EXT include guards.
  • Types & Idioms: Plain-data structs vs. RAII resource-owning classes; C++20 concepts (<concepts>, <ranges>) over inheritance; std::variant state 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, explicit object base classes with __slots__).
  • System & Path Boundaries: Separate user-facing paths from canonical internal paths via fspathverbs (no pathlib); avoid subprocess, platform, and multiprocessing in 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, and setup.cfg.

Shell

  • POSIX String & Pipeline Idioms: Parameter expansion suffix stripping (${s%%"$sep"*}, ${s%"$sep"*}), { cmd1; cmd2; } | next grouping, and find ... -print0 | xargs -0 for 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, and cat ... | dd of=... status=progress streaming.
  • CLI Parsing: Standard POSIX getopts with leading : optstrings (while getopts ':abc:d:' name).

Coding Guidelines
https://jifengwu2k.github.io/2025/09/28/Coding-Guidelines/
Author
Jifeng Wu
Posted on
September 28, 2025
Licensed under