agent-ops-optimize-instructions
БесплатноБез исполняемых скриптовНе проверенOptimize agent instruction files by extracting sections into separate files and referencing them. Reduces context size while preserving information.
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
Instruction File Optimization Workflow
Purpose
Optimize agent or instruction files (AGENTS.md, copilot-instructions.md, SKILL.md, etc.) by:
- Identifying logical sections that can be extracted
- Moving verbose content to separate reference files
- Replacing with concise summaries and links
- Reducing total context size while preserving information
This helps keep prompt context within token limits while maintaining comprehensive guidance.
When to Use
- Instruction file exceeds recommended size (~2000 lines)
- File contains large code examples or detailed procedures
- Multiple sections could be shared across files
- Agent consistently runs out of context
- Preparing instructions for smaller context models
Optimization Strategies
Strategy 1: Section Extraction
Extract large, self-contained sections into reference files.
Before:
# AGENTS.md
## API Guidelines
{500 lines of detailed API guidelines}
## Testing Patterns
{300 lines of testing examples}
After:
# AGENTS.md
## API Guidelines
See: [api-guidelines.md](.github/reference/api-guidelines.md)
Key points: REST conventions, error handling, versioning.
## Testing Patterns
See: [testing-patterns.md](.github/reference/testing-patterns.md)
Key points: pytest fixtures, mocking, coverage targets.
Strategy 2: Example Consolidation
Move detailed examples to reference files, keep summaries inline.
Before:
### Example: Complex Query
```python
def complex_query(db, filters, pagination, sorting):
# 50 lines of example code
...
**After:**
```markdown
### Example: Complex Query
See: [examples/complex-query.py](.github/reference/examples/complex-query.py)
Pattern: Filter → Paginate → Sort → Execute
Strategy 3: Conditional Loading
Mark sections as "load on demand" for agents that support it.
## Advanced Configuration
<!-- LOAD_ON_DEMAND: Only load when user asks about configuration -->
See: [advanced-config.md](.github/reference/advanced-config.md)
Strategy 4: Tiered Detail
Keep high-level summary inline, link to detailed version.
## Error Handling
**Quick reference:** Try/catch, log, return Result type.
**Full guide:** [error-handling.md](.github/reference/error-handling.md)
Procedure
Phase 1: Analysis
- Measure current size: Count lines, estimate tokens
- Identify section boundaries: Headers, code blocks, tables
- Classify sections by extraction potential:
- ✅ Extract: Large (>50 lines), self-contained, reference-style
- ⚠️ Consider: Medium (20-50 lines), may need context
- ❌ Keep: Small (<20 lines), critical, frequently referenced
- Check for duplication: Same content in multiple files?
Phase 2: Extraction Planning
For each section marked "Extract":
- Choose target location:
.github/reference/— General reference docs.github/reference/examples/— Code examples.github/reference/lang-{language}.md— Language-specific
- Draft summary (2-5 lines) to replace full content
- Identify key points that must stay inline
- Plan cross-references if content is shared
Phase 3: User Confirmation
Present optimization plan:
## Instruction Optimization Plan: AGENTS.md
Current size: 2,450 lines (~98,000 tokens)
Target size: ~800 lines (~32,000 tokens)
Reduction: 67%
### Proposed Extractions
| Section | Lines | Target File | Summary |
|---------|-------|-------------|---------|
| API Guidelines | 520 | reference/api-guidelines.md | REST conventions, errors |
| Python Patterns | 380 | reference/lang-python.md | pytest, typing, logging |
| Code Examples | 450 | reference/examples/ | 12 example files |
### Sections to Keep Inline
- Core workflow (critical path)
- Quick reference tables
- Navigation links
Proceed? [Y]es / [E]dit plan / [C]ancel
Phase 4: Execution
- Create reference directory if needed
- Extract sections to target files:
- Copy full content
- Add header with source reference
- Format as standalone document
- Update source file:
- Replace with summary + link
- Preserve header structure
- Add "See: file" references
- Validate links: Ensure all references resolve
Phase 5: Verification
- Check file sizes: Source reduced, references created
- Validate markdown: No broken links, proper formatting
- Test with agent: Verify instructions still work
- Report results:
✅ Optimization Complete
Before: 2,450 lines (98k tokens)
After: 812 lines (32k tokens)
Reduction: 67%
Created reference files:
- .github/reference/api-guidelines.md (520 lines)
- .github/reference/lang-python.md (380 lines)
- .github/reference/examples/ (12 files)
The instruction file no
Установить agent-ops-optimize-instructions в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл agent-ops-optimize-instructions?
Optimize agent instruction files by extracting sections into separate files and referencing them. Reduces context size while preserving information.
Как установить скилл agent-ops-optimize-instructions?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-ops-optimize-instructions запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic