Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/freshworks-developers/fw-dev-tools/fdk-refactorgit clone --depth 1 https://github.com/freshworks-developers/fw-dev-toolsWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00041 | $0.00539 |
| Opus 5 | $0.00020 | $0.00269 |
| Sonnet 5 | $0.00008 | $0.00108 |
| Haiku 4.5 | $0.00004 | $0.00054 |
Grade A, and why
fdk-refactor 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 2d 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.
What it actually says
FDK Refactor Command
Usage: /fdk-refactor
You are reducing function complexity in a Freshworks app. Target: cyclomatic complexity ≤ 7 per function. Follow these steps exactly.
Step 1: Determine app directory
- Search the workspace for
manifest.jsonfiles. - If multiple folders contain manifest.json: Ask the user which app to refactor.
- If one folder: Use that directory.
- If none: Inform the user and stop.
Step 2: Identify high-complexity functions
Scan server/server.js and app/scripts/*.js for functions with:
- Deep nesting (multiple
if/for/whilelevels) - Many conditional branches
- Long functions (> 50 lines)
Reference: Code complexity threshold is 7 (max cyclomatic complexity per function).
Step 3: Refactoring techniques
Apply these patterns:
- Extract helper functions: Move nested logic into separate, well-named functions.
- Early returns: Replace nested ifs with guard clauses.
- Extract loops: Move loop bodies into separate functions.
- Simplify conditionals: Use lookup tables or strategy pattern instead of long if-else chains.
Step 4: Preserve behavior
- Do NOT change app behavior or logic.
- Keep helper functions after the exports block (FDK parser requirement).
- Ensure all exports still work correctly.
Step 5: Validate
First: SKILL.md → Manifest + toolchain gate before any fdk validate (same as /fdk-fix: fw-setup / /fdk-migrate / raise engines — no toolchain downgrade).
Toolchain: If fdk validate cannot run, fw-app-dev does not install the CLI — use fw-setup or prompt the user to add it (SKILL.md → FDK / Node.js toolchain — not provided by fw-app-dev).
Run: cd <app-directory> && fdk validate
Ensure no new errors were introduced. Report the refactored functions and validation status.
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.
- 2d ago First seen · 54 lines · 41 tokens per session scan A b138c20ff52d
fdk-refactor is a command published in the GitHub repository freshworks-developers/fw-dev-tools (5 stars, last pushed 8d ago), licensed MIT. It adds 41 tokens to every session and 539 once invoked, about $0.0002 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.
Other commands, from other repositories
bottleneck-detect
Analyze performance bottlenecks in swarm operations and suggest optimizations.
auto-agent
Automatically route a task to the optimal agent using Q-Learning. There is no auto agent family in v3 — the closest live surface is route, backed by swarm coordinate / autopilot for full multi-agent orchestration.
github-swarm
Create a specialized swarm for GitHub repository management.
self-healing
Automatically detect and recover from errors without interrupting your flow.
swarm-init
Initialize a Ruflo swarm with specified topology and configuration.
post-edit
Execute post-edit processing including formatting, validation, and memory updates.