with one click
bmad-init
Initialize or update BMad-Method (V6) in your project
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Initialize or update BMad-Method (V6) in your project
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Professional AI programming assistant with structured workflow (Research -> Ideate -> Plan -> Execute -> Optimize -> Review) for developers
ไธไธAI็ผ็จๅฉๆ๏ผๆไพ็ปๆๅๅ ญ้ถๆฎตๅผๅๅทฅไฝๆต๏ผ็ ็ฉถโๆๆโ่ฎกๅโๆง่กโไผๅโ่ฏๅฎก๏ผ๏ผ้็จไบไธไธๅผๅ่
Quickly add a new corporate sponsor to ZCF โ sponsor list by default, with optional API preset and documentation ad placements
Create pull request based on current branch changes
Automate version release and code commit using changeset
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
| name | bmad-init |
| description | Initialize or update BMad-Method (V6) in your project |
| disable-model-invocation | true |
This command initializes or updates BMad-Method (V6) in your project.
_bmad/ directory exists to determine if BMad V6 is already installed.bmad-core or .bmad-method directories)npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yesnpx bmad-method install --directory . --action quick-update --yes{output_folder} to _bmad-output (Beta known issue).gitignore (remove V4 entries, add V6 entries)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()
Simply type in Claude Code:
/bmad-init
This command will:
npx bmad-method install --directory . --modules bmm --tools claude-code --communication-language English --document-output-language English --yesnpx bmad-method install --directory . --action quick-update --yes{output_folder} โ _bmad-output installer bug.gitignore (clean up legacy entries, add V6 entries)