Repository navigation
Compress CLAUDE.md and add size limit enforcement - #1693
Conversation
Reduced from 40.3k chars (1183 lines) to 6.3k chars (165 lines) via: - Condensed verbose explanations to terse requirements - Removed redundant examples while keeping critical ones - Consolidated related sections - Kept all MANDATORY rules intact All essential patterns, conventions, and requirements preserved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Refactored into reusable composite action pattern: - Logic in .github/actions/check-claude-md-size/action.yml - Simple workflow in .github/workflows/claude.yml - Documentation in action README Features: - Checks file size on PR changes to CLAUDE.md - Posts warning comment if limit exceeded - Updates to success comment when fixed - Fails CI check to block merge - Shows current usage percentage - Configurable file path and size limit Triggers on: - Pull requests modifying CLAUDE.md - Changes to the workflow or action 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
📝 WalkthroughWalkthroughAdds a new composite GitHub Action and CI workflow to enforce a configurable CLAUDE.md size limit, and replaces the repository's CLAUDE.md with a reorganized, architecture-and-pattern-focused document. Changes
Sequence DiagramsequenceDiagram
participant PR as PR Event
participant Workflow as claude.yml Workflow
participant Action as check-claude-md-size Action
participant File as CLAUDE.md
participant GH as GitHub PR API
PR->>Workflow: trigger (opened/synchronize/reopened)
Workflow->>Action: run with inputs (file-path, max-size, github-token)
Action->>File: check existence
alt file missing
Action-->>Workflow: exit success (skipped)
else file present
Action->>File: compute size & usage%
File-->>Action: size data
alt exceeds limit
Action->>GH: create/update failure comment (hidden marker)
GH-->>Action: comment result
Action-->>Workflow: exit non-zero (fail)
else within limit
Action->>GH: update success comment if present
GH-->>Action: comment updated
Action-->>Workflow: exit zero (success)
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2025-10-21T15:50:22.360ZApplied to files:
📚 Learning: 2025-09-23T02:30:42.362ZApplied to files:
📚 Learning: 2025-09-23T02:30:42.362ZApplied to files:
🪛 LanguageToolCLAUDE.md[grammar] ~35-~35: Please add a punctuation mark at the end of paragraph. (PUNCTUATION_PARAGRAPH_END) [style] ~130-~130: Since ownership is already implied, this phrasing may be redundant. (PRP_OWN) [typographical] ~164-~164: Consider using a typographic opening quote here. (EN_QUOTES) [typographical] ~197-~197: Consider using typographic quotation marks here. (EN_QUOTES) [style] ~263-~263: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional. (EN_REPEATEDWORDS_NEED) [typographical] ~266-~266: Consider using a typographic opening quote here. (EN_QUOTES) [typographical] ~268-~268: In American English, use a period after an abbreviation. (MISSING_PERIOD_AFTER_ABBREVIATION) [style] ~305-~305: Consider using the typographical ellipsis character here instead. (ELLIPSIS) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning This PR exceeds the recommended limit of 1,000 lines.Large PRs are difficult to review and may be rejected due to their size. Please verify that this PR does not address multiple issues. |
|
Important Cloud Posse Engineering Team Review RequiredThis pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes. To expedite this process, reach out to us on Slack in the |
Document mandatory patterns for codebase consistency: **Factory & Registry Pattern:** - Command registry (all new commands MUST use this) - Component registry - Store registry - Reference to command-registry-pattern.md **Interface-Driven Design:** - Define interfaces for all major functionality - Use dependency injection for testability - Generate mocks to avoid integration tests - Example with mockgen directive **Package Organization:** - Avoid utils package bloat - Create purpose-built, focused packages - Each package has clear responsibility - Examples: pkg/store/, pkg/git/, pkg/pro/ **Testing Strategy:** - Prefer unit tests with mocks over integration tests - Use interfaces + DI for testability - Integration tests only when necessary File size: 8,464 chars (21% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
All Product Requirement Documents must be placed in docs/prd/ with kebab-case filenames. Examples: - command-registry-pattern.md - error-handling-strategy.md - testing-strategy.md File size: 8,690 chars (21% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Changed "Factory & Registry Pattern" to "Registry Pattern" for accuracy. Registry pattern is the correct term for the plugin-like architecture used in command registry, component registry, and store registry. File size: 8,677 chars (21% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Document functional options pattern for avoiding functions with many parameters (dog sledding/parameter drilling). Pattern includes: - Define Option func(*Config) type - Provide option builders (WithTimeout, WithRetries) - Constructor accepts variadic options - Apply defaults before applying options Benefits: - Avoids parameter drilling through function chains - Provides sensible defaults - Extensible without breaking changes - Clean, self-documenting API File size: 9,462 chars (23% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Document when and when NOT to use context.Context: **Use context for:** - Cancellation signals across API boundaries - Deadlines and timeouts - Request-scoped values (trace IDs, sparingly) **DO NOT use context for:** - Passing configuration (use Options pattern instead) - Passing dependencies (use struct fields or DI) - Avoiding proper function parameters Includes examples of correct usage: - IO operations and network calls - Coordinating multiple operations with cancellation - Context as first parameter convention This clarifies the distinction between: - Options pattern (for configuration) - Context (for cancellation/deadlines only) - Proper function parameters (for dependencies) File size: 10,541 chars (26% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Expanded Pull Requests section to emphasize CI-enforced blog post requirement: - PRs labeled minor/major MUST include blog post - Filename format: website/blog/YYYY-MM-DD-feature-name.md - Must include <!--truncate--> marker - Tag appropriately (feature/enhancement/bugfix or contributors) - CI will fail without blog post This makes the existing requirement more explicit and actionable, since it's enforced by the changelog-check workflow. File size: 10,707 chars (26% of 40k limit) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1693 +/- ##
==========================================
+ Coverage 66.57% 66.58% +0.01%
==========================================
Files 359 359
Lines 41780 41780
==========================================
+ Hits 27813 27820 +7
+ Misses 11911 11905 -6
+ Partials 2056 2055 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
.github/actions/check-claude-md-size/action.yml (2)
36-42: File size calculation looks correct, but simplify the pipe.Line 42 uses
wc -c < "$FILE" | tr -d ' 'which works, but piping totris unnecessary. Since<redirects stdin,wc -coutputs only the count (with optional leading space). You can simplify:-SIZE=$(wc -c < "$FILE" | tr -d ' ') +SIZE=$(wc -c < "$FILE")Bash arithmetic expansion on line 43 will strip whitespace automatically when doing the calculation.
75-75: Consider storing query result to reduce redundant gh calls.Steps 2 and 3 both query for the same comment ID (lines 75 and 120). Since the comment state changes only in step 2, consider storing the ID as an output from step 2 to avoid the second query in step 3. Not critical, but cleaner.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
.github/actions/check-claude-md-size/README.md(1 hunks).github/actions/check-claude-md-size/action.yml(1 hunks).github/workflows/claude.yml(1 hunks)CLAUDE.md(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-21T15:50:22.360Z
Learnt from: CR
PR: cloudposse/atmos#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-21T15:50:22.360Z
Learning: Always compile and run tests after any change; fix compilation errors immediately; use go build . && go test ./... 2>&1.
Applied to files:
CLAUDE.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Before submitting PRs, ensure tests pass, coverage targets met, run golangci-lint, and update documentation
Applied to files:
CLAUDE.md
📚 Learning: 2025-09-23T02:30:42.362Z
Learnt from: CR
PR: cloudposse/atmos#0
File: .cursor/rules/atmos-rules.mdc:0-0
Timestamp: 2025-09-23T02:30:42.362Z
Learning: Applies to **/*.go : All code must pass golangci-lint checks
Applied to files:
CLAUDE.md
🪛 LanguageTool
CLAUDE.md
[grammar] ~27-~27: Please add a punctuation mark at the end of paragraph.
Context: ...mponent(), terraform.output()`, store integration ## Architectural Patterns (MANDATORY) ...
(PUNCTUATION_PARAGRAPH_END)
[grammar] ~35-~35: Please add a punctuation mark at the end of paragraph.
Context: ...ore/registry.go` - Multi-provider store implementations **New commands MUST use command regist...
(PUNCTUATION_PARAGRAPH_END)
[style] ~130-~130: Since ownership is already implied, this phrasing may be redundant.
Context: ...ilt packages** - New functionality gets its own package in pkg/ - **Well-tested, focu...
(PRP_OWN)
[typographical] ~164-~164: Consider using a typographic opening quote here.
Context: ...## Performance Tracking (MANDATORY) Add defer perf.Track(atmosConfig, "pkg.FuncName")() + blank line to all pu...
(EN_QUOTES)
[typographical] ~197-~197: Consider using typographic quotation marks here.
Context: ...st Skipping Conventions (MANDATORY) Use t.Skipf("reason") with clear context. CLI tests auto-bu...
(EN_QUOTES)
[style] ~263-~263: This word has been used in one of the immediately preceding sentences. Using a synonym could make your text more interesting to read, unless the repetition is intentional.
Context: ...inimum (CodeCov enforced). All features need tests. make testacc-coverage for repo...
(EN_REPEATEDWORDS_NEED)
[typographical] ~266-~266: Consider using a typographic opening quote here.
Context: ...# Environment Variables (MANDATORY) Use viper.BindEnv("ATMOS_VAR", "ATMOS_VAR", "FALLBACK") - ...
(EN_QUOTES)
[typographical] ~268-~268: In American English, use a period after an abbreviation.
Context: ... - ATMOS_ prefix required. ### Logging vs UI (MANDATORY) UI (prompts, status) → s...
(MISSING_PERIOD_AFTER_ABBREVIATION)
[style] ~305-~305: Consider using the typographical ellipsis character here instead.
Context: ...ANDATORY) ALWAYS compile after changes: go build . && go test ./.... Fix errors immediately. ### Pre-comm...
(ELLIPSIS)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build (windows)
- GitHub Check: Build (macos)
- GitHub Check: Run pre-commit hooks
- GitHub Check: autofix
- GitHub Check: Analyze (go)
- GitHub Check: Lint (golangci)
- GitHub Check: Summary
🔇 Additional comments (8)
.github/actions/check-claude-md-size/README.md (1)
1-62: LGTM! Clear and complete action documentation.The README provides good coverage of inputs, outputs, behavior, and error handling with practical examples. Well-structured for users getting started with the action.
.github/actions/check-claude-md-size/action.yml (2)
144-146: Good defensive error handling on comment update.The
|| { echo "..." }fallback gracefully handles the case where the comment was deleted between queries. Solid.
32-102: The review comment raises a valid concern. When usinggh apiwith direct string parameters,gh apiwill escape verbatim newlines, which can cause formatting issues with multiline content.The action currently passes
COMMENT_BODYdirectly togh api -X PATCHwith the-f body="$COMMENT_BODY"pattern on lines 97–98 and 143. The documented working patterns for multiline content are reading from a file with-F [email protected]or from stdin using-F body=@-.However, whether the current implementation actually breaks depends on how
ghhandles literal newlines in shell variable expansion. To be safe, refactor these calls to use stdin:echo "$COMMENT_BODY" | gh api -X PATCH "/repos/${{ github.repository }}/issues/comments/$EXISTING_COMMENT" -F body=@-This ensures multiline markdown is properly JSON-encoded and avoids escaping quirks.
.github/workflows/claude.yml (1)
1-23: LGTM! Clean, focused workflow.The trigger is appropriately configured: runs on PR open/sync/reopen with paths filtering for CLAUDE.md, the action directory, and the workflow itself. Good self-test coverage. Uses current checkout action and passes correct inputs.
CLAUDE.md (4)
19-148: Excellent architectural refactor while preserving mandatory patterns.The restructure successfully shifts from procedural guidance to architectural patterns and design directives. All mandatory rules (Registry Pattern, Interface-Driven Design, Options Pattern, Context Usage, Package Organization, Error Handling, Testing Strategy) are retained with clear examples. Code samples are concrete and reference-friendly.
176-197: Testing strategy clearly documented with actionable requirements.Test isolation with
cmd.NewTestKit(t), mock generation patterns, >80% coverage target, and table-driven tests are all well-specified. Strong guidance for contributors.
1-17: Project overview and essential commands concise and helpful.Quick reference for build, test, and lint commands is practical. Architecture section provides good mental model without overexplaining.
231-250: Documentation and PR requirements are clear.Blog post enforcement for minor/major PRs (lines 240–244) and PRD placement requirements (lines 234–235) provide good structure. The cross-reference to
docs/prd/anddocs/developing-atmos-commands.mdis helpful.
|
These changes were released in v1.196.0-rc.0. |
what
why
Compression Details
Metrics:
Techniques Applied:
What's Preserved:
✅ All MANDATORY requirements
✅ Code patterns and conventions
✅ Error handling strategies
✅ Testing requirements
✅ CLI command structure
✅ Development workflows
✅ Cross-platform compatibility rules
✅ Git and PR guidelines
GitHub Action Structure
Action Features:
Triggers:
references
Summary by CodeRabbit
New Features
Documentation