Skip to content

docs: move migration guidance out of always-loaded CLAUDE.md - #564

Merged
abdulrafey1 merged 4 commits into
mainfrom
rafey/docs/trim-claude-md
Aug 6, 2026
Merged

docs: move migration guidance out of always-loaded CLAUDE.md#564
abdulrafey1 merged 4 commits into
mainfrom
rafey/docs/trim-claude-md

Conversation

@abdulrafey1

@abdulrafey1 abdulrafey1 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What

Trims the always-loaded root CLAUDE.md by moving the database-migration procedure into a skill that loads on demand, cutting resident context in every session from ~14.8k to ~12.7k characters.

Changes

  • docs: move the Alembic procedure (autogenerate mechanics, the two app/analytics lineages, the continuous-aggregate backfill, resolving split heads) into a new database-migrations skill that loads on invocation
  • docs: drop the Red-Green-Refactor enumeration — it restates a generic practice already covered by the superpowers:test-driven-development skill; the TDD directives themselves are unchanged
  • docs: fold the duplicate ## GitHub Project Management section into the commit-conventions section that already pointed at the same skill
  • docs: add the new skill to the Additional Documentation table

Safety-critical prohibitions stay in the root file, always loaded. Never edit an existing migration file. No exceptions. and Never use bare except Exception blocks. are untouched. The whole Exception Handling section — including the domain-exception-to-HTTP mapping rules — stays in the root file unchanged: domain exceptions are raised from services, engines, and plugins outside sparkth/api/, so those rules need to be resident everywhere.

How to Test

  1. Confirm no guidance was lost, only relocated:
    git show --stat HEAD
    git diff origin/main..HEAD -- CLAUDE.md
  2. Confirm the safety-critical rules are still in the always-loaded file:
    grep -n "Never edit an existing migration file" CLAUDE.md
    grep -n "Never use bare .except Exception." CLAUDE.md
  3. Confirm the new skill is discovered and its frontmatter is valid — start a session in the repo and run /context; database-migrations should appear in the skill listing with its description.

Notes

No migration, no breaking change, no env var, no dependency change. Documentation and agent-guidance files only — no runtime code is touched.

This is deliberately standalone and based directly on main, so it can merge independently of the in-flight permission-groups / org-tree PR stack.

This description was written with the assistance of an LLM (Claude).

The root CLAUDE.md loads into every session, so each line is resident context for
the whole session. Three sections were paying that cost without needing to be
always available.

The Alembic procedure (autogenerate mechanics, the two app/analytics lineages, the
continuous-aggregate backfill, resolving split heads) becomes a skill that loads on
invocation. The domain-exception-to-HTTP mapping rules move to sparkth/api/CLAUDE.md,
which loads only when working under that directory.

Safety-critical prohibitions deliberately stay in the root file, where they are always
loaded: "never edit an existing migration file" and "never use bare except Exception"
are unchanged, as are the general exception rules that apply outside the API layer.

Also drops the Red-Green-Refactor enumeration, which restates a generic practice the
superpowers:test-driven-development skill already covers, and folds the duplicate
GitHub Project Management section into the commit-conventions section that already
pointed at the same skill.

Root CLAUDE.md drops from 14821 to 11003 characters.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@abdulrafey1 abdulrafey1 self-assigned this Aug 3, 2026
Drops the nested sparkth/api/CLAUDE.md introduced earlier on this branch and
restores the full domain-exception-to-HTTP mapping rules to the root CLAUDE.md,
unchanged from main. The nested-file approach loads the rules only when working
under sparkth/api/, but domain exceptions are raised from services, engines, and
plugins — code that lives outside that directory — so the rules need to be
resident everywhere.

The branch now makes a single relocation: the Alembic procedure moves into the
database-migrations skill. Root CLAUDE.md lands at 12727 characters (from 14821
on main).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@abdulrafey1 abdulrafey1 changed the title docs: move migration and api guidance out of always-loaded CLAUDE.md docs: move migration guidance out of always-loaded CLAUDE.md Aug 4, 2026
abdulrafey1 and others added 2 commits August 6, 2026 11:47
main made the continuous-aggregate backfill automatic: `make migrations` now
delegates to the `sparkth migrate` CLI command, which applies both lineages and
then runs the backfill, with `make analytics-backfill` kept for refreshing a
single aggregate by name. The skill was written against the earlier behavior,
where the backfill was a separate one-off manual step after migrating, so its
"Applying migrations" and continuous-aggregate sections described a workflow
that no longer exists.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@abdulrafey1
abdulrafey1 merged commit 2d73e5f into main Aug 6, 2026
6 checks passed
@abdulrafey1
abdulrafey1 deleted the rafey/docs/trim-claude-md branch August 6, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants