perf-setup
Skill2 starsChanged 6 months agoMITView on GitHub
Detect Firebase/GCP configuration, validate BigQuery access, and prepare for performance data queries. TRIGGER when: user asks about app performance, screen rendering metrics, frozen frames, slow rendering, Firebase Performance, BigQuery setup, or performance monitoring for their Android/iOS/Flutter app. Real phrasings: "which screens are slow", "where is the jank", "we have Firebase Performance, can you pull the numbers", "set up performance tracking". SKIP if: .perf/config.json already exists (go straight to /perf-query), or the app has no Firebase Performance SDK and no BigQuery export — say so instead of setting up.
- Installs packages
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- perf-dashboardSkill
- perf-fixSkill
- perf-querySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 12 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Run all steps autonomously without asking the developer for confirmation at each step.
- Distinctive: line 37
Check and install required tools.
- Very specific: line 55
If brew is not available:
- Very specific: line 69
After install, verify: gcloud --version.
- Very specific: line 72
If gcloud was installed via official installer: gcloud components install bq --quiet
- Very specific: line 73
If via Homebrew: try $(brew --prefix)/share/google-cloud-sdk/bin/bq --version
- Distinctive: line 93
Run the detection script from this skill's directory:
- Distinctive: line 99
If the script is not found at that path, look for it at these alternative locations:
- Distinctive: line 116
If platform = "UNKNOWN": STOP. Tell the developer: "Could not detect project platform.
- Distinctive: line 118
If platform = "FLUTTER": Before asking, auto-detect the target platform:
- Very specific: line 119
Check if android/app/google-services.json exists → select Android silently
- Very specific: line 120
Check if ios/Runner/GoogleService-Info.plist exists → select iOS silently
- Distinctive: line 121
If both exist → ask: "Flutter project with Firebase configs for both Android and iOS.
- Distinctive: line 122
If neither exists → ask: "Flutter project detected.
- Distinctive: line 124
If gcp_project_id is empty: Ask the developer: "Could not find Firebase config.
- Distinctive: line 126
If app_id is empty: Ask for package name (Android) or bundle ID (iOS).
- Distinctive: line 136
Always add: "Screen rendering data takes 24-48 hours to appear in BigQuery after enabling."
- Distinctive: line 145
Run the validation script:
- Very specific: line 175
Create .perf/config.json with all discovered/confirmed values:
- Very specific: line 193
Add .perf/ to .gitignore if not already present:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Firebase Performance Setup
Discover the project's Firebase configuration, install prerequisites if needed, validate BigQuery access, and prepare for performance queries. This skill uses helper scripts in the scripts/ directory alongside this file.
IMPORTANT: Autonomous Execution
Run all steps autonomously without asking the developer for confirmation at each step. Only ask the developer when:
- A choice is genuinely ambiguous (e.g., multiple production-like config files)
- A required value cannot be detected automatically
- An auth step requires browser interaction (just tell them what's happening, don't ask permission)
- A permission/access error occurs that you cannot fix
Do NOT ask:
- "Should I check gcloud?" — just check it
- "Should I proceed to the next step?" — just proceed
- "Should I run the validation?" — just run it
- "Is this the correct account?" — only ask if there's a clear mismatch (e.g., personal email on a corporate project)
Think of this as a setup wizard that runs to completion, only pausing when it hits an actual blocker.
Step 1: Install Prerequisites
Check and install required tools. Do NOT report errors — actively fix them. Run all checks together, then fix what's missing.
echo "gcloud: $(command -v gcloud >/dev/null 2>&1 && echo 'OK' || echo 'MISSING')"
echo "bq: $(command -v bq >/dev/null 2>&1 && echo 'OK' || echo 'MISSING')"
echo "python3: $(command -v python3 >/dev/null 2>&1 && echo 'OK' || echo 'MISSING')"
echo "auth: $(gcloud auth list --filter=status:ACTIVE --format='value(account)' 2>/dev/null | head -1 || echo 'NONE')"
echo "adc: $(gcloud auth application-default print-access-token >/dev/null 2>&1 && echo 'OK' || echo 'MISSING')"If everything is OK: Proceed silently to Step 2. Do not print a status report.
If gcloud is MISSING, detect the OS and install:
- macOS (check with
uname -s):
Ifbrew install google-cloud-sdkbrewis not available:curl -fsSL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-darwin-$(uname -m).tar.gz | tar -xz -C "$HOME" $HOME/google-cloud-sdk/install.sh --quiet --path-update true source "$HOME/google-cloud-sdk/path.bash.inc" - Linux:
curl -fsSL https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-linux-$(uname -m).tar.gz | tar -xz -C "$HOME" $HOME/google-cloud-sdk/install.sh --quiet --path-update true source "$HOME/google-cloud-sdk/path.bash.inc"
After install, verify: gcloud --version. If gcloud is still not found, try: source ~/.bashrc or source ~/.zshrc.
If bq is MISSING:
- If gcloud was installed via official installer:
gcloud components install bq --quiet - If via Homebrew: try
$(brew --prefix)/share/google-cloud-sdk/bin/bq --version
If python3 is MISSING (rare):
- macOS:
xcode-select --install - Linux:
sudo apt install python3orsudo yum install python3
If auth is NONE: Tell the developer "Authenticating with Google Cloud — this will open a browser." Then run:
gcloud auth login --quietIf ADC is MISSING: Tell the developer "Setting up BigQuery credentials — one more browser window." Then run:
gcloud auth application-default login --quietIMPORTANT: Both auth commands open a browser. On remote/headless machines, use --no-launch-browser and show the URL to visit manually.
Step 2: Detect Platform and Firebase Config
Run the detection script from this skill's directory:
bash "$(dirname "$(find .claude/skills/perf-setup -name detect_config.sh 2>/dev/null | head -1)")/detect_config.sh" .If the script is not found at that path, look for it at these alternative locations:
.claude/skills/perf-setup/scripts/detect_config.shskills/perf-setup/scripts/detect_config.sh
The script outputs JSON with these fields:
platform: "ANDROID", "IOS", "FLUTTER", or "UNKNOWN"gcp_project_id: extracted project ID (may be empty)app_id: extracted app ID (may be empty)config_file: path to the config file foundconfig_files_count: number of config files found (>1 means build flavors)config_files_list: newline-separated paths of all config files foundselected_flavor: which flavor was auto-selected (if multiple found)has_application_id_suffix: whether applicationIdSuffix was detectedfirebase_perf_sdk_found: whether Firebase Performance SDK was found
Step 3: Handle Detection Results
If platform = "UNKNOWN": STOP. Tell the developer: "Could not detect project platform. Are you in the root directory of an Android, iOS, or Flutter project?"
If platform = "FLUTTER": Before asking, auto-detect the target platform:
- Check if
android/app/google-services.jsonexists → select Android silently - Check if
ios/Runner/GoogleService-Info.plistexists → select iOS silently - If both exist → ask: "Flutter project with Firebase configs for both Android and iOS. Which platform are you optimizing?"
- If neither exists → ask: "Flutter project detected. Configure for Android or iOS? (You'll need a Firebase config file for that platform.)"
If gcp_project_id is empty: Ask the developer: "Could not find Firebase config. Please provide your GCP Project ID (Firebase Console → Project Settings → General)."
If app_id is empty: Ask for package name (Android) or bundle ID (iOS).
If config_files_count > 1 and selected_flavor is set: The script auto-selected the production config. Tell the developer which one was chosen: "Found multiple Firebase configs (build flavors). Auto-selected {selected_flavor} as the production config from: {config_file}". Proceed without asking — only ask if selected_flavor is "unknown" or empty.
If has_application_id_suffix = true: Note (don't block): "Build uses applicationIdSuffix. Using the base applicationId for BigQuery table name."
If firebase_perf_sdk_found = false: Warn with platform-specific fix:
- Android: "Firebase Performance SDK not detected. Add
implementation(\"com.google.firebase:firebase-perf\")and apply thecom.google.firebase.perfplugin." - iOS: "Firebase Performance SDK not detected. Add
pod 'FirebasePerformance'to Podfile. EnsureFirebaseApp.configure()is called in AppDelegate." - Flutter: "Firebase Performance SDK not detected. Add
firebase_performanceto pubspec.yaml." - Always add: "Screen rendering data takes 24-48 hours to appear in BigQuery after enabling."
Step 4: Validate BigQuery Access
Construct the BigQuery table name:
- Replace dots in app ID with underscores
- Format:
{projectId}.firebase_performance.{sanitized_appId}_{PLATFORM} - Example:
my-app-123.firebase_performance.com_example_myapp_ANDROID
Run the validation script:
bash "$(dirname "$(find .claude/skills/perf-setup -name validate_gcloud.sh 2>/dev/null | head -1)")/validate_gcloud.sh" "{gcp_project_id}" "{table_name}"Alternative paths:
.claude/skills/perf-setup/scripts/validate_gcloud.shskills/perf-setup/scripts/validate_gcloud.sh
The script outputs JSON. Handle each field:
gcloud_installed = false: Should not happen (Step 1 installed it). Re-run Step 1.logged_in = false: Should not happen. Rungcloud auth login.active_account: Only flag if there's an obvious mismatch (e.g.,@gmail.comaccount on a corporate project, or vice versa). Otherwise proceed silently.adc_valid = false: Rungcloud auth application-default loginautomatically.bq_installed = false: Rungcloud components install bq --quietautomatically.table_exists = false: read thetable_errorfield — it contains the rawbq showstderr verbatim, not a translation. The cause is usually one of:- (a) IAM — the active gcloud account lacks BigQuery permission on this project.
gcloud auth listshows what other accounts are configured locally; an obvious mismatch (e.g. a personal@gmail.comaccount active on a corporate GCP project) often points the way. If the right account is already active, ask the project admin forroles/bigquery.dataViewer. - (b) Firebase BigQuery export not enabled — the table genuinely isn't there. Go to Firebase Console → Settings → Integrations → BigQuery and enable it. Data takes 24-48 hours to appear after the first enable.
- (c) Wrong table name construction — re-check Step 4 against
firebase_performance.{sanitized_appId}_{PLATFORM}.
Pick the branch that matches the raw error in
table_error. Don't assume — the samebq showfailure can mean any of the three, and the text of the stderr is the only reliable signal.- (a) IAM — the active gcloud account lacks BigQuery permission on this project.
smoke_test_count = 0: WARNING (don't block): "Table exists but no screen trace data in the last 7 days. If recently enabled, data can take up to 48 hours."smoke_test_count > 0: Proceed. Briefly note: "Found {count} screen traces in the last 7 days."
If permission denied on BigQuery: "Your account doesn't have BigQuery access on this project. Ask your project admin to grant the BigQuery Data Viewer role (roles/bigquery.dataViewer) in Google Cloud Console → IAM & Admin → IAM."
Step 5: Write Configuration
Create .perf/config.json with all discovered/confirmed values:
{
"version": 1,
"created_at": "{ISO timestamp}",
"platform": "{ANDROID or IOS}",
"gcp_project_id": "{project ID}",
"app_id": "{app ID}",
"table_name": "{constructed table name}",
"gcloud_account": "{active gcloud email}",
"lookback_days": 30,
"min_samples": 50,
"min_daily_samples": 10,
"max_screens": 50
}Add .perf/ to .gitignore if not already present:
grep -qxF '.perf/' .gitignore 2>/dev/null || echo '.perf/' >> .gitignorePrint: "Setup complete. Configuration saved to .perf/config.json. Run /perf-query to fetch performance data."
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
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.

