Vibe-Rules
Actionable coding rules, patterns, and best practices organized by language and framework. These rules are indexed into the knowledge graph and made available for semantic search during development.
What are Vibe-Rules?
Vibe-rules are your team's coding standards and patterns encoded as searchable knowledge:
- Searchable: Tag rules with hashtags for semantic search
- Contextual: Link rules to related concepts in the knowledge graph
- Versioned: Track rule changes in git
- Shareable: Export/import collections across projects
- Hierarchical: Global rules + language-specific + project-specific
Think of vibe-rules as executable knowledge that AI assistants can reference when suggesting code.
Directory Structure
vibe-rules/
βββ global/ # Universal rules (all languages)
β βββ naming-conventions.md
β βββ documentation-standards.md
β βββ security-guidelines.md
βββ rust/ # Rust-specific rules
β βββ async-patterns.md
β βββ error-handling.md
β βββ testing.md
βββ python/ # Python-specific rules
β βββ pep8-extensions.md
βββ typescript/ # TypeScript-specific rules
β βββ react-patterns.md
βββ collections/ # Named rule sets
βββ web-backend/
βββ cli-tools/
βββ wasm/Quick Start
1. Search Rules
With Terraphim running:
# Find async patterns
# Via Claude Desktop MCP
# Ask: "Show me async patterns"
# Claude will search vibe-rules automatically2. Add New Rule
Create vibe-rules/rust/new-pattern.md:
- 3. Rebuild Knowledge Graph
# Terraphim automatically detects new files and rebuilds
# Just restart the server or reload configuration
Rule Categories
Global Rules (All Languages)
Naming Conventions (global/naming-conventions.md)
- Variable naming
- Function naming
- Type naming
- Boolean naming
- Constants
Documentation Standards (global/documentation-standards.md)
- When to comment
- Function documentation
- Type documentation
- README structure
- Changelog format
Security Guidelines (global/security-guidelines.md)
- Input validation
- Secret management
- Authentication patterns
- Authorization patterns
- Secure communication
Rust Rules
Async Patterns (rust/async-patterns.md)
tokio::spawnpattern- Bounded channels
- Cancellation with
tokio::select! - Error propagation in async
- Structured concurrency
Error Handling (rust/error-handling.md)
thiserrorfor custom errors?operator usage- Error recovery patterns
- Early return pattern
- Logging errors
Testing (rust/testing.md)
- Unit test structure
- Integration tests
- Async testing with
tokio::test - Property-based testing
- Test organization
Python Rules
PEP 8 Extensions (python/pep8-extensions.md)
- Type hints usage
- Async patterns with
asyncio - Error handling
- Testing with
pytest
TypeScript Rules
React Patterns (typescript/react-patterns.md)
- Component structure
- State management
- Error boundaries
- Performance optimization
Rule Structure
Every rule follows this template:
- ---
- --
- --
- -
- -Collections
Collections are named sets of rules for specific project types:
web-backend/
Rules for web backend services:
- API design patterns
- Authentication/authorization
- Database access patterns
- Caching strategies
- Error handling for HTTP
cli-tools/
Rules for command-line applications:
- Argument parsing conventions
- Error message formatting
- Output formatting
- Exit code conventions
- Configuration file handling
wasm/
Rules for WebAssembly development:
- Memory management in WASM
- JavaScript interop patterns
- Performance optimization
- Size optimization
- Error handling across WASM boundary
Creating Collections
# Create collection directory
# Add rules (or symlink existing ones)
# Configure role to use collection
# In context_engineer_config.json:
{
}Tagging Strategy
Primary Tags (Category)
#async- Asynchronous programming#error- Error handling#testing- Testing approaches#security- Security patterns#performance- Performance optimization#api- API design#database- Database access
Secondary Tags (Specificity)
#tokio- Tokio-specific patterns#channels- Channel patterns#bounded- Bounded resources#cancellation- Cancellation patterns#retry- Retry logic#timeout- Timeout handling
Language Tags
#rust- Rust language#python- Python language#typescript- TypeScript language#javascript- JavaScript language
Pattern Type Tags
#pattern- Recommended pattern#antipattern- Pattern to avoid#refactoring- Refactoring technique#best-practice- Best practice
Integration with Claude Desktop
Configure Claude Desktop to use vibe-rules via MCP:
Now Claude can:
User: "How should I handle async cancellation in Rust?"
Claude: [Searches vibe-rules for #async #cancellation]
According to the async patterns rule, you should use tokio::select!
for cancellation. Here's the recommended pattern:
[Shows example from async-patterns.md with file path and line numbers]Version Control
Treat vibe-rules as code:
# Add new rule
# Update existing rule
# Share with team
# Team members pull latest rules
# Terraphim rebuilds knowledge graph automaticallyRule History
View rule evolution:
# See who changed what
# Compare versions
# Restore old version
Token Tracking
Track token usage for LLM context:
Query token usage:
# Count total tokens in vibe-rules
| Best Practices
Writing Rules
- Be Specific: Provide concrete examples, not abstract principles
- Show Both: Include good and bad examples
- Explain Why: Don't just state rules, explain reasoning
- Link Related: Cross-reference related rules
- Keep Current: Update as practices evolve
Organizing Rules
- One Rule Per File: Easier to search and link
- Descriptive Filenames:
async-patterns.mdnotrules1.md - Consistent Structure: Follow the template
- Hierarchical: Global β Language β Framework β Project
- Collections for Context: Group related rules
Maintaining Rules
- Review Quarterly: Update outdated practices
- Deprecate Gracefully: Mark old rules, don't delete immediately
- Get Team Input: Rules should reflect team consensus
- Test Examples: Ensure code examples compile/run
- Measure Impact: Track which rules help most
Migration from Other Systems
From Conare AI
If you're migrating from Conare:
- Export your vibe-rules to markdown
- Add hashtags for searching
- Place in appropriate directory (global/rust/python/etc.)
- Cross-reference related rules
- Restart Terraphim to rebuild knowledge graph
From Team Wiki
Convert wiki pages to vibe-rules:
- Export wiki pages to markdown
- Restructure using rule template
- Add code examples
- Tag with hashtags
- Organize by category
Troubleshooting
Rules Not Found in Search
# Verify files exist
# Check config includes path
|
# Rebuild knowledge graph
Autocomplete Not Working
# Test MCP server
# Verify Claude Desktop config
Conflicting Rules
When rules conflict:
- Project-specific overrides framework-specific
- Framework-specific overrides language-specific
- Language-specific overrides global
- Document exceptions in rule
Examples
See example rules in:
global/naming-conventions.md- Universal naming rulesglobal/documentation-standards.md- Documentation rulesrust/async-patterns.md- Rust async patternsrust/error-handling.md- Rust error handling
Contributing
- Fork the repository
- Add your rule following the template
- Test that examples compile
- Submit pull request
- Team reviews and discusses
- Merge and knowledge graph updates automatically
See Also
- Context Library - Reference documentation
- Conare Comparison - Context engineering with Terraphim
- Knowledge Graph System - How rules are indexed