Home/Tools/@tpmjs/tools-decision-record-adr

decisionRecordADRTool

@tpmjs/tools-decision-record-adr

Create an Architecture Decision Record (ADR) from structured input. Follows the standard ADR format with title, status, context, decision, and consequences. Useful for documenting important technical and architectural decisions.

Official
documentation
v0.2.0
MIT

Interactive Playground

Test @tpmjs/tools-decision-record-adr (decisionRecordADRTool) with AI-powered execution

0/2000 characters

Installation & Usage

Install this tool and use it with the AI SDK

1. Install the package

npm install @tpmjs/tools-decision-record-adr
pnpm add @tpmjs/tools-decision-record-adr
yarn add @tpmjs/tools-decision-record-adr
bun add @tpmjs/tools-decision-record-adr
deno add npm:@tpmjs/tools-decision-record-adr

2. Import the tool

import { decisionRecordADRTool } from '@tpmjs/tools-decision-record-adr';

3. Use with AI SDK

import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { decisionRecordADRTool } from '@tpmjs/tools-decision-record-adr';

const result = await generateText({
  model: openai('gpt-4o'),
  tools: { decisionRecordADRTool },
  prompt: 'Your prompt here...',
});

console.log(result.text);

Parameters

Available configuration options

Auto-extracted
title
Required
Type: string

Title of the decision (e.g., "Use PostgreSQL for primary database")

context
Required
Type: string

Context and background information that led to this decision. What forces are at play?

decision
Required
Type: string

The decision that was made. What are we going to do?

consequences
Required
Type: array

Array of consequences (both positive and negative). What becomes easier or harder?

Schema extracted: 1/1/2026, 8:17:58 AM

README

@tpmjs/tools-decision-record-adr

Create Architecture Decision Records (ADR) from structured input following industry standards.

Installation

npm install @tpmjs/tools-decision-record-adr

Usage

import { decisionRecordADRTool } from '@tpmjs/tools-decision-record-adr';

const result = await decisionRecordADRTool.execute({
  title: 'Use PostgreSQL for primary database',
  context: `We need to choose a database for our new application. Requirements include:
    ACID compliance, strong consistency, support for complex queries, and good TypeScript integration.
    Team has experience with both SQL and NoSQL databases.`,
  decision: `We will use PostgreSQL as our primary database with Prisma as the ORM.
    This provides strong typing, migrations, and excellent developer experience.`,
  consequences: [
    'Better type safety with Prisma client',
    'Strong consistency guarantees for critical data',
    'Team needs to learn Prisma migrations',
    'Increased complexity for horizontal scaling',
    'Excellent JSON support for flexible schemas',
  ],
});

console.log(result.adr);
// # Use PostgreSQL for primary database
//
// **Status:** Accepted
//
// **Date:** 2025-12-31
//
// **Filename:** `use-postgresql-for-primary-database.md`
//
// ## Context
//
// We need to choose a database for our new application...
//
// ## Decision
//
// We will use PostgreSQL as our primary database...
//
// ## Consequences
//
// ### Positive
//
// - Better type safety with Prisma client
// - Strong consistency guarantees for critical data
// - Excellent JSON support for flexible schemas
//
// ### Negative
//
// - Team needs to learn Prisma migrations
// - Increased complexity for horizontal scaling

console.log(result.date);   // '2025-12-31'
console.log(result.status); // 'Accepted'

API

decisionRecordADRTool.execute(input)

Creates an Architecture Decision Record (ADR) following the standard template.

Input

  • title (string, required): Title of the decision
  • context (string, required): Context and background for the decision
  • decision (string, required): The decision that was made
  • consequences (string[], required): Array of consequences (positive and negative)

Output

Returns a Promise<DecisionRecord> with:

  • adr (string): The formatted ADR in markdown
  • date (string): Date the ADR was created (YYYY-MM-DD)
  • status (string): Status of the decision (default: "Accepted")

Features

  • Standard ADR format: Follows the widely-used ADR template structure
  • Smart categorization: Automatically categorizes consequences as positive, negative, or neutral
  • Filename generation: Creates a URL-friendly filename from the title
  • Markdown output: Returns clean, readable markdown ready for version control
  • Date stamping: Automatically includes creation date

ADR Structure

The tool generates ADRs with this structure:

  1. Title: Clear, concise decision statement
  2. Status: Decision status (Accepted, Proposed, Deprecated, Superseded)
  3. Date: When the decision was made
  4. Context: Background and forces leading to the decision
  5. Decision: What was decided
  6. Consequences: Categorized outcomes (positive, negative, other)

Use Cases

  • Document architectural decisions in software projects
  • Track technical choices and rationale over time
  • Share decision context with team members
  • Create decision history for future reference
  • Support onboarding with decision background

Best Practices

  • Write context focusing on why the decision was needed
  • State the decision clearly and unambiguously
  • List both positive and negative consequences
  • Include trade-offs and alternatives considered
  • Version control ADRs alongside code

License

MIT

Statistics

Downloads/month

0

Quality Score

0%

Bundle Size

NPM Keywords

tpmjs
documentation
ai
adr
architecture
decision-record

Maintainers

thomasdavis(thomasalwyndavis@gmail.com)

Frameworks

vercel-ai