スキル一覧に戻る
kylehughes

engineering-claude-context

by kylehughes

Personal dot files and development environment configuration for macOS.

1🍴 0📅 2026年1月14日
GitHubで見るManusで実行

SKILL.md


name: engineering-claude-context description: Curates context, optimizes prompts with XML, and manages extended thinking for Anthropic Claude models. Use when building Claude-based agents, designing system prompts, or handling long-context tasks.

Claude Context Engineering

Instructions

Follow these strategies to maximize reliability and performance for Anthropic Claude models within limited attention budgets.

  1. Curate High-Signal Context

    • Treat context as a finite resource; every token dilutes attention.
    • Prune low-value information (e.g., repetitive logs, unused tool outputs).
    • Use "Just-in-Time" Retrieval: Provide lightweight identifiers (file lists, summaries) initially, allowing Claude to load full details only when needed.
  2. Structure with XML Tags

    • Use XML tags to strictly delineate prompt sections (Claude is optimized for this).
    • Common tags: <instructions>, <context>, <tools>, <examples>, <formatting>.
    • Nest tags for hierarchy (e.g., <examples><example>...</example></examples>).
    • Reference tags explicitly in instructions (e.g., "Analyze the data in <context>").
  3. Optimize for Long Horizons

    • Compaction: Periodically summarize conversation history to free up context while preserving key state (decisions, bugs).
    • Memory: Implement an external "notebook" (e.g., scratchpad.md) where Claude reads/writes persistent state, freeing it from the context window.
    • Sub-Agents: Delegate distinct, context-heavy sub-tasks to ephemeral sub-agents that return only distilled results.
  4. Leverage Extended Thinking

    • Use for: Complex STEM problems, constraint optimization, and multi-step strategic frameworks.
    • Prompting: Use open-ended, high-level instructions ("Think thoroughly about X") rather than rigid step-by-step constraints for reasoning.
    • Few-Shot: Include <thinking> blocks in your examples to demonstrate the reasoning process, not just the final output.
    • Budget: Start small (1024 tokens) and scale up for complexity (up to 32k+ with batch processing).
  5. Design Token-Efficient Tools

    • Ensure tools return only necessary data (e.g., grep output vs. full file).
    • Keep tool definitions clear and distinct to avoid ambiguity.

Critical Rules

  • No Brittle Logic: Avoid hardcoding complex if/else chains in prompts; use examples ("pictures") to guide behavior instead.
  • Don't Prefill Thinking: Never prefill Claude's response when using Extended Thinking mode.
  • Progressive Disclosure: Don't dump all data at once. Let Claude discover information layer by layer (hierarchy -> summary -> detail).
  • Clear Separation: Always separate System Instructions from User Data to prevent prompt injection and confusion.

Checklist

  • Tags: Are distinct sections wrapped in XML tags?
  • Efficiency: Is the initial context free of unnecessary bulk?
  • Retrieval: Does Claude have tools to fetch details "just-in-time"?
  • Memory: Is there a mechanism (compaction or external file) for long-term persistence?
  • Examples: Do few-shot examples demonstrate the reasoning (if using thinking) or format required?
  • Thinking: Is Extended Thinking enabled only for complex/planning tasks, not simple lookups?

Detailed Guidance

For deep dives on context anatomy, compaction strategies, and extended thinking patterns, see REFERENCE.md.

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です