Version: 2.2.0 Last Updated: 2026-01-15 Purpose: Documentation-only reference for AI-assisted development patterns
- Project Overview
- Development Standards
- Documentation Guidelines
- Codebase Agent (CBA) Patterns
- Git Workflow
- CI/CD for Documentation
This is a GitHub template repository demonstrating AI-assisted development best practices. It's a documentation-only reference using the "standalone patterns approach" - concepts are standalone and independently adoptable.
Key Principles:
- ✅ Standalone patterns approach - Patterns are standalone and independently adoptable
- ✅ Documentation-focused - Pure reference material, no working application
- ✅ Succinct content - No AI slop, get to the point
- ✅ Quality automation - Documentation linting and validation
- ❌ No Red Hat branding - Pure "Ambient Code" documentation
- ❌ No "Amber" terminology - Use "Codebase Agent" or "CBA" only
Documentation (docs/):
- Quickstart guide (README.md) for AI-assisted development
- Standalone pattern documentation (patterns/)
- ADR scaffolding (adr/)
Codebase Agent Configuration (.claude/):
- Agent definitions and capabilities
- Context files for modular memory system
- Example commands and skills
CI/CD (.github/workflows/):
- Codebase Agent automation (codebase-agent.yml)
- Documentation validation (docs-validation.yml)
- Security scanning (security.yml)
- Documentation deployment (deploy-docs.yml)
Automation Scripts (.github/scripts/codebase_agent/):
- Python module for CBA workflow execution
- AI client with Vertex AI and Anthropic API support
- GitHub event parsing and PR automation
For a working FastAPI application demonstrating these patterns in practice, see: demo-fastapi - Minimal application showing CBA patterns in action
For any code examples in documentation:
- Python 3.11 (primary)
- Python 3.12 (tested in CI matrix)
When testing code examples:
# Create virtual environment
python3.11 -m venv .venv
# Activate
source .venv/bin/activate
# Verify
echo $VIRTUAL_ENV # Should show project pathUse uv instead of pip for any package installations:
# Install dependencies
uv pip install -r requirements-dev.txtMANDATORY: Load repomap at session start and use proactively throughout development.
ALWAYS load .repomap.txt as the first action when starting any development session:
# At session start - load existing repomap
cat .repomap.txtPurpose: Provides token-optimized codebase context for AI-assisted development, reducing context window usage while maintaining code understanding.
Note: The .repomap.txt file is tracked in git and should already exist. Only regenerate it when structural changes occur.
Use repomap context in these scenarios:
- Planning implementations - Review repomap before designing features
- Understanding dependencies - Check which files/classes exist before creating new ones
- Code reviews - Reference structure when reviewing changes
- Refactoring - Understand impact scope across codebase
- Documentation - Ensure docs reflect actual code structure
Regenerate repomap when:
- Files are added or removed
- Classes or functions are added/removed
- Major refactoring is completed
- Before creating PRs (ensure map is current)
Automated regeneration:
The repository includes automation for repomap management:
# Manual regeneration (recommended method)
./scripts/update-repomap.sh
# Check if repomap is current
./scripts/update-repomap.sh --check
# Legacy manual method (still works)
python repomap.py . > .repomap.txt
git add .repomap.txt # Include in commitsPre-commit hook: The repomap is automatically regenerated when you commit changes to code files (.py, .js, .ts, .tsx, .go, .sh, .bash) via the pre-commit hook.
CI validation: The CI workflow validates that the repomap is current on every push/PR.
Include repomap in commit tracking:
# Pre-commit: Update repomap
python repomap.py . > .repomap.txt
git add .repomap.txt
# Commit message references structure changes
git commit -m "Add UserService class
Updated repomap to reflect new service layer structure"Use in AI prompts:
- Reference specific files/classes from repomap by name
- Ask questions about structure (e.g., "Where should I add authentication logic?")
- Validate assumptions (e.g., "Does a Config class already exist?")
- ✅ Load at session start (always)
- ✅ Regenerate after structural changes
- ✅ Reference in planning and design discussions
- ✅ Include in commit workflow
- ✅ Use to avoid duplicate implementations
- ❌ Don't rely on stale repomaps
- ❌ Don't skip regeneration before PRs
For linting documentation code examples:
# Format code examples
black docs/examples/
# Sort imports in examples
isort docs/examples/
# Lint examples
ruff check docs/examples/ALWAYS lint markdown files:
markdownlint docs/**/*.md README.md CLAUDE.md --fixALWAYS run validation before showing work:
# Run validation checks
.github/scripts/check.sh
# Auto-fix common issues
.github/scripts/auto-fix.shThis ensures all quality gates pass before presenting work to the user.
- Succinct: No AI slop, get to the point
- Practical: Focus on how to use, not theory
- Example-heavy: Show patterns, not just descriptions
- Quickstart-focused: Help users understand quickly
Core docs (docs/):
README.md- 5-minute quickstart for AI-assisted development patternspatterns/- Individual pattern documentation (standalone, independently adoptable)adr/- Architecture Decision Records scaffolding (template only)
User note: "Mermaid diagrams always have errors"
ALWAYS validate before committing:
./scripts/validate-mermaid.shCI enforcement: Blocks merge if diagrams invalid
Example validation script:
#!/bin/bash
# Validate all Mermaid diagrams
find docs/ -name "*.mmd" -exec mmdc -i {} -o /dev/null \;Location: docs/adr/
Scaffolding only - NO actual content:
README.md- Explains ADR purpose and formattemplate.md- Shows format (YYYYMMDD-title.md)
Purpose: Provide structure for teams to document their own decisions
Location: .claude/agents/codebase-agent.md
Terminology: Use "Codebase Agent" or "CBA" - NEVER "Amber"
Location: .claude/context/
Modular context files:
architecture.md- Architecture patterns and conventionssecurity-standards.md- Security best practicestesting-patterns.md- Testing strategies and patterns
Purpose: Demonstrate how to structure context for AI agents to maintain consistency across development sessions.
Common patterns to document:
- Issue-to-PR Automation - Converting well-defined issues into PRs
- Code Reviews - Providing actionable feedback
- Proactive Maintenance - Dependency updates, linting, docs
- Context Management - Using memory systems effectively
Document autonomy levels teams might implement:
- Level 1 (Conservative): PR creation only - WAIT for human approval
- Level 2 (Moderate): Auto-merge for low-risk changes (docs, deps)
- Level 3 (Aggressive): Auto-deploy after tests pass
ALWAYS work in feature branches unless explicitly told otherwise:
# Check current branch BEFORE any modifications
git branch --show-current
# Create feature branch
git checkout -b feature/descriptive-namePre-commit checklist:
- Lint markdown:
markdownlint docs/**/*.md --fix - Validate diagrams:
./scripts/validate-mermaid.sh - Check git status:
git status - Review changes:
git diff
Commit message style:
Add documentation for X pattern
- Explain Y concept
- Add diagram for Z
Focus on "why" rather than "what".
Before creating PR:
git status- check untracked filesgit diff- review all changesgit log- review commit history- Ensure CI passes (markdown linting, diagram validation)
PR requirements:
- Markdown linting passes
- Mermaid diagrams validated
- No broken links
- Documentation is clear and succinct
NEVER:
- Update git config without permission
- Run destructive commands (hard reset, force push) without explicit request
- Skip hooks (--no-verify)
- Force push to main/master
- Commit secrets or credentials
Workflows:
-
.github/workflows/codebase-agent.yml(Codebase Agent)- Issue-to-PR automation
- PR review automation
- Triggered by: @cba mentions, cba-review/cba-help labels
- Supports both Anthropic API and Vertex AI authentication
-
.github/workflows/docs-validation.yml(Documentation)- Markdown linting (markdownlint)
- Mermaid diagram validation
- Link checking
- Triggers: on docs/** changes, PRs
-
.github/workflows/ci.yml(General CI)- Code example linting (if any)
- Documentation build test
- Repomap validation (ensures .repomap.txt is current)
- Triggers: on push, PR
-
.github/workflows/deploy-docs.yml(Documentation Deployment)- Deploys documentation to GitHub Pages
- Triggers: on main branch push
-
.github/workflows/security.yml(Security Scanning)- Security vulnerability scanning
- Triggers: on push, PR, schedule
File: .github/dependabot.yml
Configuration:
- Schedule: Weekly
- Auto-label: "dependencies"
- Package ecosystem: pip (for doc tooling)
Teams can extend with:
- GitHub Pages deployment
- MkDocs builds
- Static site generation
# Clone repository
git clone https://github.com/yourusername/reference.git
cd reference
# Install repomap dependencies
uv pip install -r requirements.txt
# Install doc tooling
uv pip install -r requirements-dev.txt
# Install pre-commit hooks
pre-commit install
# Load repomap (session start)
cat .repomap.txt
# Lint documentation
markdownlint docs/**/*.md --fix
# Validate diagrams
./scripts/validate-mermaid.sh# 1. Create feature branch
git checkout -b docs/topic-name
# 2. Review repomap
cat .repomap.txt
# 3. Edit documentation
# ... make changes ...
# 4. Validate
markdownlint docs/**/*.md --fix
./scripts/validate-mermaid.sh
# 5. Regenerate repomap if structure changed
python repomap.py . > .repomap.txt
# 6. Commit
git add docs/ .repomap.txt
git commit -m "Add documentation for X"
# 7. Push and create PR
git push -u origin docs/topic-name
gh pr create --title "docs: Add X" --body "Documentation for X pattern"Common pattern for AI-assisted applications:
API Layer (Routes/Endpoints)
↓ Handles HTTP, validation, serialization
Service Layer (Business logic)
↓ Core business rules, orchestration
Model Layer (Data validation)
↓ Data validation, serialization
Core Layer (Config, utilities)
↓ Cross-cutting concerns
API Layer:
- Route handlers
- Request/response validation
- HTTP status codes
- Error responses
- API documentation
Service Layer:
- Business logic
- Data manipulation
- Transaction coordination
- No transport concerns
Model Layer:
- Data validation
- Type annotations
- Serialization rules
Core Layer:
- Configuration management
- Security utilities
- Logging configuration
- Shared utilities
Validate at boundaries only:
- Validate all external input (user requests, API calls)
- Trust internal code between layers
- Use schema validation libraries
Common sanitization functions to implement:
sanitize_string()- Remove dangerous charactersvalidate_slug()- Ensure URL-safe identifierssanitize_path()- Prevent path traversal
- Environment variables only - Use
.envfiles - Config from environment - Never hardcode secrets
- Container secrets - Pass as environment variables
- Never commit -
.envfiles in.gitignore
NEVER include:
- ❌ Red Hat branding or references
- ❌ "Amber" terminology (use "Codebase Agent" or "CBA")
- ❌ Sequenced/linear adoption path (standalone patterns approach only)
- ❌ Deployment infrastructure (focus on development)
- ❌ AI slop in documentation
- ❌ Security overrotation (light touch, practical)
- ❌ Mermaid syntax errors (always validate)
- ❌ Actual ADR content (scaffolding only)
- ❌ Time estimates (unless explicitly requested)
- ❌ Working application code (documentation-only)
This CLAUDE.md file is the source of truth for all AI-assisted development in this repository. Follow these standards strictly.