Communitygithub.com

majiayu000/claude-skill-registry

檢查上下文使用限制、監控剩餘時間、優化 Token 消耗、除錯上下文失敗。當詢問上下文百分比、速率限制、使用警告、上下文最佳化、代理架構、記憶體系統時使用。

claude-skill-registry 是什麼?

這是一個名為「上下文工程」的 AI 代理技能,專注於為大型語言模型任務策劃最小且高訊號的 Token 集。其主要目標是在最大化推理品質的同時,最小化 Token 使用量。該技能對於設計和除錯代理系統、處理上下文限制導致的效能瓶頸、最佳化成本與延遲、以及建構多代理協作系統的使用者特別有用。它支援多種場景,包括實施記憶系統、評估代理效能和開發 LLM 驅動的管道。技能的核心原則強調上下文品質勝於數量、注意力有限(U 型曲線)、漸進式資訊揭露、隔離防止退化,以及在最佳化之前進行測量。它提供了一個四桶策略:寫入、選擇、壓縮和隔離。此外,它還具有運行時感知功能,可透過 PostToolUse 鉤子自動注入使用監控,提供 Claude 使用限制和上下文視窗使用量的即時資料,並在特定閾值觸發警告或關鍵行動。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/majiayu000/claude-skill-registry/tree/HEAD/skills/context-management/context-engineering-hoanghd218-landing-page-ai-kien

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

上下文工程

上下文工程旨在為 LLM 任務策劃最小且高訊號的 Token 集。其目標:在最大化推理品質的同時,最小化 Token 使用量。

何時激活

  • 設計/除錯代理系統
  • 上下文限制限制了效能
  • 最佳化成本/延遲
  • 建構多代理協調
  • 實施記憶體系統
  • 評估代理效能
  • 開發 LLM 驅動的管道

核心原則

  1. 上下文品質 > 數量 - 高訊號 Token 勝過詳盡內容
  2. 注意力是有限的 - U 型曲線有利於開頭/結尾位置
  3. 漸進式揭露 - 即時載入資訊
  4. 隔離防止退化 - 將工作劃分到子代理
  5. 先測量再最佳化 - 了解你的基準

重要事項:

  • 為了簡潔,可以犧牲文法。
  • 在保持高品質的同時確保 Token 效率。
  • 將這些規則傳遞給子代理。

快速參考

主題何時使用參考資料
基礎知識了解上下文結構、注意力機制context-fundamentals.md
退化除錯失敗、中間遺失、毒化context-degradation.md
最佳化壓縮、遮罩、快取、分割context-optimization.md
壓縮長時間會話、摘要策略context-compression.md
記憶體跨會話持久化、知識圖譜memory-systems.md
多代理協調模式、上下文隔離multi-agent-patterns.md
評估測試代理、LLM 作為評審、指標evaluation.md
工具設計工具整合、描述工程tool-design.md
管道專案開發、批次處理project-development.md
運行時感知使用限制、上下文視窗監控runtime-awareness.md

關鍵指標

  • Token 利用率:70% 時警告,80% 時觸發最佳化
  • Token 變異性:解釋 80% 的代理效能差異
  • 多代理成本:約單代理基線的 15 倍
  • 壓縮目標:減少 50-70%,品質損失小於 5%
  • 快取命中目標:穩定工作負載達 70% 以上

四桶策略

  1. 寫入:將上下文儲存到外部(暫存區、檔案)
  2. 選擇:僅提取相關上下文(檢索、過濾)
  3. 壓縮:在保留資訊的同時減少 Token(摘要)
  4. 隔離:跨子代理分割(分割)

反模式

  • 詳盡的上下文而非精選的上下文
  • 關鍵資訊放在中間位置
  • 在達到限制前沒有觸發壓縮
  • 對可並行化的任務使用單一代理
  • 工具缺乏清晰的描述

指南

  1. 將關鍵資訊放在上下文的開頭/結尾
  2. 在利用率達到 70-80% 時實施壓縮
  3. 使用子代理進行上下文隔離,而非角色扮演
  4. 使用 4 問題框架設計工具(功能、時機、輸入、回傳)
  5. 最佳化每個任務的 Token,而非每個請求的 Token
  6. 使用基於探針的評估進行驗證
  7. 在生產環境中監控 KV 快取命中率
  8. 從最簡開始,只有在證明必要時才增加複雜性

運行時感知

系統透過 PostToolUse 鉤子自動注入使用感知:

<usage-awareness>
Claude 使用限制:5h=45%, 7d=32%
上下文視窗使用量:67%
</usage-awareness>

閾值:

  • 70%:警告 - 考慮最佳化/壓縮
  • 90%:關鍵 - 需要立即行動

資料來源:

  • 使用限制:Anthropic OAuth API (https://api.anthropic.com/api/oauth/usage)
  • 上下文視窗:狀態列暫存檔 (/tmp/ck-context-{session_id}.json)

腳本

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

majiayu000/claude-skill-registry

Builds, edit or validate Agent Skill through conversational discovery. Use when the user requests to "Create an Agent", "Optimize an Agent" or "Edit an Agent".

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD agents while maintaining compliance

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Edit existing BMAD modules while maintaining coherence

majiayu000/claude-skill-registry

Analyzes current state and user query to answer BMad questions or recommend the next workflow or agent. Use when user says what should I do next, what do I do now, or asks a question about BMad

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Build AI agents with Google ADK Python (Agent Development Kit). Use for multi-agent systems, workflow agents (sequential/parallel/loop), Vertex AI deployment, tool integration, human-in-the-loop.

majiayu000/claude-skill-registry

Portfolio allocation and rebalancing optimizer. Manages asset allocation across stocks/cash/bonds, performs periodic rebalancing, and ensures diversification according to market regime and risk tolerance.

majiayu000/claude-skill-registry

Create a hilarious and ultra-realistic video of an anthropomorphic animal acting like a human vlogger in a real-world setting.

majiayu000/claude-skill-registry

Speech-to-text transcription and translation via OpenAI Audio API -- models, response formats, timestamps, prompting, streaming, chunking, and diarization

majiayu000/claude-skill-registry

BlockRun works with Claude Code and Google Antigravity.

majiayu000/claude-skill-registry

This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.

majiayu000/claude-skill-registry

小省导购员数字人带货版即梦视频提示词生成系统,基于四大智能体协同(提示词生成师、质量管控师、知识库运维师、跨环节适配师),按照"主体+运动+场景+(镜头语言+光影+氛围)"公式输出中英文双版提示词,适配5s短视频。确保人物一致性、视觉连贯性、情绪连贯性,支持知识库智能复用和跨工具适配(Suno音乐、AI绘画),为数字人带货视频提供高质量提示词生成服务。

majiayu000/claude-skill-registry

Upload and manage files using Google Gemini File API via scripts/. Use for uploading images, audio, video, PDFs, and other files for use with Gemini models. Supports file upload, status checking, and file management. Triggers on "upload file", "file API", "upload image", "upload PDF", "upload video", "file management".

majiayu000/claude-skill-registry

CRITICAL: Use for MolyKit AI chat toolkit. Triggers on: BotClient, OpenAI, SSE streaming, AI chat, molykit, PlatformSend, spawn(), ThreadToken, cross-platform async, Chat widget, Messages, PromptInput, Avatar, LLM

majiayu000/claude-skill-registry

AI and machine learning workflow covering LLM application development, RAG implementation, agent architecture, ML pipelines, and AI-powered features.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Analyze images/audio/video with Gemini API (better vision than Claude). Generate images (Imagen 4), videos (Veo 3). Use for vision analysis, transcription, OCR, design extraction, multimodal AI.

majiayu000/claude-skill-registry

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

相關技能