agentleFS
JeffKarlingJeffKarling/Anvil/.agents/skills/performance/SKILL.md

performance

Skill0 starsChanged 2 days agoMIT-0View on GitHub

Profiles, benchmarks, and optimizes hot paths in components against hardware PMU baselines. Use this skill when optimizing, benchmarking, or profiling a component.

81 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use app-brief, design-from-app and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • StijnusSkill

    app-brief

    One-page brief (docs/BRIEF.md) for a new macOS app, written before any code. Use when the user has an app idea, wants to replace an app they pay for, or the research and clone skills are done.

    Also in 3 projects that use this

  • StijnusSkill

    design-from-app

    Rebuild the look of an app the user likes as a native SwiftUI design kit, by measuring its screenshots (sizes, spacing, type, colors, icons), building its parts, and comparing pixel by pixel until they match. Use when the user names an app whose look they want, shares screenshots of one, or says "make it look like X".

    Also in 3 projects that use this

  • FlorianBruniauxSkill

    tdd-rust

    Also in 3 projects that use this

  • RodrigoTomeESSkill

    web-quality-audit

    Comprehensive web quality audit covering performance, accessibility, SEO, and best practices. Use when asked to "audit my site", "review web quality", "run lighthouse audit", "check page quality", or "optimize my website".

    Also in 9 projects that use this

  • launchapp-devSkill

    layout-grid

    Define responsive layout grid systems with columns, gutters, margins, and breakpoint behavior.

    Also in 3 projects that use this

  • MohamedAbdallah-14Skill

    app-icon

    Generate an app icon from a single 1024² master and fan out to iOS (AppIcon.appiconset with squircle-ready 1024 opaque), Android (adaptive foreground + background + Android 13 monochrome), PWA (192/512 + 512 maskable with 80% safe zone), and visionOS (3-layer parallax).

    Also in 3 projects that use this

  • +1 more from Stijnus

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 54 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Ensure /proc/sys/kernel/perf_event_paranoid is <= 1 via sudo sysctl kernel.perf_event_paranoid=1 and CPU governor is set to performance via …

    line 18
  2. Distinctive:

    Never delete, weaken, or bypass unit tests or exception firewalls to inflate benchmark scores.

    line 36
  3. Very specific:

    Prefer linking accelerated routines from cmake/dependencies.cmake privately over custom scalar loops.

    line 38
  4. Very specific:

    When profiling shows a coarse compute bound loop with high IPC over contiguous std::span memory, encapsulate the kernel inside an anonymous …

    line 39
  5. Very specific:

    Never apply target_clones to tiny inlined helpers or memory bound loops, and never include arch=x86-64-v2.

    line 45
  6. Very specific:

    Verify correctness gates first, then evaluate hardware counter progression and resync production_artifacts/manifest.json.

    line 49
  7. Very specific:

    If three consecutive tactical trials fail to achieve at least a 1.03x composite speedup over the parent commit or oscillate between …

    line 61
  8. Very specific:

    Run .agents/skills/audit-sans/SKILL.md before finalizing any optimization lineage to confirm zero memory, UB, or thread safety poisoning.

    line 62

“Common” is measured: kept by at least 6 in 10 of the 54 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Performance optimization workflow

Step 1. Verify clean Git state, host PMU permissions, and baseline

Refuse to start any optimization loop if uncommitted changes exist in the working tree.

python3 .agents/skills/architect/scripts/sync_manifest.py --require-clean-git

Ensure /proc/sys/kernel/perf_event_paranoid is <= 1 via sudo sysctl kernel.perf_event_paranoid=1 and CPU governor is set to performance via powerprofilesctl set performance.

Measure the starting baseline under an optimized release preset.

cmake --build --preset Clang_Custom_Release --target <component>BENCH_run

Step 2. Diagnose bottlenecks from structured JSON hardware counters

Inspect production_artifacts/profiling/<component>_score_report.json or run whole application profiling via cmake --build --preset Clang_Custom_Release --target Perf_stat, Perf_record, and Perf_report.

  • High instructions (instruction_bloat). Eliminate virtual dispatch, redundant copies, or per iteration bounds checks inside loops by slicing spans before iteration via span.first(count).
  • Low IPC or cache misses (memory_bound). Pack data into contiguous buffers and access via std::span.
  • Branch misses (branch_stalled). Replace inner loop conditionals with branchless arithmetic or lookup tables.

Step 3. Dispatch isolated tactical optimization trials via invoke_subagent

Execute optimization trials in isolated Antigravity shared Git worktrees by calling invoke_subagent with TypeName: "tactical_worker", Workspace: "share", and Model: "pro" while keeping targets/<component>/<component>/<component>.hpp and existing unit test assertions in <component>TEST.cpp unmodified.

  • Never delete, weaken, or bypass unit tests or exception firewalls to inflate benchmark scores.
  • Audit candidate trial diffs using tactical_verifier before committing to confirm unit test assertions in <component>TEST.cpp were not weakened to game benchmarks.
  • Prefer linking accelerated routines from cmake/dependencies.cmake privately over custom scalar loops.
  • When profiling shows a coarse compute bound loop with high IPC over contiguous std::span memory, encapsulate the kernel inside an anonymous namespace in <component>.cpp and apply multi versioning across the three standard tiers.
__attribute__((target_clones("default", "arch=x86-64-v3", "arch=x86-64-v4")))

Never apply target_clones to tiny inlined helpers or memory bound loops, and never include arch=x86-64-v2. Verify IFUNC clone generation under GNU_Default_Release using nm --demangle targets/<component>/CMakeFiles/<component>.dir/<component>.cpp.o.

Step 4. Evaluate safety barriers, plateau stalls, and rollback directives

Verify correctness gates first, then evaluate hardware counter progression and resync production_artifacts/manifest.json.

./production_artifacts/build_all.sh custom debug
cmake --build --preset Clang_Custom_Release --target <component>BENCH_run
python3 .agents/skills/architect/scripts/sync_manifest.py --check

Apply the strategic acceptance and stopping rules using production_artifacts/profiling/<component>_score_report.json.

  • Any failure in compilation, unit tests, or static analysis zeroes the candidate score. Runtime sanitizer faults also zero the score and trigger an immediate revert to the clean parent commit.
  • regression_detected in directive means revert the candidate commit immediately.
  • stop_hardware_saturated or stop_diminishing_returns in directive means commit the winning state and halt optimization on the component.
  • If three consecutive tactical trials fail to achieve at least a 1.03x composite speedup over the parent commit or oscillate between bottlenecks, mark the search branch stalled. Backtrack to the highest scoring clean ancestor and either switch to an orthogonal algorithmic strategy or stop optimizing.
  • Run .agents/skills/audit-sans/SKILL.md before finalizing any optimization lineage to confirm zero memory, UB, or thread safety poisoning.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.