Skip to content

Latest commit

Β 

History

138 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Doctrine Style Guide

Doctrine Style Guide

Version: 2.11.0 | Changelog | AGENTS.md

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Canonical style guide for all projects. Vendored from Google Style Guides with project-specific tooling and conventions. Each tool was selected as the best available option for its ecosystem as of September 2026, reviewed quarterly.

All projects MUST follow:

See versioning guide for details.


Language Guides

Every category is indexed in guides/README.md.

Language Guide Upstream
Overview guides/languages/README.md β€”
Python guides/languages/python.md Google
Ruby guides/languages/ruby.md Community
Go guides/languages/go.md Google
Rust guides/languages/rust.md Official
Rust: topic index guides/languages/rust/README.md Official
Rust: Rust API Design guides/languages/rust/api-design.md Official
Rust: Async Runtimes guides/languages/rust/async.md Official
Rust: Cargo Features guides/languages/rust/features.md Official
Rust: Procedural Macros guides/languages/rust/macros.md Official
Rust: Rust Testing Tools guides/languages/rust/testing.md Official
Rust: Rust Testing Scenarios guides/languages/rust/testing-scenarios.md Official
Rust: Unsafe Rust guides/languages/rust/unsafe.md Official
Rust: WebAssembly guides/languages/rust/wasm.md Official
Rust: CI Pipeline guides/languages/rust/ci.md Official
Rust: Dependencies and Supply Chain guides/languages/rust/dependencies.md Official
Rust: Tested Version Matrix guides/languages/rust/versions.md Official
TypeScript guides/languages/typescript.md Google
C# guides/languages/csharp.md Google
.NET guides/languages/dotnet.md Microsoft
SQL guides/languages/sql.md Community
Shell guides/languages/shell.md Google
CSS guides/languages/css.md Google

Framework Guides

Framework Guide Language
Overview guides/frameworks/README.md β€”
Axum guides/frameworks/axum.md Rust
Django guides/frameworks/django.md Python
FastAPI guides/frameworks/fastapi.md Python
Flask guides/frameworks/flask.md Python
Gin guides/frameworks/gin.md Go
Hanami guides/frameworks/hanami.md Ruby
Next.js guides/frameworks/nextjs.md TypeScript
Rails guides/frameworks/rails.md Ruby
React guides/frameworks/react.md TypeScript
Sinatra guides/frameworks/sinatra.md Ruby
Strawberry guides/frameworks/strawberry.md Python (GraphQL)
Tailwind CSS guides/frameworks/tailwind.md CSS

AI-Assisted Development

Topic Guide Description
Overview guides/ai/README.md When and how to use AI assistance
AI Workflows guides/ai/ai-workflows.md Hero Flow, TDD, Visual Iteration
Claude guides/ai/claude.md Anthropic Claude best practices
OpenAI guides/ai/openai.md OpenAI GPT and Codex best practices
Gemini guides/ai/gemini.md Google Gemini best practices
Claude Code guides/ai/claude-code.md CLI config: hooks, agents, commands
Code Agents guides/ai/code-agents.md 8 agents: review, perf, a11y, API
Security Agents guides/ai/security-agents.md 16 agents: threat modeling, compliance
System Agents guides/ai/system-agents.md 14 agents: Docker, Ansible, networking
Release Manager guides/ai/release-manager-agent.md Release automation and quality gates
Local LLMs guides/ai/local-llms.md Ollama, vLLM, Docker Model Runner
AGENTS.md guides/ai/agents-md.md Project instruction files
Security guides/ai/security.md LLM security considerations

API Design Guides

Protocol Guide Description
Overview guides/api/README.md API design index
GraphQL guides/api/graphql.md Schema design, queries, mutations, security
REST guides/api/rest.md Resources, HTTP methods, status codes, pagination

Process Guides

Topic Guide
Overview guides/process/README.md
Testing guides/process/testing.md
Versioning guides/process/versioning.md
CI/CD guides/process/ci.md
GitHub Templates guides/process/github-templates.md

Design Guides

Topic Guide Description
Overview guides/design/README.md Design principles and process
Design Systems guides/design/design-systems.md Tokens, typography, color, spacing
Components guides/design/components.md Reusable component patterns
Accessibility guides/design/accessibility.md WCAG compliance and inclusive design
Motion guides/design/motion.md Animation and interaction feedback

Infrastructure Guides

Topic Guide
Overview guides/infrastructure/README.md
Operating Systems
Fundamentals guides/infrastructure/os/README.md
Linux (Debian) guides/infrastructure/os/linux.md
Services
Services Overview guides/infrastructure/services/README.md
SSH guides/infrastructure/services/ssh.md
NTP guides/infrastructure/services/ntp.md
DNS guides/infrastructure/services/dns.md
Firewall (nftables) guides/infrastructure/services/nftables.md
Logging guides/infrastructure/services/logging.md
Infrastructure as Code
Ansible guides/infrastructure/ansible.md
Docker guides/infrastructure/docker.md

Documentation

Topic Guide
Overview guides/docs/README.md
Markdown guides/docs/markdown.md
Specifications guides/docs/specifications.md

What Each Language Guide Covers

Every language guide MUST include:

Category Topics
Code Quality Lint, Format, Type Check, Semantic Analysis, Dead Code
Testing Unit, Integration, E2E, Acceptance, Performance
Advanced Testing Thread Safety, Idempotence, Reliability, Compatibility
Specialized i18n/UTF-8, Data Integrity, A/B Testing, Feature Flags
Dependencies Package Manager, Lock Files, Vulnerability Scanning

Quick Reference: Tooling by Language

Language Lint Format Type Check Coverage Fuzz
Python Ruff Ruff Mypy, Pyright pytest-cov Hypothesis
Ruby StandardRB StandardRB Sorbet SimpleCov -
Go golangci-lint gofmt built-in go test -cover native
Rust Clippy rustfmt built-in cargo-tarpaulin cargo-fuzz
C# Roslynator dotnet format built-in coverlet SharpFuzz
TypeScript Biome Biome built-in c8 -
SQL SQLFluff SQLFluff - - -
Shell shellcheck shfmt - bashcov -
CSS Stylelint Prettier - - -

Tool Selection Rationale

Python: Ruff

Ruff is a Python linter and formatter written in Rust, 10-100x faster than alternatives. It replaces Flake8, isort, Black, and many other tools with a single binary. Combined with uv for package management, this is the modern Python toolchain.

Ruby: StandardRB

StandardRB provides zero-config linting built on RuboCop. It eliminates bikeshedding debates and provides sensible defaults. For teams needing custom rules, use RuboCop directly with StandardRB's config as a base.

Go: golangci-lint

golangci-lint is a meta-linter aggregating 120+ linters including Staticcheck, gosec, and govet. It is 5x faster than running linters separately and is the de facto standard used by Kubernetes, Prometheus, and Terraform.

Rust: Clippy + rustfmt

Clippy is the official Rust linter with 750+ lints. rustfmt is the official formatter. Both are included with the Rust toolchain. No alternatives come close.

C#/.NET: Roslynator + dotnet format

Roslynator provides 500+ analyzers and refactorings. dotnet format (built into .NET SDK 6+) handles formatting via EditorConfig. Add SonarAnalyzer.CSharp for security analysis.

TypeScript: Biome

Biome is 20x faster than ESLint+Prettier and combines linting and formatting. For legacy projects or those needing extensive plugin ecosystems, ESLint remains viable.

SQL: SQLFluff

SQLFluff is the most popular SQL linter, supporting PostgreSQL, MySQL, SQLite, and 20+ dialects. It parses SQL to catch syntax issues and auto-fixes most problems.


Configuration Files

Ready-to-copy configuration files:

Config Path Purpose
Agents agents/ 53 agents across 6 families
Commands commands/ 18 slash commands (/code, /security, ...)
Ansible configs/ansible/ Ansible configuration templates
AGENTS.md configs/agents/AGENTS.md.template AI assistant context
Claude Code configs/claude/ Hooks, settings, MCP config
EditorConfig configs/editorconfig/.editorconfig Editor settings
Pre-commit configs/pre-commit/.pre-commit-config.yaml Git hooks
Prettier configs/prettier/.prettierrc Code formatting
Doctrine Sync .github/workflows/sync-doctrine.yml Auto-sync configs to projects

Reference material

reference/ holds third-party guides vendored verbatim for offline reading and comparison. Doctrine does not modify them; report problems upstream. Google style guides are licensed under CC-BY 3.0.

Vendored file Upstream project
reference/airbnb/css-in-javascript.md airbnb/javascript
reference/airbnb/javascript.md airbnb/javascript
reference/airbnb/react.md airbnb/javascript
reference/airbnb/ruby.md airbnb/ruby
reference/google/csharp.md google/styleguide
reference/google/go-best-practices.md google/styleguide
reference/google/go-decisions.md google/styleguide
reference/google/go.md google/styleguide
reference/google/htmlcss.html google/styleguide
reference/google/javascript.html google/styleguide
reference/google/json.xml google/styleguide
reference/google/markdown.md google/styleguide
reference/google/python.md google/styleguide
reference/google/shell.md google/styleguide
reference/google/typescript.html google/styleguide
reference/holywell/sql.md treffynnon/sqlstyle.guide
reference/ietf/rfc2119.txt IETF RFC 2119
reference/rubocop/rails.adoc rubocop/rails-style-guide
reference/rubocop/ruby.adoc rubocop/ruby-style-guide
reference/shopify/ruby.md Shopify/ruby-style-guide
reference/uber/go.md uber-go/guide

Three directories are indexed rather than listed file by file:

Directory Contents Provenance
reference/ietf/ RFC 2119 plus a Doctrine-written index reference/ietf/README.md
reference/rust/ Rust API Guidelines plus a Doctrine 2024 supplement reference/rust/README.md
reference/security/ Security corpora (MITRE, OWASP, NIST, CIS, CWE, KEV) reference/security/manifest.json records the upstream, version and licence of every source

Licence

Doctrine's own guides, configuration files and agent definitions are licensed under the MIT Licence, Copyright (c) 2026 Alex Howells.

Everything under reference/ is third-party material and is NOT covered by that grant. Each vendored source keeps its own licence:

  • THIRD_PARTY_NOTICES.md records every source, its licence and licence URL, what Doctrine changed, and the attribution that MUST travel with the material.
  • Licence texts sit next to the material they cover, in reference/<vendor>/LICENSE* and reference/security/LICENSES/.
  • Machine-readable licence fields for the security data are in reference/security/manifest.json.

Two sources restrict commercial use and MUST be excluded from commercial redistribution unless permission is obtained: the CIS Critical Security Controls in reference/security/cis/ (CC BY-NC-ND 4.0, no derivatives) and the JA4+ variant material in reference/security/fingerprints/ (FoxIO License 1.1, non-commercial). reference/holywell/ is CC BY-SA 4.0 and carries a ShareAlike obligation.

CODE_OF_CONDUCT.md is adapted from the Contributor Covenant 3.0 and is licensed under CC BY-SA 4.0, not MIT.

About

Doctrine πŸ‘©πŸΌβ€πŸ’» Tech Style Guide | Attempting to keep code, documentation and our approach to technical projects consistent. Useful for AI-assisted πŸ€– development, just instruct Claude, Gemini and Codex to check they complied with Doctrine!

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages