Files
opencode-primer/.opencode/commands/optimize.md
Wesam Abousaid 5ce285d088 feat(.opencode): worked-example agents, commands, plugins, skills
This repo doubles as a fully-configured OpenCode project so readers can
see real files instead of abstract format docs.

Agents (.opencode/agents/, OpenCode YAML + markdown body):
- code-reviewer.md — read-only subagent, glob-gated bash perms,
  Severity/Where/Why/Fix output format. Rewrites the pre-refactor file
  which used incorrect frontmatter shape (no YAML, claude-sonnet-4.6
  as bare ID, made-up tool keys).
- security-auditor.md — OWASP-focused review subagent, deny edit,
  ask bash, CWE-aware output template.

Commands (.opencode/commands/):
- review.md, pr.md, test.md, optimize.md — uses real placeholders
  ($ARGUMENTS, @file, !shell), points the right agent at each task.

Plugins (.opencode/plugins/):
- protect-secrets.js — blocks tool calls touching .env*, secrets/,
  credentials*, SSH keys, .npmrc, .pypirc. Pure JS, no deps.
- audit-log.js — appends one JSON line per successful tool call to
  .opencode/audit.jsonl (also added to .gitignore).
- README.md — how to install/disable, sample audit-log line, link to
  docs/plugins.md.

Skills (.opencode/skills/git-release/SKILL.md):
- Proper folder-with-SKILL.md format. Trigger-shaped description so the
  model actually loads it when the conversation touches release prep.
2026-05-18 19:59:56 +02:00

1.2 KiB
Raw Permalink Blame History

description, agent
description agent
Suggest concrete performance improvements for the given file or directory plan

Analyze the target for performance issues: $ARGUMENTS (or the current branch's changes if empty).

Cover these dimensions in this order:

  1. Algorithmic — wrong data structure, O(n²) where O(n) is possible, repeated work.
  2. I/O — N+1 queries, missing indexes, sync calls on hot paths, unbatched network requests.
  3. Memory — unbounded growth, leaks, large in-memory snapshots that could stream.
  4. Frontend (if applicable) — re-render cascades, large bundles, unmemoized expensive renders, blocking main-thread work.
  5. Micro-optimizations — only if (1)–(4) are clean and the call site is genuinely hot.

For each suggestion, output:

[Impact] <summary>
  Where:  <file:line>
  Before: <snippet>
  After:  <snippet>
  Why:    <one sentence — what's faster and roughly by how much>

Impact tiers: High (>10× or removes the bottleneck) · Medium (2–10×) · Low (small constant factor).

Don't make the changes yet. End by asking which suggestions to apply.

Optional flag — pass --apply in arguments to skip the discussion and implement the High-impact suggestions directly.