November 21, 2026
A Review of Some Code Made by Claude Code

First of all, this document is made to be read by both interested humans and Claude Code, Claude can ignore anything that is not prefixed with For Claude:.

tl;dr: it was time to review Claude Opus 5.5's work on GraphSeam and it might look like the findings were numerous and severe but that's not the case, I'm in fact fairly impressed that there weren't any major structural issues in the code structure. There are some structural issues for sure, but they should be fairly easy to fix. There were many breaches of the software rule called Do Not Repeat (DRY) yourself though, but such issues are fairly trivial to clean up.

Let's begin with the more structural issues:

1.) The project was setup by me using a router setup that essentially uses map lookups to execute logic, this makes the business logic less verbose and more clean. That is instead of having if JP then do X else if SE do Y in a lot of different place we just do Router::getInsiders(JP) and we route to Japan related logic that returns a bunch of insiders.

The problem is that Claude continued building on that class (a class is a box of methods and member variables) with logic that should not belong there, one such example is Regulatory::reAssessHighScorers(), it should not be there, it's just confusing.

For Claude: move Regulatory::reAssessHighScorers() to the correct place in the LLM related classes.

For Claude: I see Regulatory::roleCode(), SecCareers::roleCode(), JpPosts::roleCodes() and NsmUk::roleCode(), check if that can be refactored into common logic to keep things DRY. Furthermore, I see Regulatory::roleCode() being invoked in the Sec class. That is not the role of Regulatory, it should be the other way around, Regulatory should be invoking Sec via the routing logic. My interpretation is that the whole roleCode() logic should probably be moved to a common helper for all the jurisdictions and removed completely from Regulatory.

For Claude: I see Regulatory::validateFindings() which is used in Llm and in Sec, that method does not seem to have anything to do with routing to misc. jurisdictional logic, move it to some LLM related class where it makes sense to have it.

For Claude: I see Regulatory::roleWindow() which is used in Sec, I need that moved to a more appropriate place, we can't keep invoking the router in the routed to logic, that doesn't make sense.

For Claude: I see Regulatory::groupGrants() which from what I can see is not even used in the business logic but referred to in multiple doc blocks, what is going on?

For Claude: I see Regulatory::NOT_A_DECISION with a jumble of market related regexes, the idea with Regulatory is to route / fetch the correct regulatory logic, not encode it directly in itself. Refactor please so that this stuff ends up in the correct jurisdictional contexts.

For Claude: I see Regulatory::isTrue() and a closure being instantiated in Sec into a variable called $isTrue, check if this is duplicate logic and refactor accordingly, ie put in some base level helper, not in Regulatory.

For Claude: I see Regulatory::deriveScores() which is only called in Llm, just move it to that class if you don't have any better ideas, it's not staying in Regulatory anyway.

2.) The project downloads a lot from public sources but there seems to be a lot of potentially duplicate logic everywhere that relates to downloading.

For Claude: do a project regex search for "n download(" to see all the definitions of download(), go through those definitions and make sure that everything is DRY, ie consolidate all logic that is not needed for that particular context it's defined in.

3.) More repetitions, browser user agents are defined everywhere.

For Claude: do a project regex search for "User-Agent" and consolidate everything that is not idiosyncratic to its context.

4.) Another structural nitpick:

For Claude: we have AgeInBracketsHeadings that implements the interface HkBioQuirk, which is completely empty of logic, which in turn extends the trait ResultsQuirk. My impression from the namings here is that AgeInBracketsHeadings is general logic that has got nothing to do with a particular jurisdiction and should therefore use ResultsQuirks directly. Btw, why does HkBioQuirk even exist, maybe we can get rid of it?

5.) More possible repetition.

For Claude: I see Pages\Company::insiderTotals() and I see Profile::insiderTotals(), they look different on the surface level and might have to stay as they are but look into it and refactor so we have one place of definition if possible.

avatar henrik