/tsh-core:managing-claude-contextfrom TSH Core
Sets up and maintains CLAUDE.md files, path-scoped rules, and decision-record indexes so repository conventions reliably load into Claude Code without bloating sessions.
Ships in TSH Core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Puts a repository's conventions where Claude Code will actually load them, and keeps them true as the code changes. The mechanics below are dictated by Claude Code's own loading rules — what loads at launch, what loads on demand, and what silently never loads at all — not by preference.
The failure this skill exists to prevent is a context file nobody can trust. A
CLAUDE.md that states a build command which no longer works is worse than no
file: the model follows it confidently and the reader stops checking.
Scope boundary. This skill owns the memory layer:
CLAUDE.mdroot and nested,.claude/rules/, and the decision-record index. If you are building a skill, subagent, hook or plugin, this is the wrong skill — useauthoring-claude-extensions. This one routes work to those primitives and hands off; it does not author them.
CLAUDE.md and Claude keeps re-deriving the same conventionsCLAUDE.md has grown past 200 lines, or covers areas the current task never touchesAGENTS.mdRead what already loads before writing anything. An existing CLAUDE.md is a
statement of team intent, not a draft to overwrite. Where a repository already has a
documentation or ADR convention, that convention wins over this skill's defaults.
docs/decisions/ is this skill's default location for decision records, not a
requirement of Claude Code. A repository that already keeps ADRs elsewhere keeps
them there; only the index wiring described below is non-negotiable.
Claude Code's own documentation outranks this skill. Loading rules, glob budgets and command behaviour ship on Claude Code's release cadence, and every reference here is a snapshot with its sources and a verification date at the bottom. Where the two disagree, follow the docs and fix the reference.
This skill does not:
writing-technical-documents~/.claude/ or any path outside the repository without being askedWhen a convention cannot be stated without a decision nobody has made, stop and name the decision instead of writing a plausible rule.
| Severity | Rule |
|---|---|
| MUST | Inventory what already loads before writing — run /context and read every file it lists under Memory files. |
| MUST | Verify every command, path, version and convention against the source before writing it into a memory file. |
| NEVER | Write a fact Claude can derive from the codebase — directory listings, dependency inventories, generated architecture overviews. |
| MUST | Exempt a domain dictionary from the rule above — it comes from the client, not the code, and may deliberately contradict it on a live project. |
| MUST | Write a domain dictionary's pointer in backticks as `docs/domain-dictionary.md`, never a bare @ import. |
| NEVER | Inline the full domain dictionary into any CLAUDE.md — the root vocabulary block stays ~15 lines; the artifact lives once, on demand. |
| MUST | Keep every CLAUDE.md under 200 lines, root and nested alike. Adherence drops as the file grows. |
| MUST | Make each layer point downward to the next instead of inlining it. |
| MUST | Move any multi-step procedure out of CLAUDE.md into a skill. CLAUDE.md holds facts, not workflows. |
| MUST | Route creation-time guidance to a skill, never a path-scoped rule. A rule fires only when Claude reads a matching file, so guidance for authoring a file that does not exist yet never loads when it is needed. Ask when the guidance is needed, not only what it is about. |
| MUST | Give every rule in .claude/rules/ a paths: glob unless it genuinely applies to every session — a rule without one costs every session, forever. |
| MUST | Confirm every paths: glob matches at least one file that exists today. Zero matches means either a broken pattern or creation-time guidance in the wrong layer; a rule that never fires is indistinguishable from one never written. |
| MUST | Write the decision index reference in backticks as `docs/decisions/README.md`. Written bare with a leading @ it becomes an import and loads the whole index at launch. |
| MUST | Give the decision index four columns — path, tags, one-line description, status. Tags carry the routing; an index without them is a list nothing can search. |
| MUST | Write the status filter into the artifacts you generate — the CLAUDE.md pointer sentence and the index header must both say that only Accepted records bind. This skill runs occasionally; the generated text is what reaches every session. |
| MUST | Treat Accepted as the only binding status when reading decisions yourself. Other statuses are history — read them to avoid re-proposing a rejected option, never as a current constraint, and never read a Superseded record without its successor. |
| NEVER | Use @path imports to reduce context. Imports load in full at launch; they organise, they never save. |
| MUST | Split downward into a nested CLAUDE.md once the root file grows per-package or per-subsystem sections. |
| NEVER | Overwrite an existing CLAUDE.md wholesale. Revise in place and report what changed and why. |
| NEVER | Remove, edit, move or summarise a block fenced by <!-- tsh:<name> START … <!-- tsh:<name> END -->, in CLAUDE.md or CLAUDE.local.md. A TSH tool owns it and rewrites it itself; keep it byte for byte when trimming, and count its lines against the 200-line target like any other. |
| MUST | Confirm what actually loaded with /context before reporting the work finished. |
| Reference | Load when | Covers |
|---|---|---|
| Choosing the layer | Before writing or moving any instruction, every time | The four layers and the predicate for each; the timing test that separates a rule from a skill; the import, /compact and read-not-write traps; when to hand off to authoring-claude-extensions |
| Writing CLAUDE.md | Creating or trimming a root or nested CLAUDE.md | The content contract, the 200-line target, what to cut, section order, AGENTS.md interop |
| Writing path-scoped rules | Recording a convention that applies to some files but not all | .claude/rules/ mechanics, paths: globs, brace-expansion budget, the unescaped-[ trap, the zero-match check, sharing rules by symlink |
| Monorepos and scale | The repo has packages or subsystems with different owners | Nested CLAUDE.md vs. path-scoped rules by ownership, the split trigger, start directory, claudeMdExcludes, per-directory skills |
| Indexing decision records | Wiring ADRs into context, or decisions exist but go unread | docs/decisions/ layout, the index schema, the Accepted-only binding rule and how to propagate it, the backtick-not-import wiring |
| Adopting a domain dictionary | A domain dictionary or glossary is being adopted, or the repository already has one | The two-tier projection, the backtick rule, monorepo slicing, the inbox, provenance, the derivable-fact carve-out |
| Bootstrapping a repository | Step 1 found no existing context files | The inspection order, /init and /import, migrating from Copilot or Cursor |
| Auditing for drift | Step 1 found existing context files | Verifying each claim against current code, pruning, /doctor, the InstructionsLoaded and Stop hooks |
Step 1 — Inventory what already loads, then branch. Run /context and read
every file listed under Memory files. Then look for what /context cannot show
because it has not loaded yet: nested CLAUDE.md files, .claude/rules/,
AGENTS.md, .github/copilot-instructions.md, .cursor/rules/. Report the
inventory before changing anything.
bootstrapping-a-repository.md.auditing-for-drift.md. Do not treat an
existing file as a blank page.Step 2 — Choose the layer for every fact. Read
choosing-the-layer.md before writing any
file. Each candidate instruction goes to exactly one layer, and the wrong layer is
the most common and most expensive mistake here: a convention placed in the root
file taxes every session forever, and a procedure placed there is ignored anyway.
Step 3 — Gather and verify. Read the build files, CI configuration, test setup and a representative slice of source. Run the commands you intend to document. Confirm every path exists. A convention you inferred from one file is a guess — check a second, or ask.
Step 4 — Write the layers, thin, pointing downward. Root CLAUDE.md orients and
points. Conventions go to .claude/rules/ with paths:. Area-owned conventions go
to a nested CLAUDE.md in the directory that owns them. If the repository has
packages or subsystems, read
monorepos-and-scale.md before deciding
between a rule and a nested file — the deciding question is ownership, not count.
Adopting or maintaining a domain dictionary follows this same shape; read
adopting-a-domain-dictionary.md
first.
Step 5 — Wire the decision index. If decision records exist or are wanted, read
indexing-decision-records.md and
create or update docs/decisions/README.md, then reference it from root CLAUDE.md
in backticks. Both the pointer and the index header must state that only Accepted
records bind — that sentence is how the rule reaches sessions this skill never runs
in. Write the index rows only; the record format and status lifecycle belong to
managing-decision-records, and status is
a human decision.
Step 6 — Verify what actually loads. Start a session and run /context. Confirm
the files you expect appear under Memory files and the ones you scoped are
absent until a matching file is read.
Answer each line before reporting the work finished. Any "no" sends you back.
- [ ] `/context` was run at the start and again at the end
- [ ] Every command, path and version was executed or checked against the source
- [ ] No root or nested CLAUDE.md exceeds 200 lines
- [ ] Nothing was written that Claude could derive from the codebase
- [ ] Every rule in .claude/rules/ has paths:, or justifies loading every session
- [ ] Every paths: glob was expanded against the tree and matches at least one file
- [ ] No creation-time guidance was left in a rule — it was routed to a skill
- [ ] The decision index is referenced in backticks, with no bare @ import anywhere
- [ ] No multi-step procedure was left in a CLAUDE.md
- [ ] An existing CLAUDE.md was revised in place, and the changes were reported
- [ ] Every convention written down is one the team holds, not one I invented
references/adopting-a-domain-dictionary.md (opens in a new tab)references/auditing-for-drift.md (opens in a new tab)references/bootstrapping-a-repository.md (opens in a new tab)references/choosing-the-layer.md (opens in a new tab)references/indexing-decision-records.md (opens in a new tab)references/monorepos-and-scale.md (opens in a new tab)references/writing-claude-md.md (opens in a new tab)references/writing-path-scoped-rules.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Trigger on: setting up Claude Code in a new repository, a `CLAUDE.md` grown past 200 lines or gone stale, Claude repeatedly ignoring a convention, a monorepo needing nested `CLAUDE.md` files or path-scoped rules, indexing decision records, migrating instructions from GitHub Copilot or Cursor, or any request to audit what loads into Claude's context.
6 skills in this plugin
/authoring-claude-extensionsDecides which Claude Code extension a need calls for — skill, subagent, hook, or plugin — and then writes it. Use when building or changing any of those four, when a workflow keeps getting pasted into chat, when a side task floods the conversation, or when a setup has to be shared across repositories or published as a plugin. A single hook wired into this repository's settings.json is Claude Code's own configuration, not an extension to author./initOne-shot setup of a project's Claude Code context. Audits what already loads, then creates or repairs root and nested `CLAUDE.md`, path-scoped rules, and the decision-record archive with its index by running the owning tsh-core skills in order, wires maintenance pointers into `CLAUDE.md` so future sessions keep it all current, and, where tsh-product-engineering is installed, has the project's verification and security-invariant skills captured. Run /tsh-core:init inside the repository to set up./managing-decision-recordsOwns the shape and lifecycle of architecture decision records — the four-section format, the status vocabulary, numbering, superseding, and keeping `docs/decisions/README.md` in step. Use when adding a decision record, changing one's status, superseding an old decision, or deciding whether something warrants a record at all./managing-git-worktreesManages Git worktree lifecycle requests: creating a worktree for a new branch from a freshly fetched base branch on origin — any branch, defaulting to origin's own default branch — adopting a branch that already exists on origin, such as a pull request's head branch, into its own worktree, listing registered worktrees, and removing a precisely identified worktree. Use when the user asks for worktree creation, adoption of an existing branch, listing, removal, or safe Git worktree lifecycle guidance./writing-technical-documentsApplies TSH's writing standard to any technical document — README, CHANGELOG, ADR, RFC, runbook, PR description, ticket, user story, bug report or test plan — so it leads with the conclusion, states only verified facts, and is short enough to be read. Use when writing or revising a document meant for other people, or when asked to tighten, shorten or clarify prose — load it before rewriting, even for one pasted paragraph, because the standard decides what to cut.npx claudepluginhub thesoftwarehouse/agentic-collections --plugin tsh-coreOther plugins' skills for the same job