En esta guía (7 elementos)
Guidelines Overview
Knowledge Base — Table of Contents
MANDATORY FOR ALL AI AGENTS: You MUST read and follow every guide listed below IN ORDER before generating any code. Each guide contains binding architectural rules. Violations of hexagonal architecture boundaries are NOT acceptable. When creating new project resources (README, LICENSE, etc.), you MUST follow resources.md exactly. Failure to comply will produce code that is architecturally invalid.
Project-agnostic: these guidelines describe patterns, not a specific project. Code samples use placeholder package
com.example.platformand service nameplatform-service. Replace with your project’s actual values when applying patterns.
Below is the table of contents for this knowledge base. Follow the sections in order.
Important: Do not move these guidelines to the project root folder.
For Developers
-
Resources (MANDATORY FIRST STEP)
- YOU MUST generate all project resource files listed in this guide before writing any code.
- Overview of helpful links, tools, and reference materials.
- Open: Resources
-
Domain-Driven Design (DDD)
- Building blocks: entities, value objects, aggregates, domain services, domain events.
- Bounded contexts and ubiquitous language.
- Open: DDD
-
Hexagonal Architecture
- Ports and adapters, layer placement rules, dependency direction.
- Transactional Outbox Pattern.
- Chain of Responsibility Pattern.
- Architecture testing with ArchUnit.
- Cross-cutting concerns.
- Open: Hexagonal Architecture
-
Architectural Decision Records (ADR)
- When to write ADRs and what counts as architecturally significant.
- MADR (default), Nygard, Y-Statement, ISO 42010 templates.
- Status lifecycle (proposed → accepted → deprecated → superseded).
- Naming, repo layout (
docs/adr/), review checklist. - Hexagonal tie-ins (ports, adapters, transactions, outbox).
- Open: ADR
-
Clean Code Principles
- Clean code practices for hexagonal Kotlin/Java services.
- Transaction abstraction patterns (Transaction port over
@Transactional). - Open: Clean Code
-
Kotlin Code Style
- Conventions, formatting rules, best practices.
data classvsclass,lateinitvs nullable,fun interface, extension functions for mappers.- Kotlin-specific anti-patterns.
- Open: Kotlin Code Style
-
Java Code Style
- Conventions, formatting rules, best practices.
recordvsclass,@FunctionalInterface, null safety (@Nullable/@NonNull), mapper patterns.- Java-specific anti-patterns.
- Open: Java Code Style
-
Spring Boot
- Spring Boot patterns for hexagonal architecture.
- Configuration strategies, transaction management, Spring Data JDBC, Kafka, Redis, Async, Scheduler.
- Testing with Testcontainers and ArchUnit.
- Open: Spring Boot
8b. application.yml Standard
- Hard rules, canonical block order,
${VAR:default}policy, profile documents. - Secret store (Parameter Store / OpenBao), effective precedence, relaxed binding.
- Actuator hardening, test
application.yml,@ConfigurationPropertiesas the contract, anti-patterns + pre-merge checklist. - Open: application.yml
-
Eclipse Vert.x
- Reactive layered N-tier + event-driven style (descriptive, not hexagonal).
- Verticles + EventBus, Future API composition, worker offload, dual store (Pg/Mongo).
- Testing with vertx-junit5 + Testcontainers; Shadow fat jar; Java 17 / Vert.x 4.x.
- Open: Eclipse Vert.x
-
Testing Strategy
- Unit testing in Domain and Application layers.
- Integration testing with Karate DSL and Testcontainers.
- Architecture testing with ArchUnit (concrete examples).
- TDD workflow for hexagonal architecture.
- Open: Testing
-
Observability (OTEL / Micrometer)
- Index + three-pillars overview.
- Themed sub-files:
obs-metrics.md,obs-tracing.md,obs-logging.md,obs-recipes.md(dashboards, alerting, step-by-step). - Custom metrics via decorator pattern, OTEL tracing automatic via Micrometer bridge, structured logs with trace correlation.
- Open: Observability
-
Gradle Build System
- Versions + bump policy (Java 21, Boot 4.0, Gradle 9.0, Kotlin optional 2.x).
- Compiler config (Java + Kotlin), multi-module hexagonal layout, BootJar pattern.
- Plugins: Spotless (Java + Kotlin), JaCoCo (per-module + aggregated + log table), SonarQube, Detekt (Kotlin), PlantUML, Structurizr C4.
- Module naming: entry points, driven adapters,
<provider>-adapterpattern (one per third-party). - SDK publishing:
maven-publish+ GitHub Packages +compileOnlySpring deps + Javadoc/Sources jars + SemVer. - BOM management (Spring Boot + Spring Cloud + AWS + Jackson + JUnit + Testcontainers).
- Repository strategy, resolution strategy with
because(), custom tasks,gradle.propertiesconventions. - Open: Gradle
-
Liquibase Migrations
- Iron rule: never modify a committed changeset (checksum break = deploy abort).
- Fix-forward with new changesets, not back-edits.
- Environment-specific seeds via preconditions (single changelog, no test/prod fork).
- Emergency escape hatches:
clearCheckSums,validCheckSum ANY(rare). - Open: Liquibase
-
Security
- STRIDE threat-model baseline, AuthN/AuthZ (OAuth2/OIDC/JWT/mTLS), Current User Port.
- Secrets management, input validation, injection prevention, cryptography defaults.
- Logging/PII rules, rate limiting/DoS, CORS/CSRF, audit trail via outbox.
- Multi-tenant isolation (RLS + app filter), container hardening, compliance hooks.
- Security testing matrix + pre-merge checklist.
- Open: Security
-
Keycloak & Identity
- Specializes Security for Keycloak: two topologies (gateway-first trusted-headers vs per-service resource server) — decision matrix + ADR trigger.
- Realm/client/role setup as code,
platform-{role}→ROLE_{ROLE}convention. JwtAuthenticationConverterforrealm_access+resource_access; trusted-header filter; Current User Port adapter per topology.- Dedicated auth microservice (
KeycloakServiceport + Admin API adapter), grant-flow selection matrix, service-to-service tokens. - Multi-tenancy models,
testcontainers-keycloak, anti-patterns + checklist. - Open: Keycloak
-
API Design
- REST conventions: resource modeling, URL/method/status matrix, JSON shape.
- Versioning (URL path default), error envelope (RFC 9457 Problem Details, obsoletes RFC 7807).
- Pagination (cursor default), filtering/sorting/sparse fieldsets.
- Idempotency-Key, caching/ETags/optimistic concurrency, rate-limit headers.
- Async/long-running, bulk, file upload/download, webhooks, HATEOAS guidance.
- OpenAPI contract-first, deprecation lifecycle, anti-patterns, pre-merge checklist.
- Open: API Design
-
Messaging
- Broker selection matrix (RabbitMQ / Kafka / SQS+SNS).
- Canonical
EventMessage<T>envelope (Header + Body) with auto-injectedorigin. - Transactional Outbox (write side reliability) + claim-based dispatch + ShedLock per-service.
- Retry/backoff/DLT, idempotent consumers, schema evolution + coexistence.
- Topology externalization (no
@Bean Queue/Exchange/Binding/NewTopic). - RabbitMQ + Kafka specifics, tracing propagation, choreography vs orchestration.
- Reference impl:
codehuntersio-sdk-event-messaging. - Open: Messaging
-
API Gateway
- Tier responsibilities (CDN/WAF → gateway → service mesh → service).
- Gateway selection matrix (KrakenD / Kong / SCG / AWS APIGW / Apigee).
- KrakenD canonical reference: Flexible Configuration template, per-concern settings split, env-override pattern, Go custom plugins (.so).
- Edge AuthN (JWT via JWKS) + claims-to-headers forwarding + skip-paths.
- Edge rate limiting, CORS, W3C Trace Context propagation (with legacy
Trace-Idfallback). - mTLS to backends, aggregation patterns (thin client / thick gateway), edge caching, service discovery.
- Observability (metrics, JSON logs, OTEL spans), deployment, 16 anti-patterns + checklist.
- Open: API Gateway
-
GitOps + ArgoCD
- OpenGitOps principles (declarative, versioned, pulled, continuously reconciled).
- CI/CD boundary: CI builds + writes commit; ArgoCD applies. CI never holds cluster credentials.
- Repo topology (split app + GitOps, env folders), bootstrap, App-of-Apps + ApplicationSet (matrix, PR-preview, cluster generators).
- Sync policies (auto + prune + self-heal), sync waves, hooks (PreSync DB migration, PostSync smoke).
- Multi-env with Kustomize, Helm only for third-party charts (pinned versions, OCI).
- Promotion strategy (folder copy default, tag-based via Image Updater, Kargo/argo-promotion).
- Secrets management (Sealed Secrets / External Secrets Operator / SOPS) — never plaintext in Git.
- Progressive delivery (Argo Rollouts canary + AnalysisTemplate via Prometheus).
- Drift detection, notifications, custom Lua health checks, multi-cluster hub-spoke, DR runbook.
- 20 anti-patterns + pre-merge checklist.
- Open: GitOps + ArgoCD
-
GitHub Actions CI/CD
- Reusable workflows (
workflow_call): typed inputs/secrets/outputs; thin per-repo callers. - Pipeline orchestration (
uses+needs), gating, main vs PR pipelines, concurrency. - SemVer from conventional commits, automated tag + release.
- Security gates (dependency review, secret scan, OWASP, Qodana/Sonar), least-privilege permissions, OIDC deploys.
- Branch + tag rulesets as code, CODEOWNERS, action pinning.
- Open: GitHub Actions
- Reusable workflows (
-
Git Workflow & Best Practices
- Conventional commits (enforced by commit-lint), atomic commits, branching model.
- Pull requests (squash, linear history, 2 approvals), rebase discipline, history immutability.
- Secret hygiene,
.gitignore, signing, local hooks. - Open: Git Workflow
For Mobile Developers
Sections 22-27 apply to React Native / Expo apps. They are the mobile counterparts of the JVM guides above: same architectural rules, different language and adapters. Do not apply the JVM sections literally to a mobile codebase, and do not apply these to a backend service.
-
Mobile Architecture (Hexagonal in React Native)
- When hexagonal is warranted vs Feature-Sliced Design; decision matrix.
- Layer placement rules, folder layout, ports, adapters, decorators, DI container.
- Parse-don’t-validate at every boundary (HTTP, storage, deep links, push).
- Offline + local outbox, monorepo layout, ESLint boundary enforcement (the ArchUnit equivalent).
- Companion commands:
/mobile-init-project,/mobile-scaffold-feature,/mobile-add-usecase,/mobile-add-adapter. - Open: Mobile Architecture
-
React Native
- Runtime baseline (New Architecture), Expo-by-default and when bare RN needs an ADR.
- Library selection matrix, Expo Router, HTTP client, environment/variants.
- Server state vs client state — TanStack Query vs Zustand, the most common mistake.
- Performance: lists, re-renders, animation, startup, profiling.
- Open: React Native
-
TypeScript Code Style
- Strict compiler flags,
typevsinterface, immutability, branded types. - Discriminated-union domain errors,
Result<T, E>overthrow, banned constructs. - Open: TypeScript Code Style
- Strict compiler flags,
-
Mobile Testing Strategy
- Pyramid mapped to layers; fakes over mocks; determinism via
Clock/IdGenerator. - Jest/Vitest, React Native Testing Library, MSW, Maestro E2E, coverage gates.
- Companion command:
/mobile-add-test. - Open: Mobile Testing
- Pyramid mapped to layers; fakes over mocks; determinism via
-
Mobile UI
- Styling engine selection (Unistyles / NativeWind / Tamagui) and why a component kit fights a custom identity.
- Design tokens (two-tier), theming and dark mode, component tiers.
- The four screen states, accessibility gates, i18n, layout, interaction, motion.
- Companion commands:
/mobile-init-project,/mobile-add-screen. - Open: Mobile UI
26b. Tailwind CSS v4 (web + mobile)
- v4 mental model:
@themenamespaces, notailwind.config.js; namespace shadowing (max-w-*broken). @sourcein a monorepo, verify-don’t-assume probe recipe, class-based dark mode.- Adopting a paid component kit (Tailwind Plus / Catalyst), Module Federation,
opacity-*contrast trap. - Open: Tailwind CSS
- Mobile Security & Release
- Security: the attacker owns the device; SecureStore vs MMKV, no secrets in the bundle, PKCE, deep links as an unauthenticated entry point, pinning, logging.
- Release: EAS Build/Submit,
runtimeVersionfingerprint policy, OTA limits and store policy, gradual rollout, crash-free sessions, rollback asymmetry. - Open: Mobile Security · Mobile Release
For Architects
- Architecture Document Specification
- 21 mandatory sections (C4, ADR portfolio, STRIDE, NFR, event catalog, risk register).
- Format-agnostic structural contract.
- Open: Arch Doc Spec
28b. Functional Specification (anatomy)
- Anatomy of a module functional spec: metadata, identifier guide, scope + out-of-scope.
- Stable identifiers (letter suffixes, never renumber), verifiable acceptance criteria.
- Traceability matrix with
Origin / Source; responsibility matrix (requests / validates / approves). - Assumptions (
S-) vs blockers (B-). - Open: Functional Spec
28c. Specification Traceability (external spec → code)
- When the functional spec comes from outside: prove criterion by criterion what is met.
- Coverage matrix, verdicts including covered but inert; six audit rules.
- Version delta with five buckets; gaps with owner — the input to task breakdown.
- Open: Spec Traceability
-
Diagram Catalog
- Mermaid, PlantUML, Structurizr conventions.
- Architecture overview, data flows, module structure, pattern catalog.
- Themed sub-files: arch-overview.md, ports-and-commands.md, data-flows.md, patterns-catalog.md, c4-diagrams.md (package, runtime, outbox event flow), best-practices.md (per-layer rules, roadmap, troubleshooting).
- Open: Diagrams
-
LaTeX Architecture Docs (board-grade PDF)
- When to use LaTeX vs Markdown/HTML.
- Tectonic / TeX Live / Pandoc bridge.
- Used by
/arch-doc --format=latexfor ARB, audit, regulator submissions. - Open: LaTeX Architecture Docs
For AI Assistants
- Claude Code Guide
- Index + required-reading order + workflow routing.
- Themed sub-files:
ccg-domain-and-ports.md(Steps 1-3),ccg-adapters-and-wiring.md(Steps 4-5),ccg-bugfix-and-testing.md,ccg-reference.md(common tasks, anti-patterns, checklists). - Companion command + agent index (
/arch-scaffold,/arch-otel,/arch-review, etc.). - Open: Claude Code Guide
31b. AI-Native SDLC (spine — read before the two below)
- Artifact chain
intent.md → spec.md → plan.md → diff → PR → production → intent.md. - Stage-by-stage map of what exists here vs what is missing; where each control belongs.
- Process metrics (leading / lagging), the Maintain loop (
bands.yaml),REVIEW.mdpolicy, roadmap. - Open: AI-Native SDLC
31c. Evals
- Regression tests for agent configuration:
CLAUDE.md, rules, skills, hooks. - Case format, runner (
~/.claude/evals/run.sh), CI gate, incident→eval rule, starter battery. - Open: Evals
31d. Hooks
- Build hooks vs deploy approval gates; the three control tiers and when to escalate.
- Current inventory classified, open gaps (attribution gate, control-path protection), governance.
- Open: Hooks
Project Automation
- Get Shit Done (GSD)
- Pipeline: new-project → spec → discuss → plan → execute → verify → ship.
- 33 specialized agents with wave-based parallelization.
- 67 skills across 6 namespaces (workflow / review / project / context / ideate / manage).
- Modes: interactive, semi-auto, quick, fast, autonomous, manager, ultraplan, MVP.
- Lifecycle: project → milestone → phase → plan → task (atomic commits).
- Quality gates: code-review, secure-phase, eval-review, ui-review, validate-phase, audit-uat/milestone.
- Codebase intel: map-codebase, graphify, docs-update, extract-learnings, ingest-docs.
- Open: GSD Guide
Reading Order
For New Team Members:
- Resources — verify all project files exist.
- DDD — understand domain concepts.
- Hexagonal Architecture — layer structure and patterns.
- ADR — how decisions are recorded.
- Clean Code — coding principles.
- Kotlin Code Style or Java Code Style per language.
- Spring Boot — framework integration; application.yml for the config file itself.
- Testing — quality assurance patterns.
- Observability — monitoring and tracing.
- Gradle — build configuration.
- Liquibase — migration discipline.
- Security — STRIDE, AuthN/Z, secrets, validation, injection, crypto, logging, audit, compliance.
- Keycloak — Keycloak topologies (gateway-first vs resource server), role mapping, auth microservice, grant flows, testing.
- API Design — REST conventions, versioning, error envelope, pagination, idempotency, OpenAPI contract-first.
- Messaging — transactional outbox, broker selection, envelope, idempotent consumers, schema evolution.
- API Gateway — KrakenD reference, edge auth/rate-limit/trace-context, mTLS to backends.
- GitOps + ArgoCD — declarative cluster state, Application/AppProject/ApplicationSet, secrets, progressive delivery.
For AI Assistants (Claude Code, Junie, Copilot, Cursor):
- Resources — verify resource files; create missing ones.
- Hexagonal Architecture — hexagonal structure.
- 2-bis. If the feature publishes events, consumes messages, or touches the outbox, read Messaging BEFORE the messaging section of hexagonal-architecture.md. Messaging is the source of truth for outbox-first; hexagonal-architecture.md defers to it.
- Scan
docs/adr/for accepted ADRs that constrain the change; ADR before authoring a new one. - Claude Code Guide — code generation patterns.
- Observability — metrics and tracing patterns.
- Liquibase — before any DB change.
- Security — before any endpoint, consumer, or sensitive code change.
- Keycloak — before wiring Keycloak auth, resource-server config, role mapping, or the auth microservice.
- API Design — before adding or modifying any REST endpoint.
- Messaging — full reference: outbox, envelope, claim-based dispatch, retry, idempotency, schema evolution. Reference impl:
codehuntersio-sdk-event-messaging. - API Gateway — before changing edge config, route table, JWT skip-paths, or trace propagation.
- GitOps + ArgoCD — before adding/modifying any Kubernetes manifest, Application, ApplicationSet, image tag, or sync policy.
- Reference Kotlin Code Style, Java Code Style, Clean Code, Testing as needed.
For Mobile (React Native / Expo):
- Mobile Architecture — decide hexagonal vs FSD first, then layer placement.
- TypeScript Code Style — strict flags, branded types,
Resultoverthrow. - React Native — Expo setup, library matrix, server vs client state.
- Mobile UI — tokens, four screen states, accessibility.
- Mobile Testing — before writing the feature, not after.
- Mobile Security — before any storage, auth, or deep-link work.
- Mobile Release — before the first build, not before the first release.
- ADR — architecture, library and offline-strategy choices are all ADRs.
For Architects (board deliverable): 0. Functional Spec / Spec Traceability — when the module spec exists (or arrives from outside) before any architecture work.
- Arch Doc Spec — 21 mandatory sections.
- Diagrams — diagram conventions.
- LaTeX Architecture Docs — PDF generation toolchain.
- ADR — decision portfolio.
Quick Reference
| Need | Doc |
|---|---|
| Hexagonal patterns | hexagonal-architecture.md |
| Decision capture (MADR/Nygard/Y-Statement) | adr.md |
| Coding standards | clean-code.md |
| Kotlin syntax | kotlin-code-style.md |
| Java syntax | java-code-style.md |
| Spring configuration | spring-boot.md |
application.yml (block order, profiles, secret store, actuator) | application-yml.md |
| Vert.x reactive service | vertx.md |
| Observability & metrics | observability.md |
| Testing strategy | testing.md |
| Build tools | gradle.md |
| Migration discipline | liquibase.md |
| Security baseline (STRIDE, AuthN/Z, secrets, crypto, audit, compliance) | security.md |
| Keycloak & identity (topologies, role mapping, auth microservice, grant flows) | keycloak.md |
| REST API design (versioning, errors, pagination, idempotency, OpenAPI) | api-design.md |
| Messaging (outbox, brokers, envelope, idempotency, schema evolution) | messaging.md |
| API Gateway (KrakenD, edge auth, rate-limit, W3C trace context) | api-gateway.md |
| GitOps + ArgoCD (Application/AppProject/ApplicationSet, secrets, Argo Rollouts, DR) | gitops-argocd.md |
| GitHub Actions CI/CD (reusable workflows, semver, rulesets) | github-actions.md |
| Git workflow (conventional commits, branching, PRs) | git-workflow.md |
| W3C Trace Context spec + propagation matrix | obs-tracing.md §Trace Context |
| Architecture document (21 sections) | arch-doc-spec.md |
| Functional spec anatomy, identifier conventions | spec-funcional.md |
| External spec → code traceability, criterion audit | spec-trazabilidad.md |
| Diagram catalog | diagrams.md |
| Outbox event flow / runtime component diagrams | c4-diagrams.md |
| Board-grade PDF (LaTeX/Tectonic/Pandoc) | latex-architecture-docs.md |
| Mobile hexagonal architecture (RN) | mobile-architecture.md |
| React Native / Expo integration | react-native.md |
| TypeScript syntax | typescript-code-style.md |
| Mobile testing (Jest, RNTL, Maestro) | mobile-testing.md |
| Mobile UI (styling engine, tokens, screen states, a11y, i18n) | mobile-ui.md |
| Mobile security (SecureStore, PKCE, deep links) | mobile-security.md |
| Mobile release (EAS, runtimeVersion, OTA) | mobile-release.md |
Tailwind v4 (@theme, @source, dark mode, component kits) | tailwind.md |
| AI-native SDLC (artifact chain, process metrics) | ai-sdlc.md |
| Evals for agent config | evals.md |
| Hooks and approval gates | hooks.md |
| GSD project automation | gsd-guide.md |