New advertisers: 50% off your first month with code FIRSTMONTHSee slots
bitwarden avatar

bitwarden-init

Generates Bitwarden-standard CLAUDE.md files for repository, workspace, and user scopes.

version
1.2.2
GitHub stars
165
View on GitHub

What it does

  • Adds /bitwarden-init:init, /bitwarden-init:enhance, /bitwarden-init:init-user, /bitwarden-init:init-workspace, and their enhance counterparts for user and workspace scopes
  • Runs a two-phase repo setup: Anthropic's /init analyzes the codebase, then /enhance restructures it into an 11-section project template
  • Shows a unified diff preview and requires an explicit Apply before writing, saving a timestamped .bak copy of any overwritten file
  • Designed for engineers setting up Claude Code across multiple locally cloned Bitwarden repositories

Initialize Claude Code configuration with Bitwarden's standardized template format

Add marketplace

/plugin marketplace add bitwarden/ai-plugins

Run it inside Claude Code once, then install the plugin below.

Install

/plugin install bitwarden-init@bitwarden-marketplace

Run it inside Claude Code after adding the marketplace.

Files

Discovered from source

Refresh an existing ~/.claude/CLAUDE.md by detecting which behavioral modules from the Bitwarden init template library are already present and offering to add the missing ones. Same safety guardrails as /bitwarden-init:init-user — backup before overwrite, diff preview, explicit Apply confirmation.

Prerequisites

~/.claude/CLAUDE.md must already exist. If it doesn't, stop and point the user at /bitwarden-init:init-user instead.

Steps

  1. Read existing file. Read ~/.claude/CLAUDE.md. If missing, exit with the message above.

  2. Detect installed modules. For each module in ${CLAUDE_PLUGIN_ROOT}/templates/user/, read its file and extract the top-level ## Heading. A module is considered "installed" if its exact heading (case-insensitive match on the first ## line) appears anywhere in the existing file.

    Build two lists:

    • Installed: modules whose heading is present.
    • Missing: modules whose heading is not present.
  3. Offer missing modules. Use AskUserQuestion with multiSelect: true showing only the missing modules. If the missing list is empty, tell the user all known modules are already present and exit cleanly. Each option's description should be the one-line summary (see /bitwarden-init:init-user for the full table).

  4. Render new content.

    • Start from the existing file content.
    • For each selected missing module, read ${CLAUDE_PLUGIN_ROOT}/templates/user/<slug>.md and append it to the end of the file, separated by a single blank line.
    • Do not modify any of the existing content. Do not reorder existing sections.
  5. Diff + confirm. Write the rendered content to a temp file. Run diff -u "$HOME/.claude/CLAUDE.md" <temp> and display. Use AskUserQuestion with Apply, Show diff again, Cancel.

  6. Backup, then write.

    • Copy the existing file to ~/.claude/CLAUDE.md.bak-$(date -u +%Y%m%dT%H%M%SZ).
    • Use Edit to update ~/.claude/CLAUDE.md with the full rendered content. (Write works as a fallback if Edit's old-string match fails for any reason — the file always exists at this point.)
    • Clean up the temp preview.
  7. Summary. Report which modules were added, the backup path, and a reminder to revisit any [YOUR-PREFERENCE] placeholders.

Notes

  • This command only adds modules. It never rewrites or removes existing content. If the user wants a from-scratch rebuild, they should use /bitwarden-init:init-user with the Replace option.
  • Preserve [YOUR-PREFERENCE] placeholders verbatim in any newly-added modules.

Readme

Bitwarden Init Plugin

Generates CLAUDE.md files at three scopes — repository, workspace, and user — using Bitwarden's templates.

What It Does

Claude Code reads CLAUDE.md files by walking up the directory tree from the current working directory and concatenating every file it finds. That makes three scopes useful:

ScopePathApplies to
User~/.claude/CLAUDE.mdEvery project, every conversation
Workspace<bw-source-root>/.claude/CLAUDE.mdEvery Bitwarden repo cloned under that root
Repository<repo>/CLAUDE.mdOne specific repo

This plugin has commands for all three.

Installation

/plugin install bitwarden-init@bitwarden-marketplace

Restart Claude Code after installation.

Commands

Repository scope

/bitwarden-init:init

Generates a new repository-level CLAUDE.md. Runs both phases automatically:

  1. Anthropic's /init analyzes the codebase.
  2. /enhance restructures and extends the output using the 11-section project template (see below).
/bitwarden-init:enhance

Enhances an existing repository-level CLAUDE.md. Reads the current file, performs supplementary codebase research, and reorganizes content into the 11 project sections.

User scope

/bitwarden-init:init-user

Walks you through a Q&A to assemble ~/.claude/CLAUDE.md from opt-in behavioral modules (intellectual honesty, simplicity, surgical changes, code-review mutation lockdown, …). The modules are a starting point assembled from one engineer's preferences — pick what fits you and edit freely.

/bitwarden-init:enhance-user

Detects which behavioral modules are already present in ~/.claude/CLAUDE.md and offers to append any that are missing.

Workspace scope

/bitwarden-init:init-workspace

Walks you through a Q&A to assemble <workspace-root>/.claude/CLAUDE.md for the folder where you keep all your locally-cloned Bitwarden repos. Auto-detects the workspace root by walking up from cwd looking for an ancestor with two or more sibling git repositories. Always asks for confirmation before writing. Modules include the zero-knowledge invariant, security principles P01–P06, core vocabulary, and operating defaults like worktrees and plan mode.

/bitwarden-init:enhance-workspace

Detects which Bitwarden domain modules are already present in the workspace-level file and offers to append any that are missing.

Safety guardrails for user / workspace scopes

Both new init and enhance flows for the user and workspace scopes:

  • Show a unified diff preview before any write.
  • Require an explicit Apply confirmation.
  • Create a timestamped *.bak-<ISO-timestamp> copy of the existing file before overwriting.
  • Surface the backup path in the success message.

Usage

Typical first-time setup, in order:

# 1. Set up your user-level CLAUDE.md (applies to every project)
/bitwarden-init:init-user

# 2. From any directory under the folder where you keep your cloned Bitwarden repos
/bitwarden-init:init-workspace

# 3. In each repo, set up the repo-level CLAUDE.md
/bitwarden-init:init

Later, to refresh a CLAUDE.md after the plugin adds new modules:

/bitwarden-init:enhance-user        # append any missing user-scope modules
/bitwarden-init:enhance-workspace   # append any missing workspace-scope modules
/bitwarden-init:enhance             # refresh a repo CLAUDE.md against the 11-section template

All four user/workspace commands open an interactive Q&A: pick the modules you want, review a unified diff against the existing file (if any), then confirm Apply. A timestamped *.bak-<...> is written before any overwrite.

Repository Template Structure

The generated CLAUDE.md includes these sections:

  • Overview - Project purpose, key concepts
  • Architecture & Patterns - System diagrams, code organization, implementation patterns
  • Development Guide - Step-by-step instructions with code templates
  • Data Models - Types, validation schemas, domain entities
  • Security & Configuration - Security rules, authentication, environment variables
  • Testing - Test structure, writing tests, running tests
  • Code Style & Standards - Formatting, naming conventions, pre-commit hooks
  • Anti-Patterns - DO/DON'T lists
  • Deployment - Build and deployment instructions
  • Troubleshooting - Common issues and solutions
  • References - Documentation links

Requirements

  • claude CLI in PATH
  • Write permissions for CLAUDE.md

Contributing

See CONTRIBUTING.md.

Changelog

See CHANGELOG.md.

License

See LICENSE.txt.

Details

Marketplace
bitwarden/ai-plugins
Source
plugins/bitwarden-init
Category
Community

More from bitwarden/ai-plugins

All 25

Similar to bitwarden-init

More Development Tools