Claude‑Mem Coding Skill
What This Skill Does
This skill teaches Claude how to:
- Mine claude-mem (via MCP) for high‑signal past work.
- Maintain a concise, high‑impact CLAUDE.md (~1,500 tokens).
- Maintain a curated MEMORY.md of lessons learned and directions, so future work is faster and less error‑prone.
It is an entry point, not a full manual. Detailed workflows and examples live in separate reference files that Claude can open on demand.
When to Use This Skill
Claude should activate this skill when:
- A feature, refactor, or significant bugfix is completed.
- An infra/deployment change introduces new operational lessons.
- Starting work on an area with substantial history in claude-mem.
- Performing a daily “memory maintenance” pass on an active repo.
Inputs and Outputs
Inputs
Claude relies on:
- Files (in repo root):
CLAUDE.md – main project instructions.
MEMORY.md – curated lessons and directions.
- claude-mem MCP tools (already installed & connected):
search – index‑level observation search.
timeline – temporal context around observations.
get_observations – full structured details.
Outputs
This skill produces:
- Patch‑style edits to:
MEMORY.md – new or updated lessons, patterns, and playbooks.
CLAUDE.md – refreshed rules while staying under ~1,500 tokens.
- No raw claude-mem transcripts are copied; only compressed, actionable guidance.
How Claude Should Behave
1. Mine claude-mem → Update MEMORY.md
High‑level behavior (details in claude-mem-usage.md):
- Use progressive disclosure against claude-mem:
search for recent decision, bugfix, refactor, discovery, change observations.
timeline around promising IDs to see context.
get_observations for a small set of high‑value IDs.
- From those, update
MEMORY.md with:
- Architectural decisions and their impact.
- Implementation patterns and anti‑patterns.
- Debugging playbooks and DevOps lessons.
Constraints
- Prefer short bullets over long prose.
- Record why decisions were made and how to act next time.
- Never store secrets or credentials in
MEMORY.md.
For a full template and examples, Claude should open:
memory-structure-reference.md
claude-mem-usage.md
2. Distill MEMORY.md → Refresh CLAUDE.md (≈1,500 tokens)
High‑level behavior:
Read the existing CLAUDE.md and approximate its size; keep the body around 1–1.5k tokens for optimal behavior.
Pull only current, high‑impact content from MEMORY.md:
- Still‑valid architectural directions.
- Frequently reused patterns and gotchas.
- Operational guardrails that materially affect daily work.
Rewrite historical notes as timeless rules, e.g.:
- “When adding retries to DB writes, always use the shared retry helper instead of manual loops.”
Use links instead of inlining:
.clauderules/code-style.md for style.
.clauderules/testing.md for testing.
MEMORY.md sections for deeper background.
Token Discipline
- If CLAUDE.md is too long:
- Merge overlapping bullets.
- Drop generic advice that doesn’t change behavior.
- Replace detailed explanations with references to supporting docs.
Diff‑First
- Propose minimal patches, not full rewrites:
- Update only sections that need change (e.g., “Architectural Directions”, “Patterns & Gotchas”).
- Preserve stable layout and headings.
- Always leave final acceptance to human review in Git/CI.
For concrete layouts and example diffs, Claude should open:
claude-md-layout-reference.md
example-diffs.md
Safety and Priority Rules
Claude must:
Quick “How to Call Me”
Users can invoke this skill with prompts like:
“Use the claude-mem coding skill to:
- mine claude-mem for recent work,
- update MEMORY.md with lessons, and
- refresh CLAUDE.md under the ~1,500‑token budget.”
Claude should then:
- Run the claude-mem
search → timeline → get_observations flow.
- Draft a patch for
MEMORY.md with new lessons.
- Draft a patch for
CLAUDE.md derived from MEMORY.md.
- Present both patches clearly for human review and commit.
External References
To keep this SKILL.md lean and within best‑practice size, Claude should open these files when more detail is needed:
claude-mem-usage.md – detailed claude-mem MCP workflows, filters, and example queries.
memory-structure-reference.md – full MEMORY.md templates and longer examples.
claude-md-layout-reference.md – canonical CLAUDE.md section layouts and size guidance.
example-diffs.md – sample before/after patches for CLAUDE.md and MEMORY.md.
1---2name: claude-mem-coded-assistant3description: Entry-point skill for using claude-mem to keep CLAUDE.md and MEMORY.md in sync so Claude learns from past work and avoids repeating mistakes.4---5
6# Claude‑Mem Coding Skill
7
8## What This Skill Does
9
10This skill teaches Claude how to:
11
12- Mine **claude-mem** (via MCP) for high‑signal past work.
13- Maintain a concise, high‑impact **CLAUDE.md** (~1,500 tokens).
14- Maintain a curated **MEMORY.md** of lessons learned and directions, so future work is faster and less error‑prone.
15
16It is an **entry point**, not a full manual. Detailed workflows and examples live in separate reference files that Claude can open on demand.
17
18---
19
20## When to Use This Skill
21
22Claude should activate this skill when:
23
24- A feature, refactor, or significant bugfix is completed.
25- An infra/deployment change introduces new operational lessons.
26- Starting work on an area with substantial history in claude-mem.
27- Performing a daily “memory maintenance” pass on an active repo.
28
29---
30
31## Inputs and Outputs
32
33### Inputs
34
35Claude relies on:
36
37- **Files** (in repo root):
38 - `CLAUDE.md` – main project instructions.
39 - `MEMORY.md` – curated lessons and directions.
40- **claude-mem MCP tools** (already installed & connected):
41 - `search` – index‑level observation search.
42 - `timeline` – temporal context around observations.
43 - `get_observations` – full structured details.
44
45### Outputs
46
47This skill produces:
48
49- **Patch‑style edits** to:
50 - `MEMORY.md` – new or updated lessons, patterns, and playbooks.
51 - `CLAUDE.md` – refreshed rules while staying under ~1,500 tokens.
52- No raw claude-mem transcripts are copied; only compressed, actionable guidance.
53
54---
55
56## How Claude Should Behave
57
58### 1. Mine claude-mem → Update MEMORY.md
59
60High‑level behavior (details in `claude-mem-usage.md`):
61
62- Use **progressive disclosure** against claude-mem:
63 1. `search` for recent `decision`, `bugfix`, `refactor`, `discovery`, `change` observations.
64 2. `timeline` around promising IDs to see context.
65 3. `get_observations` for a small set of high‑value IDs.
66- From those, update `MEMORY.md` with:
67 - Architectural decisions and their impact.
68 - Implementation patterns and anti‑patterns.
69 - Debugging playbooks and DevOps lessons.
70
71**Constraints**
72
73- Prefer short bullets over long prose.
74- Record *why* decisions were made and how to act next time.
75- Never store secrets or credentials in `MEMORY.md`.
76
77For a full template and examples, Claude should open:
78
79- `memory-structure-reference.md`
80- `claude-mem-usage.md`
81
82---
83
84### 2. Distill MEMORY.md → Refresh CLAUDE.md (≈1,500 tokens)
85
86High‑level behavior:
87
88- Read the existing `CLAUDE.md` and approximate its size; keep the body around **1–1.5k tokens** for optimal behavior.
89- Pull only **current, high‑impact** content from `MEMORY.md`:
90 - Still‑valid architectural directions.
91 - Frequently reused patterns and gotchas.
92 - Operational guardrails that materially affect daily work.
93- Rewrite historical notes as **timeless rules**, e.g.:
94 - “When adding retries to DB writes, always use the shared retry helper instead of manual loops.”
95
96- Use links instead of inlining:
97 - `.clauderules/code-style.md` for style.
98 - `.clauderules/testing.md` for testing.
99 - `MEMORY.md` sections for deeper background.
100
101**Token Discipline**
102
103- If CLAUDE.md is too long:
104 - Merge overlapping bullets.
105 - Drop generic advice that doesn’t change behavior.
106 - Replace detailed explanations with references to supporting docs.
107
108**Diff‑First**
109
110- Propose **minimal patches**, not full rewrites:
111 - Update only sections that need change (e.g., “Architectural Directions”, “Patterns & Gotchas”).
112 - Preserve stable layout and headings.
113- Always leave final acceptance to human review in Git/CI.
114
115For concrete layouts and example diffs, Claude should open:
116
117- `claude-md-layout-reference.md`
118- `example-diffs.md`
119
120---
121
122## Safety and Priority Rules
123
124Claude must:
125
126- **Always**:
127 - Query claude-mem before re‑solving problems already encountered in this project.
128 - Update `MEMORY.md` after meaningful work with concise, actionable lessons.
129 - Keep `CLAUDE.md` focused on rules that change how work is done, not on general LLM tips.
130
131- **Never**:
132 - Overwrite `CLAUDE.md` or `MEMORY.md` entirely; always propose small diffs.
133 - Paste raw claude-mem observations verbatim into either file.
134 - Store secrets, API keys, or sensitive infra details in these files.
135
136- **Conflict resolution priority**:
137 1. Explicit instructions in `CLAUDE.md`.
138 2. Latest curated guidance in `MEMORY.md`.
139 3. Raw claude-mem observations and session summaries.
140 4. Ad‑hoc reasoning in the current session.
141
142---
143
144## Quick “How to Call Me”
145
146Users can invoke this skill with prompts like:
147
148> “Use the claude-mem coding skill to:
149> 1) mine claude-mem for recent work,
150> 2) update MEMORY.md with lessons, and
151> 3) refresh CLAUDE.md under the ~1,500‑token budget.”
152
153Claude should then:
154
1551. Run the claude-mem `search → timeline → get_observations` flow.
1562. Draft a patch for `MEMORY.md` with new lessons.
1573. Draft a patch for `CLAUDE.md` derived from `MEMORY.md`.
1584. Present both patches clearly for human review and commit.
159
160---
161
162## External References
163
164To keep this SKILL.md lean and within best‑practice size, Claude should open these files when more detail is needed:
165
166- `claude-mem-usage.md` – detailed claude-mem MCP workflows, filters, and example queries.
167- `memory-structure-reference.md` – full MEMORY.md templates and longer examples.
168- `claude-md-layout-reference.md` – canonical CLAUDE.md section layouts and size guidance.
169- `example-diffs.md` – sample before/after patches for CLAUDE.md and MEMORY.md.
170