claudebox / claude
CLAUDE.md1.2k starsChanged 3 months agoMITView on GitHub
CRITICAL: Always consider TDD discipline before starting any coding task Key behavioral change: Make TDD consideration automatic, not optional. CRITICAL: Always run these checks before any commit: All tests must pass before any commit or push: When tests fail: - Investigate the root cause - Don't just change the test, understand why it's failing - Fix the implementation or test - Address the actual issue, whether in code or test logic - Verify the fix - Run the full test…
Trending
Quiet since February.thin dataabout the whole repository
Who's talking about RchGrav/claudebox
- A Hacker News story“ClaudeBox: Claude Code Docker Development Environment”Hacker News · Jun 26, 2025 · 4 points
- SabatinoMasala/laravel-agent-commands“Question about claudebox”GitHub · Feb 3, 2026
The biggest 2 of 2 mentions linking to the repository that our crawl found. Each line is their own headline.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
84 rules. About 0 are common, 79 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈79
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Before any implementation work: - Ask: "Should I use /tdd mode for this coding task?"
- Very specific: line 22
Use /tdd [task description] command to activate strict discipline
- Distinctive: line 23
Follow red-green-refactor cycle rigorously
- Distinctive: line 24
Never write multiple test cases without implementing each one first
- Distinctive: line 25
Commit test + implementation + docs together for each test case
- Distinctive: line 35
Formatting: - Run code formatters first (prettier, black, rustfmt, etc.)
- Distinctive: line 36
Linting: - Run linters after formatting
- Distinctive: line 37
Type checking: - Run type checkers
- Distinctive: line 38
Tests: - Run relevant tests last
- Distinctive: line 41
Final review: - Check git diff --staged to review what will be committed
- Distinctive: line 42
Security check: - Verify no sensitive information (keys, tokens, passwords) is included
- Distinctive: line 48
Fix failing tests immediately: - Never leave failing tests for "future PRs" or "follow-up work"
- Distinctive: line 54
Investigate the root cause: - Don't just change the test, understand why it's failing
- Distinctive: line 56
Verify the fix: - Run the full test suite to ensure no regressions
- Distinctive: line 57
Document complex fixes: - If the fix was non-obvious, add comments explaining the solution
- Distinctive: line 65
If any check fails twice, report the issue and ask for guidance
- Distinctive: line 66
Always include auto-fixes in the same commit when possible
- Distinctive: line 72
Create logical, atomic commits that can be reviewed independently
- Distinctive: line 74
Commit related changes together (e.g., function + tests + documentation)
- Distinctive: line 76
Use descriptive commit messages that explain the "why" not just the "what"
- Distinctive: line 89
Prefer 10-20 micro-commits over 3-5 larger commits for a feature
- Distinctive: line 96
Update code comments: when changing function behavior or adding parameters
- Distinctive: line 97
Update README.md: if adding new setup steps, dependencies, or usage instructions
- Very specific: line 118
Use /tdd [task] command for strict behavioral enforcement
- Very specific: line 124
When modifying hard-to-test existing code, use the /tdd command which includes specialized legacy code workflow guidance.
- Very specific: line 138
Use /refactor command for systematic refactoring workflow
- Distinctive: line 145
Make it work: - Follow TDD to implement working functionality
- Very specific: line 146
Make it right: - Use /refactor to systematically improve design
- Distinctive: line 170
Test that applications exit with error when prerequisites fail
- Distinctive: line 171
Test that validation returns success when requirements are met
- Distinctive: line 172
Test that dry-run mode logs actions without executing them
- Distinctive: line 173
Test that configuration parsing sets the correct values
- Distinctive: line 176
Test that specific function names exist in files
- Distinctive: line 177
Test that files contain specific text patterns
- Distinctive: line 178
Test internal variable names or private functions
- Distinctive: line 179
Test file structure or import statements
- Distinctive: line 201
When asked to commit multiple changes, organize them logically:
- Distinctive: line 206
Prefer merge commits over rebasing to preserve commit history
- Distinctive: line 210
Create descriptive branch names (feature/add-metrics, fix/memory-leak, etc.)
- Distinctive: line 211
Keep branches focused on a single feature or fix
- Distinctive: line 212
Use merge commits to integrate branches (avoid rebasing)
- Distinctive: line 232
Before pushing, review the full diff with git diff main...HEAD
- Distinctive: line 233
Ensure commit messages follow conventional format
- Distinctive: line 242
Avoid dead code: - Don't add functions/utilities without demonstrating their use
- Distinctive: line 243
Include documentation updates: - Update code comments, READMEs, CLAUDE.md as needed
- Distinctive: line 247
Target < 100 lines: when possible for easy review
- Distinctive: line 248
Accept larger PRs (200-400+ lines): when needed for completeness
- Distinctive: line 270
Always create PRs in draft mode for review workflows
- Distinctive: line 271
Use structured PR templates for clear communication
- Distinctive: line 279
Commit and push changes immediately after making them
- Distinctive: line 280
Update PR description after pushing commits with new functionality
- Distinctive: line 281
Never consider PRs "done" until actually merged
- Distinctive: line 286
All commits must be explained in PR descriptions
- Distinctive: line 288
Wait for user direction before considering PR work finished
- Distinctive: line 302
After creating/merging PRs
- Distinctive: line 303
After discovering new issues or requirements
- Distinctive: line 304
After making important technical decisions
- Distinctive: line 305
After user feedback or direction changes
- Distinctive: line 314
When moving files: If git doesn't detect as a move (due to content changes), explicitly stage both the new file creation AND the old file …
- Distinctive: line 342
When creating PRs that add new functions/utilities before they're used:
- Distinctive: line 361
Use descriptive function names that indicate future purpose
- Distinctive: line 362
Add comments explaining the intended use case
- Distinctive: line 367
Always verify that all expected test files are running: when running the test suite:
- Distinctive: line 375
Verify test runner scans all expected test directories
- Distinctive: line 376
Ensure no test locations are being excluded unintentionally
- Distinctive: line 379
Test files missing required permissions or attributes
- Distinctive: line 380
Test files not matching expected naming patterns or conventions
- Distinctive: line 382
Test runner configuration excluding certain paths or file types
- Distinctive: line 386
Run the test suite and note how many tests it reports finding
- Distinctive: line 388
Check if specific test directories or files are being excluded
- Distinctive: line 389
Verify file naming conventions and required attributes
- Distinctive: line 396
When pre-commit checks fail, I'll fix the issues, stage the fixes, and automatically retry the commit to keep the workflow smooth.
- Distinctive: line 400
Use clear, descriptive commit messages without promotional footers:
- Distinctive: line 402
Use conventional commit format when applicable
- Distinctive: line 403
Do NOT include "Generated with Claude Code" or co-author lines
- Distinctive: line 404
Keep messages concise and professional
- Distinctive: line 422
Only contain Claude-specific guidance and notes
- Distinctive: line 431
Always phrase updates universally: - avoid language-specific, framework-specific, or project-specific examples
- Distinctive: line 433
Test universal applicability: - ask yourself "Would this apply to a Python web app?
- Distinctive: line 447
Check for inaccuracies: - verify file paths, commands, and examples still work
- Distinctive: line 449
Update outdated information: - remove references to deleted files or changed workflows
- Distinctive: line 450
Add new learnings: - document any project-specific insights discovered during development
- Distinctive: line 458
Don't assume file naming conventions: - check what files actually exist
- Distinctive: line 460
Test file paths: before committing documentation that references them
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Current Environment Tooling
- @~/.claudebox/tooling.md
Default Coding Behavior
CRITICAL: Always consider TDD discipline before starting any coding task
- Before any implementation work - Ask: "Should I use /tdd mode for this coding task?"
- Default to TDD discipline unless explicitly told otherwise or for trivial changes
- TDD applies to most coding scenarios:
- Adding new functions or features
- Implementing validation logic
- Building utilities or libraries
- Refactoring with behavioral changes
- Any multi-step implementation work
- Skip TDD only for:
- Simple documentation updates
- Obvious typo fixes
- Configuration file changes
- Single-line code adjustments
- TDD workflow activation:
- Use
/tdd [task description]command to activate strict discipline - Follow red-green-refactor cycle rigorously
- Never write multiple test cases without implementing each one first
- Commit test + implementation + docs together for each test case
- Use
Key behavioral change: Make TDD consideration automatic, not optional.
Automatic Commit Workflow
Pre-commit Checks (in order)
CRITICAL: Always run these checks before any commit:
- Formatting - Run code formatters first (prettier, black, rustfmt, etc.)
- Linting - Run linters after formatting
- Type checking - Run type checkers
- Tests - Run relevant tests last
- Test coverage verification - Confirm all expected test files are running
- All tests must pass - CRITICAL: Fix any failing tests immediately, do not commit/push with failing tests
- Final review - Check
git diff --stagedto review what will be committed - Security check - Verify no sensitive information (keys, tokens, passwords) is included
Test Requirements
All tests must pass before any commit or push:
- Fix failing tests immediately - Never leave failing tests for "future PRs" or "follow-up work"
- CI requirement - Most CI/CD systems require all tests to pass before merge
- Quality gate - Failing tests indicate broken functionality that must be addressed
- No exceptions - Even if failure seems minor or unrelated, investigate and fix
When tests fail:
- Investigate the root cause - Don't just change the test, understand why it's failing
- Fix the implementation or test - Address the actual issue, whether in code or test logic
- Verify the fix - Run the full test suite to ensure no regressions
- Document complex fixes - If the fix was non-obvious, add comments explaining the solution
When Pre-commit Checks Fail
- Formatting failures: Auto-fix and stage the formatted changes, then retry commit
- Linting failures: Fix the issues, stage the fixes, then retry commit
- Type checking failures: Fix type errors, stage the fixes, then retry commit
- Test failures: Fix failing tests, stage the fixes, then retry commit
- If any check fails twice, report the issue and ask for guidance
- Always include auto-fixes in the same commit when possible
Git Workflow
Commit Strategy
- Create logical, atomic commits that can be reviewed independently
- Each commit should represent a single conceptual change
- Commit related changes together (e.g., function + tests + documentation)
- Separate refactoring commits from feature commits
- Use descriptive commit messages that explain the "why" not just the "what"
Development Commit Frequency
- Commit early and often during feature development
- Make a commit after completing each logical unit of work:
- Adding a single function with its test
- Implementing one specific feature or validation
- Adding documentation for a single component
- Fixing one specific issue or bug
- Never bundle unrelated changes in a single commit
- One behavior per commit - each commit should implement exactly one piece of functionality
- Separate commits even for the same file type - configuration changes, documentation updates, and code changes should be separate commits even if they modify similar file types
- Prefer 10-20 micro-commits over 3-5 larger commits for a feature
- Each commit should leave the codebase in a working state
Documentation Updates
Include necessary documentation updates in the same commit as the code change:
- Update code comments when changing function behavior or adding parameters
- Update README.md if adding new setup steps, dependencies, or usage instructions
- Update existing examples that would be invalidated by the change
- Skip excessive documentation that would quickly become outdated
- Focus on user-facing changes that affect how people use the code
Examples:
- ✅ Adding a new CLI flag? Update README.md usage examples in the same commit
- ✅ Changing function parameters? Update the function's comment block
- ✅ Adding a new dependency? Update installation instructions
- ❌ Don't document internal implementation details that change frequently
- ❌ Don't add verbose explanations for self-documenting code
TDD Commit Strategy
For detailed TDD workflow enforcement, use the /tdd command.
Key principles when following Test-Driven Development:
- One test case at a time with minimal implementation
- Group test + implementation + docs in same commit
- Follow red-green-refactor cycle rigorously
- For legacy code: characterization test → refactor → unit tests → TDD
- Use
/tdd [task]command for strict behavioral enforcement
See /tdd command for complete rules and legacy code guidance.
TDD with Legacy Code
When modifying hard-to-test existing code, use the /tdd command which includes specialized legacy code workflow guidance.
Key approach: characterization test → refactor → unit tests → TDD for new behavior.
See /tdd command for complete legacy code workflow, assessment guidance, and commit sequence examples.
Post-Implementation Code Review and Refactoring
After all tests pass, always consider refactoring opportunities in new code.
Key principles:
- Focus refactoring on code you just wrote for this behavior
- Eliminate dead code and duplication within new functionality
- Make design improvements before finalizing PR
- Use
/refactorcommand for systematic refactoring workflow
Scope guidelines:
- ✅ Include refactoring that improves the current PR (new code, localized improvements)
- ❌ Defer refactoring that expands PR scope (large-scale redesigns, unrelated cleanup)
Two-phase approach:
- Make it work - Follow TDD to implement working functionality
- Make it right - Use
/refactorto systematically improve design
See /refactor command for detailed code quality checklist and improvement techniques.
Examples of Good Commit Granularity
- ✅ "Add input validation with test"
- ✅ "Add database connectivity validation with test"
- ✅ "Add edge case test for connection timeout handling"
- ✅ "Add API version validation with test"
- ✅ "Add test for unsupported API version error message"
- ✅ "Add dry-run mode flag parsing with test"
- ✅ "Add integration test for service prerequisite validation"
- ✅ "Update CLAUDE.md with refactoring guidelines"
- ✅ "Update Claude permissions for development commands"
- ❌ "Add all prerequisite validation tests and implementation" (too broad - multiple test cases)
- ❌ "Implement multiple validation functions" (unrelated changes)
- ❌ "Add tests and fix bugs" (unrelated changes)
- ❌ "Update CLAUDE.md and settings.json" (unrelated changes - different purposes)
Testing Philosophy
Always test behavior, not implementation details:
✅ Good: Test Behavior
- Test that applications exit with error when prerequisites fail
- Test that validation returns success when requirements are met
- Test that dry-run mode logs actions without executing them
- Test that configuration parsing sets the correct values
❌ Bad: Test Implementation Details
- Test that specific function names exist in files
- Test that files contain specific text patterns
- Test internal variable names or private functions
- Test file structure or import statements
Why This Matters
- Maintainable: Behavioral tests survive refactoring, renaming, and code reorganization
- Meaningful: Tests verify actual user-facing functionality rather than code structure
- Robust: Less likely to break when implementation changes but behavior stays the same
- Focused: Tests tell you what the code should do, not how it should do it
Examples
# ❌ Brittle implementation test
if search_for_function_name("validate_prerequisites", setup_file):
assert_true("setup should call specific function")
# ✅ Robust behavioral test
exit_code = run_setup_with_failed_prerequisites()
assert_not_equals(0, exit_code, "setup should exit when prerequisites fail")Multi-commit Guidelines
- When asked to commit multiple changes, organize them logically:
- Setup/configuration changes first
- Core functionality changes
- Tests and documentation last
- Each commit should leave the codebase in a working state
- Prefer merge commits over rebasing to preserve commit history
Branch Management
- Create descriptive branch names (feature/add-metrics, fix/memory-leak, etc.)
- Keep branches focused on a single feature or fix
- Use merge commits to integrate branches (avoid rebasing)
- Delete merged feature branches immediately after PR is merged to maintain git hygiene
Post-Merge Workflow
CRITICAL: Always execute these steps immediately after merging any PR:
- Switch to main branch -
git checkout main(ormaster/trunkdepending on repository) - Pull latest changes -
git pullorgit pull origin main - Delete merged feature branch -
git branch -d feature-branch-name(use-Dif needed) - Automatic execution - These steps should be automatic after every merge, not requiring user request
This workflow ensures:
- Local repository stays current with merged changes
- Merged feature branches are cleaned up immediately
- Ready to start new work from updated main branch
- Prevents branch pollution and confusion
PR Preparation
- Before pushing, review the full diff with
git diff main...HEAD - Ensure commit messages follow conventional format
- Split large changes into multiple PRs when possible
- Include context about why changes were made, not just what changed
PR Size and Focus Guidelines
Each PR should be a complete bundle of one new behavior:
- Complete functionality - Include tests, implementation, and actual usage together
- Avoid dead code - Don't add functions/utilities without demonstrating their use
- Include documentation updates - Update code comments, READMEs, CLAUDE.md as needed
- One responsibility per PR - Each PR should do exactly one thing, but do it completely
Size guidelines:
- Target < 100 lines when possible for easy review
- Accept larger PRs (200-400+ lines) when needed for completeness
- Better to have one complete 300-line PR than three 100-line PRs with dead code
- Size is secondary to completeness and logical boundaries
Examples of complete behavior bundles:
- ✅ "Add Homebrew detection with tests and integration into installation script"
- ✅ "Add API validation with tests, error messages, and documentation"
- ✅ "Add database migration with rollback functionality and admin tools"
- ❌ "Add Homebrew detection utility" (missing actual usage)
- ❌ "Add authentication tests" (missing implementation and integration)
When to split PRs:
- Multiple unrelated behaviors (authentication vs database vs caching)
- Different deployment boundaries (frontend vs backend in systems with separate deployment pipelines)
- Refactoring separate from new features (clean up existing code vs add new functionality)
- Infrastructure changes that enable multiple future features (but include at least one usage example)
PR Creation Requirements
For detailed PR creation workflow, use the /pr-draft command.
Key principles:
- Always create PRs in draft mode for review workflows
- Use structured PR templates for clear communication
- Focus on complete functionality bundles (see sizing guidelines above)
See /pr-draft command for complete workflow and template guidelines.
PR Workflow Requirements
CRITICAL commit and push behavior:
- Commit and push changes immediately after making them
- Update PR description after pushing commits with new functionality
- Never consider PRs "done" until actually merged
- Stay focused on current PR until user confirms completion
Key principles:
- User expects to see changes in GitHub UI immediately
- All commits must be explained in PR descriptions
- Include off-topic commits transparently
- Wait for user direction before considering PR work finished
See /pr-draft and /pr-review commands for detailed workflow guidance.
Multi-PR Task Management
CRITICAL: Always maintain task roadmap files throughout development
For tasks involving multiple PRs, create and maintain a roadmap file:
- Create task roadmap file in
.claude/tasks/YYYY-MM-DD-task-name.md - Update throughout development with progress, learnings, and context
- Update after EVERY significant change:
- After creating/merging PRs
- After discovering new issues or requirements
- After making important technical decisions
- After user feedback or direction changes
- Never let task files become stale - they are critical handoff documentation
- Include essential information for future Claudes taking over:
- Completed PRs with key outcomes
- Current PR status and next steps
- Important decisions made and why
- Technical patterns established
- Any gotchas or lessons learned
- Critical issues discovered during development
- When moving files: If git doesn't detect as a move (due to content changes), explicitly stage both the new file creation AND the old file deletion in the same commit
Task file maintenance is NOT optional - these files are essential for:
- Continuity when conversations end mid-task
- Context for future development sessions
- Preventing repeated mistakes and decisions
- Maintaining project momentum across multiple sessions
Example task file structure:
# 2025-07-06-feature-improvements.md
## Progress
- ✅ PR 1: Testing Foundation
- ✅ PR 2: Service Authentication
- 🔄 PR 3: Error Handling (in review)
## Key Decisions
- Using behavioral tests instead of implementation tests
- Async approach for better performance
## Next Steps
- PR 4: Individual Service Testing
- Need to integrate retry mechanism into API clientInfrastructure-First PR Guidelines
When creating PRs that add new functions/utilities before they're used:
- Add TODO comments in the code indicating where the function will be used:
# TODO: Use in PR 7 (Error Recovery) for graceful failure handling function handle_error() { ... } - Include usage preview in PR description showing how the code will be used:
## Usage Preview This validation functionality will be used in future PRs to: - PR 7: Wrap all service calls with `validate_input` - PR 8: Add validation summaries for user feedback - Mark dead code clearly so reviewers understand it's intentional:
- Use descriptive function names that indicate future purpose
- Add comments explaining the intended use case
- Reference the roadmap/plan if one exists
Test Coverage Verification
Always verify that all expected test files are running when running the test suite:
- Compare manual count vs test runner output:
- Count test files manually using appropriate commands for the project
- Compare with test runner output (usually shows "Found X test(s)" or similar)
- Numbers should match for complete coverage
- Check for missing test directories:
- Verify test runner scans all expected test directories
- Ensure no test locations are being excluded unintentionally
- Common test runner issues to watch for:
- Test files missing required permissions or attributes
- Test files not matching expected naming patterns or conventions
- Directories not being scanned recursively when they should be
- Test runner configuration excluding certain paths or file types
- Build artifacts or temporary files interfering with test discovery
- When test count doesn't match expectations:
- Run the test suite and note how many tests it reports finding
- Manually count test files using project-appropriate commands
- Check if specific test directories or files are being excluded
- Verify file naming conventions and required attributes
- Fix any discrepancies before proceeding
This prevents regressions where test files exist but aren't being executed.
For project-specific commands and examples, see the project's CLAUDE.md file.
When pre-commit checks fail, I'll fix the issues, stage the fixes, and automatically retry the commit to keep the workflow smooth.
Commit Message Format
Use clear, descriptive commit messages without promotional footers:
- Focus on what changed and why
- Use conventional commit format when applicable
- Do NOT include "Generated with Claude Code" or co-author lines
- Keep messages concise and professional
Project Documentation Guidelines
README.md vs CLAUDE.md
For projects with both README.md and CLAUDE.md files:
README.md should contain:
- General project information that benefits all users
- Installation and setup instructions
- Usage examples and documentation
- Troubleshooting guides
- Contributing guidelines
- Any information multiple people would find useful
Project-level CLAUDE.md should:
- Reference README.md for general information: "For installation instructions, see README.md"
- Only contain Claude-specific guidance and notes
- Focus on development workflow, file structure, and Claude-specific considerations
- Be kept minimal and accurate - verify file paths and commands exist before referencing them
- Evolve as the project changes (e.g., update test suite information when tests are added)
Personal CLAUDE.md Maintenance
When updating your personal CLAUDE.md:
- Always phrase updates universally - avoid language-specific, framework-specific, or project-specific examples
- Use generic examples that apply across programming languages and project types
- Test universal applicability - ask yourself "Would this apply to a Python web app? A Rust CLI? A JavaScript frontend?"
- Replace specific tools with categories (e.g., "npm" → "package manager", "setup.zsh" → "main script")
Project CLAUDE.md Maintenance
Consider updating the project CLAUDE.md when:
- Learning something that would help future Claudes working on this specific project
- Making changes that invalidate existing project documentation (new test commands, file moves, etc.)
- Discovering project-specific patterns or gotchas that aren't obvious from the code
- Adding new tools, frameworks, or workflows specific to this project
Periodic project CLAUDE.md review (before each PR):
- Check for inaccuracies - verify file paths, commands, and examples still work
- Look for important omissions - what would have helped you that isn't documented?
- Update outdated information - remove references to deleted files or changed workflows
- Add new learnings - document any project-specific insights discovered during development
File Path Verification (Universal)
Always verify file paths exist before referencing them in any documentation:
- Use directory listing commands to check actual file names before referencing them
- Don't assume file naming conventions - check what files actually exist
- Verify correct directories - files might be in different locations than expected
- Test file paths before committing documentation that references them
- Common mistake: Assuming numbered prefixes or specific naming patterns without verification
This prevents documentation that references non-existent files, which creates confusion and reduces trust in the documentation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

