Skip to content

Rewrite CLAUDE.md with architecture docs#59

Merged
MarjovanLier merged 1 commit intomainfrom
chore/update-deps-and-claude-md
Feb 6, 2026
Merged

Rewrite CLAUDE.md with architecture docs#59
MarjovanLier merged 1 commit intomainfrom
chore/update-deps-and-claude-md

Conversation

@MarjovanLier
Copy link
Owner

@MarjovanLier MarjovanLier commented Feb 6, 2026

User description

Summary

  • Rewrote CLAUDE.md with proper Claude Code header and project overview
  • Consolidated Docker and local commands into a single reference table
  • Added architecture section explaining the trait-as-constants pattern and public API reference
  • Added static analysis levels and code conventions sections
  • Removed generic rules already covered by global configuration

Test plan

  • Full test pipeline passes (docker-compose run --rm test-all)
  • Rector, PHPStan, PHPMD, and Pint all pass individually
  • No code changes — documentation only

PR Type

Documentation


Description

  • Restructured CLAUDE.md with Claude Code header and project overview

  • Consolidated Docker and local commands into single reference table

  • Added architecture section explaining trait-as-constants pattern

  • Added public API quick-reference and static analysis levels sections

  • Removed generic rules duplicated from global configuration


Diagram Walkthrough

flowchart LR
  A["CLAUDE.md<br/>Original"] -->|"Restructure"| B["Project Overview<br/>& Architecture"]
  A -->|"Consolidate"| C["Docker/Local<br/>Commands Table"]
  A -->|"Add"| D["Public API<br/>Reference"]
  A -->|"Add"| E["Static Analysis<br/>& Conventions"]
  A -->|"Remove"| F["Generic Rules<br/>Duplication"]
  B --> G["Updated<br/>CLAUDE.md"]
  C --> G
  D --> G
  E --> G
  F --> G
Loading

File Walkthrough

Relevant files
Documentation
CLAUDE.md
Comprehensive architecture and API documentation restructure

CLAUDE.md

  • Added Claude Code header and comprehensive project overview describing
    the library as high-performance PHP 8.3+ string manipulation with zero
    dependencies
  • Consolidated separate Docker and local command lists into a single
    reference table with 13 rows covering all testing tasks
  • Added architecture section explaining the trait-as-constants pattern,
    public API with 7 methods, and performance optimization via strtr()
    with pre-computed arrays
  • Added static analysis levels section documenting PHPStan, Psalm, Phan,
    and PHPMD strictness settings
  • Added code conventions section covering strict typing, final classes,
    typed constants, docblocks, and Laravel Pint style guidelines
  • Added test organization section explaining Pest v4 structure and
    mutation testing target (88% MSI)
  • Removed generic development rules already covered by global
    configuration
+85/-58 

- Add Claude Code header and project overview
- Consolidate Docker/local commands into single table
- Add architecture section explaining trait-as-constants pattern
- Add public API quick-reference table
- Add static analysis levels section
- Remove generic rules duplicated from global config

Signed-off-by: Marjo Wenzel van Lier <marjo.vanlier@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • CLAUDE.md is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/update-deps-and-claude-md

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @MarjovanLier, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the project's documentation by providing a detailed and structured guide specifically tailored for AI interaction. The changes aim to improve clarity, consistency, and comprehensiveness, making it easier for automated systems and developers alike to understand the project's structure, development practices, and API.

Highlights

  • Documentation Restructuring: The CLAUDE.md file has been completely rewritten to serve as a comprehensive guide for the Claude AI, including a proper header and a detailed project overview.
  • Command Consolidation: Docker and local build/test commands are now presented in a single, easy-to-read reference table, improving clarity and accessibility.
  • Architectural Details: A new section outlines the project's architecture, explaining the "trait-as-constants" pattern and providing a reference for the public API methods.
  • Coding Standards: Dedicated sections have been added for static analysis levels and detailed code conventions, ensuring consistent code quality and style.
  • Redundant Information Removal: Generic development rules that were already covered by global configurations have been removed to streamline the documentation.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • CLAUDE.md
    • Renamed the document title from "StringManipulation Development Guide" to "CLAUDE.md" and added an introductory sentence for Claude Code.
    • Introduced a "Project Overview" section describing the library's purpose and key features.
    • Transformed the "Build & Test Commands" into a consolidated table, merging Docker and local commands for various tasks, and added a "Code style fix" command.
    • Added a new "Architecture" section detailing the project's structure, the use of traits for constants, and performance considerations.
    • Included a "Public API" subsection listing the 7 main methods with their respective purposes.
    • Created a "Static Analysis Levels" section, specifying the strict configurations used for PHPStan, Psalm, Phan, and PHPMD.
    • Expanded the "Code Conventions" section with more specific rules, including the use of #["SensitiveParameter"] and South African English in documentation.
    • Added a "Test Organisation" section, explaining the testing framework (Pest), test file structure, and mutation testing targets.
    • Introduced a "CI" section detailing the GitHub Actions setup for testing and vulnerability scanning.
    • Removed the "Critical Development Rules" and "Code Review" sections, as well as some redundant code style guidelines.
Activity
  • The pull request was created.
  • No human activity (comments, reviews) has occurred yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@qodo-code-review
Copy link
Contributor

Changelog updates: 🔄

2026-02-06

Changed

  • Updated the Claude Code development guide with consolidated commands and expanded architecture/public API documentation.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@MarjovanLier MarjovanLier merged commit f7485d3 into main Feb 6, 2026
9 checks passed
@MarjovanLier MarjovanLier deleted the chore/update-deps-and-claude-md branch February 6, 2026 09:24
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a705f6c) to head (35ed9a6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main       #59   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity        32        32           
===========================================
  Files              1         1           
  Lines             61        61           
===========================================
  Hits              61        61           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the project's documentation by rewriting CLAUDE.md to serve as a comprehensive guide for AI assistants. The new structure is excellent, providing a clear overview of the project's architecture, commands, and conventions. The consolidated command table and detailed sections on architecture and static analysis are particularly valuable. I've identified a couple of minor inconsistencies between the documentation and the project's configuration/code, which are detailed in my comments. Overall, this is a fantastic documentation update.

| `utf8Ansi(?string)` | Convert UTF-8 to ANSI equivalents |
| `isValidDate(string, string)` | Validate date string against format with logical checks |
| `strReplace(...)` | Optimised replacement (uses `strtr()` for single-char) |
| `trim(string, string)` | Stricter trim |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The description "Stricter trim" for the trim method is misleading. The implementation in StringManipulation.php is a simple wrapper around PHP's native trim() function and does not provide any additional strictness. To ensure the documentation is accurate, I recommend updating the purpose to reflect its actual behavior.

Suggested change
| `trim(string, string)` | Stricter trim |
| `trim(string, string)` | Wrapper for PHP's native trim function |


Tests are split by method and concern: `NameFixTest`, `NameFixEdgeCasesTest`, `NameFixNegativeFlowTest`, `NameFixSpecialCharactersTest`, etc. Bug regressions get dedicated test files (e.g., `ArrayCombineValidationBugFixTest`, `UppercaseAccentMappingBugFixTest`).

Mutation testing target MSI: 88%.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There is a discrepancy between the documented mutation testing target and the actual configuration. This file states the target MSI is 88%, while infection.json.dist sets minMsi to 85. Please update the documentation to match the configuration for consistency.

Suggested change
Mutation testing target MSI: 88%.
Mutation testing target MSI: 85%.

@qodo-code-review
Copy link
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
Clarify contradictory Docker usage instructions

Clarify the documentation to explain that Docker is for final validation while
local commands are for convenience. Update the command table headers and
surrounding text to reflect this distinction.

CLAUDE.md [11-29]

-**Always use Docker** to ensure consistent PHP 8.3 + AST extension environment.
+**Always use Docker for final validation** to ensure a consistent PHP 8.3 + AST extension environment. Local commands can be used for convenience during development, but the full Docker pipeline must pass before committing.
 
-| Task | Docker | Local |
+| Task | Docker (Recommended) | Local (Convenience) |
 |------|--------|-------|
 | Full pipeline | `docker-compose run --rm test-all` | `composer tests` |
 ...
 | Security check | `docker-compose run --rm test-security` | `composer test:vulnerabilities-check` |
 
-**Run the full pipeline before committing**: `docker-compose run --rm test-all`
+**Run the full Docker pipeline before committing**: `docker-compose run --rm test-all`

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 6

__

Why: The suggestion correctly identifies a confusing contradiction in the documentation and proposes a clear resolution, improving developer guidance and preventing potential environment inconsistencies.

Low
Clarify an incomplete method signature

In the Public API table, replace the ambiguous strReplace(...) with its full
signature, strReplace(string|array $search, string|array $replace, string
$subject), to improve clarity.

CLAUDE.md [47-55]

 | Method | Purpose |
 |--------|---------|
 | `searchWords(?string)` | Normalise strings for database search (lowercase, remove accents/special chars) |
 | `nameFix(?string)` | Standardise surnames (handles mc/mac prefixes, van/von/de particles, hyphens) |
 | `removeAccents(string)` | Strip diacritics preserving case |
 | `utf8Ansi(?string)` | Convert UTF-8 to ANSI equivalents |
 | `isValidDate(string, string)` | Validate date string against format with logical checks |
-| `strReplace(...)` | Optimised replacement (uses `strtr()` for single-char) |
+| `strReplace(string|array $search, string|array $replace, string $subject)` | Optimised replacement (uses `strtr()` for single-char) |
 | `trim(string, string)` | Stricter trim |
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: This suggestion significantly improves the clarity of the API documentation by replacing an ambiguous placeholder ... with the full method signature for strReplace, making it easier for developers to understand and use.

Low
Specify code block language

Add the text language identifier to the markdown code block showing the
directory tree to ensure consistent rendering.

CLAUDE.md [33-38]

-```
+```text
 src/
 ├── StringManipulation.php    # Single final class, all public static methods
 ├── AccentNormalization.php   # Trait: SEARCH_WORDS_MAPPING + ACCENT_MAPPING constants
 └── UnicodeMappings.php       # Trait: UTF8_ANSI2 constant


- [ ] **Apply / Chat** <!-- /improve --apply_suggestion=2 -->


<details><summary>Suggestion importance[1-10]: 3</summary>

__

Why: This is a good markdown best practice that improves rendering consistency for the file structure diagram, though its impact on functionality or readability is minor.


</details></details></td><td align=center>Low

</td></tr>
<tr><td align="center" colspan="2">

- [ ] More <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>

- [ ]  **Author self-review**: I have reviewed the PR code suggestions, and addressed the relevant ones. <!-- approve and fold suggestions self-review -->

@qodo-code-review
Copy link
Contributor

Auto-approved PR

@qodo-code-review
Copy link
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Accuracy

Validate that the described architecture details (single final class, trait constant names/files, line counts, and the performance claims about strtr()/O(1) lookups) exactly match the current codebase to avoid misleading contributors.

High-performance PHP 8.3+ string manipulation library with zero production dependencies. Single final class (`StringManipulation`) exposing static methods optimised with pre-computed character mappings for O(1) lookups via `strtr()`.

## Build & Test Commands

**Always use Docker** to ensure consistent PHP 8.3 + AST extension environment.

| Task | Docker | Local |
|------|--------|-------|
| Full pipeline | `docker-compose run --rm test-all` | `composer tests` |
| Pest tests | `docker-compose run --rm tests ./vendor/bin/pest` | `./vendor/bin/pest` |
| Single test | `docker-compose run --rm tests ./vendor/bin/pest --filter testName` | `./vendor/bin/pest --filter testName` |
| Code style check | `docker-compose run --rm test-code-style` | `composer test:code-style` |
| Code style fix | `docker-compose run --rm tests ./vendor/bin/pint` | `composer fix:code-style` |
| PHPStan | `docker-compose run --rm test-phpstan` | `composer test:phpstan` |
| Psalm | `docker-compose run --rm test-psalm` | `composer test:psalm` |
| Phan | `docker-compose run --rm test-phan` | `composer test:phan` |
| PHPMD | `docker-compose run --rm test-phpmd` | `composer test:phpmd` |
| Mutation testing | `docker-compose run --rm test-infection` | `composer test:infection` |
| Rector (dry-run) | `docker-compose run --rm test-rector` | `composer test:rector` |
| Linting | `docker-compose run --rm test-lint` | `composer test:lint` |
| Security check | `docker-compose run --rm test-security` | `composer test:vulnerabilities-check` |

**Run the full pipeline before committing**: `docker-compose run --rm test-all`

## Architecture

src/
├── StringManipulation.php # Single final class, all public static methods
├── AccentNormalization.php # Trait: SEARCH_WORDS_MAPPING + ACCENT_MAPPING constants
└── UnicodeMappings.php # Trait: UTF8_ANSI2 constant


- **StringManipulation** uses two traits purely as constant containers for pre-computed character mapping arrays
- All methods are static; the class is never instantiated
- Performance comes from `strtr()` with pre-computed array constants (hash table O(1) lookups) and single-pass algorithms
- The traits exist to keep the ~600 lines of mapping data separate from the ~400 lines of logic

Tooling Claims

Double-check the stated static-analysis strictness/coverage targets and enabled features (e.g., PHPStan “MAX”, Psalm taint analysis, coverage percentages, Phan plugins) align with actual project configuration and CI behavior.

## Static Analysis Levels

All analysers run at their strictest settings:
- **PHPStan**: Level MAX with strict rules, type-perfect, 95%+ type coverage
- **Psalm**: Level 1, taint analysis enabled, 99.95% type coverage
- **Phan**: All strict checking flags enabled, 11 quality plugins
- **PHPMD**: Max 100 lines/method, max 15 public methods/class
CI Versions

Confirm the CI statement about testing against PHP 8.3, 8.4, and 8.5 is correct for the repository’s GitHub Actions matrix; if not, update to the real supported versions.

## CI

GitHub Actions runs the test matrix against PHP 8.3, 8.4, and 8.5 with vulnerability scanning (osv-scanner + Enlightn).

@claude
Copy link
Contributor

claude bot commented Feb 6, 2026

PR Review: Rewrite CLAUDE.md with architecture docs

Overall Assessment

Verdict: ✅ Approved with minor suggestions

This is an excellent documentation improvement that significantly enhances the value of CLAUDE.md for AI-assisted development. The restructuring is well-executed and accurately reflects the codebase.


Strengths

1. Accuracy & Correctness ✅

  • All technical claims verified against the codebase:
    • ✅ 7 public static methods confirmed in StringManipulation.php
    • ✅ Traits correctly described as constant containers
    • ✅ PHPStan level max with strict rules (95%+ type coverage target confirmed)
    • ✅ Psalm level 1 with taint analysis enabled (99.95% claimed - config shows totallyTyped="true")
    • ✅ Phan plugins: 11 quality plugins verified in .phan/config.php (lines 339-349)
    • ✅ PHPMD: 100 lines/method, 15 public methods/class limits confirmed in phpmd.xml
    • ✅ PHP 8.3, 8.4, 8.5 test matrix confirmed in .github/workflows/php.yml

2. Excellent Structure 📋

  • Proper Claude Code header following conventions
  • Consolidated command table is far more scannable than the previous format
  • Architecture section provides crucial context about the trait-as-constants pattern
  • Public API quick reference is extremely helpful
  • Progressive information disclosure (overview → commands → architecture → details)

3. Documentation Quality 📝

  • Concise yet comprehensive
  • Explains the "why" behind design decisions (traits for keeping 600 lines of mapping data separate)
  • Includes performance rationale (O(1) lookups via strtr())
  • South African English usage consistent with conventions

4. Practical Improvements 🎯

  • Removed generic rules duplicated from global configuration (reduces noise)
  • Added "Code style fix" command (Pint) that was missing
  • Clear emphasis on Docker-first workflow
  • Test organization section helps contributors understand the structure

Minor Suggestions

1. Phan Plugin Count Clarification
The documentation states "11 quality plugins" which is technically correct, but could be more precise:

11 quality plugins

Actually counted: 11 plugins total (AlwaysReturnPlugin, DollarDollarPlugin, DuplicateArrayKeyPlugin, DuplicateExpressionPlugin, PregRegexCheckerPlugin, PrintfCheckerPlugin, SleepCheckerPlugin, UnreachableCodePlugin, UseReturnValuePlugin, EmptyStatementListPlugin, StrictComparisonPlugin, LoopVariableReusePlugin).

This is accurate. No change needed.

2. Consider Adding Line Count Context
The architecture section mentions "~600 lines of mapping data" and "~400 lines of logic". While this provides good context, you might consider adding a note that these are approximate figures that may change with updates.

3. Optional: Add Mutation Testing Context
Consider adding a brief note about what MSI (Mutation Score Indicator) represents for readers unfamiliar with mutation testing:

Mutation testing target MSI: 88% (Mutation Score Indicator - percentage of code mutations killed by tests).

Code Quality Assessment

No code changes: This is purely documentation, so code quality concerns don't apply.

Best Practices: ✅

  • Follows South African English conventions (organisation, colour, normalise)
  • Consistent formatting and style
  • Proper markdown syntax
  • Appropriate use of emphasis (bold, code blocks, tables)

Performance Considerations: N/A (documentation only)

Security Concerns: ✅ None

Test Coverage: ✅

  • PR description indicates full test pipeline passes
  • No code changes, so existing test coverage remains unchanged

Recommendation

LGTM - This is a well-executed documentation improvement. The new structure is significantly more useful for AI-assisted development while maintaining accuracy and clarity.

The removed "Critical Development Rules" section was somewhat generic, and its key points (running tests, no force push) are either enforced by CI/tooling or are general git best practices that don't need to be in a project-specific file.

The addition of architecture context and API quick reference adds substantial value for anyone (human or AI) working with this codebase.


Review performed by: Claude Code (claude.ai/code)
Verification: All claims cross-referenced against source files, configs, and CI workflows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant