Learn how to use Codebuff to streamline your code review process.
Start in a Git Repo
Ensure you're in a Git repository before starting Codebuff. This will allow you to track changes that Codebuff makes to your code.
If Codebuff introduces an issue you don't like, you can easily revert to the previous version.
Leverage .gitignore
in your repo
Codebuff will ignore files specified in your .gitignore
file. This allows you to specify files that you don't want Codebuff to read, like configuration files or build artifacts.
If there are files you want to keep tracked in Git, but you don't want Codebuff to read, you can create a .codebuffignore
file in your repo.
Planning
Codebuff is really good at ad-hoc changes, but sometimes you have bigger features to build. You can ask Codebuff to help plan out all the details of your feature before you start coding!
Do a long brain dump of your feature, with as much technical detail as you want to consider. Don't worry about formatting it nicely.
Then, ask Codebuff to re-word what I said in a goal-oriented plan, and output that to a
plan.md` file in markdown format.
Codebuff will write out what it thinks is the best way to implement your feature, and you can use that as a starting point! Make sure to read through it carefully and adjust anything needed.
Then, you can simply ask Codebuff to build the feature, using the plan.md
file you both collaborated on as a guide.
Include docs via pasting a link
Make Codebuff even smarter by connecting it with external documentation:
- Include URLs in your messages and Codebuff will automatically scrape and convert them to markdown format
- Add documentation links to your knowledge.md files for automatic scraping on startup
- Perfect for:
- API documentation
- Framework guides
- Library references
- Design patterns
- Stack Overflow solutions
- The scraped content becomes part of Codebuff's context, helping it provide more accurate assistance
- Example: "Here's the docs for the library I'm using: [url]. Can you help me implement feature X following their best practices?"
Refactor Files
Codebuff excels at rewriting and reorganizing code. Here are some examples of what it can do:
- Convert files between languages while preserving functionality
- Update code to use new APIs or libraries
- Implement consistent patterns across your codebase
- Reorganize file structure for better maintainability
If you have projects with particular patterns and styles, Codebuff can help you keep them consistent as you develop.
Multi-file Edits
No more copy/paste! Codebuff is particularly good at making changes that involve multiple files:
- Rename functions, classes, or variables across the entire codebase
- Update API endpoints and their corresponding client code
- Modify shared types and update all their usages
- Add new features that require changes in multiple parts of the application
Code Generation
Codebuff can help generate boilerplate code and common patterns:
- Create new API endpoints with proper logging and error handling
- Generate TypeScript types from existing code
- Add test cases for new functionality
- Create documentation files in markdown format
Terminal Integration
Codebuff can run terminal commands to help with development tasks:
- Install new dependencies with the correct package manager
- Run type checks and tests after making changes
- Search through code using grep or other tools
- Move, rename, or delete files as part of refactoring
Knowledge Management
Codebuff maintains knowledge files (files ending in knowledge.md
) that capture important context about your codebase:
- Project-specific patterns and conventions
- Architecture decisions and their rationale
- Best practices for different parts of the codebase
Feel free to update them as you see fit! Codebuff will load your codebase's knowledge files every time it starts up, so it has full context into your project's unique needs and quirks.
Use these commands inside Codebuff:
login
to log into Codebuff
undo
or u
: Undo last change
redo
or r
: Redo change
diff
or d
to show changes from last assistant response
ESC
or Ctrl/Cmd + C
to stop generation
usage
to show current credit usage
clear
to clear terminal screen
Command Line Flags
Get help:
--help
: See other options
When starting Codebuff, you can use these flags to control the cost/quality tradeoff:
--lite
: Use budget models & fetch fewer files for more economical responses
--max
: Use higher quality models & fetch more files for more comprehensive responses – o1 for deep thinking, 3.5 Sonnet for picking files (also accepts --o1
)
Terminal commands
- Type two spaces in a row to insert a line break - useful for writing multi-line prompts
- Use Codebuff like a terminal by entering terminal commands directly, like
cd backend
or npm test
/run <command>
: run long terminal commands explicitly
Codebuff uses knowledge files to store project-specific information and best practices. These files help Codebuff understand your project's context and requirements.
Getting Started
You can ask Codebuff to create an initial knowledge file for your project:
Or create one manually:
- Create a
knowledge.md
file at the root of your project:
- For larger projects, you can optionally create additional knowledge files in subdirectories:
This organization helps keep knowledge specific to different parts of your codebase close to the relevant code.
What to Include
Knowledge files should contain information that isn't obvious from the code itself:
- Project goals and mission
- Technical decisions and their rationale
- Coding standards and best practices
- Common pitfalls to avoid
- Tips for working with project-specific tools
- Links to important documentation
- Build and deployment requirements
- Testing guidelines
- Verification commands to run after changes (e.g.,
npm run build
, npm run lint
, or npm test
)
Don't worry about keeping knowledge files too short - they can grow to a couple hundred lines without impacting performance or cost. Focus on capturing useful information rather than minimizing file size.
Post-Change Verification
You can specify commands that Codebuff should run after making changes to verify everything still works. For example:
When these commands are specified in a knowledge file, Codebuff will automatically run them after making changes to confirm the edits are valid.
Remember: Knowledge files should capture information that would be valuable for new team members or for refreshing your own memory after time away from the project.
Undo and Redo Changes
If Codebuff makes a change you don't like, you can easily undo it:
- Type
undo
or u
to remove the last change
- Type
redo
or r
to reapply a change you undid
- Type
diff
or d
to see what changes were made in the last response
These commands work like your editor's undo/redo, making it easy to experiment with changes while keeping your code safe.
Of course, if you use Git, you can always restore files to previous versions.
Git Integration
Codebuff works alongside your existing git workflow:
- Changes are made to your working directory
- You maintain control over what gets committed
- Review changes with
git diff
before committing
- Use normal git commands to manage your repository
You can also use Codebuff to create commit messages, just ask it to do so:
Here are some example commands beyond the normal coding you can use with Codebuff. Feel free to adapt these to your needs!
Code Review
Get feedback on your changes:
Git Workflow Commands
Manage your git workflow:
Codebase Questions
Understand your codebase:
Script Generation
Create scripts for common tasks:
Documentation Commands
Generate and update documentation:
Configuration Commands
Handle configuration tasks:
SQL Commands
Get help with database operations:
Remember that Codebuff understands natural language, so you don't need to use exact commands. Describe what you want to do in your own words, and Codebuff will help you accomplish it.
Tips for Better Results
- Be specific about what files or components you're working with
- Provide context about what you're trying to achieve
- If the first attempt isn't quite right, clarify what you need
- Use knowledge.md files to teach Codebuff about project-specific patterns