Skip to content

existential-birds/beagle / plugins/beagle-analysis/skills/adr-writing

adr-writing

Verified

Use when writing or formatting an ADR document using the MADR template, applying Definition of Done (E.C.A.D.R.) criteria, or verifying ADR completeness. Triggers on "write the ADR", "format as MADR", "check ADR quality", "mark gaps in ADR". Also triggers when a decision has been extracted and needs to become a document. Does NOT extract decisions from conversations (use adr-decision-extraction) or orchestrate the full extract-confirm-write workflow (use write-adr).

FileKindSize
SKILL.mdskill md7.2 KB
references/definition-of-done.mdmarkdown3.5 KB
references/madr-template.mdmarkdown4.2 KB
scripts/next_adr_number.pyexecutablescript3.1 KB

scripts/next_adr_number.py

View on GitHub
#!/usr/bin/env python3
"""Get the next ADR sequence number.

Scans docs/adrs/ for existing ADRs and returns the next available number.

Usage:
    python scripts/next_adr_number.py
    python scripts/next_adr_number.py --dir /path/to/docs/adrs
    python scripts/next_adr_number.py --count 3  # Pre-allocate 3 numbers for parallel writes
"""

import argparse
import re
import sys
from pathlib import Path


def find_adr_directory() -> Path:
    """Find the ADR directory by searching up from cwd."""
    candidates = [
        Path("docs/adrs"),
        Path("docs/adr"),
        Path("adr"),
        Path("adrs"),
        Path("doc/adr"),
        Path("doc/adrs"),
    ]

    # Search from current directory
    cwd = Path.cwd()
    for candidate in candidates:
        if (cwd / candidate).is_dir():
            return cwd / candidate

    # Search up to git root
    git_root = cwd
    while git_root != git_root.parent:
        if (git_root / ".git").exists():
            break
        git_root = git_root.parent

    for candidate in candidates:
        if (git_root / candidate).is_dir():
            return git_root / candidate

    return cwd / "docs/adrs"


def get_existing_numbers(adr_dir: Path) -> list[int]:
    """Extract ADR numbers from filenames in the directory."""
    pattern = re.compile(r"^(\d{4})-.*\.md$")
    numbers = []

    if not adr_dir.exists():
        return numbers

    for file in adr_dir.iterdir():
        if file.is_file():
            match = pattern.match(file.name)
            if match:
                numbers.append(int(match.group(1)))

    return sorted(numbers)


def next_number(existing: list[int]) -> int:
    """Calculate the next ADR number."""
    if not existing:
        return 1
    return max(existing) + 1


def format_number(num: int) -> str:
    """Format number as zero-padded 4-digit string."""
    return f"{num:04d}"


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Get the next ADR sequence number"
    )
    parser.add_argument(
        "--dir",
        type=Path,
        help="ADR directory (auto-detected if not specified)",
    )
    parser.add_argument(
        "--list",
        action="store_true",
        help="List existing ADR numbers",
    )
    parser.add_argument(
        "--count",
        type=int,
        default=1,
        help="Number of sequential ADR numbers to allocate (for parallel writes)",
    )
    args = parser.parse_args()

    adr_dir = args.dir or find_adr_directory()
    existing = get_existing_numbers(adr_dir)

    if args.list:
        if existing:
            print(f"ADR directory: {adr_dir}")
            print(f"Existing ADRs: {[format_number(n) for n in existing]}")
        else:
            print(f"No ADRs found in {adr_dir}")
        return 0

    next_num = next_number(existing)

    if args.count == 1:
        print(format_number(next_num))
    else:
        # Output multiple numbers, one per line, for parallel allocation
        allocated = [format_number(next_num + i) for i in range(args.count)]
        print("\n".join(allocated))

    return 0


if __name__ == "__main__":
    sys.exit(main())
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall