Skills: Performance Optimization

Last updated: 2026-08-31

A fast Skill is a joy to use; a slow one is a chore — performance determines how often a Skill gets used.


1. Performance Bottlenecks

(1) Bottleneck Analysis

Bottleneck Impact Optimization Direction
Long context Slow response, high cost Compress context
Too many tool calls Long duration, token waste Merge calls
Verbose prompts Slow processing, more ambiguity Simplify prompts
Large search scope Imprecise results Narrow scope
Repeated operations Low efficiency Cache results

(2) Performance Metrics

TEXT 📖 Display only
Skill Performance Indicators
├── Response time: Time from invocation to first output
├── Tool call count: Number of tool invocations in one execution
├── Token consumption: Total input + output tokens
├── Accuracy: Proportion of output meeting expectations
└── Completion rate: Proportion of tasks successfully completed

2. Prompt Optimization

(1) Simplification Principles

TEXT 📖 Display only
Three Prompt Simplification Principles
├── Delete: Remove redundant explanations and excessive examples
├── Merge: Combine similar rules into unified descriptions
└── Compress: Use tables instead of long text descriptions

(2) Example Comparison

Verbose version:

TEXT 📖 Display only
When reviewing code please check security. Security includes SQL injection, XSS,
CSRF and other common vulnerabilities. Also check if sensitive information is
hardcoded in the code. Also check if insecure dependency libraries are used......

Concise version:

MARKDOWN
## Security Checks
- SQL injection / XSS / CSRF
- Hardcoded keys / tokens
- Insecure dependencies

(3) Structured Prompts

MARKDOWN
## Recommended Structure
1. Role definition (1 line)
2. Execution flow (ordered list)
3. Review dimensions (table)
4. Output format (template)
5. Constraints (list)

3. Tool Call Optimization

(1) Batch Instead of Sequential

TEXT 📖 Display only
Inefficient:
Read file1.py → Read file2.py → Read file3.py
(3 tool calls)

Efficient:
Glob "src/**/*.py" → Selectively Read key files
(1 + 2 = 3 calls, but more targeted)

(2) Search Instead of Traversal

TEXT 📖 Display only
Inefficient:
Read all files → Check one by one for targets

Efficient:
Grep "class.*Service" → Only Read matching files

(3) Incremental Instead of Full

TEXT 📖 Display only
Inefficient:
Read all project files for every review

Efficient:
Only read files changed in git diff

4. Context Optimization

(1) Context Budget

TEXT 📖 Display only
Context Allocation Strategy (200K token total budget)

Skill prompt: 5K (2.5%)
Project context: 10K (5%)
Tool output: 80K (40%)
Conversation history: 50K (25%)
Reserved space: 55K (27.5%)

(2) Summarization Strategy

Original Content Summarization Method Compression Ratio
Complete files Function signatures + key lines 10:1
Search results Matching lines + paths 5:1
Error logs Error type + stack top 8:1
Conversation history Decision record summary 20:1

(3) Lazy Loading

MARKDOWN
## Lazy Loading Strategy
1. Don't preload all project files
2. Use Glob/Grep to locate first
3. Only Read necessary files
4. Avoid recursively reading dependency chains

5. Performance Optimization Practice

▶ Example: Optimizing a Review Skill

Alice compared her review Skill before and after optimization:

TEXT 📖 Display only
Before:
- 3000-word prompt → Slow processing, more ambiguity
- Read 10 files one by one → 10 calls
- No context limit → High token consumption

After:
- 800-word prompt (tabular) → Fast processing, clear
- Grep to locate + Read 3 key files → 4 calls
- 50K context limit → 60% token reduction

Bob said: "The core of performance optimization isn't doing less — it's doing the right things. Targeted search is 10x faster than traversing all files."


❓ FAQ

Q Will shorter prompts reduce quality?
A Not necessarily. The key is specificity and clarity, not length. Concise structured prompts often outperform verbose essays.
Q How to balance accuracy and performance?
A Ensure accuracy for core steps; optimize performance for auxiliary steps. Review dimensions can't be cut, but search scope can be narrowed.
Q How to monitor token consumption?
A Each platform has token usage statistics. Skill-level monitoring requires asking for token usage in the prompt or obtaining it from the platform API.

📖 Summary


📝 Exercises

  1. Basic (⭐): Review your existing Skill prompts, remove redundant content while maintaining effectiveness.
  2. Intermediate (⭐⭐): Optimize a Skill's tool call chain, using search instead of traversal, comparing call counts before and after.
  3. Advanced (⭐⭐⭐): Design a Skill performance benchmarking plan, quantitatively comparing response time, token consumption, and accuracy before and after optimization.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏