User Story
As a user of the code-context skill, I want a single /code-context command that does the right thing regardless of whether a context file already exists, so that I don't have to remember when to use init vs update and the mental model matches the reality that both commands already overlap heavily.
Acceptance Criteria
- WHEN a user runs
/code-context with no subcommand THEN the skill SHALL auto-detect project state and perform the correct action:
- No
code-context.md present → full generation (current init behavior)
code-context.md present with a valid <!-- code-context-marker: <hash> --> → git-diff-driven targeted update (current update behavior)
code-context.md present without a marker → full re-generation, preserving sections that still hold
- WHEN a user runs
/code-context <hint text> (where the first word is not a known subcommand) THEN the skill SHALL treat the entire argument as a focus hint for the merged command
- WHEN a user runs
/code-context init or /code-context update THEN the skill SHALL error with a clear migration message pointing to the unified command (e.g., "init and update have been merged — just run /code-context")
- WHEN the merged command completes THEN the
<!-- code-context-marker: ... --> SHALL be set to the current git rev-parse HEAD and the "Last updated" date SHALL be today's date
- WHEN the merged command runs AND no
CLAUDE.md "Code Context" section exists THEN the skill SHALL add it (same behavior as current init)
- WHEN the CLAUDE.md snippet is written THEN it SHALL NOT reference the
/code-context update (or any) subcommand name — the snippet SHALL describe the git-diff auto-update behavior inline so it stays correct regardless of future command renames
- WHEN
uninstall and global-uninstall are invoked THEN they SHALL continue to work unchanged
Implementation Phases
Risk Assessment
- Technical risks: Users with older
CLAUDE.md files (from prior installs) contain the old snippet referencing /code-context update. Their next session will try to auto-run it and hit the error stub. Mitigation: the error message must be unambiguous and mention that re-running /code-context once will rewrite CLAUDE.md with the new inline snippet. The command routing must catch this path cleanly.
- Dependencies: None — self-contained change in this repo.
- Unknowns: Whether we need a one-shot migration helper for old CLAUDE.md snippets, or whether the "run
/code-context once to heal" flow is sufficient. Current plan: the latter.
Notes
Motivation: init and update already overlap — init reads and preserves an existing code-context.md, and update is really just an optimization that uses the git marker for targeted edits. Exposing both as separate verbs forces users to learn a distinction that the skill already handles internally. Collapsing to one command matches user intent ("bring my context file up to date with the current code") and is a cleanup refactor, not a feature change.
Design decisions captured in this issue (from the refinement discussion):
- Default command (no subcommand) is the merged entry point
- Auto-detects state via presence of file and marker
- Old subcommands error out rather than aliasing — the user explicitly wanted a clean break
- CLAUDE.md snippet drops any subcommand reference so it's rename-proof
User Story
As a user of the code-context skill, I want a single
/code-contextcommand that does the right thing regardless of whether a context file already exists, so that I don't have to remember when to useinitvsupdateand the mental model matches the reality that both commands already overlap heavily.Acceptance Criteria
/code-contextwith no subcommand THEN the skill SHALL auto-detect project state and perform the correct action:code-context.mdpresent → full generation (currentinitbehavior)code-context.mdpresent with a valid<!-- code-context-marker: <hash> -->→ git-diff-driven targeted update (currentupdatebehavior)code-context.mdpresent without a marker → full re-generation, preserving sections that still hold/code-context <hint text>(where the first word is not a known subcommand) THEN the skill SHALL treat the entire argument as a focus hint for the merged command/code-context initor/code-context updateTHEN the skill SHALL error with a clear migration message pointing to the unified command (e.g., "initandupdatehave been merged — just run/code-context")<!-- code-context-marker: ... -->SHALL be set to the currentgit rev-parse HEADand the "Last updated" date SHALL be today's dateCLAUDE.md"Code Context" section exists THEN the skill SHALL add it (same behavior as currentinit)/code-context update(or any) subcommand name — the snippet SHALL describe the git-diff auto-update behavior inline so it stays correct regardless of future command renamesuninstallandglobal-uninstallare invoked THEN they SHALL continue to work unchangedImplementation Phases
SKILL.md— collapse theInit CommandandUpdate Commandsections into a single default command with the three-way state detection; updateCommand routingto route unknown/empty first-word to the merged command and routeinit/updateto an error stubclaude-md-snippet.mdto remove the/code-context updatereference and describe the auto-update behavior inline (renaming-proof)README.md— revise the Usage section to show the single command and removeinit/updateas separate entries; update any other prose that distinguishes init vs updatedescription,argument-hint) inSKILL.mdto reflect the new surface areaRisk Assessment
CLAUDE.mdfiles (from prior installs) contain the old snippet referencing/code-context update. Their next session will try to auto-run it and hit the error stub. Mitigation: the error message must be unambiguous and mention that re-running/code-contextonce will rewriteCLAUDE.mdwith the new inline snippet. The command routing must catch this path cleanly./code-contextonce to heal" flow is sufficient. Current plan: the latter.Notes
Motivation:
initandupdatealready overlap —initreads and preserves an existingcode-context.md, andupdateis really just an optimization that uses the git marker for targeted edits. Exposing both as separate verbs forces users to learn a distinction that the skill already handles internally. Collapsing to one command matches user intent ("bring my context file up to date with the current code") and is a cleanup refactor, not a feature change.Design decisions captured in this issue (from the refinement discussion):