bmad-init

bmad-init is a skill for Claude Code from UfoMiao/zcf. It costs 18 tokens per session (2,599 once invoked), scanned A, original, MIT.

A setup command for installing or updating BMad-Method V6 in a project. BMad-Method is a software-development workflow and its files are stored in project folders such as _bmad and _bmad-output.

In plain words
What is it for?
Use it to install BMad V6 in a new project or update an existing installation, remove legacy entries, fix the known output-folder issue, and update .gitignore.
Why use it?
It avoids manually checking old installations, repairing known installer output, and maintaining the related ignore-file entries by hand.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: reads .claude/ paths; mentions Claude Code.

About the project

ZCF is a command-line setup tool for configuring Claude Code and Codex with agents, instructions, skills, hooks, commands, and settings. It is for developers who want to install and personalize these coding-agent workflows through an interactive setup.

UfoMiao/zcf · 6,085 stars · on GitHub · zcf.ufomiao.com

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/ufomiao/zcf/bmad-init
Any agent
npx skills add UfoMiao/zcf --skill bmad-init
Clone the repo
git clone --depth 1 https://github.com/UfoMiao/zcf

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bmad-init

README.md
[![agentmods](https://agentmods.dev/badge/skills/ufomiao/zcf/bmad-init.svg)](https://agentmods.dev/skills/ufomiao/zcf/bmad-init)
Your own site
<a href="https://agentmods.dev/skills/ufomiao/zcf/bmad-init"><img src="https://agentmods.dev/badge/skills/ufomiao/zcf/bmad-init.svg" alt="Measured on agentmods" height="20"></a>
Per session 18 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,599 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.02599
Opus 5 $0.00009 $0.01300
Sonnet 5 $0.00004 $0.00520
Haiku 4.5 $0.00002 $0.00260

Measured 6d ago against content hash 2a4e10bb0c2e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

bmad-init scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

const { execSync } = require('node:child_process')
templates/skills/en/bmad-init/SKILL.md · 282 lines

How it starts

The opening of the file, as written. The whole thing — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/bmad-init Command

This command initializes or updates BMad-Method (V6) in your project.

When this command is invoked:

  1. Check if _bmad/ directory exists to determine if BMad V6 is already installed
  2. Check for legacy V4 installations (.bmad-core or .bmad-method directories)
  3. Fresh install executes: npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes
  4. Existing install executes: npx bmad-method install --directory . --action quick-update --yes
  5. Fix installer bug: rename {output_folder} to _bmad-output (Beta known issue)
  6. Automatically update .gitignore (remove V4 entries, add V6 entries)
  7. Display installation results and prompt user for next steps

Implementation

const { execSync } = require('node:child_process')
const fs = require('node:fs')
const path = require('node:path')

// Legacy entries to clean from .gitignore
const LEGACY_GITIGNORE_ENTRIES = [
  '.bmad-core',
  '.bmad-method',
  '.claude/commands/BMad',
  '{output_folder}',  // v6.0.0-Beta.8 bug artifact
]

// V6 .gitignore entries
const V6_GITIGNORE_ENTRIES = [
  '_bmad/',
  '_bmad-output/',
]

// Fix installer bug: {output_folder} not resolved to _bmad-output (v6.0.0-Beta.8)
function fixOutputFolderBug(cwd) {
  const buggyPath = path.join(cwd, '{output_folder}')
  const correctPath = path.join(cwd, '_bmad-output')

  if (!fs.existsSync(buggyPath)) return false

  if (!fs.existsSync(correctPath)) {
    // _bmad-output doesn't exist, simply rename
    fs.renameSync(buggyPath, correctPath)
    console.log('   ✅ {output_folder} → _bmad-output/ (renamed)')
  } else {
    // _bmad-output already exists, merge subdirectories then delete
    const entries = fs.readdirSync(buggyPath, { withFileTypes: true })
    for (const entry of entries) {
      const src = path.join(buggyPath, entry.name)
      const dest = path.join(correctPath, entry.name)
      if (!fs.existsSync(dest)) {
        fs.renameSync(src, dest)
        console.log(`   ✅ Moved ${entry.name} → _bmad-output/`)
      }
    }
    fs.rmSync(buggyPath, { recursive: true, force: true })
    console.log('   ✅ Removed redundant {output_folder}/')
  }
  return true
}

function updateGitignore(cwd) {
  const gitignorePath = path.join(cwd, '.gitignore')
  let content = ''
  let exists = false

  if (fs.existsSync(gitignorePath)) {
    content = fs.readFileSync(gitignorePath, 'utf8')
    exists = true
  }

  const lines = content.split('\n')
  let changed = false

  // Remove V4 legacy entries
  const filtered = lines.filter(line => {
    const trimmed = line.trim()
    const isLegacy = LEGACY_GITIGNORE_ENTRIES.some(entry =>
      trimmed === entry || trimmed === entry + '/' || trimmed === '/' + entry
    )
    if (isLegacy) {
      console.log(`   🗑️  Removing legacy entry: ${trimmed}`)
      changed = true
    }
    return !isLegacy
  })

  // Add V6 entries
  const newEntries = []
  for (const entry of V6_GITIGNORE_ENTRIES) {
    const entryBase = entry.replace(/\/$/, '')
    const alreadyExists = filtered.some(line => {
      const trimmed = line.trim()
      return trimmed === entry || trimmed === entryBase || trimmed === '/' + entryBase
    })
    if (!alreadyExists) {
      newEntries.push(entry)
      console.log(`   ✅ Adding new entry: ${entry}`)
      changed = true
    }
  }

  if (!changed) {
    console.log('   ℹ️  .gitignore is up to date, no changes needed')
    return
  }

  // Build new content
  let result = filtered.join('\n')

  if (newEntries.length > 0) {
    // Ensure trailing newline, then add BMad section
    if (result.length > 0 && !result.endsWith('\n')) {
      result += '\n'
    }
    result += '\n# BMad Method V6\n'
    result += newEntries.join('\n') + '\n'
  }

  fs.writeFileSync(gitignorePath, result, 'utf8')
  console.log(`   📝 .gitignore ${exists ? 'updated' : 'created'}`)
}

async function initBmad() {
  const cwd = process.cwd()
  const bmadV6Path = path.join(cwd, '_bmad')
  const legacyCorePath = path.join(cwd, '.bmad-core')
  const legacyMethodPath = path.join(cwd, '.bmad-method')

  // Check for legacy V4 installation
  const hasLegacyCore = fs.existsSync(legacyCorePath)
  const hasLegacyMethod = fs.existsSync(legacyMethodPath)

  if (hasLegacyCore || hasLegacyMethod) {
    console.log('⚠️  Legacy BMad V4 installation detected:')
    if (hasLegacyCore) console.log('   • .bmad-core/ (V4 core directory)')
    if (hasLegacyMethod) console.log('   • .bmad-method/ (V4 method directory)')
    console.log('')
    console.log('📌 The V6 installer will handle legacy migration automatically. Follow the prompts during installation.')
    console.log('   Details: https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/upgrade-to-v6')
    console.log('')
  }

  // Check if V6 is already installed
  const hasV6 = fs.existsSync(bmadV6Path)

  // Build non-interactive install command
  let installCmd
  if (hasV6) {
    console.log('🔄 Existing BMad V6 installation detected, performing quick update...')
    console.log('')
    installCmd = [
      'npx bmad-method install',
      '--directory .',
      '--action quick-update',
      '--yes',
    ].join(' ')
  } else {
    console.log('🚀 Initializing BMad-Method V6...')
    console.log('')
    installCmd = [
      'npx bmad-method install',
      '--directory .',
      '--modules bmm',
      '--tools claude-code',
      '--communication-language English',
      '--document-output-language English',
      '--yes',
    ].join(' ')
  }

  // Execute installation
  try {
    console.log(`📋 Executing: ${installCmd}`)
    console.log('')
    execSync(installCmd, {
      stdio: 'inherit',
      cwd: cwd,
      shell: true
    })

    console.log('')
    console.log('✅ BMad-Method V6 installation/update complete!')
    console.log('')
    console.log('═══════════════════════════════════════════════════════════════')
    console.log('📌 IMPORTANT: Please restart your AI IDE to load BMad extensions')
    console.log('═══════════════════════════════════════════════════════════════')
    console.log('')
    // Fix {output_folder} bug (v6.0.0-Beta.8)
    console.log('🔧 Checking for known installer issues...')
    try {
      const fixed = fixOutputFolderBug(cwd)
      if (!fixed) console.log('   ℹ️  No fixes needed')
    } catch (err) {
      console.log(`   ⚠️  Failed to fix {output_folder}: ${err.message}`)
      console.log('   Please manually rename {output_folder}/ to _bmad-output/')
    }
    console.log('')

    console.log('📂 V6 Directory Structure:')
    console.log('   • _bmad/          — agents, workflows, tasks, and configuration')
    console.log('   • _bmad-output/   — generated artifact output directory')
    console.log('')

    // Automatically update .gitignore
    console.log('🔧 Updating .gitignore...')
    try {
      updateGitignore(cwd)
    } catch (err) {
      console.log('   ⚠️  Failed to automatically update .gitignore, please manually add _bmad/ and _bmad-output/')
    }
    console.log('')
    console.log('🚀 Quick Start:')
    console.log('   1. Restart your AI IDE')
    console.log('   2. Run /bmad-help for guidance and next step suggestions')
    console.log('   3. Type /bmad and use autocomplete to browse available commands')
    console.log('')
    console.log('💡 Common Workflows:')
    console.log('   • /bmad-help                      — Interactive help')
    console.log('   • /bmad-bmm-create-prd             — Create Product Requirements Document')
    console.log('   • /bmad-bmm-create-architecture     — Create Architecture Document')
    console.log('   • /bmad-bmm-create-epics-and-stories — Create Epics and User Stories')
    console.log('   • /bmad-bmm-sprint-planning         — Initialize Sprint Planning')
    console.log('   • /bmad-bmm-dev-story               — Implement User Story')

    // Legacy V4 IDE command cleanup reminder
    const legacyClaudeAgents = path.join(cwd, '.claude', 'commands', 'BMad', 'agents')
    const legacyClaudeTasks = path.join(cwd, '.claude', 'commands', 'BMad', 'tasks')
    if (fs.existsSync(legacyClaudeAgents) || fs.existsSync(legacyClaudeTasks)) {
      console.log('')
      console.log('⚠️  Legacy V4 IDE commands detected, consider removing manually:')
      if (fs.existsSync(legacyClaudeAgents)) console.log('   • .claude/commands/BMad/agents/')
      if (fs.existsSync(legacyClaudeTasks)) console.log('   • .claude/commands/BMad/tasks/')
      console.log('   New V6 commands are installed under .claude/commands/bmad/')
    }
  }
  catch (error) {
    console.error('❌ Installation failed:', error.message)
    console.log('')
    console.log('🛠️  Manual Installation Guide:')
    console.log('   1. Ensure Node.js 20+ is installed')
    console.log('   2. Non-interactive install:')
    console.log('      npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yes')
    console.log('   3. Quick update existing installation:')
    console.log('      npx bmad-method install --directory . --action quick-update --yes')
    console.log('   4. Or interactive install:')
    console.log('      npx bmad-method install')
    console.log('')
    console.log('📖 Documentation:')
    console.log('   https://bmad-code-org.github.io/BMAD-METHOD/docs/how-to/install-bmad')
  }
}

// Execute initialization
initBmad()

Read the full file on GitHub · 282 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 282 lines · 18 tokens per session scan A 2a4e10bb0c2e

Subscribe to this mod's changes

bmad-init is a skill published in the GitHub repository UfoMiao/zcf (6,085 stars, last pushed 6d ago), licensed MIT. It adds 18 tokens to every session and 2,599 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

cli-forge-github

Audit and fix GitHub repository health: rulesets vs CI alignment, branch hygiene, PR lifecycle, release automation flow, permission issues, and transient CI failures. Detects misconfigurations that cause PRs to hang, CI to fail silently, branches to accumulate, and releases to stall. Use when the user says 'PR stuck'…

Destynova2/cli-code-skills · 165 tokens

cli-watermark

Steganographic code watermarking for IP defense. Generates multi-layered fingerprints that survive AI rewrites, language changes, renaming, and clean-code passes. Produces timestamped cryptographic commitments for legal proof of authorship. Use when the user wants to watermark a codebase, protect IP, prove code…

Destynova2/cli-code-skills · 140 tokens

cli-audit-data

Audit PostgreSQL database safety in Rust/SQLx applications. Use for schemas, migrations, constraints, indexes, transactions, repositories, state transitions, idempotency, concurrency, queues, multi-tenancy, soft deletion, ledgers, auditability, repair, database incidents, or whenever SQLx and PostgreSQL changes could…

Destynova2/cli-code-skills · 85 tokens

cli-audit-tangle

Detect spaghetti code and dependency cycles using graph theory, spectral analysis, and biomimetic patterns. Finds god functions, circular dependencies, dead code, suboptimal module boundaries, CI/CD pipeline deadlocks, and inefficient call patterns. Uses call graph topology (not just line-level metrics) to identify…

Destynova2/cli-code-skills · 220 tokens

cli-forge-doc

Generate and audit comprehensive project documentation from a Git repository. Produces standard documentation (CONTRIBUTING.md, architecture, troubleshooting) in Diataxis structure with zero AI markers by default. Use this skill whenever someone asks to document a project, generate docs, create a README, write API…

Destynova2/cli-code-skills · 104 tokens

cli-forge-resilience

Generate a production-parity resilience blueprint: test battery, troubleshooting runbook, agent-ready operations pack, failure-injection plan, and incident blackbox templates. Uses biological and physical reasoning — genome/contracts, membranes/boundary conditions, homeostasis/health checks, immune system/negative…

Destynova2/cli-code-skills · 152 tokens