Saas perf profile

From Basinfy/Basinfy-SaaS-Studio · View interactive version

Saas perf profile is an AI agent skill from the GitHub repository Basinfy/Basinfy-SaaS-Studio. Profile Core Web Vitals (LCP, INP, CLS), bundle budgets, and API/query p95 latencies.

How to use this skill

Skill file

<!-- Generated from .claude/skills by scripts/sync-agent-skills.py. -->

Running this workflow on this client

Run commands from the project root (use Git Bash on Windows if bash points to an unavailable WSL distro). Shared studio files live in .claude/; follow .agents/PORTABLE-RUNTIME.md and .claude/docs/config-resolution.md for client tools, delegation, and approval rules.

Run bash .claude/hooks/yaml-helper.sh resolve_config --keys locale,performance.enforce,automation,workflow and use its output below.

Resolved above — use as-is. No block → defaults in

.claude/docs/config-resolution.md.

Performance Profile

Locale & User Profile: Match locale (pt-BR → natural Brazilian Portuguese questions/options, overriding English examples; en → English) and user_profile (founder → plain business language with (Recomendado) first, zero tech jargon; developer → technical). Keep code/tests in English.

Every AskUserQuestion call follows .claude/docs/automation-modes.md

(collaborative asks always · guided major-only · autonomous logs and proceeds;

automation_always_ask categories always prompt).

Insufficient input — check this before producing any report

**If the inputs this skill needs do not exist, the answer is "could not run" —

not a filled-in report.** Check first, and stop if the check fails.

  1. List the inputs this skill reads (data files, prior reports, profiler output,

test results, registries, source code).

  1. For each, record FOUND or ABSENT — not "assumed present".
  2. If any input required for a section is ABSENT, that section is

NOT ASSESSED — NO DATA. Do not estimate it, do not infer it from an

adjacent artifact, and do not leave a mandated cell to be filled by whoever

reads the template next.

  1. If every required input is ABSENT, stop and report

NOT ASSESSED — NO DATA as the whole verdict, naming what was missing and

which skill produces it.

A verdict of NOT ASSESSED is a success. It is the correct, useful answer to

"what does the data say?" when there is no data. The failure mode this prevents is

specific: a report whose verdict enum has no "could not run" state produces

false clean passes — an asset audit returning COMPLIANT on a project with no

assets and no standards, or a performance profile reporting ">99% headroom against

a 16.67ms budget" with zero profiler data and no budget ever set.

Absence of evidence is never evidence of absence. A scan that finds no

matches because there are no files to scan has not verified anything. Say which of

the two happened — a reader cannot tell from a green result.


Phase 0: Resolve Budget Enforcement

performance.enforce decides what a budget violation means in this run. It

does not change which budgets are measured — performance.target_lcp_ms,

target_inp_ms, target_cls, max_initial_bundle_kb and api_p95_latency_ms are profiled the

same way at every level:

| Value | Effect on this profile's findings |

|-------|-----------------------------------|

| warn (default) | Violations are reported as findings. They do not block; CI logs them without failing. |

| block | Violations are blockers. Say so explicitly in the report — a block project treats an over-budget system as release-stopping, and /saas-gate-check will FAIL the Polish gate on it. |

| off | Budgets are informational only. Still report measured values, but do not raise violations as findings or recommendations to fix. |

Only warn, block and off are recognized. Surface any other value to the

user and fall back to warn rather than guessing.

The value is locally overridable (/saas-settings --local performance.enforce=block),

so use the resolved block above rather than reading project.yaml — a

teammate's stricter local setting is meant to bite on their machine only.

Phase 1: Determine Scope

Read the argument:


Phase 2: Load Performance Budgets

Read the committed budgets from config first — they are the project's

record of what it agreed to, and design docs are the fallback, not the source:

bash .claude/hooks/yaml-helper.sh get_effective_yaml_key performance.target_lcp_ms
bash .claude/hooks/yaml-helper.sh get_effective_yaml_key performance.target_inp_ms
bash .claude/hooks/yaml-helper.sh get_effective_yaml_key performance.target_cls
bash .claude/hooks/yaml-helper.sh get_effective_yaml_key performance.max_initial_bundle_kb
bash .claude/hooks/yaml-helper.sh get_effective_yaml_key performance.api_p95_latency_ms

Run each line as its own plain command, one key per call: the helper moves to

the project root itself, so it works when the session was started in a

subfolder, and this skill pre-approves that form only (a source or cd ... &&

wrapper asks the user every time). Empty output means that budget is not set.

Existing projects may still have performance.target_fid_ms. FID and INP measure different aspects of responsiveness. If the project has only a FID budget, flag the old key and ask the user to set an INP budget via /saas-settings. Until then, report INP as NOT ASSESSED unless an explicit INP budget was recorded in the design docs.

Resolve these budgets from project.yaml, not from prose. Phase 0 above

states these budgets "are profiled the same way at every level". A user

who set performance.api_p95_latency_ms: 250 in project.yaml has it ignored if

the budget is read from design docs or CLAUDE.md instead.

Then fall back to design docs or CLAUDE.md for anything config does not carry:

A metric with no committed budget is NOT ASSESSED, not a pass. Do not

measure against the template's [16.67ms] placeholder — an unset budget is not

a budget that was met, and reporting headroom against a number nobody chose is

the exact fabrication this skill's own header warns about.


Phase 3: Analyze Codebase

CPU & Backend Profiling Targets:

Frontend & DOM Profiling Targets:

Asset & Bundle Size Targets:

Network & I/O Targets:


Phase 4: Generate Profiling Report

Write the report to production/polish/[scope]-report-[date].md, asking first

per the Collaboration Protocol: *"May I write this profiling report to

production/polish/[scope]-report-[date].md?"* Create the directory if absent.

**Name the destination — do not just render the template into the

conversation.** A profile that lives only in the transcript is gone the moment

the session ends, and no two runs can be compared. production/polish/

is the same location /saas-team-polish writes, deliberately: a profile taken by

either route belongs in one place, or the comparison this skill exists to enable

cannot be made.

If a NOT ASSESSED section survives into the report, keep it in the written

file. A profile whose gaps are edited out on the way to disk reads, later, as a

complete measurement.

## Performance Profile: [System or Full]
Generated: [Date]

### Performance Budgets
| Metric | Budget | Estimated Current | Status |
|--------|--------|-------------------|--------|
| LCP (Largest Contentful Paint) | [2000ms] | [estimate] | [OK/WARNING/OVER/NOT ASSESSED] |
| INP (Interaction to Next Paint) | [committed budget] | [estimate] | [OK/WARNING/OVER/NOT ASSESSED] |
| CLS (Layout Shift) | [0.1] | [estimate] | [OK/WARNING/OVER/NOT ASSESSED] |
| API p95 Latency | [250ms] | [estimate] | [OK/WARNING/OVER/NOT ASSESSED] |
| Initial JS Bundle | [200KB] | [estimate] | [OK/WARNING/OVER/NOT ASSESSED] |

### Hotspots Identified
| # | Location | Issue | Estimated Impact | Fix Effort |
|---|----------|-------|------------------|------------|

### Optimization Recommendations (Priority Order)
1. **[Title]** — [Description]
   - Location: [file:line]
   - Expected gain: [estimate]
   - Risk: [Low/Med/High]
   - Approach: [How to implement]

### Quick Wins (< 1 hour each)
- [Simple optimization 1]

### Requires Investigation
- [Area that needs actual runtime profiling to confirm impact]

Output the report with a summary: top 3 hotspots, estimated headroom against

each budget that is set — for a metric with none, `no budget set — headroom not

assessed` — and recommended next action.


Phase 5: Scope and Timeline Decision

Activate this phase only if any hotspot has Fix Effort rated M or L.

Present significant-effort items and ask the user to choose for each:

If multiple items are deferred to Polish (choice C), record them under ### Deferred to Polish.


Verdict

Close every run that produced a report — whether or not Phase 5 ran — with:

Verdict: COMPLETE — performance profile generated (saved to

production/polish/[scope]-report-[date].md if the write was approved). The only

other outcome is the NOT ASSESSED — NO DATA path above.


Phase 6: Next Steps

Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.