con un clic
language-optimization
// Optimize code for readability, performance, maintainability, and security across Bash, Python, and Rust. Use when asked to improve code quality, optimize performance, add type safety, or refactor for idioms.
// Optimize code for readability, performance, maintainability, and security across Bash, Python, and Rust. Use when asked to improve code quality, optimize performance, add type safety, or refactor for idioms.
Automatic quality control, linting, and static analysis procedures. Use when validating code changes for syntax correctness and project standards. Triggers on keywords: lint, format, check, validate, types, static analysis.
Refactoring and cleanup - improving code structure, removing dead code, eliminating duplication, or pre-merge cleanup. Use when code is hard to maintain, has dead code or debug artifacts, or needs pre-merge polishing.
Fix a GitHub issue end-to-end - from reading the issue, understanding requirements, implementing the fix, writing tests, and creating a commit. Use when given a GitHub issue number or URL to resolve.
Create, debug, and optimize GitHub Actions workflows with security best practices. Use when asked to "create workflow", "fix workflow", "add CI", or needs help with GitHub Actions.
Review code changes (diffs, PRs, patches) and provide structured, actionable feedback on correctness, maintainability, and test coverage. Use when the user asks for a code review, requests feedback on a patch/PR, or wants an assessment of changes.
Craft immersive, high-performance premium web experiences with advanced motion, typography, and architectural craftsmanship. Use when building award-level landing pages, interactive portfolios, or components requiring top-tier visual polish.
| name | language-optimization |
| description | Optimize code for readability, performance, maintainability, and security across Bash, Python, and Rust. Use when asked to improve code quality, optimize performance, add type safety, or refactor for idioms. |
| allowed-tools | Bash(git:*), Bash(ruff:*), Bash(mypy:*), Bash(pytest:*), Bash(shellcheck:*), Bash(shfmt:*), Bash(clippy:*), Bash(cargo:*), Read, Write, Edit, Glob, Grep |
Optimize code across languages following universal principles and language-specific idioms.
Think through optimization systematically:
instructions/| Principle | Rule |
|---|---|
| KISS | Simple over clever; readability first |
| YAGNI | Don't build before needed; no premature optimization |
| DRY | Extract repeated logic; single source of truth |
| Fail Fast | Validate early; specific error messages |
| Security | No secrets in code; validate at boundaries |
<language_specific>
instructions/bash.instructions.mdset -euo pipefail, quote variables, use [[ ]] not [ ]shellcheck, shellhardenfd over find, rg over grep, sd over sedinstructions/python.instructions.mdT | None not Optional[T]ruff (lint+format), mypy (types), pytest (tests)pathlib over os.path, f-strings over .format()instructions/rust.instructions.mdResult/Option, use clippy lintsclippy (lints), rustfmt (format), cargo test&str over String in params, thiserror for errors</language_specific>
<performance_patterns>
| Pattern | Before | After |
|---|---|---|
| Algorithm | O(n^2) nested loops | O(n) hash map lookup |
| Caching | Recompute every call | Memoize/cache result |
| Lazy eval | Build full list | Generator/iterator |
| Batching | N individual calls | Single batch operation |
| Built-ins | Custom implementation | Standard library function |
</performance_patterns>
# Before
def get_user(id, include_posts=False):
user = db.find(id)
if include_posts:
user['posts'] = db.posts(id)
return user
# After
def get_user(user_id: int, *, include_posts: bool = False) -> User | None:
user = db.find(user_id)
if user is None:
return None
if include_posts:
user.posts = db.posts(user_id)
return user
# Before
files=$(find . -name "*.py")
for f in $files; do
if [ -f "$f" ]; then
grep -l "TODO" "$f"
fi
done
# After
fd -e py --type f -x rg -l "TODO" {}
// Before
fn read_config(path: &str) -> String {
let contents = std::fs::read_to_string(path).unwrap();
contents
}
// After
fn read_config(path: &Path) -> Result<Config, ConfigError> {
let contents = std::fs::read_to_string(path)
.map_err(|e| ConfigError::ReadFailed { path: path.into(), source: e })?;
toml::from_str(&contents)
.map_err(|e| ConfigError::ParseFailed { source: e })
}
Optimization is complete when:
instructions/instructions/bash.instructions.md, instructions/python.instructions.md, instructions/rust.instructions.mdskills/code-maintenance/