Skip to content

deznode/coding-standards

Repository files navigation

🇬🇧 English · 🇨🇻 Portugues

Deznode Coding Standards

Deznode Coding Standards

Coding standards, tooling configurations, and development workflows for deznode projects. This repository provides reusable documentation, configuration templates, and Claude Code rules for bootstrapping new projects.

Tech Stack Covered

Layer Technologies
Backend Kotlin, Spring Boot 4, Spring Modulith 2.0, PostgreSQL, Flyway, Testcontainers
Frontend Next.js 16, React 19, TypeScript, Tailwind CSS 4, Zustand
Mobile Kotlin Multiplatform, Jetpack Compose, SQLDelight, Koin, Ktor
Tooling Taskfile v3, Lefthook, ESLint, Prettier, ktlint, detekt, EditorConfig
Infrastructure Docker, Docker Compose, Terraform

Repository Structure

coding-standards/
├── docs/                          # Standalone reference documentation
│   ├── backend/
│   │   └── 01-architecture.md     # Spring Modulith architecture patterns
│   ├── frontend/
│   │   └── 01-architecture.md     # Next.js App Router architecture
│   ├── mobile/
│   │   └── 01-architecture.md     # KMP module layout and DDD for mobile
│   ├── tooling/
│   │   ├── 01-linting-formatting.md   # ESLint, Prettier, ktlint, detekt
│   │   ├── 02-git-hooks.md            # Lefthook pre-commit hooks
│   │   ├── 03-task-runner.md          # Taskfile v3 setup
│   │   └── 04-editor-config.md        # EditorConfig settings
│   ├── git/
│   │   └── 01-workflow.md         # Commits, branches, PRs
│   └── testing/
│       └── 01-strategy.md         # Testing philosophy and tiers
├── templates/
│   ├── claude-rules/              # Claude Code rules (.claude/rules/)
│   │   ├── backend/               # Backend-specific rules
│   │   ├── frontend/              # Frontend-specific rules
│   │   ├── mobile/                # Mobile/KMP-specific rules
│   │   └── infrastructure/        # Infrastructure rules
│   ├── configs/                   # Configuration file templates
│   └── claude-hooks/              # Claude Code hooks (.claude/hooks/)
├── skills/                        # Claude Code plugin skill
│   └── coding-standards/          # Bootstrap, update, audit skill
├── .claude-plugin/
│   └── plugin.json                # Plugin manifest
└── README.md                      # This file

How to Use

Standalone Documentation (docs/)

Read these files for context and reference when working on any deznode project. Each document is self-contained and covers a specific concern (architecture, tooling, testing, git workflow).

Claude Rules Templates (templates/claude-rules/)

Copy into a new project's .claude/rules/ directory to give Claude Code project-specific knowledge:

cp -r templates/claude-rules/* /path/to/project/.claude/rules/

Configuration Templates (templates/configs/)

Copy and adapt configuration files for new projects:

cp templates/configs/.editorconfig /path/to/project/
cp templates/configs/lefthook.yml /path/to/project/
cp templates/configs/Taskfile.yml /path/to/project/

Review and adjust paths, project names, and tool versions after copying.

Claude Hooks (templates/claude-hooks/)

Copy into a new project's .claude/hooks/ directory and configure in .claude/settings.json:

cp -r templates/claude-hooks/* /path/to/project/.claude/hooks/

Claude Code Plugin (Recommended)

This repo is a Claude Code plugin with an automated skill for bootstrapping, updating, and auditing projects.

Installation

From the target project directory:

# Add this repo as a plugin marketplace
/plugin marketplace add /path/to/coding-standards

# Install the plugin
/plugin install coding-standards@coding-standards

Usage

The skill triggers automatically when you mention "coding standards", "bootstrap rules", "update rules", or "audit standards". Or invoke directly:

/coding-standards:coding-standards

Three Operations

  1. Bootstrap -- First-time setup: detects your ecosystem (JVM/Node.js/KMP), copies relevant rules, configs, and hooks with path customization
  2. Update -- Syncs existing project with latest templates: shows diffs, lets you select which updates to apply
  3. Audit -- Read-only compliance check: scores your project against current standards, reports missing or outdated files

The skill is ecosystem-aware: JVM projects get backend rules, Node.js projects get frontend rules, KMP/Android projects get mobile rules, full-stack projects get everything.


Quick Start: Manual Bootstrapping

If you prefer to copy templates manually instead of using the plugin:

  1. Create the project repository and clone it locally.

  2. Clone this repo alongside your project:

    git clone https://github.com/deznode/coding-standards.git
  3. Copy editor and tooling configs:

    cp coding-standards/templates/configs/.editorconfig .
    cp coding-standards/templates/configs/lefthook.yml .
    cp coding-standards/templates/configs/Taskfile.yml .
  4. Set up Claude Code rules:

    mkdir -p .claude/rules
    cp -r coding-standards/templates/claude-rules/* .claude/rules/
  5. Set up Claude Code hooks:

    mkdir -p .claude/hooks
    cp -r coding-standards/templates/claude-hooks/* .claude/hooks/
  6. Install git hooks:

    lefthook install
  7. Customize: Edit copied files to match your project's directory structure, module names, and tool versions.

  8. Reference the docs: Use docs/ as a living reference for architecture decisions, coding patterns, and workflow conventions.

Documentation Index

Backend

Document Description
Architecture Spring Modulith module layout, DDD patterns, event-driven communication
API Design ApiResult wrappers, controllers, HTTP patterns, validation
Kotlin Conventions Jackson 3.x, kotlin-logging, transactions, naming conventions
Database Patterns Flyway migrations, entities, UUID keys, JSONB, full-text search
Security JWT authentication, authorization, rate limiting
Testing Integration tests, MockMvc, MockK, Testcontainers, test fixtures
Error Handling Sealed exception hierarchies, ProblemDetail (RFC 9457), ordered @ControllerAdvice

Frontend

Document Description
Architecture Next.js App Router, server components, client islands, caching
Component Patterns forwardRef, clsx, loading states, import organization
State Management Zustand, TanStack Query, query key factories, Zod schemas
Styling 3-tier token architecture, dark mode, Tailwind CSS 4
API Client Factory pattern, serverApi, client hooks, dual data fetching
Performance Waterfalls, bundle size, server-side optimization, Suspense

Mobile (Android/KMP)

Document Description
Architecture KMP module layout, source sets, DDD for mobile
Build Configuration Convention plugins, version catalogs, Gradle config
Compose Patterns Route/Screen split, state management, navigation, performance
Kotlin Conventions Expect/actual, Koin DI, kotlinx-serialization, Ktor
Offline First SQLDelight, sync strategies, outbox, conflict resolution
Testing Testing pyramid, Compose tests, Flow tests, screenshot tests
Quality Tooling Detekt, ktlint, Kover, ArchUnit for mobile

Tooling

Document Description
Linting and Formatting ESLint, Prettier, ktlint, detekt configuration
Git Hooks Lefthook pre-commit hook setup
Task Runner Taskfile v3 standard tasks
Editor Config EditorConfig cross-editor settings

Workflow & Quality

Document Description
Git Workflow Conventional commits, branching, PR process
Testing Strategy Testing philosophy, tiers, and commands

Templates

Directory Description
Claude Rules Claude Code rule files for .claude/rules/
Config Templates Reusable configuration files
Claude Hooks Claude Code hook scripts

Rule Severity Levels

Rules in the documentation use three severity levels to set expectations:

Level Meaning Enforcement
MUST Non-negotiable. Violations block PRs. Automated (linter, CI gate, pre-commit hook)
SHOULD Strong recommendation. Follow unless you have a documented reason not to. Code review
MAY Team preference. Use judgment based on context. Informational

Rules enforced by tooling (formatters, linters, CI) have near-100% compliance. Focus human attention on architecture, security, and correctness decisions.

Exceptions

Deviating from a standard is acceptable when:

  1. The rule doesn't apply to the specific context (e.g., a prototype, spike, or proof-of-concept).
  2. Following the rule would introduce worse problems (performance, readability, or maintainability).
  3. The rule conflicts with a third-party library or framework constraint.

How to document an exception:

  • Add an inline comment explaining the deviation: // Exception: [reason]
  • For architectural deviations, record an ADR (Architecture Decision Record).
  • If the same exception recurs across multiple files, propose a rule change instead.

Contributing to the Standard

These standards are living documents. To propose a change:

  1. Open a PR against this repository with the proposed change.
  2. Include rationale — explain what problem the change solves or what improvement it brings.
  3. Reference evidence — link to incidents, code review discussions, or industry practices that support the change.
  4. Allow review time — changes affect all projects. Give the team at least one week to comment.

Changes that remove rules require the same rigor as adding them. Document why the rule is no longer needed.

Review Cadence

Review this standard quarterly to:

  • Remove rules that no longer provide value.
  • Add rules based on recurring bugs, code review friction, or new tooling.
  • Update version references (Spring Boot, Next.js, Tailwind, etc.) as the stack evolves.
  • Incorporate feedback from developers using the standard.

About

Coding standards, tooling configs, and development workflows for deznode projects (Kotlin/Spring Boot + Next.js/React)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors