Skip to content

Commit ac858db

Browse files
dougborgclaude
andcommitted
docs: slim CLAUDE.md to a spine + topical pointer table
CLAUDE.md was 688L / 40KB and was injected into every session — most of its bulk was topical pitfalls only relevant when working on a specific subsystem (Prefab UI, typed cache, OpenAPI spec, API helpers). Every session paid that context tax even for topics never touched. This commit completes the refactor started in the previous commit: - Replace the ~293-line Known Pitfalls section with a short Cross-cutting list (5 genuinely repo-wide rules — null SKUs, generated files, raw list mocks, kwargs, worktree safety) plus a 6-row Topical pointer table. Each row lists the most-greppable keywords inside (DataTable, archive, ListResponse, uv.lock, HEAD:refs/heads, …) so an agent grepping CLAUDE.md lands on the right pointer with enough context to follow the link. - Delete the 65-line "API Response Handling Best Practices" section; the content lives in katana_public_api_client/docs/guide.md and is reachable via the topical table. - Extend the Detailed Documentation table with rows for the three new subsystem docs added in the previous commit. Final size: 381L / 22KB — a 45% reduction. Also update stale section pointers in three harness files that referenced sections that moved: - .claude/agents/domain-advisor.md (4 citations now pointing at guide.md / spec-authoring.md / prefab/README.md). - .claude/skills/techdebt/SKILL.md and .claude/skills/pre-commit/SKILL.md (anti-pattern source citations). The "rebase before PR" rule that previously lived in CLAUDE.md is already enforced by /open-pr and /review-pr CRITICAL sections, so the topical table delegates to the skills rather than duplicating the rule. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2434876 commit ac858db

4 files changed

Lines changed: 66 additions & 371 deletions

File tree

.claude/agents/domain-advisor.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ items = unwrap_data(response, default=[]) # 200 list (.data envelop
5353
if is_success(response): ... # 201/204
5454
```
5555

56-
Anti-pattern: `if response.status_code == 200`. Source: `CLAUDE.md` API Response Handling Best Practices.
56+
Anti-pattern: `if response.status_code == 200`. Source: `katana_public_api_client/docs/guide.md` Response Handling section.
5757

5858
### "How do I handle UNSET attrs fields?"
5959

@@ -64,15 +64,15 @@ status = unwrap_unset(order.status, None) # read attrs field; default if
6464
payload_value = to_unset(maybe_optional) # write attrs field; UNSET if None
6565
```
6666

67-
Never `isinstance(value, type(UNSET))`, never `hasattr(order, 'status')` for attrs-defined fields. Source: `CLAUDE.md` Anti-Patterns.
67+
Never `isinstance(value, type(UNSET))`, never `hasattr(order, 'status')` for attrs-defined fields. Source: `katana_public_api_client/docs/guide.md` — Response Handling section (anti-patterns).
6868

6969
### "Where do retries go?"
7070

7171
Transport layer (`katana_client.py`). All 100+ endpoints get retries, rate-limit handling, and pagination automatically. Never wrap individual API methods. Source: `katana_public_api_client/docs/adr/0001-transport-layer-resilience.md`.
7272

7373
### "How are list responses shaped?"
7474

75-
Katana wraps every list in `{"data": [...]}`. Test mocks must reflect this — never define raw arrays. Source: `CLAUDE.md` Known Pitfalls.
75+
Katana wraps every list in `{"data": [...]}`. Test mocks must reflect this — never define raw arrays. Source: `katana_public_api_client/docs/spec-authoring.md` — "List responses must use a `ListResponse` schema".
7676

7777
### "Which exceptions can `unwrap_as` raise?"
7878

@@ -84,11 +84,11 @@ Katana wraps every list in `{"data": [...]}`. Test mocks must reflect this — n
8484
| 5xx | `ServerError` |
8585
| Other 4xx | `APIError` |
8686

87-
Source: `CLAUDE.md` Exception Hierarchy.
87+
Source: `katana_public_api_client/docs/guide.md` — Response Handling section, "Exception hierarchy".
8888

8989
### "When do I need to update the help resource?"
9090

91-
When you add or change MCP tool parameters. The help resource at `katana_mcp_server/.../resources/help.py` has hardcoded tool documentation that drifts silently. Source: `CLAUDE.md` Known Pitfalls.
91+
When you add or change MCP tool parameters. The help resource at `katana_mcp_server/.../resources/help.py` has hardcoded tool documentation that drifts silently. Source: `katana_mcp_server/docs/prefab/README.md` — "Help resource drift".
9292

9393
## EDGE CASES
9494

.claude/skills/pre-commit/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ git diff --cached
4646
Look for:
4747

4848
- Generated-file edits (`api/**/*.py`, `models/**/*.py`, `client.py`) without spec change
49-
- Anti-patterns from `CLAUDE.md` "Known Pitfalls" and "Anti-Patterns to Avoid"
49+
- Anti-patterns from `CLAUDE.md` "Known Pitfalls" and `katana_public_api_client/docs/guide.md` "Response Handling" section
5050

5151
### 3. Verify test coverage
5252

.claude/skills/techdebt/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ uv run poe quick-check
3535
Categories:
3636

3737
1. **Dead code** — unused imports/vars/functions/classes; unreachable paths; commented-out blocks. Confirm with `LSP findReferences` before flagging.
38-
2. **Outdated patterns** — anti-patterns from `CLAUDE.md` Known Pitfalls / Anti-Patterns sections (UNSET misuse, manual status checks, retry wrapping, hasattr on attrs models, raw list mocks).
38+
2. **Outdated patterns** — anti-patterns from `katana_public_api_client/docs/guide.md` "Response Handling" section and `CLAUDE.md` "Known Pitfalls" (UNSET misuse, manual status checks, retry wrapping, hasattr on attrs models, raw list mocks).
3939
3. **Code duplication** — repeated logic that should be a helper, copy-pasted test setup that should be a fixture.
4040
4. **Code smells** — broad `except Exception`, missing type annotations on public functions, parameter explosions, name shadowing, circular imports.
4141
5. **Missing best practices** — public functions without docstrings, async tests missing `@pytest.mark.asyncio`, fixtures that should be `scope="session"`.

0 commit comments

Comments
 (0)