mcpbeat Sign in

Strategic Compact Skill for Claude

Suggests manual context compaction at logical intervals to preserve context through task phases rather than arbitrary auto-compaction.

2k tokens
context cost
the whole folder, loaded on every use
2
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
265
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/loulanyue/awesome-claude-notes --skill strategic-compact

The instruction itself

1 sections, as written by the author

전략적 컴팩트 스킬

임의의 자동 컴팩션에 의존하지 않고 워크플로우의 전략적 지점에서 수동 /compact를 제안합니다.

활성화 시점

  • 컨텍스트 제한에 근접하는 긴 세션을 실행할 때 (200K+ 토큰)
  • 다단계 작업을 수행할 때 (조사 -> 계획 -> 구현 -> 테스트)
  • 같은 세션 내에서 관련 없는 작업 간 전환할 때
  • 주요 마일스톤을 완료하고 새 작업을 시작할 때
  • 응답이 느려지거나 일관성이 떨어질 때 (컨텍스트 압박)

전략적 컴팩션이 필요한 이유

자동 컴팩션은 임의의 지점에서 실행됩니다:

  • 종종 작업 중간에 실행되어 중요한 컨텍스트를 잃음
  • 논리적 작업 경계를 인식하지 못함
  • 복잡한 다단계 작업을 중단할 수 있음

논리적 경계에서의 전략적 컴팩션:

  • 탐색 후, 실행 전 -- 조사 컨텍스트를 압축하고 구현 계획은 유지
  • 마일스톤 완료 후 -- 다음 단계를 위한 새로운 시작
  • 주요 컨텍스트 전환 전 -- 다른 작업 시작 전에 탐색 컨텍스트 정리

작동 방식

suggest-compact.js 스크립트는 PreToolUse (Edit/Write)에서 실행되며 다음을 수행합니다:

  • 도구 호출 추적 -- 세션 내 도구 호출 횟수를 카운트
  • 임계값 감지 -- 설정 가능한 임계값에서 제안 (기본값: 50회)
  • 주기적 알림 -- 임계값 이후 25회마다 알림

Hook 설정

~/.claude/settings.json에 추가합니다:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/hooks/run-with-flags.js\" \"pre:edit-write:suggest-compact\" \"scripts/hooks/suggest-compact.js\" \"standard,strict\""
          }
        ],
        "description": "Suggest manual compaction at logical intervals"
      }
    ]
  }
}

구성

환경 변수:

  • COMPACT_THRESHOLD -- 첫 번째 제안까지의 도구 호출 횟수 (기본값: 50)

컴팩션 결정 가이드

컴팩션 시기를 결정하기 위해 이 표를 사용하세요:

| 단계 전환 | 컴팩션? | 이유 |

|-----------------|----------|-----|

| 조사 -> 계획 | 예 | 조사 컨텍스트는 부피가 크고, 계획이 증류된 결과물 |

| 계획 -> 구현 | 예 | 계획은 TodoWrite 또는 파일에 있으므로 코드를 위한 컨텍스트 확보 |

| 구현 -> 테스트 | 경우에 따라 | 테스트가 최근 코드를 참조하면 유지; 포커스 전환 시 컴팩션 |

| 디버깅 -> 다음 기능 | 예 | 디버그 추적이 관련 없는 작업의 컨텍스트를 오염시킴 |

| 구현 중간 | 아니오 | 변수명, 파일 경로, 부분 상태를 잃는 비용이 큼 |

| 실패한 접근 후 | 예 | 새 접근을 시도하기 전에 막다른 길의 추론을 정리 |

컴팩션에서 유지되는 것

무엇이 유지되는지 이해하면 자신 있게 컴팩션할 수 있습니다:

| 유지됨 | 손실됨 |

|----------|------|

| CLAUDE.md 지침 | 중간 추론 및 분석 |

| TodoWrite 작업 목록 | 이전에 읽은 파일 내용 |

| 메모리 파일 (~/.claude/memory/) | 다단계 대화 컨텍스트 |

| Git 상태 (커밋, 브랜치) | 도구 호출 기록 및 횟수 |

| 디스크의 파일 | 구두로 언급된 세밀한 사용자 선호도 |

모범 사례

  • 계획 후 컴팩션 -- TodoWrite에서 계획이 확정되면 새로 시작하기 위해 컴팩션
  • 디버깅 후 컴팩션 -- 계속하기 전에 에러 해결 컨텍스트 정리
  • 구현 중간에는 컴팩션하지 않기 -- 관련 변경 사항의 컨텍스트 보존
  • 제안을 읽기 -- Hook이 *언제*를 알려주고, *할지* 여부는 당신이 결정
  • 컴팩션 전에 기록 -- 컴팩션 전에 중요한 컨텍스트를 파일이나 메모리에 저장
  • 요약과 함께 /compact 사용 -- 커스텀 메시지 추가: /compact Focus on implementing auth middleware next

관련 항목

  • The Longform Guide -- 토큰 최적화 섹션
  • 메모리 영속성 Hook -- 컴팩션에서 살아남는 상태를 위해
  • continuous-learning 스킬 -- 세션 종료 전 패턴 추출

원문

  • 영문 원문

탐색

  • 한국어 문서 안내
  • 기여 가이드

Other skills for the same job

different authors, same section of the catalogue
Protocolsio Integration
by christophacham
×4

Integration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.

16k tokens
Tailored Resume Generator
by frostant
×4

Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances

3k tokens
Excalidraw Diagram Generator
by github
vendor ×3

Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.

36k tokens scripts
Expo Dev Client
by openai
vendor ×3

Build and distribute Expo development clients locally or via TestFlight

961 tokens
Executing Plans
by ZhanlinCui
×3

Use when you have a written implementation plan to execute in a separate session with review checkpoints

542 tokens
Anndata
by christophacham
×3

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

16k tokens
Benchling Integration
by christophacham
×3

Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.

14k tokens
Biopython
by christophacham
×3

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

24k tokens

How to use it

Copy the folder

Take loulanyue/awesome-claude-notes-strategic-compact from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.