
forge-cost-optimizer
Optimizes Atlassian Forge apps to reduce platform consumption and avoid unnecessary costs using Atlassian's "Optimise Forge platform costs" guidance. Use when the user asks to optimize Forge app costs, reduce Forge invocations, lower GB-seconds, reduce storage or log usage, tune memory, replace polling, improve scheduled triggers, reduce KVS writes, move work to the frontend, use bridge APIs, batch API calls, add caching, or evaluate Forge Remote trade-offs. By default, perform an audit first and offer to make the recommended changes after presenting the audit. Only modify files immediately when the user explicitly asks the agent to implement or apply optimizations.
- Installs
- 356
- Last 24h
- +20
- Trending rank
- #5815
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/atlassian/forge-skills --skill forge-cost-optimizer- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads forge-cost-optimizer automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Forge Cost Optimizer
Optimize Forge apps for lower platform consumption while preserving correctness, security, and maintainability. This skill turns Atlassian's Forge cost optimization guidance into an actionable agent workflow.
Source Guidance
Base recommendations on Atlassian's official guide: https://developer.atlassian.com/platform/forge/optimise-forge-costs/
If live Forge documentation tools are available, search the Forge docs for the exact module or API before changing code that depends on current manifest syntax, bridge APIs, storage APIs, trigger filters, or Forge Remote behavior.
Core Principle
Prioritize changes that reduce unnecessary work:
- Avoid invocations entirely — move safe work to UI Kit / Custom UI frontend, use context from the bridge, replace polling with events, add trigger filters.
- Do less work per invocation — bulk API calls, field selection, source-side filtering, pagination, early exits, bounded concurrency.
- Reduce billed data volume — trim resolver payloads, reduce KVS reads/writes, avoid large log payloads, use entity properties where appropriate.
- Tune compute cost — right-size
memoryMiB, reduce duration, offload only when the operational trade-off is justified.
Never reduce costs by weakening authorization, exposing secrets to the frontend, skipping required validation, dropping necessary error handling, or making data stale beyond the user's business requirements.
When Triggered
When the user asks to optimize an existing Forge app, immediately inspect the app before asking questions unless the target app directory is ambiguous.
Default behavior is audit-first: complete the cost optimization audit, present prioritized recommendations, and ask the user whether they want the agent to make the recommended changes. Do not modify files during the initial audit unless the user explicitly requested implementation in the same prompt, such as "make the changes", "apply the optimizations", "fix these issues", or "update the code".
Read, in order:
manifest.yml/manifest.yaml— functions, modules, triggers, scheduled triggers, remotes, resources, permissions, endpoint mappings,memoryMiB.package.json— dependencies, scripts, Forge package versions.- Backend/resolver code —
src/**, handlers referenced by the manifest, storage usage, API calls, logging, async control flow. - Frontend code — UI Kit or Custom UI resources, bridge usage,
invoke()patterns, render lifecycle, caching, payload needs. - Any tests or fixtures that describe behavior to preserve.
After the audit, offer clear next-step options such as implementing all quick wins, implementing selected high-impact changes, or collecting usage measurements first. If the user explicitly requested implementation upfront, make safe, localized improvements after the audit findings are understood and explain trade-offs.
Optimization Workflow
Step 1: Establish the Cost Profile
Identify which cost drivers the app likely uses:
| Driver | Inspect | Common signals |
|---|---|---|
| Function GB-seconds | manifest.yml, handlers | many resolver calls, slow sequential APIs, high memoryMiB, heavy transforms |
| Invocations | frontend invoke(), triggers | calls on render, chatty UI, scheduled polling, broad event subscriptions |
| KVS / Custom Entities | storage.* usage | writes on every request, loops over keys, low TTL cache churn, large values |
| Logs | console.* | full event/API payload logging, debug logs in hot paths |
| Forge SQL | SQL client usage | frequent compute requests, long queries, oversized stored data |
| Remote / egress | remotes, fetch calls | external polling, compute offload candidates, Runs on Atlassian implications |
When usage metrics are unavailable, mark estimates as qualitative: High, Medium, Low, or Unknown.
Step 2: Find No-Invocation Opportunities
Prefer removing function invocations over making them cheaper.
Check for:
- Resolver calls that only fetch product context. Replace with:
- UI Kit:
useProductContext()from@forge/react - UI Kit or Custom UI:
view.getContext()from@forge/bridge
- UI Kit:
- Read-only Jira/Confluence API calls routed through a resolver even though user-context access is acceptable. Consider
requestJira()/requestConfluence()from@forge/bridge. - Formatting, sorting, grouping, client-safe validation, or UI-only transformation in resolvers. Move to frontend when data is already authorized for the context user.
invoke()calls inside render bodies, unbounded effects, repeated event handlers, or multiple calls on page load that can be cached or batched.
Keep logic in the backend when it requires asApp(), Forge storage, secrets, external credentials, cross-user authorization checks, or sensitive business rules.
Step 3: Optimize Triggers and Scheduling
Check scheduledTrigger, trigger, and webtrigger modules.
Recommended changes:
- Increase scheduled trigger intervals when business requirements allow (
fiveMinutes→hour→day→week). - Replace scheduled polling of Atlassian product changes with product events.
- Replace scheduled polling of external services with inbound webhooks via Forge web triggers when the external service supports webhooks.
- Add manifest
filter.expressionto suppress irrelevant product events before invocation. - Add
filter.ignoreSelf: truefor Jira triggers that would otherwise process events caused by the app itself. - Add cheap early exits at the top of handlers before API calls, storage reads, or expensive transforms.
- Use Forge Realtime instead of frontend polling loops that repeatedly invoke resolvers waiting for backend state changes.
Step 4: Optimize API and Data Fetching
Every API request inside a function contributes to duration. Look for:
- N+1 calls. Replace per-item fetches with bulk endpoints or search APIs that return requested fields.
- Missing
fields,expand,limit, ormaxResultsconstraints. Request only what the app uses. - Filtering after fetching all data. Push filters to JQL, CQL, REST query parameters, or storage indexes.
- Sequential independent calls. Use
Promise.allor bounded concurrency. - Unbounded concurrency. Batch large workloads to avoid rate limits; use about 5–10 concurrent requests unless docs or tests justify otherwise.
- Large resolver responses. Return only fields consumed by the UI.
Step 5: Optimize Storage
KVS and Custom Entity reads/writes are billed by data volume above free allowances; writes are much more expensive than reads.
Check for:
- Writes on every invocation even when values have not changed. Compare before writing or debounce writes.
- Very short cache TTLs for data that changes rarely. Prefer longer TTLs where staleness is acceptable.
- Storage reads/writes inside loops. Batch, restructure keys, or use Custom Entities queries.
storage.query().getMany()followed by in-memory filtering. Use.index(...),.where(...),.limit(...), and cursor pagination.- Large values where only a small subset is needed. Store normalized or trimmed values.
- Small, non-sensitive per-issue/page metadata stored in KVS. Consider Jira entity properties or Confluence content properties instead, noting visibility and 32 KB size constraints.
Do not move sensitive or confidential data to entity/content properties because they may be visible through product REST APIs.
Step 6: Optimize Logging
Find console.log, console.info, console.warn, console.error, and structured logger calls.
Recommended changes:
- Remove or gate debug logs in production hot paths.
- Never log full event payloads, API responses, storage values, secrets, tokens, personal data, or large JSON strings.
- Keep concise error logs and meaningful state changes.
- Add environment-variable gated debug logging only when useful, for example
process.env.DEBUG_LOGGING === 'true'.
Step 7: Tune Function Memory
Inspect function entries in manifest.yml.
- The cost model is GB-seconds:
(memoryMiB / 1024) × durationSeconds. - Lower memory for lightweight resolvers only after considering performance and test coverage.
- Keep or increase memory for large payload processing if lower memory increases duration or causes failures.
- Prefer evidence: logs, profiling, benchmark results, or realistic local tests.
- If evidence is missing, recommend measurement rather than guessing aggressive memory reductions.
Step 8: Evaluate Forge Remote Carefully
Forge Remote can remove Forge function execution for suitable workloads, but it shifts responsibility to externally operated infrastructure.
Only recommend Forge Remote when one or more are true:
- Long-running work exceeds standard Forge function limits.
- Compute-intensive processing dominates cost or runtime.
- The team already operates a secure backend that should own the logic.
- Storage/query needs genuinely exceed Forge platform capabilities.
Always mention trade-offs:
- The team must secure, scale, monitor, patch, and operate the remote backend.
- Remote architecture may affect Runs on Atlassian eligibility.
- The external infrastructure has its own costs and compliance obligations.
Safe Implementation Patterns
When modifying code:
- Preserve behavior and authorization boundaries.
- Prefer small, reviewable commits worth of changes.
- Add or update tests when logic changes.
- Use existing project style and dependencies; do not add dependencies for simple utilities.
- Avoid sweeping rewrites unless the user explicitly asks.
- Validate with the narrowest relevant test/build command.
Finding Patterns Quickly
Search for these patterns:
invoke(
useAction(
useEffect(
requestJira(
requestConfluence(
asApp().requestJira
asUser().requestJira
storage.get
storage.set
storage.query
console.log
console.info
scheduledTrigger
ignoreSelf
memoryMiB
Promise.all
for await
for (
Interpret results carefully; a pattern is not automatically a problem.
Output Format
For default audit-first requests, return the audit and end by offering to implement recommended changes:
# Forge Cost Optimization Audit
## Summary
- Overall opportunity: High | Medium | Low
- Highest-impact lever: <invocations | duration | storage | logs | memory | remote>
- Files inspected: <list>
## Prioritized Opportunities
1. [High] <title>
- Evidence: `<file:line>` and observed pattern
- Why it costs money: <cost driver>
- Recommended change: <specific fix>
- Safety notes: <authorization/data freshness/trade-offs>
## Quick Wins
- <low-risk change>
## Needs Measurement
- <changes that require usage metrics or profiling>
## Recommended Next Step
Would you like me to implement the quick wins, implement selected high-impact changes, or collect usage measurements first?
For requests where the user explicitly asked for implementation, return:
# Forge Cost Optimization Complete
## Changes Made
- <file>: <change and cost driver reduced>
## Validation
- <commands run and results>
## Expected Impact
- <qualitative or measured impact>
## Follow-ups
- <optional deeper optimizations or metrics to collect>
Anti-Patterns to Avoid
- Do not move privileged
asApp()operations to the frontend. - Do not expose secrets, app credentials, or admin-only data in browser code.
- Do not use entity properties for sensitive data.
- Do not remove logs needed for production incident diagnosis; reduce verbosity instead.
- Do not increase cache TTL beyond acceptable product freshness requirements.
- Do not recommend Forge Remote as a default; it is an architectural trade-off, not a simple cost switch.
- Do not claim exact savings without actual usage metrics.
FAQ
What does the forge-cost-optimizer skill do?
Optimizes Atlassian Forge apps to reduce platform consumption and avoid unnecessary costs using Atlassian's "Optimise Forge platform costs" guidance. Use when the user asks to optimize Forge app costs, reduce Forge invocations, lower GB-seconds, reduce storage or log usage, tune memory, replace polling, improve scheduled triggers, reduce KVS writes, move work to the frontend, use bridge APIs, batch API calls, add caching, or evaluate Forge Remote trade-offs. By default, perform an audit first and offer to make the recommended changes after presenting the audit. Only modify files immediately when the user explicitly asks the agent to implement or apply optimizations.
How do I install forge-cost-optimizer?
Run npx skills add https://github.com/atlassian/forge-skills --skill forge-cost-optimizer in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/forge-cost-optimizer/ (personal) or .claude/skills/forge-cost-optimizer/ (project).
Which AI agents can use forge-cost-optimizer?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is forge-cost-optimizer safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains forge-cost-optimizer?
It is published by atlassian in atlassian/forge-skills. It has 356 recorded installs.
More from atlassian/forge-skills
forge-app-builder
atlassian/forge-skills
Plan, build, scaffold, or safely extend Atlassian Forge apps using current official documentation. Use for fresh Forge apps, existing-app feature work, module and manifest changes, UI Kit or Custom UI implementation, backend functions and events, Atlassian or external APIs, storage, permissions, environment configuration, distribution-affecting implementation, validation, and explicitly authorized deployment or installation; route standalone debugging and specialist reviews to their dedicated skills.
forge-app-review
atlassian/forge-skills
Open the skill to read its SKILL.md instructions.
forge-security-review
atlassian/forge-skills
Open the skill to read its SKILL.md instructions.
Popular security skills
azure-compliance
microsoft/azure-skills
Run Azure compliance and security audits with azqr plus Key Vault expiration checks. Covers best-practice assessment, resource review, policy/compliance validation, and security posture checks. WHEN: compliance scan, security audit, BEFORE running azqr (compliance cli tool), Azure best practices, Key Vault expiration check, expired certificates, expiring secrets, orphaned resources, compliance assessment.
minimal-run-and-audit
lllllllama/rigorpilot-skills
Rigor Run skill for README-first deep learning repo reproduction. Use when the task is specifically to capture or normalize evidence from the selected smoke test or documented inference or evaluation command and write standardized reprooutputs/ files, including patch notes when repository files changed. Do not use for training execution, initial repo intake, generic environment setup, paper lookup, target selection, hidden scientific-meaning changes, or end-to-end orchestration by itself.
seo-audit
coreyhaines31/marketingskills
When the user wants to audit, review, or diagnose SEO issues on their site. Also use when the user mentions "SEO audit," "technical SEO," "why am I not ranking," "SEO issues," "on-page SEO," "meta tags review," "SEO health check," "my traffic dropped," "lost rankings," "not showing up in Google," "site isn't ranking," "Google update hit me," "page speed," "core web vitals," "crawl errors," "indexing issues," "stuck on page 2," "striking distance keywords," "title tag rewrite," "low CTR," "local SEO," "Google Business Profile," or "map pack." Use this even if the user just says something vague like "my SEO is bad" or "help with SEO" — start with an audit. For building pages at scale to target keywords, see programmatic-seo. For adding structured data, see schema. For AI search optimization, see ai-seo.
firebase-security-rules-auditor
firebase/agent-skills
Audits Firebase (Firestore, Cloud Storage) security rules for vulnerabilities, privilege escalation, role bypasses, create vs update inconsistencies, resource exhaustion, type safety, size limits, and hasOnly ownership checks. Use when auditing/reviewing rules, running red-team rule assessments, or scoring against auditor checklists. Don't use for Firebase CLI (login, deploy), Auth, Crashlytics, Remote Config, or database queries.
audit
pbakaus/impeccable
Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review.
competitors
coreyhaines31/marketingskills
When the user wants to create competitor comparison or alternative pages for SEO and buyer-facing use. Also use when the user mentions 'alternative page,' 'vs page,' 'competitor comparison,' 'comparison page,' '[Product] vs [Product],' '[Product] alternative,' 'competitive landing pages,' 'how do we compare to X,' 'competitor teardown,' 'audit our competitor pages,' 'are our comparison pages out of date,' or 'competitive asset audit.' Use this for any content that positions your product against competitors. Covers four formats: singular alternative, plural alternatives, you vs competitor, and competitor vs competitor. For auditing existing claims (not researching competitors from scratch, which is competitor-profiling; not technical SEO on these pages, which is seo-audit), use the asset audit here. For internal battle cards and sales-specific competitor docs, see sales-enablement.