claude-workspace: Command for Claude Code

.claude/commands/perf-audit.md

perf-audit is a command for Claude Code from Piyush8296/claude-workspace. It costs 16 tokens per session (1,481 once invoked), scanned A, original, MIT.

A frontend website performance check covering build output, JavaScript size, dependencies, code reuse, images, and the order resources load. It looks for parts of a site that may slow loading or increase downloaded data.

In plain words
What is it for?
Use it to inspect a web build, find large JavaScript files or packages, identify duplicate dependencies, review lighter alternatives, and examine image and loading performance.
Why use it?
Websites can feel slow because of oversized scripts, heavy packages, duplicate code, unoptimized images, or a poor loading sequence. A structured audit helps locate those sources.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is Piyush8296/claude-workspace's own configuration. It tells Claude Code how to work on claude-workspace itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-workspace configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Piyush8296/claude-workspace. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Piyush8296/claude-workspace/main/.claude/commands/perf-audit.md
Clone the repo
git clone --depth 1 https://github.com/Piyush8296/claude-workspace

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for perf-audit

README.md
[![agentmods](https://agentmods.dev/badge/commands/piyush8296/claude-workspace/perf-audit/github.svg)](https://agentmods.dev/commands/piyush8296/claude-workspace/perf-audit)
Your own site
<a href="https://agentmods.dev/commands/piyush8296/claude-workspace/perf-audit"><img src="https://agentmods.dev/badge/commands/piyush8296/claude-workspace/perf-audit/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for perf-audit

Your own site · 80×15
<a href="https://agentmods.dev/commands/piyush8296/claude-workspace/perf-audit"><img src="https://agentmods.dev/badge/commands/piyush8296/claude-workspace/perf-audit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,481 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00016 $0.01481
Opus 5 $0.00008 $0.00740
Sonnet 5 $0.00003 $0.00296
Haiku 4.5 $0.00002 $0.00148

Measured 9d ago against content hash 9b8159630a88, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

perf-audit scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/perf-audit.md · 152 lines

How it starts

The opening of the file, as written. The whole thing — 152 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Performance Audit

Audit performance: $ARGUMENTS

Instructions

1. Bundle Analysis

# Build and measure output
pnpm build 2>&1 | tail -30

# Measure build output size
find dist/ .next/ build/ -name '*.js' -type f 2>/dev/null | \
  xargs du -sh 2>/dev/null | sort -rh | head -15

# Find the largest JS chunks
find dist/ .next/static/ build/static/ -name '*.js' -type f 2>/dev/null | \
  while read f; do echo "$(du -k \"$f\" | cut -f1)KB  $f"; done | \
  sort -rn | head -10

Flag any chunk > 200KB (gzipped) as a concern.

2. Dependency Weight

# Top 20 heaviest node_modules
du -sh node_modules/* 2>/dev/null | sort -rh | head -20

# Check for duplicate packages
npm ls --all 2>/dev/null | grep -E 'deduped|UNMET' | head -10

# Find packages that could be lighter
grep -E '"(moment|lodash|date-fns|axios)"' package.json

Common replacements:

Heavy Lighter Alternative Savings
moment.js (~300KB) date-fns (~20KB tree-shaken) or dayjs (~2KB) 95%+
lodash (~70KB) lodash-es (tree-shakeable) or native 80%+
axios (~14KB) fetch (built-in) 100%
classnames (~1KB) clsx (~0.5KB) 50%

3. Tree-Shaking Analysis

# Find namespace imports that prevent tree-shaking
grep -rn "import \* as" src/ --include='*.ts' --include='*.tsx' | \
  grep -v 'React\|next' | head -10

# Find barrel file re-exports
find src/ -name 'index.ts' -exec grep -l 'export \*' {} \; | head -10

# Check for side-effect imports
grep -rn "^import '" src/ --include='*.ts' --include='*.tsx' | head -10

4. Code Splitting

# Check for dynamic imports (good)
grep -rn 'dynamic(\|lazy(' src/ --include='*.tsx' | wc -l

# Check total page/route count vs dynamic imports
find src/app src/pages -name 'page.tsx' -o -name '*.page.tsx' 2>/dev/null | wc -l

# Find heavy components that should be code-split
find src/components -name '*.tsx' -size +10k | while read f; do
  echo "$(wc -l < \"$f\") lines  $(du -k \"$f\" | cut -f1)KB  $f"
done | sort -rn | head -10

Read the full file on GitHub · 152 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 152 lines · 16 tokens per session scan A 9b8159630a88

Subscribe to this mod's changes

perf-audit is a command published in the GitHub repository Piyush8296/claude-workspace (2 stars, last pushed 4mo ago), licensed MIT. It adds 16 tokens to every session and 1,481 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.