Rsdoctor Analysis Assistant Skill
Use the Rsdoctor Agent SDK CLI (rsdoctor-agent) to read rsdoctor-data.json and provide evidence-based optimization recommendations.
Response order (required): High-Priority Issues -> Reference Chain Traceability -> Proposed Solutions -> Next Deep-Dive Analysis.
Guardrails
- Default behavior is read-only analysis.
- Do not modify user code/config except these explicit cases:
install: install@rsdoctor/rspack-pluginor@rsdoctor/webpack-plugin, and updatepackage.json.config: add Rsdoctor plugin config to supported config files.
- Optional verification workflow (only with user confirmation):
- If the goal is to validate optimization impact, you may adjust
splitChunksand re-run build to compare results. - Ask for user confirmation before modifying
splitChunksand before re-running build.
- If the goal is to validate optimization impact, you may adjust
- In Codex, do not run
installorbuildinside sandbox. - For all analysis commands, provide recommendations only. Do not auto-apply optimization edits.
Stable CLI Entry
- CLI entry:
rsdoctor-agent ai <group> <subcommand> [options]
- Command format:
<group> <subcommand> [--option value] --data-file <path> [--compact]
- Global options:
--data-file <path>(required)--compact(optional)
Workflow
- Verify prerequisites:
- Node.js 18+
@rsdoctor/rspack-plugin >= 1.1.2(Rspack ecosystem) or@rsdoctor/webpack-plugin >= 1.1.2(Webpack)
- Locate
rsdoctor-data.json:- Common paths:
dist/rsdoctor-data.json,output/rsdoctor-data.json,static/rsdoctor-data.json,.rsdoctor/rsdoctor-data.json
- Common paths:
- If
rsdoctor-data.jsonis missing:- Configure plugin first:
- Rspack/Rsbuild/Rslib/Rspress/Modern.js: reference/install-rsdoctor-rspack.md
- Webpack: reference/install-rsdoctor-webpack.md
- Required plugin output:
disableClientServer: trueoutput.mode: 'brief'output.options.type: ['json']
- Auto-generate file by running:
RSDOCTOR=true npm run build(or pnpm/yarn equivalent)- In Codex, do not run this build in sandbox.
- Configure plugin first:
- Run analysis commands:
- Path query: run
modules by-path, thenmodules by-idif multiple matches. - Other queries: run target command directly.
- Path query: run
- Synthesize and output in required response format.
- Optional optimization verification (only if user confirms):
- Update
splitChunksaccording to agreed optimization plan. - Rebuild with
RSDOCTOR=true npm run build(or pnpm/yarn equivalent) outside sandbox in Codex. - Re-run the same analysis commands and compare before/after results.
- Update
Command Coverage
- Covered groups:
chunks,modules,packages,assets,loaders,build,bundle,errors,rules,server,tree-shaking
- Full command map is in:
Response Format
- High-priority issues in current build data:
- Include concrete evidence (size/time/count/path/rule code).
- Whether reference chains can be traced:
- For example, duplicate packages should include import/reference chain findings when available.
- If not available, explicitly state what is missing.
- Proposed solutions:
- Provide actionable recommendations with priority (High/Med/Low).
- Whether deeper analysis is still needed:
- List remaining gaps and the next command/step to close each gap.
Formatting:
- For Top-N insights, prefer a table:
Name | Volume/Time | Count | Recommendation. - For large output, use
--compact.
Troubleshooting
rsdoctor-data.jsonmissing:- Configure plugin and run
RSDOCTOR=true npm run build.
- Configure plugin and run
- Command not found:
- Verify
@rsdoctor/agent-cliis globally linked andrsdoctor-agentis inPATH.
- Verify
- Build/install blocked in sandbox:
- Re-run outside sandbox.
- JSON read error:
- Verify file path, JSON validity, and permissions.