Skip to content

Instantly share code, notes, and snippets.

@bater
Last active September 9, 2025 15:59
Show Gist options
  • Save bater/1f360ca9b80e4e9da60b5aa1cf90d98a to your computer and use it in GitHub Desktop.
Save bater/1f360ca9b80e4e9da60b5aa1cf90d98a to your computer and use it in GitHub Desktop.
agents.md

Purpose

This file defines coding style and design preferences for all AI Coding Agents (e.g., Gemini, Claude Code, Copilot).

Goal: produce code that is clear to humans and consistent for machines.

General Principles

  • Code must be readable by humans and regular for machines.
  • Prefer clarity over cleverness.
  • Naming must be explicit, avoid metaphors or hidden meaning.
  • Consistency is more important than abstraction depth.
  • Every layer of abstraction must provide clear value.
  • Documentation (docstrings, comments) must capture purpose and usage, not just repetition.
  • Avoid unnecessary duplication, but also avoid over-abstraction that hides logic.
  • Always provide type hints and structured metadata (docstrings, schema).
  • Specs and requirements must be preserved in code as structured reference (comments or annotations).
  • Treat code as a shared medium between humans and AI; prefer explicitness over style.

Practical Rules

  • Always generate consistent formatting (follow language community conventions).
  • Use docstrings + type hints for all public functions, classes, and modules.
  • Keep function length moderate; split if exceeding ~50 lines.
  • Avoid one-letter or context-free variable names.
  • Keep imports explicit; avoid import *.
  • Write comments for why, not for what.
  • Avoid hidden "clever" tricks; prefer straightforward implementations.
  • Prefer deterministic and reproducible outputs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment