/bmad-init
Initialize or update BMad-Method (V6) in your project
$ npx -y skills add UfoMiao/zcf --skill bmad-init --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/bmad-init
Context preview
The summary Claude sees to decide when to auto-load this skill.
Initialize or update BMad-Method (V6) in your project
SKILL.md
bmad-init.SKILL.mdname: bmad-init
description: Initialize or update BMad-Method (V6) in your project
disable-model-invocation: true
/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.lRead more
name: bmad-init description: Initialize or update BMad-Method (V6) in your project disable-model-invocation: true
/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.lRepo: UfoMiao/zcf
Other skills on zcf.
- /zcf-add-sponsor
Quickly add a new corporate sponsor to ZCF — sponsor list by default, with optional API preset and documentation ad placements
Open skill - /zcf-pr
Create pull request based on current branch changes
Open skill - /zcf-release
Automate version release and code commit using changeset
Open skill - /zcf-update-docs
Automatically check code changes since last tag and update documentation in docs/ directory (en, zh-CN, ja-JP) and CLAUDE.md to ensure consistency with actual code implementation
Open skill - /feat
Add New Feature
Open skill - /git-clean-branches
Safely find and clean up merged or stale Git branches with dry-run mode and custom base/protected branches support
Open skill

