| name | feature-branch-setup |
| description | Automate feature branch creation following project conventions, verify branch naming patterns, check base branch state, run initial QA validation, and prepare development environment. Use when starting new features, creating bug fix branches, or setting up development branches. |
Feature Branch Setup
Automates the creation and setup of feature branches following Maou project conventions.
Branch Naming Conventions
The project follows these patterns:
Feature branches: feature/{topic} or feature/{ticket-id}-{description}
Bug fix branches: fix/{issue} or fix/{ticket-id}-{description}
Refactoring branches: refactor/{topic}
Examples:
feature/add-array-bundling
feature/gh-123-implement-mcts
fix/memory-leak-training
refactor/clean-architecture-domain
Branch Creation Workflow
1. Verify Current State
Check working directory is clean:
git status
If you have uncommitted changes, commit or stash them first:
git stash
git add .
git commit -m "wip: save progress"
2. Update Base Branch
Ensure main branch is up to date:
git checkout main
git pull origin main
git log --oneline -1
3. Create Feature Branch
Create and switch to new branch:
git checkout -b feature/your-topic-name
git branch --show-current
4. Run Initial QA Check
Validate that the base state passes all checks:
uv run ruff format src/
uv run ruff check src/ --fix
uv run isort src/
uv run mypy src/
uv run pytest
This ensures you're starting from a clean state.
5. Push Branch to Remote
Set up tracking with remote:
git push -u origin feature/your-topic-name
git branch -vv
Complete Setup Script
Here's the complete workflow:
git status
git checkout main
git pull origin main
git checkout -b feature/your-topic-name
uv run pytest
git push -u origin feature/your-topic-name
echo "Branch setup complete! Ready for development."
Validation Steps
Verify Branch Name Format
Check that branch name follows conventions:
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ $BRANCH =~ ^(feature|fix|refactor)/ ]]; then
echo "✓ Valid branch name: $BRANCH"
else
echo "✗ Invalid branch name: $BRANCH"
echo "Expected format: feature/*, fix/*, or refactor/*"
fi
Check Base Branch
Verify you branched from main:
git show-branch main HEAD
git merge-base main HEAD
Verify Remote Tracking
Ensure branch tracks remote:
git branch -vv
Development Environment Setup
Install Dependencies
Ensure uv environment is ready:
uv sync
uv sync --extra cpu --extra gcp
uv sync --extra cuda --extra aws
uv sync --extra tpu --extra gcp
Setup Pre-commit Hooks
Install pre-commit hooks for automatic validation:
uv run bash scripts/pre-commit.sh
Verify Environment
Test that tools are working:
uv run python --version
uv run python -c "import maou; print('✓ Maou package imports successfully')"
Common Scenarios
Scenario 1: New Feature from Scratch
git checkout main
git pull origin main
git checkout -b feature/new-awesome-feature
uv run pytest
git push -u origin feature/new-awesome-feature
Scenario 2: Bug Fix Branch
git checkout main
git pull origin main
git checkout -b fix/training-memory-leak
uv run pytest
git push -u origin fix/training-memory-leak
Scenario 3: Refactoring Branch
git checkout main
git pull origin main
git checkout -b refactor/simplify-data-pipeline
uv run pytest
git push -u origin refactor/simplify-data-pipeline
Scenario 4: Branch from Specific Commit
git checkout main
git pull origin main
git checkout -b feature/backport-fix abc1234
uv run pytest
git push -u origin feature/backport-fix
Troubleshooting
Issue: "Branch already exists"
git branch -D feature/old-topic
git push origin --delete feature/old-topic
Issue: "Uncommitted changes"
git stash
git stash list
git add .
git commit -m "wip: save progress before branching"
git reset --hard HEAD
Issue: "Not up to date with origin/main"
git fetch origin
git rebase origin/main
git merge origin/main
Issue: "Tests failing on clean branch"
git checkout -b feature/your-topic-name --no-track
Branch Lifecycle
- Create: Use this skill to setup branch
- Develop: Make changes, commit regularly
- Validate: Run QA pipeline frequently
- Review: Use
pr-preparation-checks skill
- Merge: Submit PR and merge to main
- Cleanup: Delete branch after merge
Integration with Other Skills
Before starting development:
- Use
feature-branch-setup (this skill)
- Run
qa-pipeline-automation to verify base state
During development:
- Use
architecture-validator when adding modules
- Use
type-safety-enforcer when adding functions
- Use
qa-pipeline-automation before commits
Before submitting PR:
- Use
pr-preparation-checks for final validation
Best Practices
- Branch early: Create branch before making changes
- Name descriptively: Branch name should explain purpose
- Track upstream: Always set up remote tracking
- Validate base: Ensure tests pass before starting
- Commit atomically: One logical change per commit
- Push regularly: Push to remote frequently
References
- .codex/config.yaml: Branch naming patterns (line 17)
- CLAUDE.md: Atomic commits (lines 351-354)
- AGENTS.md: Conventional commit format (lines 231-238)
- Git branching model: Feature branch workflow