.agents/skills/triage/fix.md
Develop and verify a fix for a diagnosed Astro bug.
CRITICAL: You MUST always read report.md and append to report.md before finishing, regardless of outcome. Even if the fix attempt fails, you encounter errors, or you cannot resolve the bug — always update report.md with your findings. The orchestrator and downstream skills depend on this file to determine what happened.
SCOPE: Do not spawn tasks/sub-agents.
These variables are referenced throughout this skill. They may be passed as args by an orchestrator, or inferred from the conversation when run standalone.
triageDir — Directory containing the reproduction project (e.g. triage/issue-123). If not passed as an arg, infer from previous conversation.issueDetails - The GitHub API issue details payload. This must be provided explicitly by the user or available from prior conversation context / tool calls. If this data isn't available, you may run gh issue view ${issue_number} to load the missing issue details directly from GitHub.report.md — File in triageDir that MAY exist. Contains the full context from all previous skills.withastro/compiler repo MAY be cloned at .compiler/ (inside the repo root, gitignored). If it exists and the root cause is in the compiler, investigate and propose fixes there. This clone is reference only — it is not wired into the monorepo's dependencies, so compiler changes cannot be tested end-to-end here. Document proposed compiler changes and diff in report.md instead.report.mdpackages/report.mdRead report.md from the triageDir directory to understand:
Skip if prerequisites unmet: Check report.md: If bug not reproduced/skipped OR diagnosis confidence is low/null OR no root cause found → append "FIX SKIPPED: [reason]" to report.md and return fixed: false.
Note: The repo may be messy from previous steps. Check git status and either work from the current state or git reset --hard to start clean.
Consider your potential fixes and verify that any modern features you plan to use are supported:
>=22.12.0.Make changes in packages/ source files. Follow these principles:
Keep it minimal:
Consider edge cases:
Example fix:
// Before (in packages/astro/src/core/render/component.ts)
export function renderComponent(component: AstroComponent, props: Props) {
const html = renderToString(component, props);
return html;
}
// After
export function renderComponent(component: AstroComponent, props: Props) {
// Skip SSR for client:only components
if (props['client:only']) {
return `<astro-island client="only" component-url="${component.url}"></astro-island>`;
}
const html = renderToString(component, props);
return html;
}
After making changes, rebuild the affected package:
pnpm -C packages/astro build # or packages/integrations/<name>
Watch for build errors — fix any TypeScript issues before proceeding.
Re-run the reproduction, often using pnpm run build/astro build or pnpm run dev/astro dev.
Test that you didn't break anything new, and that normal cases still work. If you find regressions, refine the fix to handle all cases.
From the repository root, generate the diff:
git diff packages/
This captures all your changes for the report.
Append your fix details to the existing report.md (written by reproduce and diagnose skills).
Include a new section with: what you changed, why, the full git diff, verification results, and any tradeoffs or alternative approaches considered.
The report must include all information needed for a final GitHub comment to be generated later by the comment skill. Make sure to include:
git status and review all changed filesconsole.logs, or temporary test filespackages/ that were only needed for diagnosis/reproductiongit checkout -- <file> to discard unwanted changesgit status that only the intended fix files remainThe triage/ directory is already gitignored, so it won't appear in git status.