Skip to content

Commit 9546755

Browse files
committed
Refactor CLAUDE.md for progressive disclosure
Extract specialized conventions into .claude/docs/ files so the root CLAUDE.md stays minimal (commands, lint, links) and detailed guidance loads on-demand: - .claude/docs/testing.md - .claude/docs/documentation.md - .claude/docs/release-and-versioning.md Removed redundant sections (Architecture/Core Classes, ASDF commands, meta intro line) that the agent can discover from the code itself.
1 parent b71303b commit 9546755

File tree

4 files changed

+89
-125
lines changed

4 files changed

+89
-125
lines changed

.claude/CLAUDE.md

Lines changed: 14 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,31 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
Ruby gem for encapsulating business logic into processes, with Rails integration, input validation, dependency injection, and observability.
44

5-
## Project Overview
6-
7-
`solid-process` is a Ruby gem for encapsulating business logic into manageable processes. It integrates with Rails and provides input validation, dependency injection, and observability features.
8-
9-
## Documentation
10-
11-
- **[docs/REFERENCE.md](docs/REFERENCE.md)** — Comprehensive guide covering every feature with detailed examples. Point AI coding agents here.
12-
- **[docs/overview/](docs/overview/)** — Quick overview guides (010–100) for each topic.
13-
14-
### Back-to-Top Anchors
15-
16-
Both `README.md` and `docs/REFERENCE.md` use back-to-top navigation after each main section. When adding a new numbered section to `REFERENCE.md`:
17-
18-
1. Add `<p align="right"><a href="#table-of-contents">⬆️ &nbsp;back to top</a></p>` before the `---` that closes the section
19-
2. Update the Table of Contents with the new entry
20-
21-
### Overview File Structure
22-
23-
Each file in `docs/overview/` follows this layout:
24-
25-
1. **Header nav**`<small>` block with `` `Previous` `` and `` `Next` `` links
26-
2. **`---`** separator
27-
3. **Content** — starts with a `#` title
28-
4. **`---`** separator
29-
5. **Footer nav**`<small>` block with the same `` `Previous` ``/`` `Next` `` links as the header
30-
31-
Navigation chain: `010_KEY_CONCEPTS``020_BASIC_USAGE` → … → `100_PORTS_AND_ADAPTERS`. The first file's `Previous` links to `../README.md#further-reading`; the last file's `Next` links to `../REFERENCE.md`.
32-
33-
When adding a new overview file:
34-
35-
1. Follow the numbered naming convention (e.g., `110_NEW_TOPIC.md`)
36-
2. Add header and footer nav blocks with `---` separators
37-
3. Update the `Previous`/`Next` links in the adjacent files to include the new file
38-
39-
## Common Commands
5+
## Commands
406

417
```bash
42-
# Setup (install dependencies: bundle + appraisal)
43-
bin/setup
44-
45-
# Clean install + full test suite. Useful when switching Ruby versions.
46-
bin/matrix
8+
bin/setup # Install dependencies (bundle + appraisal)
9+
bin/rake matrix # Run full test suite
4710

48-
# Run all tests for current Ruby version
49-
bin/rake matrix
50-
51-
# Run a single test file
11+
# Single test file
5212
bundle exec appraisal rails-8-1 ruby -Ilib:test test/solid/process/result_test.rb
5313

54-
# Run a specific test by name
14+
# Single test by name (append -n test_method_name)
5515
bundle exec appraisal rails-8-1 ruby -Ilib:test test/solid/process/result_test.rb -n test_method_name
56-
57-
# Interactive console
58-
bin/console
5916
```
6017

6118
## Lint
6219

63-
**Ensure lint is green before committing.**
64-
65-
```bash
66-
# Check for style violations (Ruby 3.4+)
67-
bin/rake standard
68-
69-
# Auto-fix style violations
70-
bin/rake standard:fix
71-
```
72-
73-
### Release Checklist
74-
75-
When `lib/solid/process/version.rb` is changed:
76-
1. Verify `CHANGELOG.md` has a matching version entry (e.g., `## [0.5.0] - YYYY-MM-DD`)
77-
2. Verify `README.md` compatibility matrix is up-to-date if Ruby/Rails support changed
78-
79-
### Ruby/Rails Version Alignment
80-
81-
When modifying Ruby or Rails version support, ensure these files stay aligned:
82-
83-
| File | Purpose |
84-
|------|---------|
85-
| `Appraisals` | Source of truth for gem dependencies per Rails version |
86-
| `Rakefile` | Local `rake matrix` task conditions |
87-
| `.github/workflows/main.yml` | CI matrix and step conditions |
88-
| `README.md` | Compatibility matrix table |
89-
90-
**Key checks:**
91-
1. Ruby version conditions must match across `Appraisals`, `Rakefile`, and CI
92-
2. CI string values (e.g., `'head'`) need explicit checks since numeric comparisons won't match them
93-
3. README table must reflect the actual tested combinations
94-
4. Ruby `head` should only run against Rails edge (not stable Rails versions)
95-
96-
## Switching Ruby Versions
97-
98-
### ASDF
99-
100-
```bash
101-
asdf list ruby # List installed Ruby versions
102-
asdf set ruby 4.0.1 # Ruby 4.x
103-
```
104-
105-
## Tests
106-
107-
Always test on multiple Ruby versions when fixing compatibility issues.
108-
109-
### Support Files
110-
111-
Test fixtures in `test/support/` follow numbered naming (e.g., `051_user_token_creation.rb`) for load order. These define sample processes used across multiple tests.
112-
113-
### Fix Library Code, Not Tests
114-
115-
When tests fail due to Ruby version differences:
116-
1. First check if the **library code** can be updated to normalize behavior
117-
2. Only modify tests if the library fix isn't possible
118-
119-
### Available Rails versions (see Rakefile for full list)
120-
```sh
121-
bundle exec appraisal rails-6-0 rake test # Ruby 2.7, 3.0
122-
bundle exec appraisal rails-6-1 rake test # Ruby 2.7, 3.0
123-
bundle exec appraisal rails-7-0 rake test # Ruby 3.0, 3.1, 3.2, 3.3
124-
bundle exec appraisal rails-7-1 rake test # Ruby 3.0, 3.1, 3.2, 3.3
125-
bundle exec appraisal rails-7-2 rake test # Ruby 3.1, 3.2, 3.3, 3.4
126-
bundle exec appraisal rails-8-0 rake test # Ruby 3.2, 3.3, 3.4
127-
bundle exec appraisal rails-8-1 rake test # Ruby 3.3, 3.4, 4.x
128-
```
129-
130-
## Architecture
131-
132-
### Core Classes
133-
134-
- **Solid::Process** (`lib/solid/process.rb`) - Base class for business processes. Requires `input` block and `call` method. Returns `Success` or `Failure` outputs.
20+
**Run `bin/rake standard` before committing.** Auto-fix with `bin/rake standard:fix`. Also ensure changes follow the conventions linked below.
13521

136-
- **Solid::Model** (`lib/solid/model.rb`) - ActiveModel-based concern providing attributes, validations, and callbacks.
22+
## References
13723

138-
- **Solid::Input** (`lib/solid/input.rb`) - Input validation class, includes Solid::Model.
24+
- **[docs/REFERENCE.md](docs/REFERENCE.md)** — Full feature guide with detailed examples
25+
- **[docs/overview/](docs/overview/)** — Quick overview guides (010–100)
13926

140-
- **Solid::Value** (`lib/solid/value.rb`) - Immutable value objects.
27+
## Conventions
14128

142-
- **Solid::Output** (`lib/solid/output.rb`) - Wraps solid-result gem for Success/Failure return types.
29+
- **[Testing](.claude/docs/testing.md)** — Test fixtures, multi-version testing, Rails version matrix
30+
- **[Documentation](.claude/docs/documentation.md)** — Back-to-top anchors, overview file structure
31+
- **[Release & Versioning](.claude/docs/release-and-versioning.md)** — Release checklist, Ruby/Rails version alignment

.claude/docs/documentation.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Documentation Conventions
2+
3+
## Back-to-Top Anchors
4+
5+
Both `README.md` and `docs/REFERENCE.md` use back-to-top navigation after each main section. When adding a new numbered section to `REFERENCE.md`:
6+
7+
1. Add `<p align="right"><a href="#table-of-contents">⬆️ &nbsp;back to top</a></p>` before the `---` that closes the section
8+
2. Update the Table of Contents with the new entry
9+
10+
## Overview File Structure
11+
12+
Each file in `docs/overview/` follows this layout:
13+
14+
1. **Header nav**`<small>` block with `` `Previous` `` and `` `Next` `` links
15+
2. **`---`** separator
16+
3. **Content** — starts with a `#` title
17+
4. **`---`** separator
18+
5. **Footer nav**`<small>` block with the same `` `Previous` ``/`` `Next` `` links as the header
19+
20+
Navigation chain: `010_KEY_CONCEPTS``020_BASIC_USAGE` → … → `100_PORTS_AND_ADAPTERS`. The first file's `Previous` links to `../README.md#further-reading`; the last file's `Next` links to `../REFERENCE.md`.
21+
22+
When adding a new overview file:
23+
24+
1. Follow the numbered naming convention (e.g., `110_NEW_TOPIC.md`)
25+
2. Add header and footer nav blocks with `---` separators
26+
3. Update the `Previous`/`Next` links in the adjacent files to include the new file
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Release & Versioning
2+
3+
## Release Checklist
4+
5+
When `lib/solid/process/version.rb` is changed:
6+
1. Verify `CHANGELOG.md` has a matching version entry (e.g., `## [0.5.0] - YYYY-MM-DD`)
7+
2. Verify `README.md` compatibility matrix is up-to-date if Ruby/Rails support changed
8+
9+
## Ruby/Rails Version Alignment
10+
11+
When modifying Ruby or Rails version support, ensure these files stay aligned:
12+
13+
| File | Purpose |
14+
|------|---------|
15+
| `Appraisals` | Source of truth for gem dependencies per Rails version |
16+
| `Rakefile` | Local `rake matrix` task conditions |
17+
| `.github/workflows/main.yml` | CI matrix and step conditions |
18+
| `README.md` | Compatibility matrix table |
19+
20+
**Key checks:**
21+
1. Ruby version conditions must match across `Appraisals`, `Rakefile`, and CI
22+
2. CI string values (e.g., `'head'`) need explicit checks since numeric comparisons won't match them
23+
3. README table must reflect the actual tested combinations
24+
4. Ruby `head` should only run against Rails edge (not stable Rails versions)

.claude/docs/testing.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Testing Conventions
2+
3+
## Fix Library Code, Not Tests
4+
5+
When tests fail due to Ruby version differences:
6+
1. First check if the **library code** can be updated to normalize behavior
7+
2. Only modify tests if the library fix isn't possible
8+
9+
## Support Files
10+
11+
Test fixtures in `test/support/` follow numbered naming (e.g., `051_user_token_creation.rb`) for load order. These define sample processes used across multiple tests.
12+
13+
## Available Rails Versions
14+
15+
See `Rakefile` for the source of truth. Quick reference:
16+
17+
```sh
18+
bundle exec appraisal rails-6-0 rake test # Ruby 2.7, 3.0
19+
bundle exec appraisal rails-6-1 rake test # Ruby 2.7, 3.0
20+
bundle exec appraisal rails-7-0 rake test # Ruby 3.0, 3.1, 3.2, 3.3
21+
bundle exec appraisal rails-7-1 rake test # Ruby 3.0, 3.1, 3.2, 3.3
22+
bundle exec appraisal rails-7-2 rake test # Ruby 3.1, 3.2, 3.3, 3.4
23+
bundle exec appraisal rails-8-0 rake test # Ruby 3.2, 3.3, 3.4
24+
bundle exec appraisal rails-8-1 rake test # Ruby 3.3, 3.4, 4.x
25+
```

0 commit comments

Comments
 (0)