```python def compress_prompt(prompt: str, max_tokens: int) -> str: """Compress prompt to fit within token limit.""" current_tokens = estimate_tokens(prompt)
Scanned 5/31/2026
Install via CLI
openskills install tools-only/X-Skills# Prompt Optimization
## Prompt Optimization
### Compress Prompts
```python
def compress_prompt(prompt: str, max_tokens: int) -> str:
"""Compress prompt to fit within token limit."""
current_tokens = estimate_tokens(prompt)
if current_tokens <= max_tokens:
return prompt
# Strategy 1: Remove redundant whitespace
compressed = " ".join(prompt.split())
if estimate_tokens(compressed) <= max_tokens:
return compressed
# Strategy 2: Truncate with ellipsis
target_chars = max_tokens * 4 - 20
compressed = prompt[:target_chars] + "... [truncated]"
return compressed
def optimize_system_prompt(prompt: str) -> str:
"""Optimize system prompt for token efficiency."""
# Remove unnecessary formatting
lines = prompt.strip().split('\n')
optimized_lines = []
for line in lines:
# Skip empty lines and excessive formatting
stripped = line.strip()
if stripped and not stripped.startswith('#' * 3):
optimized_lines.append(stripped)
return '\n'.join(optimized_lines)
```
### Context Compression
```python
def compress_context(
context: str,
max_tokens: int,
preserve_ratio: float = 0.5
) -> str:
"""Compress context while preserving key information."""
current_tokens = estimate_tokens(context)
if current_tokens <= max_tokens:
return context
# Split into chunks
paragraphs = context.split('\n\n')
if len(paragraphs) == 1:
# Single block - truncate from middle
char_limit = max_tokens * 4
half = char_limit // 2
return context[:half] + "\n[...content omitted...]\n" + context[-half:]
# Multiple paragraphs - keep first and last, summarize middle
preserve_count = max(2, int(len(paragraphs) * preserve_ratio))
keep_start = preserve_count // 2
keep_end = preserve_count - keep_start
kept = paragraphs[:keep_start] + ["[...additional context omitted...]"] + paragraphs[-keep_end:]
return '\n\n'.join(kept)
```No comments yet. Be the first to comment!
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...
**Complete production-ready guide for Google Gemini embeddings API** This skill provides comprehensive coverage of the `gemini-embedding-001` model for generating text embeddings, including SDK usage, REST API patterns, batch processing, RAG integration with Cloudflare Vectorize, and advanced use cases like semantic search and document clustering. ---
Interview, source-challenge, verify, save, and ADR-gate fuzzy coding requests into Codex-ready implementation specs. Use when a feature, bugfix, refactor, migration, repo-wide change, or architecture task needs user-verified requirements, source-backed decisions, durable architecture decisions, acceptance criteria, validation commands, rollout notes, saved spec/ADR files, and a Codex execution prompt. Do not use when already fully specified or when the user wants direct implementation now.
Use when a repo needs CodeGraph plus ast-grep for Codex MCP setup, exploration, impact analysis, structural search, or safe refactor planning.