content-optimization
Enhance any content type using research-backed techniques. Optimize AI prompts with step-by-step approval, improve code quality, refine database queries, enhance documentation, optimize commit messages, and improve communication. Wraps incentive-prompting skill with content-type detection.
What this skill does
# Content Optimization Skill ## Purpose Systematically enhance any type of content using research-backed techniques and best practices. This skill: - Automatically detects content type - Applies domain-specific optimization techniques - Provides step-by-step approval workflow (especially for prompts) - Measures improvement with confidence scores - Supports multiple optimization modes (conservative, moderate, aggressive) ## When to Use - **AI Prompts**: Improve clarity, add reasoning chains, optimize for better responses - **Code**: Refactor for performance, readability, error handling - **Database Queries**: Optimize performance, suggest indexes, enable caching - **Commit Messages**: Clarify intent, follow conventional format - **Documentation**: Improve structure, add examples, enhance clarity - **Communication**: Refine tone, improve call-to-action, enhance effectiveness ## The Problem Without systematic optimization: - Prompts to AI models are vague, leading to poor responses - Code is written without considering performance - Database queries are inefficient, causing slowdowns - Commit messages lack clarity about changes - Documentation is unclear for readers - Communications miss the mark With this skill: - Prompts generate 45-115% better responses (research-backed) - Code is performant and maintainable - Queries execute faster with proper indexes - Commit history is clear and navigable - Documentation is clear and helpful - Communications are more effective ## Supported Content Types | Type | Purpose | Techniques | |------|---------|-----------| | `prompt` | AI prompt optimization | Expert personas, step-by-step reasoning, stakes language, challenge framing | | `code` | Source code improvement | Performance, readability, error handling, best practices | | `query` | Database/search query | Indexes, execution plans, caching, pagination | | `commit` | Git commit messages | Conventional commits, clarity, intent description | | `docs` | Documentation | Structure, examples, clarity, accessibility | | `email` | Communication | Tone, clarity, call-to-action, effectiveness | ## Prompt Optimization Techniques ### 1. Expert Persona Assignment Assigns detailed expert role with relevant background. ``` Instead of: "Help me debug this" Optimized: "As a senior backend engineer with 10 years of experience debugging distributed systems..." ``` **Impact**: +60% accuracy (Kong et al., 2023) ### 2. Step-by-Step Reasoning Instructs systematic analysis approach. ``` "Take a deep breath and think step by step. First, identify the symptoms..." ``` **Impact**: +46% accuracy (Yang et al., 2023) ### 3. Stakes Language Frames importance and consequences. ``` "This is critical for production. Incorrect analysis could cause service outage." ``` **Impact**: +45% quality (Bsharat et al., 2023) ### 4. Challenge Framing Positions as difficult problem worth solving. ``` "This is a tricky optimization problem. I bet you can't find the perfect balance." ``` **Impact**: +115% on hard tasks (Li et al., 2023) ### 5. Self-Evaluation Requests confidence ratings and uncertainty identification. ``` "Rate your confidence in this solution (0.0-1.0) and identify any uncertainties." ``` **Impact**: +10% calibration ## Usage Examples ### Optimize AI Prompts ```bash /optimize "Help me debug auth" --prompt # Interactive approval workflow: # - Shows detected domain (security) # - Suggests optimization steps # - Asks approve/reject/modify for each step # - Calculates expected improvement /optimize "Help me debug auth" --prompt --verbose # Detailed walkthrough with reasoning for each optimization /optimize "Help me debug auth" --prompt --mode=aggressive # Apply maximum optimization (more aggressive than default) /optimize "Help me debug auth" --prompt --mode=conservative # Minimal changes, preserve original intent # Skip optimization /optimize "! Help me debug auth" --prompt # Exclamation mark prefix bypasses optimization ``` ### Optimize Source Code ```bash /optimize src/auth.js --code # Suggests: performance improvements, readability, error handling /optimize src/auth.js --code --preview # Show changes before applying /optimize src/auth.js --code --apply # Automatically apply optimizations /optimize src/auth.js --code --mode=aggressive # Maximum optimization (may add complexity) ``` ### Optimize Database Queries ```bash /optimize "SELECT * FROM users WHERE status = 'active'" --query # Suggests: add indexes, pagination, caching, execution plan /optimize "SELECT * FROM users WHERE status = 'active'" --query --preview # Preview query optimization without applying ``` ### Optimize Commit Messages ```bash /optimize "fix: resolve login bug" --commit # Suggests: add scope, detail, follow conventional commits /optimize "fix: resolve login bug" --commit --apply # Apply optimized message ``` ### Optimize Documentation ```bash /optimize "README.md" --docs # Suggests: structure improvements, add examples, clarify sections /optimize "README.md" --docs --interactive # Ask clarifying questions about audience and purpose ``` ### Optimize Communication ```bash /optimize "Hey, can you review my code?" --email # Suggests: professional tone, clear request, timeline /optimize "Hey, can you review my code?" --email --apply # Apply professional version ``` ### Auto-Detect Content Type ```bash /optimize "help me optimize this database query" # Automatically detects as prompt, applies optimization # (Or specify --type if auto-detection fails) ``` ## Options | Option | Description | Values | Default | |--------|-------------|--------|---------| | `--type <type>` | Content type | prompt/code/query/commit/docs/email | auto | | `--mode <mode>` | Optimization intensity | conservative/moderate/aggressive | moderate | | `--preview` | Show changes before applying | flag | false | | `--apply` | Apply optimizations automatically | flag | false | | `--interactive` | Ask clarifying questions | flag | false | | `--verbose` | Show detailed process | flag | false | | `--force` | Apply without confirmation | flag | false | | `--output <file>` | Save to file instead of stdout | path | stdout | | `--source <sources>` | Research sources | anthropic/openai/opencode/all | all | ## Interactive Approval Workflow (Prompts) When optimizing prompts, you get step-by-step approval: ### Step 1: Analysis ``` Domain detected: Security (authentication/debugging) Complexity: Medium (moderate ambiguity) Suggested techniques: ✓ Expert Persona (security engineer with 10yr exp) ✓ Step-by-Step Reasoning (systematic debugging approach) ✓ Stakes Language (production impact) ✓ Self-Evaluation (confidence rating) ``` ### Step 2: Approval ``` For each technique, choose: [A] Approve - Use this technique [R] Reject - Skip this technique [M] Modify - Change the wording [E] Edit - Full edit mode [C] Cancel - Don't optimize ``` ### Step 3: Result ``` Original: "Help me debug auth" Optimized: "As a senior security engineer with 10 years of experience debugging distributed authentication systems, help me systematically debug this login issue. This is production-critical - incorrect analysis could cause service outage. Walk through your reasoning step by step. Rate your confidence (0.0-1.0) and identify any uncertainties." Expected improvement: +78% response quality Confidence: 0.92 ``` ## Code Optimization Techniques - **Performance**: Reduce complexity, optimize algorithms, cache results - **Readability**: Better variable names, extract functions, add comments - **Error Handling**: Add try-catch, validate inputs, handle edge cases - **Best Practices**: Follow language conventions, use idioms, avoid antipatterns ## Query Optimization Techniques - **Indexes**: Suggest missing indexes on WHERE/JOIN columns - **Execution Plans**: Show query plan analysis and bottlenecks - **Pagination**: Add LIMIT/OFFSET for large result sets - **Caching**: Identify cacheable queries - **Join
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.