java/src/main/resources/targets/claude/skills/core/plan/x-adr-generate/SKILL.md
Automates ADR generation from architecture plan mini-ADRs: extracts inline decisions, expands to full ADR format, assigns sequential numbering, updates the ADR index, and adds cross-references.
npx skillsauth add edercnj/ia-dev-environment x-adr-generateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Automates the generation of Architecture Decision Records (ADRs) from mini-ADRs embedded in architecture plans. Extracts inline decisions, expands them to full ADR format using a standard template, assigns sequential numbering, updates the ADR index, and inserts cross-references between stories, architecture plans, and ADRs.
/x-adr-generate [architecture-plan-path] [story-id] — extract mini-ADRs from the specified architecture plan and generate full ADR filesx-arch-plan has produced an architecture plan containing ### ADR: markersadr/ directory needs to be populated or updated with new decisions| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| architecture-plan-path | String | Yes | Path to the architecture plan file (e.g., plans/architecture-plan-STORY-0004-0006.md) |
| story-id | String | Yes | Story identifier for cross-referencing (e.g., story-0004-0006) |
The skill reads mini-ADRs embedded in architecture plan documents. Each mini-ADR follows this structure:
### ADR: [Title of the Decision]
- **Context:** Description of the problem or situation requiring a decision.
- **Decision:** The architectural decision that was made.
- **Rationale:** Justification for why this decision was chosen over alternatives.
The four fields of a mini-ADR are:
| Field | Required | Description | |-------|----------|-------------| | title | Yes | Short descriptive title of the architectural decision | | context | Yes | Problem statement or situation that prompted the decision | | decision | Yes | The specific decision that was made | | rationale | Yes | Justification explaining why this decision was chosen |
Each mini-ADR is expanded into a full ADR file with YAML frontmatter and structured sections:
---
status: Accepted
date: YYYY-MM-DD
story-ref: story-XXXX-YYYY
deciders: AI-assisted (via x-adr-generate)
---
# ADR-NNNN: Title of the Decision
## Status
Accepted — YYYY-MM-DD
## Context
Expanded description of the problem or situation requiring a decision.
Provides background information and the forces at play.
## Decision
The architectural decision that was made, described in full detail.
## Consequences
### Positive
- Benefit 1 derived from this decision
- Benefit 2 derived from this decision
### Negative
- Trade-off or downside 1
- Trade-off or downside 2
### Neutral
- Observation that is neither positive nor negative
The output ADR frontmatter fields are:
| Field | Value | Description |
|-------|-------|-------------|
| status | Accepted | Initial status for auto-generated ADRs |
| date | Current date (YYYY-MM-DD) | Date of ADR generation |
| story-ref | Story ID from argument | Cross-reference to originating story |
| deciders | AI-assisted (via x-adr-generate) | Attribution |
The output ADR sections are:
| Section | Source |
|---------|--------|
| Status | Set to Accepted with generation date |
| Context | Expanded from mini-ADR context field |
| Decision | Expanded from mini-ADR decision field |
| Consequences | Inferred from mini-ADR rationale field, split into Positive/Negative/Neutral |
{architecture-plan-path}### ADR: markers to identify mini-ADRs# Example: search for mini-ADR markers
grep -n "### ADR:" {architecture-plan-path}
adr/0003 from ADR-0003-use-postgresql.md)max + 1adr/ is empty or does not exist, start from ADR-0001# Example: find max ADR number
ls adr/ADR-*.md 2>/dev/null | sort -t'-' -k2 -n | tail -1
For each mini-ADR, before creating a new ADR file:
adr/WARNING: Duplicate ADR detected for "[title]", skipping — existing ADR found at adr/ADR-NNNN-*.md
For each non-duplicate mini-ADR:
ADR-0001 format)status, date, story-ref, deciders## Status section: Accepted — {date}## Context section: expanded from mini-ADR context## Decision section: expanded from mini-ADR decision## Consequences section: inferred from rationale, split into Positive/Negative/Neutraladr/ directory exists (create if needed)adr/ADR-NNNN-title-in-kebab-case.mdadr/README.md (create if it does not exist)# Architecture Decision Records
| ADR | Title | Status | Date |
|-----|-------|--------|------|
| [ADR-NNNN](ADR-NNNN-title-in-kebab-case.md) | Title of the Decision | Accepted | YYYY-MM-DD |
story-ref: {story-id} is present### ADR: marker that was processed, add a reference:
> Generated: [ADR-NNNN](../../adr/ADR-NNNN-title-in-kebab-case.md)
The sequential numbering algorithm ensures globally unique ADR identifiers:
Glob to find all files matching adr/ADR-*.mdADR-0003-*.md yields 3)max + 1ADR-NNNN format, e.g., ADR-0004)ADR-0001adr/
ADR-0001-use-postgresql.md
ADR-0002-adopt-hexagonal-arch.md
ADR-0003-event-driven-comms.md
-> Next: ADR-0004
Before creating each ADR, check for existing ADRs with similar titles:
Duplicate ADR detected, skipping: "[original title]"This prevents accidental overwriting of manually curated ADRs and avoids redundant documentation.
Cross-references create bidirectional traceability between stories, architecture plans, and ADRs:
Each generated ADR includes a story-ref field in its YAML frontmatter:
story-ref: story-0004-0006
The Context section of each ADR references the originating story and architecture plan:
This decision was identified during the architecture planning phase for story-0004-0006.
After processing, the architecture plan is updated with links to generated ADRs:
### ADR: Use PostgreSQL for Persistence
- **Context:** ...
- **Decision:** ...
- **Rationale:** ...
> Generated: [ADR-0004](../../adr/ADR-0004-use-postgresql-for-persistence.md)
If a service architecture document exists with a Section 7 (ADR references), update it with links to newly generated ADRs.
The ADR index at adr/README.md serves as the master list of all ADRs:
adr/README.md (or create if missing)| ADR | header row)| [ADR-NNNN](ADR-NNNN-title-in-kebab-case.md) | Title | Accepted | YYYY-MM-DD |
### ADR: Use PostgreSQL for Persistence
- **Context:** The system requires a relational database for transactional data with ACID guarantees. The team has experience with PostgreSQL and it supports JSON columns for semi-structured data.
- **Decision:** Use PostgreSQL 15+ as the primary relational database for all transactional persistence.
- **Rationale:** PostgreSQL provides strong ACID compliance, excellent JSON support via jsonb columns, mature tooling, and the team has operational experience. Alternatives like MySQL lack native JSON indexing; NoSQL options like MongoDB sacrifice transactional consistency.
File: adr/ADR-0004-use-postgresql-for-persistence.md
---
status: Accepted
date: 2024-01-15
story-ref: story-0004-0006
deciders: AI-assisted (via x-adr-generate)
---
# ADR-0004: Use PostgreSQL for Persistence
## Status
Accepted — 2024-01-15
## Context
The system requires a relational database for transactional data with ACID guarantees. The team has experience with PostgreSQL and it supports JSON columns for semi-structured data.
This decision was identified during the architecture planning phase for story-0004-0006.
## Decision
Use PostgreSQL 15+ as the primary relational database for all transactional persistence.
## Consequences
### Positive
- Strong ACID compliance ensures data integrity for transactional workloads
- Native jsonb column support enables flexible schema for semi-structured data
- Mature ecosystem with excellent tooling (pgAdmin, pg_dump, extensions)
- Team has existing operational experience, reducing ramp-up time
### Negative
- Vertical scaling limits may require sharding for very high write throughput
- Operational overhead for managing replication and backups
- Less suitable for graph-like query patterns compared to specialized databases
### Neutral
- Requires standard database migration tooling (Flyway, Liquibase, or similar)
- Connection pooling (e.g., PgBouncer) recommended for high-concurrency scenarios
| [ADR-0004](ADR-0004-use-postgresql-for-persistence.md) | Use PostgreSQL for Persistence | Accepted | 2024-01-15 |
### ADR: Use PostgreSQL for Persistence
- **Context:** The system requires a relational database...
- **Decision:** Use PostgreSQL 15+...
- **Rationale:** PostgreSQL provides strong ACID compliance...
> Generated: [ADR-0004](../../adr/ADR-0004-use-postgresql-for-persistence.md)
| Scenario | Action |
|----------|--------|
| Architecture plan file not found | Report error with path and exit |
| No ### ADR: markers found | Report "No mini-ADRs found in plan" and exit cleanly |
| Duplicate ADR title detected | Emit warning, skip the duplicate, continue processing remaining |
| adr/ directory does not exist | Create it automatically |
| adr/README.md does not exist | Create it with table header |
| Write failure | Report error with file path and reason |
| Skill | Relationship | Context |
|-------|-------------|---------|
| x-arch-plan | called-by | Prerequisite: generates the architecture plan with inline mini-ADRs |
| x-arch-update | calls | Updates service architecture document Section 7 with new ADR references |
| x-story-implement | called-by | Invoked during documentation phase to formalize architectural decisions |
testing
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.
tools
Generates a Picocli @Command with subcommands, options, converters, and unit tests.
testing
Scaffolds a Micronaut service with @Controller, DI, health, Dockerfile, and tests.
testing
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.