memory-optimizer
Refactors CLAUDE.md into minimal startup context by extracting path-specific rules, skills, commands, and agents. Use when CLAUDE.md exceeds 50 lines, startup feels slow, memory needs restructuring, or splitting monolithic project instructions.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
Memory Optimizer
Restructures .claude/CLAUDE.md using progressive disclosure to minimize startup tokens.
Decision Table
| Signal in CLAUDE.md | Extract To | Frontmatter |
|---|---|---|
File extensions (.ts, .py) or directories (src/api/) |
.claude/rules/{topic}.md |
paths: {glob} |
| Multi-step workflow (3+ steps) | .claude/skills/{name}/SKILL.md |
name:, description: |
| User-triggered template | .claude/commands/{name}.md |
description: |
| Specialized task needing limited tools | .claude/agents/{name}.md |
name:, description:, tools: |
| Essential for ALL interactions | Keep in CLAUDE.md | — |
Workflow
- Analyze: Read CLAUDE.md, count lines
- Categorize: Apply decision table to each section
- Plan: Present extraction table for approval
- Extract: Create files with proper frontmatter
- Refactor: Reduce CLAUDE.md to <50 lines
- Report: Show before/after line counts
Extraction Plan Format
Present before creating files:
| Content | Extract To | Type | Trigger/Path |
| -------------- | ------------------------------ | ------- | ------------------- |
| TS conventions | .claude/rules/typescript.md | Rule | `**/*.ts` |
| Deploy process | .claude/skills/deploy/SKILL.md | Skill | "deploy", "release" |
| PR template | .claude/commands/review.md | Command | `/review` |
| Security check | .claude/agents/security.md | Agent | security tasks |
File Templates
Rule
---
paths: src/**/*.ts
---
# {Topic}
{ Instructions }
Skill
---
name: {kebab-case}
description: {What it does}. Use when {triggers}.
---
# {Name}
{Instructions}
Command
---
description: { Brief description }
---
{ Prompt template with $ARGUMENTS }
Agent
---
name: {name}
description: {When to delegate}. Use proactively for {triggers}.
tools: Read, Grep, Glob
---
# {Name}
{Instructions}
Refactored CLAUDE.md Target
# {Project}
{1-2 sentence overview}
## Commands
- Build: `{cmd}`
- Test: `{cmd}`
## References
- @README.md
- @docs/architecture.md
Goal: <50 lines, ideally 20-30
Validation
After extraction, verify:
- CLAUDE.md line count reduced
- Each file has valid YAML frontmatter
- Rules have
paths:, skills havedescription:with "Use when"
Description Formula
{Verb} {what}. Use when {trigger1}, {trigger2}, or {trigger3}.
Bad: Helps with code review
Good: Reviews code for security and performance issues. Use when reviewing PRs, checking code quality, or after major changes.
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-01-20
- 索引更新时间
- 2026-01-28
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!