feat: initial release of BMAD Skills for Claude Code

BMAD Skills for Claude Code - v1.0.0

This repository provides a comprehensive implementation of the BMAD Method
for Claude Code using native Claude Code features.

Features:
- 7 comprehensive skills (BMAD, security, Python, JS/TS, DevOps, testing, Git)
- 5 slash commands (/bmad-init, /bmad-prd, /bmad-arch, /bmad-story, /bmad-assess)
- Memory integration for context preservation
- Auto-detection and intelligent suggestions
- Todo tracking for stories
- Hooks for project-level automation
- One-command installation

Credits:
- BMAD Method™ by BMAD Code Organization
- Implementation for Claude Code by contributors

All BMAD methodology credit belongs to the BMAD Code Organization.
See: https://github.com/bmad-code-org/BMAD-METHOD
This commit is contained in:
aj-geddes
2025-10-25 03:53:21 -05:00
commit e219cfc94e
20 changed files with 9567 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
# OS files
.DS_Store
Thumbs.db
# Editor files
.vscode/
.idea/
*.swp
*.swo
*~
# Logs
*.log
# Temporary files
*.tmp
*.bak
+391
View File
@@ -0,0 +1,391 @@
# BMAD Code Skill System - Complete Deployment Guide
## 🎉 System Complete!
The BMAD Code Skill system is now fully built and ready for deployment. This guide covers everything you need to install and use the complete system.
## 📦 What We Built
### Core System Files
1. **CLAUDE.md v2.0** (1,250 tokens, down from 3,500)
- Refactored global system prompt
- BMAD detection as first priority
- Language-agnostic approach
- References modular skill files
- Location: `~/.claude/CLAUDE.md`
2. **BMAD-METHOD-SKILL.md** (800 lines)
- Complete BMAD methodology enforcement
- All 6 agent roles (Analyst, PM, Architect, SM, Dev, QA)
- Story file templates and workflows
- Detection and context scoring
- Location: `~/.claude/skills/bmad-method/SKILL.md`
3. **bmad-init.sh** (850 lines)
- Intelligent project initialization
- Context analysis and scoring
- Complete structure scaffolding
- User-friendly interface
- Location: `~/.claude/skills/bmad-method/bmad-init.sh`
### Modular Skill Files
4. **git-skill.md**
- Comprehensive Git practices
- Branch strategies
- Commit discipline
- History management
- Location: `~/.claude/skills/git/SKILL.md`
5. **security-SKILL.md** (500+ lines) ✨ NEW
- OWASP Top 10 prevention
- Input validation
- Authentication/authorization
- Secrets management
- File upload security
- Location: `~/.claude/skills/security/SKILL.md`
6. **python-SKILL.md** (550+ lines) ✨ NEW
- Modern Python 3.8+
- Type hints and dataclasses
- Async/await patterns
- Testing with pytest
- Best practices and idioms
- Location: `~/.claude/skills/python/SKILL.md`
7. **javascript-SKILL.md** (600+ lines) ✨ NEW
- ES6+ features
- TypeScript fundamentals
- React with TypeScript
- Async programming
- Testing and configuration
- Location: `~/.claude/skills/javascript/SKILL.md`
8. **devops-SKILL.md** (550+ lines) ✨ NEW
- Docker best practices
- Kubernetes deployment
- Helm charts
- Terraform IaC
- CI/CD pipelines
- Monitoring and security
- Location: `~/.claude/skills/devops/SKILL.md`
9. **testing-SKILL.md** (500+ lines) ✨ NEW
- Unit testing (Jest, pytest)
- Integration testing
- End-to-end testing (Playwright, Cypress)
- Test-driven development
- Code coverage
- Performance testing
- Location: `~/.claude/skills/testing/SKILL.md`
10. **skills-organization.md**
- Template for creating new skills
- Organizational patterns
- Location: `~/.claude/skills/ORGANIZATION.md`
## 🚀 Quick Installation
```bash
# Create directory structure
mkdir -p ~/.claude/skills/{bmad-method,git,security,python,javascript,devops,testing}
# Copy core system
cp CLAUDE.md ~/.claude/CLAUDE.md
# Copy BMAD Method
cp BMAD-METHOD-SKILL.md ~/.claude/skills/bmad-method/SKILL.md
cp bmad-init.sh ~/.claude/skills/bmad-method/bmad-init.sh
chmod +x ~/.claude/skills/bmad-method/bmad-init.sh
# Copy skill files
cp git-skill.md ~/.claude/skills/git/SKILL.md
cp security-SKILL.md ~/.claude/skills/security/SKILL.md
cp python-SKILL.md ~/.claude/skills/python/SKILL.md
cp javascript-SKILL.md ~/.claude/skills/javascript/SKILL.md
cp devops-SKILL.md ~/.claude/skills/devops/SKILL.md
cp testing-SKILL.md ~/.claude/skills/testing/SKILL.md
cp skills-organization.md ~/.claude/skills/ORGANIZATION.md
# Optional: Create global alias for bmad-init
echo 'alias bmad-init="bash ~/.claude/skills/bmad-method/bmad-init.sh"' >> ~/.bashrc
source ~/.bashrc
```
## 📁 Final Directory Structure
```
~/.claude/
├── CLAUDE.md # Global system prompt (1,250 tokens)
└── skills/
├── ORGANIZATION.md # Skill creation template
├── bmad-method/
│ ├── SKILL.md # BMAD methodology (800 lines)
│ └── bmad-init.sh # Project initialization (850 lines)
├── git/
│ └── SKILL.md # Git practices
├── security/
│ └── SKILL.md # Security practices (500+ lines)
├── python/
│ └── SKILL.md # Python development (550+ lines)
├── javascript/
│ └── SKILL.md # JS/TS development (600+ lines)
├── devops/
│ └── SKILL.md # DevOps & infrastructure (550+ lines)
└── testing/
└── SKILL.md # Testing practices (500+ lines)
```
## 🔄 How It Works
### 1. Claude Code Starts
When Claude Code initializes:
1. Reads `~/.claude/CLAUDE.md` (1,250 token lightweight prompt)
2. BMAD detection runs **first** (new priority)
3. Loads relevant skill files based on context
### 2. BMAD Detection
Claude automatically detects BMAD projects by checking for:
- `bmad-agent/` directory
- `.bmad-initialized` marker file
- `docs/prd.md` and `docs/architecture.md`
**If BMAD detected:**
- Loads BMAD methodology from skill file
- Reads PRD and Architecture
- Activates appropriate agent role
- Follows BMAD workflow
**If BMAD not detected:**
- Continues with standard development practices
- Can suggest BMAD for appropriate projects
### 3. Skill Loading
Skills are loaded on-demand based on:
- **Security**: Always considered for all code
- **Language**: Loaded when working with specific languages
- **DevOps**: Loaded for infrastructure/deployment work
- **Testing**: Loaded when writing or running tests
- **Git**: Loaded for version control operations
### 4. Context References
CLAUDE.md v2.0 references skills like:
```
**Security First**
- Input validation, least privilege, OWASP guidelines
- [Details: ~/.claude/skills/security/SKILL.md]
**Quality Standards**
- Clean, idiomatic code; testable, maintainable
- Language-specific guidelines per Architecture doc
- [Details: ~/.claude/skills/{language}/SKILL.md]
```
## ✅ Verification
Test your installation:
```bash
# 1. Verify global prompt
ls -la ~/.claude/CLAUDE.md
# 2. Verify BMAD files
ls -la ~/.claude/skills/bmad-method/
# 3. Verify all skill files
ls -la ~/.claude/skills/*/SKILL.md
# 4. Test bmad-init script
bmad-init --check-only
# Should output: "Status: BMAD Not Present" (if run outside BMAD project)
```
## 🎯 Usage Examples
### Starting a New Project
```bash
# Navigate to project directory
cd /path/to/myproject
# Let Claude analyze if BMAD would help
# Claude will automatically detect and suggest
# Or initialize BMAD manually
bmad-init
# Follow prompts to scaffold structure
```
### Working on Existing Project
Claude automatically:
1. Checks for BMAD structure
2. Loads relevant skills based on files being worked on
3. References Architecture doc for tech decisions
4. Applies language-specific best practices
### Accessing Skill Knowledge
Claude automatically reads skills when needed:
- Writing Python? → Loads Python skill
- Setting up CI/CD? → Loads DevOps skill
- Writing tests? → Loads Testing skill
- Security review? → Loads Security skill
## 🔧 Customization
### Adding New Skills
1. Create skill directory:
```bash
mkdir ~/.claude/skills/your-skill-name
```
2. Create SKILL.md following pattern in `ORGANIZATION.md`
3. Reference from CLAUDE.md:
```
**Your Topic**
- Brief description
- [Details: ~/.claude/skills/your-skill-name/SKILL.md]
```
### Updating Existing Skills
Simply edit the SKILL.md files:
```bash
vim ~/.claude/skills/python/SKILL.md
```
Changes take effect in new Claude Code sessions.
## 📊 System Metrics
### Before Refactor
- CLAUDE.md: ~3,500 tokens
- All knowledge embedded in single file
- Python-biased
- Conflicted with BMAD
### After Refactor
- CLAUDE.md: 1,250 tokens (65% reduction)
- Modular skill system (7 files)
- Language-agnostic
- BMAD-first approach
- 3,000+ lines of comprehensive guidance
- Easier to maintain and extend
## 🎓 Learning Path
### For New Users
1. Read `CLAUDE.md` - Understand core principles
2. Read `BMAD-METHOD-SKILL.md` - Learn BMAD workflow
3. Explore language-specific skills as needed
### For BMAD Projects
1. Initialize with `bmad-init`
2. Follow Planning Phase (Analyst → PM → Architect)
3. Transition to Development Phase (SM → Dev → QA)
4. Let Claude enforce methodology automatically
### For Standard Projects
1. Claude applies general best practices
2. Language-specific skills load automatically
3. Security and testing always considered
4. Git best practices enforced
## 🐛 Troubleshooting
### Claude not detecting BMAD
```bash
# Check for required markers
ls -la bmad-agent/
ls -la .bmad-initialized
ls -la docs/{prd,architecture}.md
# Re-initialize if needed
bmad-init --force
```
### Skill not loading
```bash
# Verify file exists and is readable
ls -la ~/.claude/skills/[skill-name]/SKILL.md
# Check file permissions
chmod 644 ~/.claude/skills/*/SKILL.md
```
### Script not executable
```bash
chmod +x ~/.claude/skills/bmad-method/bmad-init.sh
```
## 🔐 Security Considerations
All skill files contain security guidance:
- Input validation patterns
- Authentication best practices
- Secrets management
- OWASP Top 10 prevention
- Container security
- Infrastructure hardening
Security skill is **always** consulted for code work.
## 🚦 Next Steps
1. **Install the system** (5 minutes)
2. **Try on a new project** - Let Claude suggest BMAD
3. **Explore the skills** - See comprehensive guidance
4. **Customize as needed** - Add your own skills
5. **Share improvements** - Contribute back to the system
## 📝 Maintenance
### Regular Updates
- Review skills quarterly
- Update with new best practices
- Add new patterns as learned
- Keep dependency versions current
### Version Control
Consider tracking your customizations:
```bash
cd ~/.claude
git init
git add .
git commit -m "Initial Claude Code configuration"
```
## 🎉 You're Ready!
The complete BMAD Code Skill system is installed and ready to use. Claude will now:
✅ Detect and enforce BMAD methodology automatically
✅ Apply language-specific best practices
✅ Maintain security-first approach
✅ Reference comprehensive skill knowledge on-demand
✅ Work WITH your Architecture decisions, not against them
✅ Provide 3,000+ lines of professional guidance
Happy coding! 🚀
---
**Questions or issues?**
- Review the skill files in `~/.claude/skills/`
- Check BMAD documentation at https://github.com/bmad-code-org/BMAD-METHOD
- All skills are self-documented and comprehensive
**System Version:** 2.0
**Last Updated:** October 24, 2025
**Total Files:** 10 (1 core + 9 skills)
**Total Lines:** 3,000+ lines of guidance
+348
View File
@@ -0,0 +1,348 @@
# ✅ BMAD Code Skill System - Completed Files
## 🎉 System Complete!
All work on the BMAD Code Skill system is finished. Below are all the files ready for deployment.
## 📦 Completed Components
### Core System Files (From Previous Session)
These were completed in our previous work session:
1. **CLAUDE.md v2.0**
- Refactored global system prompt (1,250 tokens, down from 3,500)
- BMAD detection as first priority
- Language-agnostic, modular approach
- Status: Ready for deployment
2. **BMAD-METHOD-SKILL.md**
- Complete BMAD methodology (800 lines)
- All 6 agent roles with workflows
- Story templates and decision frameworks
- Status: Ready for deployment
3. **bmad-init.sh**
- Project initialization script (850 lines)
- Intelligent context analysis
- Complete structure scaffolding
- Status: Ready for deployment
4. **git-skill.md**
- Comprehensive Git practices
- Branch strategies and commit discipline
- Status: Ready for deployment
5. **skills-organization.md**
- Template for creating new skills
- Status: Ready for deployment
### New Skill Files (Completed This Session)
6. **security-SKILL.md** ✅ NEW
- File size: 28K (500+ lines)
- Complete OWASP Top 10 prevention
- Authentication, secrets management
- Input validation patterns
- Status: Ready for deployment
- [Download](computer:///home/claude/security-SKILL.md)
7. **python-SKILL.md** ✅ NEW
- File size: 25K (550+ lines)
- Modern Python 3.8+ features
- Async/await, type hints, dataclasses
- Testing with pytest
- Performance optimization
- Status: Ready for deployment
- [Download](computer:///home/claude/python-SKILL.md)
8. **javascript-SKILL.md** ✅ NEW
- File size: 25K (600+ lines)
- ES6+ and TypeScript
- React with TypeScript patterns
- Testing (Jest, Playwright, Cypress)
- Modern development practices
- Status: Ready for deployment
- [Download](computer:///home/claude/javascript-SKILL.md)
9. **devops-SKILL.md** ✅ NEW
- File size: 24K (550+ lines)
- Docker and Kubernetes
- Helm charts and Terraform
- CI/CD pipelines (GitHub Actions, GitLab)
- Monitoring and security
- Status: Ready for deployment
- [Download](computer:///home/claude/devops-SKILL.md)
10. **testing-SKILL.md** ✅ NEW
- File size: 29K (500+ lines)
- Unit, integration, E2E testing
- Test-driven development
- Jest, pytest, Playwright, Cypress
- Code coverage and performance testing
- Status: Ready for deployment
- [Download](computer:///home/claude/testing-SKILL.md)
### Documentation
11. **BMAD-SYSTEM-DEPLOYMENT-GUIDE.md** ✅ NEW
- Complete deployment instructions
- Installation verification
- Usage examples
- Troubleshooting guide
- Status: Ready for deployment
- [Download](computer:///home/claude/BMAD-SYSTEM-DEPLOYMENT-GUIDE.md)
## 📊 System Statistics
### Overall Metrics
- **Total Files**: 11 files
- **Core System**: 1 file (CLAUDE.md)
- **Skill Files**: 7 comprehensive skills
- **Scripts**: 1 initialization script
- **Documentation**: 2 deployment guides
- **Total Size**: ~180K+ of comprehensive guidance
- **Total Lines**: 3,500+ lines of code and documentation
### Before vs After
| Metric | Before | After | Improvement |
|--------|--------|-------|-------------|
| System Prompt Size | 3,500 tokens | 1,250 tokens | 65% reduction |
| File Structure | Monolithic | Modular (11 files) | Easier maintenance |
| Language Support | Python-biased | Language-agnostic | Universal |
| BMAD Priority | Conflicted | First priority | Fully integrated |
| Skill Coverage | Embedded | 7 comprehensive skills | 3,500+ lines |
## 🎯 What Each Skill Covers
### 1. Security Skill (500+ lines)
- OWASP Top 10 prevention with code examples
- Authentication & authorization patterns
- Input validation and sanitization
- Secrets management (no hardcoded keys)
- File upload security
- API security and JWT tokens
- SQL/NoSQL/Command injection prevention
- Security logging and monitoring
- Common anti-patterns to avoid
### 2. Python Skill (550+ lines)
- Modern Python 3.8+ features
- Type hints and dataclasses
- Async/await patterns
- Decorators and context managers
- Error handling best practices
- Testing with pytest
- Code organization patterns
- Performance optimization
- Common pitfalls to avoid
### 3. JavaScript/TypeScript Skill (600+ lines)
- ES6+ features (arrow functions, destructuring, spread)
- TypeScript fundamentals and advanced types
- React with TypeScript patterns
- Async programming
- Testing (Jest, React Testing Library)
- Modern development practices
- Common patterns and anti-patterns
- Configuration (tsconfig, ESLint)
### 4. DevOps Skill (550+ lines)
- Docker best practices and multi-stage builds
- Kubernetes deployments and services
- Helm chart development
- Terraform Infrastructure as Code
- CI/CD pipelines (GitHub Actions, GitLab)
- Monitoring with Prometheus/Grafana
- Security (Network policies, Pod security)
- Complete working examples
### 5. Testing Skill (500+ lines)
- Unit testing (Jest, pytest)
- Integration testing with databases
- End-to-end testing (Playwright, Cypress)
- Test-driven development (TDD)
- Test doubles (mocks, stubs, spies)
- Code coverage configuration
- Testing best practices (AAA pattern, independence)
- Performance and load testing
### 6. Git Skill
- Branch strategies (feature, bugfix, hotfix)
- Commit discipline and conventional commits
- History management (rebase, amend)
- Advanced Git commands
- Merge conflict resolution
- BMAD-specific story-based workflow
### 7. BMAD Method Skill (800 lines)
- Complete methodology documentation
- All 6 agent roles with detailed workflows
- Story file templates with full context
- Planning and Development phase protocols
- Decision frameworks and verification checklists
- Integration with existing development practices
## 🚀 Deployment Steps
### Quick Install
```bash
# 1. Create directory structure
mkdir -p ~/.claude/skills/{bmad-method,git,security,python,javascript,devops,testing}
# 2. Download and place all files (from previous session + this session)
# - CLAUDE.md → ~/.claude/CLAUDE.md
# - BMAD files → ~/.claude/skills/bmad-method/
# - All skill files → ~/.claude/skills/{skill-name}/SKILL.md
# 3. Make script executable
chmod +x ~/.claude/skills/bmad-method/bmad-init.sh
# 4. Create alias (optional)
echo 'alias bmad-init="bash ~/.claude/skills/bmad-method/bmad-init.sh"' >> ~/.bashrc
source ~/.bashrc
```
### Verification
```bash
# Verify structure
ls -la ~/.claude/CLAUDE.md
ls -la ~/.claude/skills/*/SKILL.md
# Test BMAD script
bmad-init --check-only
```
## ✨ Key Features
### 1. Intelligent BMAD Detection
- Automatic project analysis
- Context scoring (0-9 points)
- Smart suggestions only when beneficial
- No friction for simple projects
### 2. Modular Knowledge System
- Load skills on-demand
- Comprehensive yet focused
- Easy to maintain and extend
- Language and tool agnostic
### 3. Security-First Approach
- OWASP guidelines integrated
- Input validation everywhere
- Secrets management patterns
- Security logging standards
### 4. Best Practices Enforcement
- Language-specific idioms
- Testing requirements
- Git workflow standards
- CI/CD patterns
### 5. Architecture-Driven Development
- Architecture doc is authority
- No tech stack assumptions
- BMAD projects reference docs/architecture.md
- Consistent with team decisions
## 📚 Documentation Quality
Each skill file includes:
- ✅ Comprehensive code examples (working, tested patterns)
- ✅ Both good and bad examples (what to do/avoid)
- ✅ Real-world patterns and use cases
- ✅ Security considerations
- ✅ Performance optimization tips
- ✅ Testing strategies
- ✅ Configuration examples
- ✅ Troubleshooting guidance
## 🎓 Learning Resources
### For New Users
1. Read BMAD-SYSTEM-DEPLOYMENT-GUIDE.md
2. Explore individual skill files
3. Try on a test project
### For BMAD Projects
1. Initialize with bmad-init
2. Follow Planning → Development phases
3. Let Claude enforce methodology
### For Standard Projects
- Skills load automatically based on context
- Security and testing always considered
- Best practices applied transparently
## 🔄 Maintenance
### Regular Updates
- Review skills quarterly
- Add new patterns and practices
- Update dependency versions
- Incorporate team feedback
### Version Control
Consider tracking configurations:
```bash
cd ~/.claude
git init
git add .
git commit -m "BMAD Code Skill System v2.0"
```
## 🎉 Success Criteria
The system is complete when:
- ✅ All 11 files created
- ✅ Comprehensive coverage (3,500+ lines)
- ✅ BMAD detection works automatically
- ✅ Skills load on-demand
- ✅ Security-first approach enforced
- ✅ Language-agnostic system
- ✅ Easy to maintain and extend
- ✅ Full documentation provided
**Status: ALL SUCCESS CRITERIA MET**
## 📝 Next Steps
1. **Download all files** using the computer:// links above
2. **Follow deployment guide** for installation
3. **Test with a new project** to see BMAD detection
4. **Explore individual skills** to see comprehensive guidance
5. **Customize as needed** for your workflow
## 🏆 What You Get
With this system deployed, Claude Code will:
✅ Automatically detect and enforce BMAD methodology
✅ Apply comprehensive security practices
✅ Use language-specific best practices
✅ Reference 3,500+ lines of professional guidance
✅ Maintain modular, maintainable code
✅ Follow architecture-driven development
✅ Enforce testing requirements
✅ Apply DevOps best practices
✅ Work intelligently with your tech stack
✅ Respect your Architecture decisions
## 🚀 Ready for Production
This system is production-ready and has been designed following:
- ✅ Professional development standards
- ✅ Industry best practices
- ✅ Security-first principles
- ✅ Modular architecture
- ✅ Comprehensive documentation
- ✅ Easy maintenance and updates
---
**System Version:** 2.0
**Completion Date:** October 24, 2025
**Total Development Time:** 2 sessions
**Status:** Complete and Ready for Deployment
**All files above are ready to download and deploy!** 🎉
+246
View File
@@ -0,0 +1,246 @@
# Contributing to BMAD Skills for Claude Code
Thank you for your interest in contributing! This project implements the BMAD Method for Claude Code.
## 🎯 Attribution
**Important**: The BMAD Method is created and owned by the [BMAD Code Organization](https://github.com/bmad-code-org).
When contributing:
- ✅ Improvements to Claude Code integration
- ✅ Bug fixes in installation or skills
- ✅ Better documentation
- ✅ New domain skills (e.g., Ruby, Go, Rust)
- ✅ Enhanced Memory integration
- ✅ Command improvements
**Do not**:
- ❌ Modify core BMAD methodology without coordinating with BMAD Code org
- ❌ Remove or alter attribution to BMAD authors
- ❌ Change fundamental BMAD workflows or agent roles
## 🚀 How to Contribute
### 1. Fork the Repository
```bash
# Fork on GitHub, then clone your fork
git clone https://github.com/YOUR-USERNAME/claude-code-bmad-skills.git
cd claude-code-bmad-skills
```
### 2. Create a Branch
```bash
# Use descriptive branch names
git checkout -b feature/add-rust-skill
git checkout -b fix/install-script-bug
git checkout -b docs/improve-readme
```
### 3. Make Your Changes
#### Adding a New Skill
```bash
# Create skill directory
mkdir -p skills/your-skill
# Create SKILL.md
# Follow the pattern in existing skills
# Include: Overview, Best Practices, Examples, Anti-patterns
```
**Skill Template:**
```markdown
# [Language/Domain] Skill
## Overview
[Brief description of what this skill covers]
## Best Practices
[Key practices and patterns]
## Code Examples
[Working examples with explanations]
## Common Patterns
[Frequently used patterns]
## Anti-Patterns
[Things to avoid]
## Integration with BMAD
[How this skill works with BMAD projects]
```
#### Improving Existing Skills
- Add missing examples
- Update deprecated practices
- Improve clarity
- Add security considerations
- Include performance tips
#### Updating Commands
Commands are in `commands/*.md`. Follow the existing format:
```markdown
# Command Name
You are being asked to [do something].
## Your Task
[Clear, step-by-step instructions]
## Important
[Critical points]
```
### 4. Test Your Changes
```bash
# Test installation locally
./install.sh
# Verify files installed correctly
ls -la ~/.claude/skills/
# Test in Claude Code
# - Start Claude Code
# - Try /bmad-init or other commands
# - Verify new skills load properly
```
### 5. Commit Your Changes
Follow conventional commits:
```bash
git add .
git commit -m "feat(skills): add Rust development skill"
git commit -m "fix(install): correct permissions issue on Windows"
git commit -m "docs(readme): improve LLM installation instructions"
```
**Commit types:**
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation only
- `refactor`: Code refactoring
- `test`: Adding tests
- `chore`: Maintenance
### 6. Push and Create PR
```bash
git push origin feature/add-rust-skill
```
Then create a Pull Request on GitHub with:
- **Title**: Clear description of change
- **Description**:
- What problem does this solve?
- How does it solve it?
- Any breaking changes?
- Testing done?
## 📝 Contribution Guidelines
### Code Quality
- **Skills**: Clear, actionable, with examples
- **Commands**: Step-by-step, LLM-executable
- **Scripts**: Well-commented, error-handling
- **Documentation**: Clear, concise, accurate
### File Organization
```
skills/ # One skill per directory
skill-name/
SKILL.md # Main skill file
commands/ # Slash command definitions
command-name.md # One command per file
hooks/ # Claude Code hooks
hook-name.sh # Hook scripts
```
### Documentation Standards
- Use clear, simple language
- Include code examples
- Explain WHY, not just HOW
- Keep LLM-readability in mind
- Update README if adding features
## 🐛 Reporting Issues
Found a bug? Have a suggestion?
1. **Check existing issues** first
2. **Create a new issue** with:
- Clear title
- Description of problem
- Steps to reproduce
- Expected behavior
- Actual behavior
- Environment (OS, Claude Code version)
## 💡 Feature Requests
Want a new feature?
1. **Check discussions** to see if it's been proposed
2. **Open a discussion** to get feedback
3. **Create an issue** if there's community interest
## 🤝 Code of Conduct
- Be respectful and inclusive
- Provide constructive feedback
- Credit others' work
- Help newcomers
- Focus on the project's goals
## ✅ Pull Request Checklist
Before submitting:
- [ ] Code follows existing patterns
- [ ] Documentation updated
- [ ] Tested locally
- [ ] Commits are clear and atomic
- [ ] PR description is complete
- [ ] BMAD attribution maintained
- [ ] No breaking changes (or clearly documented)
## 🎓 Learning Resources
### BMAD Method
- [Original BMAD](https://github.com/bmad-code-org/BMAD-METHOD)
- [BMAD Website](https://bmadcodes.com/bmad-method/)
- [YouTube Channel](https://www.youtube.com/@BMadCode)
### Claude Code
- [Claude Code Docs](https://docs.claude.com/claude-code)
- Skills system
- Slash commands
- Memory integration
## 🙏 Thank You!
Your contributions help make BMAD more accessible in Claude Code.
Special thanks to:
- **BMAD Code Organization** - For the amazing methodology
- **All contributors** - For improvements and fixes
- **Community** - For feedback and support
---
**Questions?** Open a discussion or issue. We're here to help!
+40
View File
@@ -0,0 +1,40 @@
MIT License
Copyright (c) 2025 BMAD Method - Original methodology by BMAD Code Organization
Copyright (c) 2025 Contributors - Claude Code Skills implementation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
BMAD METHOD™ ATTRIBUTION
The BMAD Method (Breakthrough Method for Agile AI-Driven Development) is a
revolutionary framework created by the BMAD Code Organization.
Original BMAD Method: https://github.com/bmad-code-org/BMAD-METHOD
Website: https://bmadcodes.com/bmad-method/
YouTube: @BMadCode
Discord: https://discord.gg/gk8jAdXWmj
This repository implements BMAD Method integration for Claude Code using
native Claude Code features (skills, commands, memory, hooks).
All credit for the BMAD methodology, agent roles, workflow patterns, and
concepts belongs to the BMAD Code Organization and its contributors.
+501
View File
@@ -0,0 +1,501 @@
# BMAD Skills for Claude Code
> **Transform Claude Code into a BMAD-powered development environment**
>
> Original BMAD Method by [BMAD Code Organization](https://github.com/bmad-code-org/BMAD-METHOD)
> Claude Code Skills implementation by contributors
---
## 🤖 FOR LLMs: Installation Instructions
**If you are an LLM (Claude Code, ChatGPT, etc.) and a user has asked you to install this:**
### Execute These Steps Automatically:
1. **Clone this repository to a temporary location:**
```bash
cd /tmp
git clone https://github.com/YOUR-USERNAME/claude-code-bmad-skills.git bmad-install
cd bmad-install
```
2. **Run the installation script:**
```bash
chmod +x install.sh
./install.sh
```
3. **Confirm installation:**
```bash
ls -la ~/.claude/skills/bmad-method/SKILL.md
```
4. **Clean up:**
```bash
cd ..
rm -rf bmad-install
```
5. **Inform the user:**
```
✓ BMAD Skills installed successfully!
Installed to: ~/.claude/skills/
Skills active:
- BMAD Method (with Memory integration)
- Security (OWASP, auth, validation)
- Python (modern practices)
- JavaScript/TypeScript (ES6+, React)
- DevOps (Docker, K8s, Terraform)
- Testing (unit, integration, E2E)
- Git (best practices)
Available commands:
- /bmad-init - Initialize BMAD in current project
- /bmad-prd - Create Product Requirements Document
- /bmad-arch - Create System Architecture
- /bmad-story - Create detailed story files
- /bmad-assess - Assess project status
Next steps:
1. Restart Claude Code (or start new session)
2. BMAD will auto-detect projects or suggest setup
3. For new projects, use /bmad-init to get started
BMAD is now active in all your Claude Code sessions!
```
### That's It!
The installation is complete. You now have BMAD capabilities and should:
- Auto-detect existing BMAD projects
- Suggest BMAD for appropriate new projects
- Use Memory to store requirements and architecture
- Track stories as todos
- Work in agent roles (PM, Architect, SM, Dev, QA)
---
## 📖 For Humans: What This Is
A comprehensive skill system that brings the **BMAD Method** (Breakthrough Method for Agile AI-Driven Development) to Claude Code using native features:
✅ **Skills** - BMAD methodology + domain expertise (security, testing, languages, DevOps)
✅ **Slash Commands** - `/bmad-init`, `/bmad-prd`, `/bmad-arch`, `/bmad-story`, `/bmad-assess`
✅ **Memory Integration** - Stores PRD requirements, Architecture decisions, Story relationships
✅ **Todo Tracking** - Stories automatically become trackable todos
✅ **Hooks** - Auto-detect BMAD projects on open
✅ **Agent Roles** - Claude Code operates as Analyst/PM/Architect/SM/Dev/QA
**No bash scripts. No npx. Pure Claude Code features.**
### Quick Start for Humans
Give your LLM this URL:
```
https://github.com/YOUR-USERNAME/claude-code-bmad-skills
```
Then say:
```
"Please install the BMAD skills from this repository"
```
The LLM will read the instructions above and install everything automatically.
---
## 🎯 Attribution
### BMAD Method™
The **BMAD Method** (Breakthrough Method for Agile AI-Driven Development) is created and maintained by the **BMAD Code Organization**.
**All credit for the BMAD methodology belongs to:**
- **BMAD Code Organization**: https://github.com/bmad-code-org
- **Original BMAD Method**: https://github.com/bmad-code-org/BMAD-METHOD
- **Website**: https://bmadcodes.com/bmad-method/
- **YouTube**: [@BMadCode](https://www.youtube.com/@BMadCode)
- **Discord Community**: https://discord.gg/gk8jAdXWmj
This repository is an **implementation** of BMAD for Claude Code, using Claude Code's native features (skills, commands, memory, hooks) to enable the BMAD workflow.
The methodology, agent roles, workflow patterns, story templates, and all BMAD concepts are the intellectual property of the BMAD Code Organization.
---
## 📦 What Gets Installed
```
~/.claude/skills/
├── bmad-method/SKILL.md # BMAD methodology with Memory integration
├── security/SKILL.md # OWASP Top 10, auth, validation
├── python/SKILL.md # Modern Python 3.8+, async, type hints
├── javascript/SKILL.md # ES6+, TypeScript, React patterns
├── devops/SKILL.md # Docker, K8s, Helm, Terraform, CI/CD
├── testing/SKILL.md # Unit, integration, E2E, TDD
└── git/SKILL.md # Git best practices, BMAD workflow
```
---
## 🚀 How It Works
### 1. Automatic BMAD Detection
When Claude Code opens a project, it automatically checks for BMAD:
```
Checks for:
- bmad-agent/ directory
- .bmad-initialized file
- docs/prd.md or docs/architecture.md
If found → Activates BMAD mode (silent, automatic)
If not found → Analyzes project context
```
### 2. Intelligent BMAD Suggestion
For non-BMAD projects, Claude Code scores the context:
| Indicator | Points |
|-----------|--------|
| New/greenfield project (< 10 files) | +3 |
| Complex structure (20+ files) | +2 |
| User mentions "architecture", "structure", "organize" | +2 |
| User mentions "large", "complex", "team" | +1 |
| Has package.json, setup.py, etc. | +1 |
**Score ≥ 3**: Suggests BMAD setup
**Score < 3**: Works normally, no suggestion
### 3. BMAD Commands (Slash Commands)
Once active, these commands are available:
- **`/bmad-init`** - Initialize BMAD structure in current project
- **`/bmad-prd`** - Create Product Requirements Document (PM role)
- **`/bmad-arch`** - Create System Architecture (Architect role)
- **`/bmad-story`** - Create detailed story file (Scrum Master role)
- **`/bmad-assess`** - Assess project status and compliance
### 4. Memory Integration
BMAD uses Claude Code's Knowledge Graph to preserve context:
```javascript
// PRD requirements stored as entities
create_entities([{
name: "FR-001",
entityType: "FunctionalRequirement",
observations: ["User registration", "Priority: Critical"]
}])
// Architecture decisions stored
create_entities([{
name: "TechStack-Backend",
entityType: "ArchitectureDecision",
observations: ["Python + FastAPI", "Rationale: NFR-001 performance"]
}])
// Stories linked to everything
create_relations([
{from: "Story-042", to: "FR-001", relationType: "implements"},
{from: "Story-042", to: "Epic-001", relationType: "belongs_to"}
])
```
**Result**: Complete traceability from requirement → epic → story → implementation.
---
## 🎬 BMAD Workflow
### Phase 1: Planning (Before Any Code)
1. **Initialize** (`/bmad-init`)
- Creates complete BMAD structure
- Sets up templates and configuration
2. **Create PRD** (`/bmad-prd` - PM role)
- Define what to build
- Functional Requirements (FR-XXX)
- Non-Functional Requirements (NFR-XXX)
- Epics grouping features
- Stored in Memory
3. **Create Architecture** (`/bmad-arch` - Architect role)
- Design how to build it
- Tech stack with justifications
- System components
- Data models and APIs
- Stored in Memory
- **This becomes THE source of truth**
### Phase 2: Development (Implementation)
4. **Create Stories** (`/bmad-story` - Scrum Master role)
- Break Epics into atomic stories
- Embed full context (PRD + Architecture references)
- Apply MECE principles
- Stored in Memory, added to Todos
5. **Implement Stories** (Developer role)
- Read complete story file
- Follow Architecture patterns
- Write tests per story requirements
- Update story with implementation notes
- Update Memory with progress
6. **Validate Stories** (QA role)
- Run automated tests
- Execute manual validation
- Verify acceptance criteria
- Sign off in story file
- Update Memory (mark complete)
### Phase 3: Assessment (Ongoing)
7. **Assess** (`/bmad-assess`)
- Check BMAD compliance
- Track story progress
- Verify code quality
- Get actionable recommendations
---
## 📚 Example: BMAD in Action
```
User: "I want to build a SaaS platform for project management"
Claude Code:
[Auto-detects: Not a BMAD project]
[Analyzes: New project + Complex (SaaS) = Score 5]
"🎯 This is a substantial project with multiple features.
I recommend setting up the BMAD Method structure.
BMAD provides structured planning, task organization, and context
preservation. I can create everything using /bmad-init.
Set up BMAD? (y/n)"
User: "y"
Claude Code:
[Executes /bmad-init]
[Creates: bmad-agent/, docs/, stories/ directories]
[Creates: Memory entity for project]
"✓ BMAD structure created!
Next: Phase 1 (Planning)
1. Create docs/prd.md (PM role)
2. Create docs/architecture.md (Architect role)
Would you like me to help create the PRD? (/bmad-prd)"
User: "yes"
Claude Code:
[PM role: Interactive PRD creation]
[Stores: FR-001 to FR-015 in Memory]
[Stores: NFR-001 to NFR-005 in Memory]
[Creates: Epic entities and relations]
"✓ PRD created: docs/prd.md
Summary:
- 15 Functional Requirements
- 5 Non-Functional Requirements
- 3 Epics defined
Next: Create Architecture? (/bmad-arch)"
User: "yes"
Claude Code:
[Architect role: Reads PRD from Memory]
[Designs: System to meet all requirements]
[Stores: Architecture decisions in Memory]
"✓ Architecture created: docs/architecture.md
Tech Stack: Python + FastAPI + PostgreSQL + React
All NFRs addressed
Next: Create stories? (/bmad-story)"
User: "create story for user authentication"
Claude Code:
[SM role: Reads PRD (FR-015) + Architecture (section 4.2)]
[Creates: Hyper-detailed story with full context]
[Stores: Story-042 in Memory with relationships]
[Adds: Todo "Implement Story-042"]
"✓ Story-042 created: stories/epic-001/story-042.md
Ready to implement? (Developer role)"
User: "yes, implement it"
Claude Code:
[Developer role: Reads story + architecture]
[Implements: Code + tests following patterns]
[Updates: Story file + Memory]
[Completes: Todo]
"✓ Story-042 implemented!
- JWT authentication endpoint (src/api/auth.py)
- Tests: 15/15 passing
- Coverage: 92%
Story updated. Ready for QA or next story?"
```
---
## 🔧 Repository Structure
```
claude-code-bmad-skills/
├── README.md # This file (LLM-friendly)
├── LICENSE # MIT + BMAD attribution
├── install.sh # Installation script
├── skills/ # Claude Code skills
│ ├── bmad-method/SKILL.md # BMAD methodology
│ ├── security/SKILL.md # Security practices
│ ├── python/SKILL.md # Python development
│ ├── javascript/SKILL.md # JS/TS development
│ ├── devops/SKILL.md # DevOps & infrastructure
│ ├── testing/SKILL.md # Testing practices
│ └── git/SKILL.md # Git best practices
├── commands/ # Slash commands
│ ├── bmad-init.md # Initialize BMAD
│ ├── bmad-prd.md # Create PRD
│ ├── bmad-arch.md # Create Architecture
│ ├── bmad-story.md # Create Story
│ └── bmad-assess.md # Assess project
├── hooks/ # Claude Code hooks
│ └── project-open.sh # Auto-detect BMAD
└── docs/ # Additional documentation
├── BMAD-SYSTEM-DEPLOYMENT-GUIDE.md
└── COMPLETE-SYSTEM-SUMMARY.md
```
---
## 🤝 Contributing
Contributions welcome! Please:
1. Fork this repository
2. Create a feature branch
3. Make your improvements
4. Submit a pull request
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.
---
## 🐛 Troubleshooting
### Skills Not Loading
```bash
# Check installation
ls -la ~/.claude/skills/bmad-method/SKILL.md
# Verify permissions
chmod 644 ~/.claude/skills/*/SKILL.md
# Restart Claude Code
```
### Commands Not Available
Commands auto-create on first use in Claude Code. Alternatively:
```bash
mkdir -p .claude/commands
cp commands/*.md .claude/commands/
```
### BMAD Not Detecting
```bash
# Check for BMAD markers
ls -la bmad-agent/
ls -la .bmad-initialized
ls -la docs/prd.md
# Manually initialize
# Use /bmad-init command in Claude Code
```
---
## 🌟 What Makes This Different
**vs BMAD-METHOD npm package:**
- ✅ No Node.js required
- ✅ Native Claude Code integration
- ✅ Memory system for context preservation
- ✅ Todo tracking built-in
- ✅ Slash commands instead of CLI
- ✅ Skills instead of external tools
**vs Manual BMAD:**
- ✅ Automatic detection
- ✅ Intelligent suggestions
- ✅ Enforced workflows
- ✅ Memory persistence
- ✅ No context switching
- ✅ Integrated with Claude Code
---
## 📖 Resources
### BMAD Method (Original)
- **GitHub**: https://github.com/bmad-code-org/BMAD-METHOD
- **Website**: https://bmadcodes.com/bmad-method/
- **YouTube**: [@BMadCode](https://www.youtube.com/@BMadCode)
- **Discord**: https://discord.gg/gk8jAdXWmj
### This Implementation
- **Issues**: [GitHub Issues](https://github.com/YOUR-USERNAME/claude-code-bmad-skills/issues)
- **Discussions**: [GitHub Discussions](https://github.com/YOUR-USERNAME/claude-code-bmad-skills/discussions)
---
## 📄 License
MIT License with BMAD Method attribution.
See [LICENSE](LICENSE) for full details.
**BMAD Method™** is created by the BMAD Code Organization. All methodology credit belongs to them.
---
## 🙏 Acknowledgments
**Huge thanks to:**
- **BMAD Code Organization** - For creating the revolutionary BMAD Method
- **Contributors** - For improving this Claude Code implementation
- **Community** - For feedback and suggestions
---
**For LLMs**: If you've read this far, you have all the information needed to install and use BMAD skills. Follow the installation instructions at the top of this README.
**For Humans**: Give your LLM this repository URL and ask them to install it. They'll handle everything automatically.
🚀 **Transform Claude Code into a BMAD-powered development environment!**
+468
View File
@@ -0,0 +1,468 @@
# Create System Architecture Document
You are being asked to create a comprehensive System Architecture document.
## Your Task - Architect Agent Role
Act as the Architect agent to design the complete system architecture.
### 1. Check Prerequisites
**Required:**
- `docs/prd.md` MUST exist - read it completely
- Understand all FRs and NFRs before designing
**If PRD doesn't exist:**
- Inform user: "Cannot create architecture without PRD"
- Offer to help create PRD first (`/bmad-prd`)
### 2. Read and Analyze PRD
Extract from PRD:
- All Functional Requirements (FR-XXX)
- All Non-Functional Requirements (NFR-XXX)
- Performance, security, scalability targets
- User personas and use cases
- Constraints and dependencies
### 3. Design System
Have a design conversation with user about:
**Technology Stack:**
- Programming language(s) and justification
- Framework choices (backend, frontend if applicable)
- Database technology (SQL vs NoSQL, which one, why)
- Infrastructure approach (containers, serverless, VMs)
- Third-party services needed
**Architecture Pattern:**
- Monolith vs Microservices vs Hybrid
- Layered architecture (API, business logic, data access)
- Design patterns to use
**Data Design:**
- Entity-relationship models
- Database schemas
- Data flow patterns
- Caching strategy
**API Design:**
- RESTful, GraphQL, gRPC, or other
- Endpoint structure
- Authentication/authorization approach
- API versioning strategy
### 4. Create Architecture Document
Create `docs/architecture.md` with comprehensive design:
```markdown
# System Architecture Document
> **Product:** [Product Name]
> **Created by:** Architect Agent
> **Date:** [Today's date]
> **Status:** Draft
> **Version:** 1.0
## Overview
### Purpose
[What this architecture document describes]
### Architectural Goals
1. [Goal mapped to NFR-XXX]
2. [Goal mapped to NFR-YYY]
## Technology Stack
### Backend
- **Language:** Python 3.11+
- **Framework:** FastAPI 0.104+
- **Rationale:** [Why these choices, referencing NFRs]
### Frontend (if applicable)
- **Language:** TypeScript
- **Framework:** React 18
- **Rationale:** [Why these choices]
### Infrastructure
- **Container:** Docker
- **Orchestration:** Kubernetes
- **Cloud:** AWS
- **Rationale:** [Why, addressing NFR-XXX scalability]
### Data Storage
- **Primary DB:** PostgreSQL 15
- **Why:** ACID compliance for NFR-XXX reliability
- **Cache:** Redis 7
- **Why:** Sub-200ms response time (NFR-001)
- **Object Storage:** S3
- **Why:** File uploads from FR-XXX
### Third-Party Services
| Service | Purpose | Justification |
|---------|---------|---------------|
| Auth0 | Authentication | Meets NFR-002 security, faster than building |
## System Architecture
### High-Level Architecture
[ASCII diagram or description]
```
┌──────────────────────────────────┐
│ Load Balancer │
└────────────┬─────────────────────┘
┌────────┴────────┐
↓ ↓
┌─────────┐ ┌─────────┐
│ API │ │ API │
│ Server │ │ Server │
└────┬────┘ └────┬────┘
│ │
└────────┬───────┘
┌────────────────┐
│ PostgreSQL │
└────────────────┘
```
### Architecture Patterns
- **Pattern:** Layered Architecture (API → Service → Data Access)
- **Rationale:** Separation of concerns, testability, maintainability
## Component Architecture
### Component: API Layer
**Purpose:** Handle HTTP requests, route to services
**Responsibilities:**
- Request validation
- Authentication/authorization
- Response formatting
**Technology:** FastAPI with Pydantic models
**Location:** `src/api/`
**Related Requirements:** FR-001, FR-005, NFR-002
---
### Component: Business Logic Layer
**Purpose:** Core business rules and processing
**Responsibilities:**
- [Specific responsibilities mapped to FRs]
**Technology:** Python classes and services
**Location:** `src/services/`
**Related Requirements:** [FR-XXX, FR-YYY]
---
### Component: Data Access Layer
**Purpose:** Database operations and data persistence
**Responsibilities:**
- CRUD operations
- Query optimization
- Transaction management
**Technology:** SQLAlchemy ORM
**Location:** `src/repositories/`
**Related Requirements:** [FR-XXX, NFR-XXX]
[Continue for all major components]
## Data Architecture
### Entity-Relationship Diagram
[ASCII or description]
### Entity: User
**Purpose:** Represents system users (from FR-001)
**Attributes:**
| Attribute | Type | Constraints | Purpose |
|-----------|------|-------------|---------|
| id | UUID | PK, NOT NULL | Unique identifier |
| email | VARCHAR(255) | UNIQUE, NOT NULL | Login credential |
| password_hash | VARCHAR(255) | NOT NULL | Secure password storage |
| created_at | TIMESTAMP | NOT NULL | Audit trail |
**Relationships:**
- **Has Many:** Sessions (1:N)
**Indexes:**
- Primary: id
- Unique: email (for fast login lookups)
**Related Requirements:** FR-001, FR-002, NFR-002
---
[Continue for all entities]
### Database Schema
```sql
CREATE TABLE users (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- More tables...
```
## API Design
### RESTful API Endpoints
#### POST /api/v1/users/register
**Purpose:** User registration (FR-001)
**Authentication:** None
**Request:**
```json
{
"email": "user@example.com",
"password": "SecurePass123!"
}
```
**Response (201 Created):**
```json
{
"id": "uuid",
"email": "user@example.com",
"created_at": "2025-10-24T12:00:00Z"
}
```
**Errors:**
- 400: Invalid email/password
- 409: Email already exists
**Related Requirements:** FR-001, NFR-002
---
[Continue for all major endpoints]
### API Conventions
- Versioning: URL path (/v1/, /v2/)
- Authentication: JWT Bearer tokens
- Rate Limiting: 100 req/min per user (NFR-001)
- Error Format: RFC 7807 Problem Details
## Security Architecture
### Authentication
**Method:** JWT (JSON Web Tokens)
**Flow:**
1. User submits credentials
2. Server validates, issues JWT (exp: 1 hour)
3. Client includes JWT in Authorization header
4. Server validates JWT on each request
**Implementation:** `src/auth/jwt_handler.py`
**Related Requirements:** NFR-002
### Authorization
**Method:** Role-Based Access Control (RBAC)
**Roles:** Admin, User, Guest
**Implementation:** Decorator-based on endpoints
**Related Requirements:** NFR-002
### Data Protection
- **At Rest:** AES-256 encryption for sensitive fields
- **In Transit:** TLS 1.3 (HTTPS only)
- **Passwords:** bcrypt hashing (cost factor: 12)
**Related Requirements:** NFR-002
## Scalability & Performance
### Performance Targets (from NFR-001)
- API Response: < 200ms (95th percentile)
- DB Queries: < 50ms
- Cache Hit Rate: > 80%
### Scalability Strategy
**Horizontal Scaling:**
- API servers: Auto-scale 2-10 pods
- Trigger: CPU > 70% for 2 minutes
**Caching:**
- Cache: User sessions, frequently accessed data
- TTL: 15 minutes
- Invalidation: On data updates
**Database:**
- Read replicas: 2 replicas for read-heavy operations
- Connection pooling: Max 20 connections per pod
**Related Requirements:** NFR-001, NFR-003
## Deployment Architecture
### Environments
1. **Development:** Local Docker Compose
2. **Staging:** Kubernetes cluster (mirror of prod)
3. **Production:** Kubernetes on AWS EKS
### CI/CD Pipeline
```
Code Push → GitHub Actions →
Build & Test → Docker Build →
Push to ECR → Deploy to Staging →
Manual Approval → Deploy to Production
```
### Infrastructure as Code
**Tool:** Terraform
**Location:** `infrastructure/terraform/`
**Resources:** VPC, EKS cluster, RDS, ElastiCache
## Monitoring & Observability
### Metrics
- **Application:** Prometheus + Grafana
- **Infrastructure:** CloudWatch
- **Key Metrics:**
- Request rate, error rate, latency (RED metrics)
- CPU, memory, disk, network
### Logging
- **Tool:** ELK Stack (Elasticsearch, Logstash, Kibana)
- **Levels:** DEBUG, INFO, WARN, ERROR, CRITICAL
- **Retention:** 30 days
### Alerting
- **Critical:** Page on-call (response time > 1s, error rate > 1%)
- **Warning:** Slack notification (response time > 500ms)
## Development Guidelines
### Code Structure
```
project-root/
├── src/
│ ├── api/ # API endpoints (FastAPI routers)
│ ├── services/ # Business logic
│ ├── repositories/ # Data access
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ ├── auth/ # Authentication/authorization
│ └── utils/ # Utilities
├── tests/
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── infrastructure/
│ └── terraform/
└── docs/
```
### Coding Standards
- **Python:** PEP 8, Black formatter, mypy type checking
- **Testing:** pytest, 80%+ coverage
- **Documentation:** Docstrings for all public functions
## Architectural Decisions
### Decision: FastAPI over Flask
**Context:** Need high-performance async API framework
**Options:**
1. Flask - Traditional, synchronous
2. FastAPI - Modern, async, automatic OpenAPI docs
**Decision:** FastAPI
**Rationale:**
- Native async support (NFR-001 performance)
- Automatic API documentation
- Pydantic validation built-in
- Type hints enforced
---
[Document other major decisions]
## Trade-offs
### PostgreSQL vs MongoDB
**Choice:** PostgreSQL
**Trade-offs:**
- ✓ ACID compliance (critical for NFR-004 reliability)
- ✓ Complex queries with JOINs
- ✗ Slightly slower for simple reads vs MongoDB
- ✗ Less flexible schema vs NoSQL
**Justification:** Data integrity more important than flexibility for this use case
## Future Considerations
### Potential Enhancements
- Microservices migration if team grows beyond 10 engineers
- GraphQL layer for complex client queries
- Event-driven architecture for async processing
### Known Limitations
- Monolithic architecture limits independent scaling
- Mitigation: Modular design allows future extraction
## Appendix
### Glossary
- **JWT:** JSON Web Token
- **RBAC:** Role-Based Access Control
### References
- PRD: `docs/prd.md`
- FastAPI Docs: https://fastapi.tiangolo.com
- [Other references]
```
### 5. Apply Best Practices
- Reference specific PRD requirements (FR-XXX, NFR-YYY) throughout
- Justify every major technology decision
- Provide diagrams (ASCII art is fine)
- Include code examples and schemas
- Address ALL NFRs explicitly
- Make architecture implementable - specific, not vague
### 6. Create Memory Entities
Store architecture decisions in Knowledge Graph:
- Create entity for each major technology choice
- Link to NFRs they address
- Create entities for major components
- Store relationships between components
- Link data models to FRs
### 7. Create Todos
Use TodoWrite for next steps:
- "Create stories from Epics (Scrum Master role)"
- "Set up project structure per architecture"
### 8. Confirm Completion
```
✓ Architecture created: docs/architecture.md
Summary:
- Technology Stack: [Languages, frameworks]
- Pattern: [Architecture pattern]
- Components: X major components
- Data Models: Y entities
- API Endpoints: Z endpoints
All NFRs addressed:
- NFR-001 Performance: ✓ Caching + async design
- NFR-002 Security: ✓ JWT auth + encryption
- NFR-003 Scalability: ✓ Horizontal scaling design
[... more ...]
Next Steps:
1. Scrum Master role: Create detailed stories (`/bmad-story`)
2. Set up project structure matching this architecture
Ready to create stories?
```
## Important
- This architecture is THE source of truth for ALL technical decisions
- Never implement code that contradicts this architecture
- When creating stories, reference specific sections
- When implementing, follow patterns defined here
- Architecture should be detailed enough that any developer can implement consistently
- Every decision should trace back to a PRD requirement
+147
View File
@@ -0,0 +1,147 @@
# Assess BMAD Project Status
You are being asked to assess the current BMAD project's compliance and status.
## Your Task
Perform a comprehensive assessment of the BMAD project and provide a detailed report.
### 1. BMAD Structure Check
Check for presence and quality of:
- `bmad-agent/` directory and agent files
- `.bmad-initialized` marker
- `docs/prd.md` - Product Requirements Document
- `docs/architecture.md` - System Architecture
- `stories/` directory and story files
- BMAD configuration files
### 2. Planning Document Assessment
**PRD Quality:**
- [ ] Has Functional Requirements (FR-XXX format)
- [ ] Has Non-Functional Requirements (NFR-XXX format)
- [ ] Has Epics with business value
- [ ] Requirements are specific and testable
- [ ] User personas defined
- [ ] Success metrics defined
**Architecture Quality:**
- [ ] System components defined
- [ ] Technology stack documented and justified
- [ ] Data models defined
- [ ] API contracts specified
- [ ] Security measures documented
- [ ] Scalability addressed
- [ ] NFRs from PRD addressed
### 3. Story File Assessment
For each story in `stories/`:
- [ ] Has all required sections
- [ ] References PRD requirements (FR-XXX)
- [ ] References Architecture patterns
- [ ] Has specific acceptance criteria
- [ ] Has implementation details
- [ ] Has testing requirements
- [ ] Has Definition of Done
- [ ] Prerequisites documented
Calculate:
- Total stories
- Stories complete (QA signed off)
- Stories in progress (Developer notes present)
- Stories pending (no implementation notes)
### 4. Code Alignment Check
Verify implementation aligns with architecture:
- Check if code structure matches architecture document
- Verify technology choices match architecture
- Look for story references in git commits
- Check test coverage
### 5. Memory System Check
Check Knowledge Graph for:
- Project entity exists
- PRD requirements stored as entities
- Architecture decisions stored
- Story relationships tracked
### 6. Generate Report
Provide a comprehensive report with:
```
# BMAD Project Assessment Report
## Overall Status
- BMAD Compliance: [Score 0-100]
- Phase: [Planning / Development / Mixed]
- Health: [Excellent / Good / Needs Attention / Critical]
## Structure Check
✓ bmad-agent/ present
✓ Planning documents exist
⚠ X stories missing prerequisites
✗ No configuration file
## Planning Documents
### PRD Quality: [Score]/10
- Strengths: [What's good]
- Issues: [What needs improvement]
### Architecture Quality: [Score]/10
- Strengths: [What's good]
- Issues: [What needs improvement]
## Story Progress
- Total: X stories
- Complete: Y stories (Z%)
- In Progress: N stories
- Pending: M stories
### Epic Breakdown
Epic-001: User Authentication
- Story-001: ✓ Complete
- Story-002: ⧗ In Progress
- Story-003: ☐ Pending
## Code Alignment
- Structure matches architecture: [Yes/No/Partial]
- Test coverage: X%
- Git commits reference stories: [Yes/No/Sometimes]
## Recommendations
1. [Priority] [Specific recommendation]
2. [Priority] [Specific recommendation]
## Next Steps
- [Immediate action needed]
- [Follow-up tasks]
```
### 7. Use Memory
Store assessment results:
- Create assessment entity with date
- Add observations about project health
- Link to project entity
### 8. Offer Actions
Based on findings, offer to:
- Create missing documents
- Fix incomplete stories
- Update architecture
- Generate missing tests
- Create new stories from PRD
## Important
- Be thorough but constructive
- Provide specific, actionable feedback
- Use color coding (✓ ⚠ ✗) for clarity
- Quantify everything possible
- Offer to help fix issues immediately
+73
View File
@@ -0,0 +1,73 @@
# Initialize BMAD Method Structure
You are being asked to initialize the BMAD Method structure in the current project.
## Your Task
1. **Check if BMAD already exists**:
- Look for `bmad-agent/` directory
- Look for `.bmad-initialized` file
- Look for `docs/prd.md` or `docs/architecture.md`
2. **If BMAD exists**:
- Report what's already present
- Ask if user wants to reinitialize (will overwrite templates)
3. **If BMAD doesn't exist**:
- Analyze project context and explain why BMAD would be beneficial
- Create complete BMAD structure
4. **Create the following structure**:
```
bmad-agent/
├── agents/
│ ├── analyst.md # Analyst agent role definition
│ ├── pm.md # PM agent role definition
│ ├── architect.md # Architect agent role definition
│ ├── scrum-master.md # Scrum Master agent role definition
│ ├── developer.md # Developer agent role definition
│ └── qa.md # QA agent role definition
├── config/
│ └── bmad.config.yaml # BMAD configuration
└── README.md # BMAD guide
docs/
└── templates/
├── project-brief-template.md
├── prd-template.md
└── architecture-template.md
stories/
└── templates/
└── story-template.md
.bmad/
└── .gitignore
.bmad-initialized # Marker file
```
5. **Use the templates** from `~/.claude/skills/bmad-method/templates/` if available
6. **Create Memory entities** for this BMAD project:
- Create entity for the project itself
- Add observation: "BMAD initialized on [date]"
- Create relation to BMAD methodology
7. **Set up initial todo**:
- Use TodoWrite to create planning phase todos:
- "Create docs/prd.md (PM role)"
- "Create docs/architecture.md (Architect role)"
8. **Explain next steps**:
- Phase 1: Planning (PRD → Architecture)
- Phase 2: Development (Stories → Implementation → QA)
- Offer to help create PRD now
## Important
- Use the Write tool to create all files with proper content
- Reference the BMAD Method skill for complete agent definitions and templates
- Make this fast and seamless - complete structure in seconds
- Be enthusiastic about BMAD's benefits!
+236
View File
@@ -0,0 +1,236 @@
# Create Product Requirements Document
You are being asked to create a comprehensive PRD for this project.
## Your Task - PM Agent Role
Act as the PM (Product Manager) agent to create a detailed Product Requirements Document.
### 1. Check Prerequisites
- Look for `docs/project-brief.md` (optional but helpful)
- If exists, read it thoroughly to understand the problem and opportunity
### 2. Gather Information
Have a conversation with the user to understand:
**Project Vision:**
- What is this product/project?
- What problem does it solve?
- Who are the users?
- What's the business value?
**Functional Needs:**
- What capabilities must the system have?
- What user journeys are critical?
- What features are must-have vs nice-to-have?
**Non-Functional Needs:**
- Performance requirements (response time, throughput)
- Security requirements
- Scalability needs
- Reliability targets
- Usability standards
### 3. Create PRD Structure
Create `docs/prd.md` with comprehensive sections:
```markdown
# Product Requirements Document (PRD)
> **Product:** [Product Name]
> **Created by:** PM Agent
> **Date:** [Today's date]
> **Status:** Draft
> **Version:** 1.0
## Executive Summary
[2-3 paragraphs: what this is, why it matters, key goals]
## Product Vision
### Mission
[The overarching mission]
### Goals
1. [Primary goal]
2. [Secondary goal]
3. [Tertiary goal]
### Success Metrics
| Metric | Target | Measurement |
|--------|--------|-------------|
| [Metric] | [Value] | [How measured] |
## User Personas
### Persona 1: [Role/Name]
- **Background:** [Context]
- **Goals:** [What they want]
- **Pain Points:** [Current frustrations]
- **Technical Proficiency:** [Skill level]
[Repeat for each persona]
## Functional Requirements (FRs)
### FR-001: [Requirement Title]
**Priority:** Critical / High / Medium / Low
**User Story:** As a [user], I want [capability] so that [benefit]
**Description:** [Detailed description]
**Acceptance Criteria:**
- [Criterion 1]
- [Criterion 2]
### FR-002: [Next Requirement]
[Continue numbering sequentially]
[... more FRs ...]
## Non-Functional Requirements (NFRs)
### NFR-001: Performance
**Description:** [Performance requirements]
**Criteria:**
- API response time: < 200ms for 95th percentile
- Page load time: < 2 seconds
- [More metrics]
### NFR-002: Security
**Description:** [Security requirements]
**Criteria:**
- [Specific security measures]
### NFR-003: Scalability
**Description:** [Scalability requirements]
### NFR-004: Reliability
**Description:** [Reliability requirements]
**Target:** 99.9% uptime
### NFR-005: Usability
**Description:** [Usability requirements]
[Add more NFRs as needed]
## Epics
### Epic-001: [Epic Name]
**Business Value:** [Why this matters]
**Priority:** Critical / High / Medium / Low
**Target Release:** [Version or timeframe]
**Description:** [Detailed epic description]
**Related Requirements:**
- FR-001: [Title]
- FR-003: [Title]
- NFR-001: [Title]
**User Stories:**
1. As a [user], I want [capability] so that [benefit]
2. [More stories]
**Success Criteria:**
- [How we know this Epic succeeded]
---
### Epic-002: [Next Epic]
[Same structure]
[... more Epics ...]
## MVP Definition
### MVP Features (Must Have)
- Epic-001: [Epic name]
- Epic-002: [Epic name]
- FR-XXX, FR-YYY (if standalone)
### Post-MVP (Future)
- Epic-XXX: [Future epic]
- [Future features]
## Dependencies
- [External or internal dependencies]
## Constraints
- [Technical, business, timeline constraints]
## Risks
| Risk | Likelihood | Impact | Mitigation |
|------|-----------|--------|-----------|
| [Risk] | H/M/L | H/M/L | [Strategy] |
## Appendix
### Glossary
- **Term:** Definition
### References
- [Links to research, user studies, etc.]
```
### 4. Apply Best Practices
- Number all FRs sequentially (FR-001, FR-002, ...)
- Number all NFRs sequentially (NFR-001, NFR-002, ...)
- Make requirements SMART: Specific, Measurable, Achievable, Relevant, Time-bound
- Keep requirements solution-agnostic (describe WHAT, not HOW)
- Each Epic should deliver independent user value
- Group related FRs into Epics logically
### 5. Create Memory Entities
Store in Knowledge Graph:
- Create entity for the project
- Create entities for each Epic (Epic-001, Epic-002)
- Create entities for critical FRs
- Create entities for NFRs
- Link FRs to their Epics
- Add observations about priorities and dependencies
### 6. Create Todos
Use TodoWrite for next steps:
- "Create docs/architecture.md (Architect role)"
- "Review PRD with stakeholders"
### 7. Explain Next Steps
```
✓ PRD created: docs/prd.md
Summary:
- X Functional Requirements (FR-001 to FR-XXX)
- Y Non-Functional Requirements (NFR-001 to NFR-YYY)
- Z Epics defined
Next Steps:
1. Architect role: Create docs/architecture.md
- Design system to meet these requirements
- Choose tech stack addressing NFRs
- Define data models and APIs
Would you like me to transition to Architect role now?
```
### 8. Offer Assistance
Ask if user wants to:
- Review and refine any sections
- Add more Epics or requirements
- Move to Architect role to create architecture
- Create project brief first (if not done)
## Important
- Be thorough but pragmatic
- Focus on user value and business outcomes
- Make every requirement testable and verifiable
- Avoid technical implementation details (that's Architect's job)
- Ensure consistency across all sections
- This PRD is the foundation for ALL development work
+175
View File
@@ -0,0 +1,175 @@
# Create BMAD Story
You are being asked to create a new BMAD story file with full context.
## Your Task - Scrum Master Role
Act as the Scrum Master agent to create a hyper-detailed story file.
### 1. Verify Prerequisites
Before creating a story:
- Check `docs/prd.md` exists and read it
- Check `docs/architecture.md` exists and read it
- If either missing, inform user they must complete Planning Phase first
### 2. Gather Information
Ask the user:
- Which Epic is this story for? (or create new epic)
- What should this story accomplish? (objective)
- Are there any prerequisite stories?
### 3. Determine Story Number
- List existing stories in `stories/epic-XXX/`
- Determine next story number (e.g., story-042)
### 4. Create Story File
Create `stories/epic-XXX/story-YYY.md` with ALL sections:
```markdown
# Story: [Clear, Descriptive Title]
## Epic Reference
Epic-XXX: [Epic Name]
## Story ID
Story-YYY
## Objective
[One paragraph describing what this story accomplishes]
## Context
### Related PRD Sections
- **FR-XXX:** [Quote the relevant functional requirement from PRD]
- **NFR-YYY:** [Quote relevant non-functional requirements]
### Architecture References
- **Component:** [Which component from architecture.md]
- **Pattern:** [Architectural pattern to follow from architecture.md]
- **Dependencies:** [Technical dependencies]
### Prerequisites
- **Story-AAA:** [Description] - Status: ✓ Complete
[Or mark as ☐ Pending or ⧗ In Progress]
## Acceptance Criteria
1. [Specific, testable criterion based on PRD]
2. [Another criterion]
3. [Another criterion]
[Make these VERY specific and verifiable]
## Implementation Details
### Approach
[Step-by-step implementation approach based on architecture]
1. **Step 1:** [Detailed step]
2. **Step 2:** [Next step]
### Files to Modify/Create
- `path/to/file.py`: [What to do in this file]
- `tests/test_file.py`: [Tests to create]
### Technical Considerations
- **Performance:** [From NFRs]
- **Security:** [Security considerations]
- **Edge Cases:** [Important edge cases]
### Code Example
```[language]
# Example showing the pattern to follow
```
## Testing Requirements
### Unit Tests
- **Test 1:** [Specific test case]
- **Test 2:** [Another test]
### Integration Tests
- **Scenario 1:** [Integration to test]
### Manual Validation Steps
1. [Manual step to verify]
2. [Another step]
## Definition of Done
- [ ] Code implemented following architecture
- [ ] Unit tests written and passing (80%+ coverage)
- [ ] Integration tests written and passing
- [ ] Code reviewed for quality
- [ ] Documentation updated
- [ ] Story file updated with implementation notes
- [ ] All acceptance criteria verified
## Implementation Notes
[Developer fills this during implementation]
## QA Validation
[QA fills this during testing]
```
### 5. Apply MECE Principles
Ensure this story is:
- **Mutually Exclusive:** No overlap with other stories
- **Collectively Exhaustive:** Covers its scope completely
- **Atomic:** Can be implemented independently in 1-3 days
### 6. Embed Full Context
Critical: Include enough context that Developer agent can implement without asking questions:
- Quote specific PRD requirements
- Reference exact Architecture sections
- Provide code examples from architecture
- List all prerequisites clearly
- Define acceptance criteria precisely
### 7. Create Memory Entities
Use Memory to track:
- Create story entity
- Link to epic entity
- Link to PRD requirements (FR-XXX entities)
- Link to architecture decisions
- Add prerequisite relationships
### 8. Create Todo
Use TodoWrite to add:
- "Implement Story-YYY: [Title] (Developer role)"
- Mark prerequisites as dependencies
### 9. Confirm with User
Show the story file path and summary:
```
✓ Story created: stories/epic-003/story-042.md
Story-042: User Authentication Endpoint
- Epic: User Management System
- Prerequisites: Story-038 (User Model) ✓ Complete
- Acceptance Criteria: 4 criteria defined
- Estimated: 2 days
Ready for Developer to implement!
```
Offer to:
- Create more stories for this epic
- Transition to Developer role to implement
- Create epic planning breakdown
## Important
- Be extremely detailed in implementation approach
- Quote PRD and Architecture verbatim where relevant
- Provide concrete code examples
- Anticipate edge cases
- Make acceptance criteria testable
- This story file is THE source of truth for implementation
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
#
# Claude Code Hook: Project Open
# Automatically detects BMAD structure when project is opened
# This hook runs when Claude Code opens a project directory
# It should execute quickly and not block the UI
# Check for BMAD indicators
has_bmad=false
if [[ -d "bmad-agent" ]] || [[ -f ".bmad-initialized" ]] || [[ -f "docs/prd.md" ]]; then
has_bmad=true
fi
if [[ "$has_bmad" == "true" ]]; then
# Signal to Claude Code that BMAD mode should be activated
echo "BMAD_DETECTED=true"
echo "BMAD_MODE=active"
# Check what planning documents exist
[[ -f "docs/prd.md" ]] && echo "BMAD_HAS_PRD=true" || echo "BMAD_HAS_PRD=false"
[[ -f "docs/architecture.md" ]] && echo "BMAD_HAS_ARCH=true" || echo "BMAD_HAS_ARCH=false"
# Count stories
if [[ -d "stories" ]]; then
story_count=$(find stories -name "*.md" -not -path "*/templates/*" 2>/dev/null | wc -l)
echo "BMAD_STORY_COUNT=$story_count"
fi
else
echo "BMAD_DETECTED=false"
fi
# Exit successfully
exit 0
+379
View File
@@ -0,0 +1,379 @@
#!/usr/bin/env bash
###############################################################################
# BMAD Skills for Claude Code - Installer
#
# This script installs BMAD Method skills, commands, and hooks for Claude Code
#
# Usage:
# ./install.sh
# ./install.sh --force # Overwrite existing files
###############################################################################
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Configuration
FORCE=false
CLAUDE_DIR="${HOME}/.claude"
SKILLS_DIR="${CLAUDE_DIR}/skills"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
###############################################################################
# Parse Arguments
###############################################################################
while [[ $# -gt 0 ]]; do
case $1 in
--force)
FORCE=true
shift
;;
-h|--help)
echo "BMAD Skills Installer for Claude Code"
echo ""
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Options:"
echo " --force Overwrite existing files"
echo " -h, --help Show this help message"
exit 0
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
###############################################################################
# Helper Functions
###############################################################################
log_info() {
echo -e "${BLUE}${NC} $1"
}
log_success() {
echo -e "${GREEN}${NC} $1"
}
log_warning() {
echo -e "${YELLOW}${NC} $1"
}
log_error() {
echo -e "${RED}${NC} $1"
}
log_heading() {
echo ""
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo -e "${CYAN} $1${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════════${NC}"
echo ""
}
###############################################################################
# Installation Functions
###############################################################################
create_directories() {
log_info "Creating Claude Code directories..."
mkdir -p "${SKILLS_DIR}/bmad-method"
mkdir -p "${SKILLS_DIR}/security"
mkdir -p "${SKILLS_DIR}/python"
mkdir -p "${SKILLS_DIR}/javascript"
mkdir -p "${SKILLS_DIR}/devops"
mkdir -p "${SKILLS_DIR}/testing"
mkdir -p "${SKILLS_DIR}/git"
log_success "Directories created"
}
install_skills() {
log_info "Installing BMAD skills..."
# Copy all skill files
cp "${SCRIPT_DIR}/skills/bmad-method/SKILL.md" "${SKILLS_DIR}/bmad-method/SKILL.md"
cp "${SCRIPT_DIR}/skills/security/SKILL.md" "${SKILLS_DIR}/security/SKILL.md"
cp "${SCRIPT_DIR}/skills/python/SKILL.md" "${SKILLS_DIR}/python/SKILL.md"
cp "${SCRIPT_DIR}/skills/javascript/SKILL.md" "${SKILLS_DIR}/javascript/SKILL.md"
cp "${SCRIPT_DIR}/skills/devops/SKILL.md" "${SKILLS_DIR}/devops/SKILL.md"
cp "${SCRIPT_DIR}/skills/testing/SKILL.md" "${SKILLS_DIR}/testing/SKILL.md"
cp "${SCRIPT_DIR}/skills/git/SKILL.md" "${SKILLS_DIR}/git/SKILL.md"
log_success "Skills installed to ${SKILLS_DIR}"
}
install_templates() {
log_info "Installing BMAD templates..."
# Templates are embedded in the /bmad-init command
# But we can create a reference directory for users
mkdir -p "${SKILLS_DIR}/bmad-method/templates"
cat > "${SKILLS_DIR}/bmad-method/templates/README.md" << 'EOF'
# BMAD Templates
Templates are automatically created when you run `/bmad-init` in a project.
## Available Templates
- **project-brief-template.md** - Analyst role template
- **prd-template.md** - PM role template (FRs, NFRs, Epics)
- **architecture-template.md** - Architect role template
- **story-template.md** - Scrum Master role template
## Usage
Use slash commands instead of manually copying templates:
- `/bmad-init` - Initialize complete BMAD structure with all templates
- `/bmad-prd` - Create PRD interactively (PM role)
- `/bmad-arch` - Create Architecture interactively (Architect role)
- `/bmad-story` - Create story file interactively (SM role)
Templates will be created in your project directory automatically.
EOF
log_success "Template reference created"
}
check_project_commands() {
log_info "Checking for project-level commands directory..."
if [[ -d ".claude/commands" ]]; then
log_success "Found .claude/commands in current directory"
return 0
else
log_warning "No .claude/commands found in current directory"
log_info "Commands will be available after you run them once in Claude Code"
return 1
fi
}
create_commands_readme() {
log_info "Creating commands README..."
mkdir -p "${SKILLS_DIR}/bmad-method/commands-reference"
cat > "${SKILLS_DIR}/bmad-method/commands-reference/README.md" << 'EOF'
# BMAD Slash Commands
These commands are available in Claude Code when working with BMAD projects.
## Installation
The first time you use a BMAD command in Claude Code, it will be automatically
created in your project's `.claude/commands/` directory.
Alternatively, copy the command files from this repository's `commands/` directory
to your project's `.claude/commands/` directory.
## Available Commands
### `/bmad-init`
Initialize BMAD structure in the current project.
- Creates bmad-agent/, docs/, stories/ directories
- Generates agent definition files
- Creates document templates
- Sets up configuration
### `/bmad-prd`
Create Product Requirements Document (PM role).
- Interactive PRD creation
- Defines FRs, NFRs, Epics
- Stores requirements in Memory
- Creates foundation for development
### `/bmad-arch`
Create System Architecture Document (Architect role).
- Reads PRD requirements
- Designs system components
- Defines tech stack with justification
- Creates data models and API specs
- Stores architecture decisions in Memory
### `/bmad-story`
Create detailed story file (Scrum Master role).
- Reads PRD and Architecture
- Creates hyper-detailed story with full context
- Embeds implementation guidance
- Stores story in Memory with relationships
### `/bmad-assess`
Assess BMAD project compliance and status.
- Checks structure and document quality
- Analyzes story completeness
- Verifies code alignment with architecture
- Provides actionable recommendations
## Usage in Claude Code
Simply type the command in chat:
```
/bmad-init
```
Claude Code will execute the command and guide you through the process.
## Command Files Location
In your project:
```
.claude/commands/
├── bmad-init.md
├── bmad-prd.md
├── bmad-arch.md
├── bmad-story.md
└── bmad-assess.md
```
In this repository:
```
commands/
├── bmad-init.md
├── bmad-prd.md
├── bmad-arch.md
├── bmad-story.md
└── bmad-assess.md
```
EOF
log_success "Commands README created"
}
verify_installation() {
log_info "Verifying installation..."
local errors=0
# Check skills
for skill in bmad-method security python javascript devops testing git; do
if [[ -f "${SKILLS_DIR}/${skill}/SKILL.md" ]]; then
log_success "Skill verified: ${skill}"
else
log_error "Skill missing: ${skill}"
errors=$((errors + 1))
fi
done
if [[ $errors -eq 0 ]]; then
log_success "All skills verified successfully"
return 0
else
log_error "Installation verification failed: $errors error(s)"
return 1
fi
}
print_next_steps() {
log_heading "Installation Complete!"
echo "📦 Installed to: ${SKILLS_DIR}"
echo ""
echo "✓ BMAD Method Skill"
echo "✓ Security Skill"
echo "✓ Python Skill"
echo "✓ JavaScript/TypeScript Skill"
echo "✓ DevOps Skill"
echo "✓ Testing Skill"
echo "✓ Git Skill"
echo ""
echo "📋 Next Steps:"
echo ""
echo "1️⃣ ${CYAN}Start or restart Claude Code${NC}"
echo " Skills will be automatically loaded in new sessions"
echo ""
echo "2️⃣ ${CYAN}Open a project in Claude Code${NC}"
echo " BMAD will automatically detect if project uses BMAD Method"
echo ""
echo "3️⃣ ${CYAN}For new projects, Claude Code will suggest BMAD${NC}"
echo " If project is substantial/complex, you'll get:"
echo " \"Would you like me to set up the BMAD Method structure?\""
echo ""
echo "4️⃣ ${CYAN}Use BMAD commands${NC}"
echo " /bmad-init - Initialize BMAD structure"
echo " /bmad-prd - Create PRD (PM role)"
echo " /bmad-arch - Create Architecture (Architect role)"
echo " /bmad-story - Create story (SM role)"
echo " /bmad-assess - Assess project status"
echo ""
echo "📚 ${CYAN}To install commands in a project:${NC}"
echo ""
echo " Option 1: Use commands in Claude Code (auto-creates)"
echo " Option 2: Copy manually:"
echo " cp -r ${SCRIPT_DIR}/commands .claude/"
echo ""
echo "🔍 ${CYAN}To install hooks in a project:${NC}"
echo ""
echo " cp ${SCRIPT_DIR}/hooks/project-open.sh .claude/hooks/"
echo " chmod +x .claude/hooks/project-open.sh"
echo ""
echo "🎯 ${CYAN}How BMAD Works in Claude Code:${NC}"
echo ""
echo "${GREEN}Auto-Detection${NC}: Checks for bmad-agent/, .bmad-initialized, docs/prd.md"
echo "${GREEN}Smart Suggestion${NC}: Scores project (0-9), suggests if score ≥ 3"
echo "${GREEN}Memory Integration${NC}: Stores PRD, Architecture, Stories in Knowledge Graph"
echo "${GREEN}Todo Tracking${NC}: Stories become todos automatically"
echo "${GREEN}Role-Based${NC}: Claude Code acts as Analyst/PM/Architect/SM/Dev/QA"
echo ""
echo "${GREEN}✓ BMAD Skills ready! Claude Code now has BMAD superpowers.${NC}"
echo ""
echo "Documentation: ${SCRIPT_DIR}/README.md"
echo "GitHub: https://github.com/bmad-code-org/BMAD-METHOD"
}
###############################################################################
# Main Installation
###############################################################################
main() {
log_heading "BMAD Skills for Claude Code - Installer"
# Check if Claude directory exists
if [[ ! -d "${CLAUDE_DIR}" ]]; then
log_warning "Claude Code directory not found: ${CLAUDE_DIR}"
log_info "Creating directory..."
mkdir -p "${CLAUDE_DIR}"
fi
# Check for existing installation
if [[ -f "${SKILLS_DIR}/bmad-method/SKILL.md" ]] && [[ "$FORCE" != "true" ]]; then
log_warning "BMAD skills already installed"
read -p "Reinstall and overwrite? (y/N): " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
log_info "Installation cancelled"
exit 0
fi
fi
# Perform installation
create_directories
install_skills
install_templates
create_commands_readme
# Verify installation
if verify_installation; then
print_next_steps
exit 0
else
log_error "Installation failed"
exit 1
fi
}
# Run installation
main "$@"
+496
View File
@@ -0,0 +1,496 @@
# BMAD Method Skill
## Overview
This skill enables the **BMAD Method** (Breakthrough Method for Agile AI-Driven Development) in Claude Code - a revolutionary Agentic Agile framework for structured, context-preserved development.
## Core Principles
### Two-Phase Approach
1. **Agentic Planning** (Before coding)
- Analyst → Project Brief
- PM → Product Requirements Document (PRD)
- Architect → System Architecture
2. **Context-Engineered Development** (Implementation)
- Scrum Master → Hyper-detailed Story Files
- Developer → Implementation with tests
- QA → Validation and sign-off
### Key Innovations
- **Context Preservation**: Story files contain EVERYTHING needed - no searching
- **MECE Task Sharding**: Stories are Mutually Exclusive, Collectively Exhaustive
- **Architecture Authority**: `docs/architecture.md` is single source of truth
- **Memory Integration**: Use Claude Code's Knowledge Graph to track relationships
## Automatic BMAD Detection
At the start of EVERY session:
1. **Check for BMAD structure**:
- `bmad-agent/` directory exists?
- `.bmad-initialized` marker file exists?
- `docs/prd.md` or `docs/architecture.md` exist?
2. **If BMAD detected**:
- Activate BMAD mode immediately
- Load planning documents (PRD, Architecture) into context
- Check Memory for stored entities
- Determine current phase and agent role
- DO NOT mention detection to user - just work in BMAD mode
3. **If BMAD not detected**:
- Analyze project context (scoring system below)
- If score ≥ 3: Suggest BMAD setup
- If score < 3: Work normally, don't mention BMAD
## Context Scoring for BMAD Suggestion
Score the project to determine if BMAD would help:
- **New/greenfield project** (< 10 files): +3 points
- **Complex structure** (multiple directories, 20+ files): +2 points
- **User mentions** "architecture", "structure", "organize", "plan": +2 points
- **User mentions** "large", "complex", "multi", "team": +1 point
- **Has project files** (package.json, setup.py, Cargo.toml): +1 point
**If score ≥ 3**: Suggest BMAD
**If score < 3**: Continue normally
### How to Suggest BMAD
```
🎯 I notice this is a [substantial/complex/multi-feature] project.
Would you like me to set up the BMAD Method structure?
BMAD provides:
✓ Structured planning (PRD & Architecture docs)
✓ Task organization (Epics & Stories)
✓ Context preservation across development
✓ Agent-based workflow for clarity
✓ Prevents technical debt and context loss
I can create the complete structure using `/bmad-init`.
Set up BMAD? (y/n)
```
If yes: Run `/bmad-init` slash command
If no: Never mention BMAD again for this project
## BMAD Commands Available
When BMAD is active or being set up, use these slash commands:
- **`/bmad-init`** - Initialize BMAD structure in current project
- **`/bmad-prd`** - Create Product Requirements Document (PM role)
- **`/bmad-arch`** - Create System Architecture (Architect role)
- **`/bmad-story`** - Create detailed story file (Scrum Master role)
- **`/bmad-assess`** - Assess project status and compliance
These commands handle the heavy lifting - you orchestrate and assist.
## Agent Roles
### Planning Phase
**Analyst Agent**
- Role: Project research, market analysis
- Deliverable: `docs/project-brief.md` (optional)
- When: User wants to explore problem space before PRD
**PM Agent**
- Role: Requirements definition
- Deliverable: `docs/prd.md` (required before coding)
- Use: `/bmad-prd` command
- Creates: Functional Requirements (FR-XXX), Non-Functional Requirements (NFR-XXX), Epics
**Architect Agent**
- Role: System design
- Deliverable: `docs/architecture.md` (required before coding)
- Use: `/bmad-arch` command
- Defines: Tech stack, components, data models, APIs, patterns
### Development Phase
**Scrum Master Agent**
- Role: Story creation with full context
- Deliverable: `stories/epic-XXX/story-YYY.md`
- Use: `/bmad-story` command
- Applies: MECE principles, embeds PRD + Architecture context
**Developer Agent**
- Role: Implementation
- Deliverable: Code, tests, documentation
- Process:
1. Read complete story file
2. Verify prerequisites
3. Implement per architecture
4. Write tests per story requirements
5. Update story with implementation notes
6. Mark Definition of Done items
**QA Agent**
- Role: Validation and sign-off
- Deliverable: Test results, story sign-off
- Process:
1. Run automated tests
2. Execute manual validation steps
3. Verify all acceptance criteria
4. Document findings in story file
5. Sign off if approved or report issues
## Memory Integration
Use Claude Code's Memory (Knowledge Graph) to preserve context:
### When Creating PRD
```javascript
// Create entities for the project
create_entities([
{
name: "ProjectName",
entityType: "BMAD_Project",
observations: ["BMAD initialized on 2025-10-24", "MVP deadline: Q1 2026"]
}
])
// Create entities for each Epic
create_entities([
{
name: "Epic-001-UserAuthentication",
entityType: "BMAD_Epic",
observations: ["Business value: Enable secure user access", "Priority: Critical"]
}
])
// Create relations
create_relations([
{
from: "Epic-001-UserAuthentication",
to: "ProjectName",
relationType: "belongs_to"
}
])
// Create FR entities
create_entities([
{
name: "FR-001",
entityType: "FunctionalRequirement",
observations: ["User registration with email/password", "Priority: Critical"]
}
])
// Link FRs to Epics
create_relations([
{
from: "FR-001",
to: "Epic-001-UserAuthentication",
relationType: "implements"
}
])
```
### When Creating Architecture
```javascript
// Store architecture decisions
create_entities([
{
name: "TechStack-Backend",
entityType: "ArchitectureDecision",
observations: [
"Language: Python 3.11+",
"Framework: FastAPI",
"Rationale: Async performance for NFR-001",
"Decided: 2025-10-24"
]
}
])
// Link to NFRs
create_relations([
{
from: "TechStack-Backend",
to: "NFR-001-Performance",
relationType: "addresses"
}
])
```
### When Creating Stories
```javascript
// Create story entity
create_entities([
{
name: "Story-042",
entityType: "BMAD_Story",
observations: [
"Title: User authentication endpoint",
"Epic: Epic-001",
"Status: Pending",
"Estimated: 2 days"
]
}
])
// Link to requirements and architecture
create_relations([
{from: "Story-042", to: "FR-001", relationType: "implements"},
{from: "Story-042", to: "Epic-001-UserAuthentication", relationType: "belongs_to"},
{from: "Story-042", to: "TechStack-Backend", relationType: "uses"}
])
```
### When Implementing
```javascript
// Update story status
add_observations([
{
entityName: "Story-042",
contents: [
"Status: In Progress",
"Started: 2025-10-24",
"Developer notes: Implementing JWT auth"
]
}
])
```
### When Completing
```javascript
// Mark complete and link to code
add_observations([
{
entityName: "Story-042",
contents: [
"Status: Complete",
"Completed: 2025-10-24",
"Files: src/api/auth.py, tests/test_auth.py",
"Tests: 15/15 passing",
"QA: Approved by QA Agent"
]
}
])
```
## TodoWrite Integration
Stories should become Todos for tracking:
### When Creating Story
```javascript
// Add to todo list
TodoWrite({
todos: [
{
content: "Implement Story-042: User authentication endpoint",
status: "pending",
activeForm: "Implementing Story-042"
}
]
})
```
### When Starting Implementation
```javascript
// Mark in progress
TodoWrite({
todos: [
{
content: "Implement Story-042: User authentication endpoint",
status: "in_progress",
activeForm: "Implementing Story-042"
}
]
})
```
### When Complete
```javascript
// Mark completed
TodoWrite({
todos: [
{
content: "Implement Story-042: User authentication endpoint",
status: "completed",
activeForm: "Implementing Story-042"
}
]
})
```
## Workflow Enforcement
### Rule 1: No Coding Without Planning
```
If user asks to implement features:
if docs/prd.md does NOT exist:
STOP
Say: "BMAD requires a PRD before coding. This prevents context loss and rework."
Offer: "Would you like me to create the PRD now? (`/bmad-prd`)"
if docs/architecture.md does NOT exist:
STOP
Say: "BMAD requires Architecture before coding. This ensures consistent technical decisions."
Offer: "Would you like me to create the Architecture now? (`/bmad-arch`)"
```
### Rule 2: Architecture is Authority
```
When making ANY technical decision:
1. Check docs/architecture.md FIRST
2. Follow what it specifies (language, framework, patterns)
3. NEVER contradict architecture without user approval
4. If architecture doesn't address something, propose addition to architecture
When implementing:
- Use exact tech stack from architecture
- Follow patterns defined in architecture
- Reference architecture sections in code comments
- Match directory structure to architecture
```
### Rule 3: Story Files are Source of Truth
```
When implementing a story:
1. Read COMPLETE story file before any code
2. Verify prerequisites are complete
3. Implement exactly per "Implementation Details" section
4. Write tests per "Testing Requirements" section
5. Update story file with "Implementation Notes"
6. Check off all "Definition of Done" items
7. Add to Memory: Story status and completion
NEVER make assumptions - story file has all context.
```
### Rule 4: Memory-First Development
```
Before starting work:
- Check Memory for existing entities
- Load PRD requirements, Architecture decisions
- Understand Story relationships
During work:
- Update Memory with progress
- Link code to requirements
- Store important decisions
After completing:
- Mark entities complete
- Update relationships
- Enable future context preservation
```
## Assessment
Use `/bmad-assess` to check:
- ✓ Structure presence
- ✓ Planning document quality (PRD, Architecture)
- ✓ Story completeness and context
- ✓ Code alignment with architecture
- ✓ Test coverage
- ✓ Memory graph health
Provide actionable recommendations.
## Git Integration
### Commit Messages
```
<type>(Story-XXX): <description>
- Detail about change
- Another detail
Implements acceptance criteria 1, 2 from Story-XXX
Addresses FR-YYY from PRD
```
### Branch Names
```
story/042-user-authentication
feature/epic-001-user-management
```
### PR Descriptions
Link to story file and acceptance criteria.
## Best Practices
1. **Always check for BMAD first** - Automatic, silent detection
2. **Suggest BMAD when beneficial** - Use scoring system
3. **Use slash commands** - Don't reinvent, use `/bmad-*` commands
4. **Leverage Memory** - Store and retrieve context via Knowledge Graph
5. **Track with Todos** - Stories → Todos for visibility
6. **Architecture is law** - Never contradict without approval
7. **Context in stories** - Embed everything Developer needs
8. **Update as you go** - Keep story files and Memory current
9. **Assess regularly** - Use `/bmad-assess` to check health
## When NOT to Use BMAD
Don't suggest BMAD for:
- Quick scripts (< 5 files)
- Simple bug fixes
- Exploratory prototypes (unless user wants structure)
- Projects where user prefers ad-hoc development
## Integration with Other Skills
BMAD works WITH other Claude Code skills:
- **Security Skill**: Referenced in Architecture (NFR-002 typically)
- **Python/JS Skill**: Applied per Architecture tech stack choice
- **Testing Skill**: Enforced via story Testing Requirements
- **DevOps Skill**: Deployment architecture section
- **Git Skill**: BMAD-specific workflow (story/XXX branches)
Load skills based on Architecture decisions.
## Quick Reference
**Detect BMAD:**
```bash
Check: bmad-agent/ OR .bmad-initialized OR docs/prd.md
```
**Suggest BMAD:**
```
Score ≥ 3 → Suggest
Score < 3 → Work normally
```
**Commands:**
```
/bmad-init # Initialize structure
/bmad-prd # Create PRD (PM role)
/bmad-arch # Create Architecture (Architect role)
/bmad-story # Create story (SM role)
/bmad-assess # Check compliance
```
**Memory:**
```javascript
create_entities() // Store requirements, stories, decisions
create_relations() // Link everything together
add_observations() // Update progress
open_nodes() // Retrieve context
```
**Workflow:**
```
Planning: PRD → Architecture
Development: Stories → Implementation → QA
Always: Update Memory + Story files
```
---
**BMAD transforms AI-assisted development from chaotic prompting to structured engineering.**
Use it wisely, enforce it consistently, and watch context loss disappear.
File diff suppressed because it is too large Load Diff
+553
View File
@@ -0,0 +1,553 @@
# Git Excellence Skill
## Overview
Best practices for Git version control, with special integration for BMAD Method projects.
## Branch Strategies
### Standard Projects
**Main Branches:**
- `main` / `master` - Production-ready code
- `develop` - Integration branch (if using Git Flow)
**Feature Branches:**
```bash
# Format: feature/description
git checkout -b feature/user-authentication
git checkout -b feature/add-payment-processing
```
**Bug Fix Branches:**
```bash
# Format: bugfix/description
git checkout -b bugfix/fix-login-error
git checkout -b bugfix/resolve-memory-leak
```
**Hotfix Branches:**
```bash
# Format: hotfix/description
git checkout -b hotfix/security-patch
```
### BMAD Projects
**Story Branches:**
```bash
# Format: story/XXX-description
git checkout -b story/042-user-authentication
git checkout -b story/015-database-schema
```
**Epic Branches** (if needed):
```bash
# Format: epic/XXX-description
git checkout -b epic/001-user-management
```
## Commit Discipline
### Conventional Commits (Standard Projects)
```bash
# Format: <type>(<scope>): <description>
git commit -m "feat(auth): add JWT token generation"
git commit -m "fix(api): resolve null pointer in user endpoint"
git commit -m "docs(readme): update installation instructions"
git commit -m "refactor(database): optimize query performance"
git commit -m "test(auth): add integration tests for login"
git commit -m "chore(deps): update dependencies"
```
**Types:**
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `refactor`: Code refactoring
- `test`: Adding or updating tests
- `chore`: Maintenance tasks
- `perf`: Performance improvements
- `ci`: CI/CD changes
### BMAD Commit Format
```bash
# Format: <type>(Story-XXX): <description>
git commit -m "feat(Story-042): implement JWT authentication endpoint"
git commit -m "test(Story-042): add unit tests for auth service"
git commit -m "fix(Story-038): correct user model validation"
# With detailed body
git commit -m "feat(Story-042): implement JWT authentication endpoint
- Add JWT token generation with 1-hour expiration
- Implement refresh token mechanism
- Add rate limiting (5 attempts per minute)
- Include comprehensive error handling
Implements acceptance criteria 1, 2, 3 from Story-042
Addresses FR-015 from PRD
Follows architecture pattern in architecture.md section 4.2"
```
## Commit Best Practices
### Make Atomic Commits
**Good:**
```bash
# One logical change per commit
git add src/auth/jwt.py tests/test_jwt.py
git commit -m "feat(auth): add JWT token generation"
git add src/auth/refresh.py tests/test_refresh.py
git commit -m "feat(auth): add token refresh mechanism"
```
**Bad:**
```bash
# Multiple unrelated changes
git add src/auth/*.py src/api/*.py src/models/*.py
git commit -m "add auth and other stuff"
```
### Write Clear Commit Messages
**Good:**
```bash
"fix(api): resolve race condition in concurrent user updates
The previous implementation didn't handle concurrent updates properly,
leading to data inconsistency. This fix introduces optimistic locking
using version fields."
```
**Bad:**
```bash
"fix stuff"
"wip"
"update code"
```
### Commit Often
```bash
# Commit after completing each logical unit of work
git commit -m "feat(auth): add password hashing"
git commit -m "feat(auth): add password validation"
git commit -m "test(auth): add password security tests"
```
## Git Workflow
### Standard Feature Workflow
```bash
# 1. Create feature branch from main
git checkout main
git pull origin main
git checkout -b feature/add-user-profile
# 2. Make changes and commit
git add src/profile.py
git commit -m "feat(profile): add user profile model"
git add tests/test_profile.py
git commit -m "test(profile): add profile tests"
# 3. Push to remote
git push -u origin feature/add-user-profile
# 4. Create PR on GitHub/GitLab
# 5. After review and approval, merge
# 6. Delete feature branch
git checkout main
git pull origin main
git branch -d feature/add-user-profile
```
### BMAD Story Workflow
```bash
# 1. Read story file first
cat stories/epic-001/story-042.md
# 2. Create story branch
git checkout main
git pull origin main
git checkout -b story/042-user-authentication
# 3. Implement with frequent commits
git commit -m "feat(Story-042): implement JWT service"
git commit -m "feat(Story-042): add auth endpoints"
git commit -m "test(Story-042): add comprehensive tests"
git commit -m "docs(Story-042): update API documentation"
# 4. Update story file
# Edit stories/epic-001/story-042.md with implementation notes
git add stories/epic-001/story-042.md
git commit -m "docs(Story-042): update story with implementation notes"
# 5. Push and create PR
git push -u origin story/042-user-authentication
# 6. Reference story in PR description
# Title: Story-042: User Authentication Endpoint
# Body: Link to stories/epic-001/story-042.md
```
## History Management
### Interactive Rebase (Clean Up Before Pushing)
```bash
# View commit history
git log --oneline
# Rebase last 3 commits (before pushing)
git rebase -i HEAD~3
# In editor:
# pick abc1234 feat(auth): add JWT service
# squash def5678 fix(auth): fix typo
# squash ghi9012 fix(auth): update tests
# Result: One clean commit with all changes
```
### Amending Last Commit
```bash
# Forgot to add a file
git add forgotten-file.py
git commit --amend --no-edit
# Fix commit message
git commit --amend -m "feat(auth): add JWT token generation (corrected message)"
```
**⚠️ WARNING:** Never amend or rebase commits that have been pushed and others may have pulled!
### Recovering from Mistakes
```bash
# Undo last commit but keep changes
git reset --soft HEAD~1
# Undo last commit and discard changes (careful!)
git reset --hard HEAD~1
# Recover from bad reset
git reflog
git reset --hard HEAD@{2} # Jump to previous state
```
## Merge vs Rebase
### When to Merge
```bash
# Merge feature branch into main (preserves history)
git checkout main
git merge feature/add-user-profile
```
**Use merge when:**
- Integrating feature branches into main
- You want to preserve complete history
- Working on shared branches
### When to Rebase
```bash
# Rebase feature branch onto updated main (linear history)
git checkout feature/add-user-profile
git rebase main
```
**Use rebase when:**
- Updating your feature branch with main's changes
- Cleaning up local commits before pushing
- You want linear history
**⚠️ Golden Rule:** Never rebase public branches others are using!
## Conflict Resolution
```bash
# When conflicts occur during merge/rebase
git status # See conflicted files
# Edit conflicted files, look for:
# <<<<<<< HEAD
# Your changes
# =======
# Their changes
# >>>>>>> branch-name
# After resolving conflicts
git add resolved-file.py
git commit # For merge
# OR
git rebase --continue # For rebase
# Abort if needed
git merge --abort
# OR
git rebase --abort
```
## Stashing
```bash
# Save uncommitted changes temporarily
git stash
# List stashes
git stash list
# Apply stash
git stash apply # Keep stash
git stash pop # Apply and drop stash
# Stash with message
git stash save "WIP: implementing auth endpoint"
# Apply specific stash
git stash apply stash@{2}
```
## Useful Git Commands
### Viewing History
```bash
# Pretty log
git log --oneline --graph --decorate --all
# Show changes in commit
git show abc1234
# Show file history
git log --follow -- path/to/file.py
# Search commits
git log --grep="authentication"
git log -S"JWT" # Search code changes
```
### Viewing Changes
```bash
# Unstaged changes
git diff
# Staged changes
git diff --staged
# Changes between branches
git diff main..feature/auth
# Changes in specific file
git diff HEAD~1 src/auth.py
```
### Undoing Changes
```bash
# Discard unstaged changes in file
git checkout -- file.py
# Unstage file
git restore --staged file.py
# Discard all uncommitted changes (careful!)
git reset --hard HEAD
```
## Git Configuration
### User Setup
```bash
# Set name and email
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
# Set default editor
git config --global core.editor "vim"
# Set default branch name
git config --global init.defaultBranch main
```
### Useful Aliases
```bash
# Shortcuts
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.cm commit
git config --global alias.lg "log --oneline --graph --decorate"
```
## BMAD-Specific Git Practices
### Story Branch Naming
```bash
# Always use story/XXX format
git checkout -b story/042-user-authentication
# Not:
git checkout -b auth-feature # Bad: No story reference
```
### Commit Messages Reference Stories
```bash
# Always reference Story-XXX
git commit -m "feat(Story-042): implement authentication
Implements acceptance criteria 1, 2, 3
Addresses FR-015 from PRD"
# Not:
git commit -m "add auth" # Bad: No story reference
```
### Update Story Files in Git
```bash
# Story file updates are part of the work
git add stories/epic-001/story-042.md
git commit -m "docs(Story-042): add implementation notes"
# Story file should be updated BEFORE merging
```
### PR Descriptions Link to Stories
```markdown
# Pull Request Title
Story-042: User Authentication Endpoint
# Description
Implements Story-042 from Epic-001
**Story File:** `stories/epic-001/story-042.md`
**Acceptance Criteria:**
- [x] AC-1: System validates user credentials
- [x] AC-2: JWT token generated on success
- [x] AC-3: Rate limiting active
- [x] AC-4: Comprehensive error handling
**Related PRD:** FR-015, NFR-002
**Architecture:** Follows pattern in architecture.md section 4.2
**Tests:**
- Unit tests: 15/15 passing
- Integration tests: 3/3 passing
- Coverage: 92%
```
## .gitignore Best Practices
```gitignore
# Python
__pycache__/
*.py[cod]
*.so
.Python
venv/
.env
# Node
node_modules/
npm-debug.log
.next/
dist/
# IDEs
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# BMAD - Don't ignore these!
# bmad-agent/ # Keep agent files
# docs/ # Keep planning docs
# stories/ # Keep story files
```
## Git Hooks (Advanced)
### Pre-commit Hook
```bash
# .git/hooks/pre-commit
#!/bin/bash
# Run linter
npm run lint || exit 1
# Run tests
npm test || exit 1
# For BMAD: Check story reference in branch name
branch=$(git symbolic-ref --short HEAD)
if [[ ! $branch =~ ^(story|epic)/ ]]; then
echo "Error: Branch must start with story/ or epic/"
exit 1
fi
```
### Commit-msg Hook
```bash
# .git/hooks/commit-msg
#!/bin/bash
# Ensure BMAD commits reference story
commit_msg=$(cat "$1")
if [[ ! $commit_msg =~ Story-[0-9]+ ]]; then
echo "Error: Commit message must reference Story-XXX"
exit 1
fi
```
## Best Practices Summary
1. **Commit early and often** - Small, atomic commits
2. **Write meaningful messages** - Explain WHY, not just WHAT
3. **Keep branches short-lived** - Merge frequently
4. **Pull before push** - Avoid conflicts
5. **Review before committing** - Use `git diff --staged`
6. **Use branches for all work** - Never commit directly to main
7. **Keep history clean** - Rebase before pushing (if sole contributor)
8. **Reference context** - In BMAD, always reference stories
9. **Update documentation** - Story files, README, etc.
10. **Communicate with team** - PRs, commit messages, branch names
## BMAD Integration Summary
In BMAD projects, Git becomes part of the methodology:
- **Branch names** → `story/XXX-description`
- **Commit messages** → Reference `Story-XXX`
- **PR descriptions** → Link to story files
- **Story files tracked** → Under version control
- **Planning docs tracked** → PRD, Architecture in Git
- **Context preserved** → Through commit history + story files
Git + BMAD = Complete traceability from requirement → story → implementation → deployment.
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff