Overview
Custom rules are defined in yourforge.yaml file and are applied in addition to each agent’s built-in instructions. They help enforce:
- Coding standards - Language conventions and style guides
- Team practices - Architecture patterns and design principles
- Quality requirements - Testing, documentation, and error handling
- Business logic - Domain-specific rules and constraints
Basic Usage
Add custom rules to yourforge.yaml:
Rule Writing Guidelines
Keep Rules Clear and Concise
Be Specific
Use Numbered Lists
Numbered lists help agents parse and reference specific rules:Example Rule Sets
General Code Quality
TypeScript/JavaScript
React Development
Python
API Development
Testing
Security
Documentation
Advanced Usage
Architecture Patterns
Domain-Specific Rules
Team Workflow
Combining with Commands
Use custom rules with custom commands for consistent workflows:Best Practices
Start Small
Start Small
Begin with 3-5 critical rules and expand as needed. Too many rules can reduce effectiveness.
Make Rules Actionable
Make Rules Actionable
Rules should be specific enough that an agent can follow them directly.Good: “Maximum line length is 100 characters”Bad: “Keep code readable”
Group Related Rules
Group Related Rules
Version Control
Version Control
Commit
forge.yaml to your repository so the team shares the same rules.Review and Update
Review and Update
Regularly review rules with your team and update as standards evolve.
- Remove rules that are consistently ignored
- Add rules for recurring issues
- Clarify ambiguous rules
Troubleshooting
Rules Not Being Followed
Rules Not Being Followed
If agents aren’t following rules:
- Make rules more specific and actionable
- Reduce the total number of rules (fewer is better)
- Phrase rules as direct instructions
- Verify rules are in the correct YAML format
YAML Syntax Errors
YAML Syntax Errors
Use the pipe character (
|) for multi-line rules:Conflicting Rules
Conflicting Rules
Ensure rules don’t contradict each other:Instead:
Examples by Project Type
- Web Application
- CLI Tool
- Library/SDK
- Data Pipeline
Next Steps
forge.yaml Reference
Explore all configuration options
Commands
Create custom commands