Agent Skillsjamditis/claude-skills-journalism › context-engineering-fundamentals

context-engineering-fundamentals

GitHub

管理长会话中的LLM注意力与证据,解决指令丢失、上下文中毒等问题。通过结构化输入、定期写入外部文件及压缩策略,确保关键信息在长交互中保持可用和准确。

dev-toolkit/skills/context-engineering-fundamentals/SKILL.md jamditis/claude-skills-journalism

Trigger Scenarios

Agent会话过长导致指令或证据丢失 多Agent协作时上下文混乱或冲突 需要维护长期状态或进度记录

Install

npx skills add jamditis/claude-skills-journalism --skill context-engineering-fundamentals -g -y
More Options

Non-standard path

npx skills add https://github.com/jamditis/claude-skills-journalism/tree/master/dev-toolkit/skills/context-engineering-fundamentals -g -y

Use without installing

npx skills use jamditis/claude-skills-journalism@context-engineering-fundamentals

指定 Agent (Claude Code)

npx skills add jamditis/claude-skills-journalism --skill context-engineering-fundamentals -a claude-code -g -y

安装 repo 全部 skill

npx skills add jamditis/claude-skills-journalism --all -g -y

预览 repo 内 skill

npx skills add jamditis/claude-skills-journalism --list

SKILL.md

Frontmatter
{
    "name": "context-engineering-fundamentals",
    "description": "Manages attention and evidence in long agent sessions. Use for lost instructions, dropped evidence, or large multi-agent contexts."
}

Context engineering fundamentals

Context engineering is the practice of managing an LLM's limited attention budget. Use this skill to keep instructions, evidence, and state available during long work.

Core concept

Context windows are constrained by attention mechanics, not only token capacity. A large context limit does not guarantee equal use of every item.

The lost-in-middle effect

The "Lost in the Middle" experiments show that retrieval quality can change with information position. The result depends on the model, task, context length, and number of documents.

Position Common test result
Beginning Often easier to retrieve
Middle Can be harder to retrieve
End Often benefits from recency

Implication: Keep critical constraints easy to find and repeat them near the decision that uses them. Do not assume position alone predicts recall.

Context degradation patterns

1. Lost-in-middle

Information in the middle of long context gets lower attention weight.

Mitigation: Structure with explicit sections. Put critical constraints at start AND end.

2. Context poisoning

Errors compound when incorrect information enters context (from tool outputs, summaries, or earlier mistakes).

Mitigation: Validate intermediate outputs. Don't blindly trust previous responses.

3. Context distraction

Irrelevant information forces attention allocation away from relevant content. Models can't "skip" irrelevant context.

Mitigation: Be selective about what goes into context. More isn't better.

4. Context confusion

Multiple task types or conflicting instructions create ambiguous responses.

Mitigation: One task per interaction when possible. Clear task boundaries.

5. Context clash

Contradictory information from multiple sources causes derailing conflicts.

Mitigation: Resolve contradictions explicitly before asking Claude to use the information.

Measure before compressing

Do not use a fixed token threshold to decide when context is reliable. Measure retrieval and reasoning quality on your own model and task. Test representative evidence at several positions, then compare the result before and after summarization.

Compress only when the measured result or the agent's behavior shows a problem. Preserve exact constraints, decisions, source links, unresolved questions, and verification evidence.

Mitigation strategies

Write externally

Do not rely on the agent to remember across turns. Write important state to files, but agree the path with the user first. Prefer a gitignored workspace so you never overwrite project-owned content:

With the user's approval, after each major step write progress to an agreed scratch file (for example a gitignored PROGRESS.md or a path they choose)
Before starting, read that file back to restore context

Select carefully

Filter irrelevant context before loading:

Instead of: "Here are all 50 files, find the bug"
Do: "Here are the 3 files involved in the error"

Compress strategically

Summarize while maintaining signal:

Instead of: Full 1000-line file
Do: Key functions and their signatures, with context on the specific area

Isolate contexts

For complex tasks, use subagents with focused contexts rather than one agent with everything.

Signs of context degradation

Symptom Likely cause
Ignores earlier instructions Lost-in-middle or context too long
Contradicts itself Context confusion or clash
Repeats information you gave Attention not reaching that content
Misses obvious details Context distraction
Gets progressively worse Context poisoning from errors

References

  • "Lost in the Middle" (Liu et al., 2023) - Position effects in long context
  • "Needle in a Haystack" benchmark - Context retrieval testing
  • RULER benchmark - Multi-hop reasoning over long context

Version History

  • cdf2292 Current 2026-08-20 05:10

Same Skill Collection

dev-toolkit/skills/accessibility-compliance/SKILL.md
dev-toolkit/skills/claude-md-updater/SKILL.md
dev-toolkit/skills/electron-dev/SKILL.md
dev-toolkit/skills/mobile-debugging/SKILL.md
dev-toolkit/skills/one-way-door/SKILL.md
dev-toolkit/skills/python-pipeline/SKILL.md
dev-toolkit/skills/test-first-bugs/SKILL.md
dev-toolkit/skills/vibe-coding/SKILL.md
dev-toolkit/skills/web-scraping/SKILL.md
dev-toolkit/skills/web-ui-best-practices/SKILL.md
dev-toolkit/skills/zero-build-frontend/SKILL.md
journalism-core/skills/ai-writing-detox/SKILL.md
journalism-core/skills/brazil-records-requests/SKILL.md
journalism-core/skills/crisis-communications/SKILL.md
journalism-core/skills/data-journalism/SKILL.md
journalism-core/skills/editorial-workflow/SKILL.md
journalism-core/skills/fact-check-workflow/SKILL.md
journalism-core/skills/foia-requests/SKILL.md
journalism-core/skills/interview-prep/SKILL.md
journalism-core/skills/interview-transcription/SKILL.md
journalism-core/skills/newsletter-publishing/SKILL.md
journalism-core/skills/newsroom-style/SKILL.md
journalism-core/skills/photo-metadata/SKILL.md
journalism-core/skills/social-media-intelligence/SKILL.md
journalism-core/skills/source-verification/SKILL.md
journalism-core/skills/story-pitch/SKILL.md
okf-wiki/SKILL.md
pdf-design/SKILL.md
pdf-playground/skills/document-design/SKILL.md
project-templates-toolkit/skills/project-memory/SKILL.md
project-templates-toolkit/skills/project-retrospective/SKILL.md
project-templates-toolkit/skills/template-selector/SKILL.md
research-toolkit/skills/academic-writing/SKILL.md
research-toolkit/skills/content-access/SKILL.md
research-toolkit/skills/digital-archive/SKILL.md
research-toolkit/skills/free-apis-catalog/SKILL.md
research-toolkit/skills/page-monitoring/SKILL.md
research-toolkit/skills/web-archiving/SKILL.md
security-toolkit/skills/api-hardening/SKILL.md
security-toolkit/skills/security-checklist/SKILL.md
superjawn/skills/brainstorming/SKILL.md
superjawn/skills/dispatching-parallel-agents/SKILL.md
superjawn/skills/executing-plans/SKILL.md
superjawn/skills/finishing-a-development-branch/SKILL.md
superjawn/skills/receiving-code-review/SKILL.md
superjawn/skills/requesting-code-review/SKILL.md
superjawn/skills/subagent-driven-development/SKILL.md
superjawn/skills/systematic-debugging/SKILL.md
superjawn/skills/test-driven-development/SKILL.md

Metadata

Files
0
Version
cdf2292
Hash
a4068d29
Indexed
2026-08-20 05:10

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 03:15
浙ICP备14020137号-1 $방문자$