fix
Skill4 starsChanged 57 days agoMITView on GitHub
End-to-end Magento 2 bug-fix workflow. Use when the user reports a defect, error, crash, exception, unexpected behaviour, or regression in an existing module. Requires user approval at the RCA gate before any code change. Calls magento2-tools:review, and magento2-tools:deploy only when authorized. Accepts a diagnosed finding via --from-finding=<report.json>#<id>; magento2-tools:remediate then owns the gate (plans: magento2-tools:triage on a magento2-tools:audit report).
44 other projects use a version of this.
Adopted by
Most recently taken up by
- crbnos/carbontheir own version, first seen Oct 4, 2026
- kapadias/nonnatheir own version, first seen Oct 1, 2026
- with-pebbly/aseprite-ai-artisttheir own version, first seen Oct 1, 2026
- shapito27/aeotester-site-audittheir own version, first seen Sep 30, 2026
- eliphazbouye/skillstheir own version, first seen Sep 30, 2026
- oderajoseph95/Claude-Intercom-HelpCenter-Article-Writertheir own version, first seen Sep 28, 2026
Used with
Projects with it also use pr-creator, frontend-code-review and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkillpr-creator
Also in 3 projects that use this
DauQuangThanhSkillfrontend-code-review
Conducts comprehensive frontend code reviews including React/Vue/Angular component analysis, TypeScript/JavaScript quality assessment, CSS/styling review, performance optimization, accessibility compliance, security vulnerabilities, and best practices validation. Produces detailed review reports with specific issues, severity ratings, and actionable recommendations. Use when reviewing frontend code, analyzing React/Vue/Angular components, checking JavaScript/TypeScript quality, validating CSS/SCSS, assessing web performance, or when users mention "review frontend code", "check React components", "analyze JavaScript", "review TypeScript", "validate accessibility", or "frontend code quality".
Also in 3 projects that use this
Microsoft AzureSkilltest
Also in 10 projects that use this
MicrosoftSkillmerge
Merge changes from the topic branch to the merge base branch. Use when the user wants to merge their session's work back to the base branch.
Also in 3 projects that use this
GitHubSkillrefactor
Surgical code refactoring to improve maintainability without changing behavior. Covers extracting functions, renaming variables, breaking down god functions, improving type safety, eliminating code smells, and applying design patterns. Less drastic than repo-rebuilder; use for gradual improvements.
Also in 6 projects that use this
BlockSkillplan
Draft a TDD, PRD, or lightweight plan in the conversation without committing it.
Also in 10 projects that use this
Other versions44 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 44
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- crbnos/carbon★ 2.7ksame name
- GoogleCloudPlatform/magic-modules★ 973same name
- kdlbs/kandev★ 899same name
- automagik-dev/genie★ 345same name
- genkovich/sdd★ 170same name
- jvm-skills/jvm-skills★ 140same name
- avibebuilder/claude-prime★ 120same name
- Towow-ai/Flowness★ 105same name
- The01Geek/prflow★ 99same name
34 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository35 other files it gives its agents.
- a11y-auditSkill
- admin-formSkill
- admin-listingSkill
- auditSkill
- breeze-adaptSkill
- breeze-compatSkill
- breeze-themeSkill
- cli-commandSkill
- contextSkill
- data-migrationSkill
- debugSkill
- deploySkill
- docsSkill
- eav-attributeSkill
- extension-pointSkill
- featureSkill
- frontendSkill
- graphqlSkill
- i18nSkill
- indexerSkill
- lintSkill
- marketplaceSkill
- message-queueSkill
- module-createSkill
- perf-auditSkill
- releaseSkill
- remediateSkill
- reviewSkill
- securitySkill
- system-configSkill
- test-generateSkill
- triageSkill
- upgradeSkill
- webapiSkill
- widgetSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. 0 are common, 10 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 36 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 28
One approval gate: Do not change any production code until the user approves the root cause + proposed fix in Phase 3.
- Distinctive: line 38
Regression test required, with two narrow waivers: Every bug fix produces a test that fails before the fix and passes after.
- Distinctive: line 44
No scope expansion: If reproduction or RCA reveals additional bugs, file them as separate tasks rather than expanding the current fix.
- Distinctive: line 46
Reproduce first: If the bug can't be reproduced after 2 attempts, stop and report "cannot reproduce" with all evidence collected.
- Very specific: line 64
Output budget: Follow context/references/output-budget.md — targeted reads, summary-first test/lint output, long logs to files.
- Distinctive: line 127
Run the reproduction (or hand it to the user if it requires interactive auth).
- Very specific: line 129
If a live reproduction fails twice, do not immediately give up: attempt to encode the defect as a failing automated test straight from the …
- Very specific: line 143
Follow the stack trace from the entry point through the module(s).
- Distinctive: line 154
Read the surrounding code, git blame, and recent commits.
- Very specific: line 155
Write the RCA per references/rca-format.md:
- Very specific: line 174
Write the test first (RED): Add the test under {ctx.magento_root}/app/code/{Vendor}/{Module}/Test/Unit/...
- Distinctive: line 181
Run the test. Confirm it fails for the right reason — the assertion must fail with the bug's symptom, not a setup error, fatal, or …
- Distinctive: line 187
Run the test. Confirm it passes.
- Very specific: line 188
Run the full test suite for the affected module, then the project's static checks ({ctx.tools} — PHPCS/PHPStan).
- Distinctive: line 191
Apply the shared module-hygiene baseline (required): After modifying or adding PHP files (the patch and the new regression test), run
- Very specific: line 213
Commit each review-fix as [bug-fix] {Module}: review fix - {finding}.
- Very specific: line 217
If user authorizes deploy: invoke deploy --env={target}.
- Distinctive: line 218
After deploy, re-run the original reproduction recipe.
- Very specific: line 219
If smoke fails after deploy, follow deploy's rollback recipe and report.
- Very specific: line 250
Never edit vendor/ or vendor/magento/ — fix via a plugin/observer in a project module.
“Common” is measured: kept by at least 6 in 10 of the 36 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Magento 2 Bug Fix
Surgical defect remediation. The user describes a bug; this skill drives reproduction, root-cause analysis, the minimal fix, a regression test, and review across eight phases (Phase 0 setup, then Phases 1–7).
Core Rules
- TDD is the preferred approach. Implement every fix test-first (red → green →
refactor): write the failing regression test, watch it fail for the right reason, then
write the minimal production code to make it pass. The test encodes the reproduction;
the patch exists only to turn it green. Reach for a non-TDD flow only when the bug is
genuinely untestable (see the regression-test rule below), and document why.
The shared red → green → refactor loop and the behaviour/boilerplate line live in
context/references/tdd-discipline.md— this skill applies it to defect remediation. - One approval gate. Do not change any production code until the user approves the root cause + proposed fix in Phase 3.
- Report-driven entry.
--from-finding=<report.json>#<finding-id>pre-fills Phases 1–2 from a finding that is already diagnosed, and delegates the Phase 3 approval to the calling orchestrator when one is present. It skips the interrogation, never the discipline — TDD, minimal change, and the mandatory regression test all still apply. A finding whoseconfidenceis notconfirmedmust be confirmed by reading its evidence before any test is written. Seereferences/from-finding.md. - Minimal change. The diff must affect only what the bug demands. No surrounding cleanup. No refactor. No "while we're here" edits.
- Regression test required, with two narrow waivers. Every bug fix produces a test that fails before the fix and passes after. The only exceptions are (a) a bug that is provably untestable (e.g. a third-party gateway outage — and most "untestable" bugs are actually testable with a clock injection or a mock, so push back first), and (b) a purely config/XML change validated by XSD instead. Either waiver must be recorded in the RCA and confirmed by the user before the fix lands.
- No scope expansion. If reproduction or RCA reveals additional bugs, file them as separate tasks rather than expanding the current fix.
- Reproduce first. If the bug can't be reproduced after 2 attempts, stop and report "cannot reproduce" with all evidence collected.
- Never edit vendor/. Fix in a project module via plugin/observer/preference. Editing
vendor/magento/or any third-party module is forbidden. - Per-task commits. Each phase that modifies files commits independently with the
[bug-fix]prefix. Seereferences/commit-format.md. - Coding style. Patched/added PHP follows PER-CS 3.0 as the baseline, with the Magento 2
coding standard taking precedence on any conflict;
--standard=Magento2PHPCS is the gate. Seecontext/references/php-coding-style.md. (Stay within the minimal-change rule — do not restyle surrounding code.) - Process surface is owned — don't defer it. The reproduce → root-cause → fix loop
(Phases 1–3) and the test-first discipline (Phase 4) are domain-tuned, owned surfaces. Do not
route them through a generic process skill (
superpowers:systematic-debugging,superpowers:test-driven-development) and do not replace the Phase 5 review with a generic one — each duplicates owned work and lacks the Magento specifics (log paths, stack-trace frames, ACL/escaping/EQP). Unlikefeature, bug-fix has no sanctioned defer-if-present hand-wave — it is surgical and single-threaded, so there is nothing to defer. The governing policy and the reasons are incontext/references/process-skills.md. - Output budget. Follow
context/references/output-budget.md— targeted reads, summary-first test/lint output, long logs to files. - After a context compaction, re-read the reference for the phase in progress before continuing.
Workflow
Phase 0 — Context Resolution
Invoke context. Capture {ctx.vendor}, {ctx.runner}, {ctx.magento_cli},
{ctx.magento_root}, {ctx.tools}. If magento_cli is null, reproduction Phase 2 will
be limited to static log analysis — note this up-front.
Then ensure work happens on a dedicated branch. If the current branch is the default
(main) or a detached HEAD, create bugfix/{slug} before any commit. All per-phase
commits land on that branch; the skill never pushes (see references/commit-format.md).
Phase 1 — Collect
Goal: have enough information to attempt reproduction.
- Parse the user's bug description.
- With
--from-finding: skip this question batch entirely — the finding supplies symptom, scope, severity andfile:lineevidence. Record the source report path and finding id in the collection notes, then go to step 3. Otherwise, ask for any of the following that's missing (one batch — do not interrupt later):- Symptom: visible failure?
- Trigger: action that causes it?
- Scope: customer-facing / admin / REST / GraphQL / cron / queue / CLI?
- Environment: production / staging / local; Magento version; module list.
- Error: exact error message or stack trace.
- First seen: date / commit / deploy.
- Pull relevant log files. With
--from-finding, do this only when the finding's category is runtime-class (controllers,cron,queue,api,graphql-auth,n_plus_one,slow_query); a purely static finding has nothing invar/logto find. Defaults (resolved against{ctx.magento_root}):var/log/system.logvar/log/exception.logvar/log/debug.logvar/report/**— recursive, includingvar/report/api/. A report file is often the ONLY record:Webapi\ErrorProcessor::apiShutdownFunction()writesvar/report/api/{id}on a PHP fatal with no logger call at all.- Any module-specific log mentioned in the symptom (
ls -t var/log/*.log | head).
- Grep logs for the symptom signature. When the user says "the error is not in the logs",
treat that as a routing fact, not a dead end:
exception.logreceives a record only whencontext['exception']is set, so string-level criticals (e.g. the ObjectManager'sType Error occurred when creating object: …) are insystem.loginstead. Seedebug/references/log-locations.md§"What to Search When the Symptom Is 'No Log Entry'".
Save the initial collection notes to {output_root}/bug-fixes/{slug}/collect.md.
Phase 2 — Reproduce
Goal: make the failure happen deterministically.
With --from-finding: the finding's verification string plus its file:line evidence
is the reproduction, and the 2-attempt live-reproduction rule below does not apply —
a statically derived finding has no runtime recipe to attempt, and demanding one yields a
spurious "cannot reproduce" for a defect whose evidence is sitting in the file. Go straight
to encoding it as the failing test in Phase 4 (step 5 below already sanctions this route).
See references/from-finding.md.
- Identify the entry point (URL / CLI / cron job / queue topic).
- Build the minimal reproduction recipe — see
references/reproduction-patterns.md. - Run the reproduction (or hand it to the user if it requires interactive auth).
- Capture the failure output and any new log entries.
- If a live reproduction fails twice, do not immediately give up: attempt to encode
the defect as a failing automated test straight from the stack trace and RCA evidence
(inject a clock, mock the third party — see
references/regression-test-patterns.md). A failing test is itself a valid reproduction. Only report "cannot reproduce" when neither a live recipe nor a failing test can be produced.
The runtime recipe is scaffolding to find the failing assertion; the regression test
written in Phase 4 is the durable reproduction artifact. Save the recipe to
{output_root}/bug-fixes/{slug}/reproduction.md.
Phase 3 — Root-Cause Analysis (APPROVAL GATE)
Goal: locate the exact code line(s) responsible.
- Follow the stack trace from the entry point through the module(s). See
references/stack-trace-reading.mdfor tips on plugin/observer/preference frames. Inagentsmode (--agentsflag, orexecution_modein.claude/m2.jsonsurfaced as{ctx.execution_mode}— selection contract incontext/references/execution-modes.md), delegate this path-tracing to the read-onlyexploreragent and work from its comprehension map; default is auto (agentswhen the plugin's context-budget hook reports this conversation above its threshold,inlineotherwise). The RCA approval gate below always runs in the main conversation, in either mode. - For each frame: is the call legitimate? Does it return the expected value?
- Identify the first frame where behaviour diverges from intent.
- Read the surrounding code,
git blame, and recent commits. - Write the RCA per
references/rca-format.md:- Defect location:
file:line - Defect description: what's wrong, in plain English
- Why: history (last-touched commit, original intent)
- Proposed fix: minimal change description (do not write code yet)
- Regression test plan: which test class, what assertion
- Defect location:
- Save RCA to
{output_root}/bug-fixes/{slug}/rca.md. - Present RCA. Wait for explicit approval ("proceed", "yes", "approved").
Exception — invoked by
remediate: the RCA is still written, but the approval is delegated upward: it is included in the batch presentation and the caller takes ONE approval for the whole batch, then this skill proceeds without re-prompting per finding. This mirrors the carve-outreviewalready documents for skill-to-skill invocation. Invoked standalone,--from-findingkeeps this gate.
Phase 4 — Patch + Regression Test (TDD)
Goal: minimal patch + a test that fails before, passes after. Follow red → green → refactor.
- Write the test first (RED). Add the test under
{ctx.magento_root}/app/code/{Vendor}/{Module}/Test/Unit/...(orTest/Integration/...if the bug requires DB state). Prefer appending atestRegression{Behaviour}()method to the module's existing test class for that subject; create a new file only when none exists. Follow the location and naming convention inreferences/regression-test-patterns.mdand start from the matchingtemplates/regression-test-*.phpskeleton. - Run the test. Confirm it fails for the right reason — the assertion must fail with the bug's symptom, not a setup error, fatal, or missing-class error. If the test passes before any fix, the test does not capture the bug or the RCA is wrong: stop and return to Phase 3 before writing any production code.
- Apply the minimal patch (GREEN). Write only the code needed to satisfy the failing assertion — no more.
- Run the test. Confirm it passes.
- Run the full test suite for the affected module, then the project's static checks
(
{ctx.tools}— PHPCS/PHPStan). Confirm no other tests broke and the patch is clean (REFACTOR: tidy only the lines you touched, keeping the test green). - Apply the shared module-hygiene baseline (required). After modifying or adding PHP
files (the patch and the new regression test), run
${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/add-license-headers.sh {ctx.magento_root}/app/code/{Vendor}/{Module} {Vendor}to stamp the standard copyright header onto every new.php(idempotent — it skips files that already carry it, so existing patched files are left as-is). On the rare occasion the fix adds acomposer.jsonrequireentry, resolve a bounded constraint via${CLAUDE_PLUGIN_ROOT}/skills/context/scripts/resolve-dep-constraint.sh <vendor/package>— never"*". Seecontext/references/module-hygiene.md. - Commit per
references/commit-format.md:[bug-fix] {Module}: {symptom} RCA: {output_root}/bug-fixes/{slug}/rca.md Files: {list}
Phase 5 — Review
- Invoke
review --diffon each modified module. - Fix any new Critical/High findings introduced by the patch (do not silently leave them — they would re-introduce risk on top of the bug fix).
- Re-run tests after each fix.
- Commit each review-fix as
[bug-fix] {Module}: review fix - {finding}.
Phase 6 — Deploy (Optional)
- If user authorizes deploy: invoke
deploy --env={target}. - After deploy, re-run the original reproduction recipe. Assert success.
- If smoke fails after deploy, follow
deploy's rollback recipe and report.
Phase 7 — Report
Save report per templates/report.md to {output_root}/bug-fixes/{slug}/report.md:
- Symptom
- Reproduction recipe (path)
- Root cause (link to RCA)
- Fix description + files changed
- Regression test path
- Review findings remediated
- Deploy result (if Phase 6 ran)
- Severity classification
Optional: open a PR. Same shape as feature PR step.
Bug Classification
Classify at the start of Phase 7 (do not let classification gate Phase 6 — the fix is already in):
| Class | Definition | Default deploy timing |
| Critical | Production down, data loss, security breach | Immediate |
| High | Major functional break on common path | Next deploy window |
| Medium | Edge case with workaround | Bundled with next feature deploy |
| Low | Cosmetic / minor inconvenience | Discretionary |
Edge Cases
Never edit vendor/ or vendor/magento/ — fix via a plugin/observer in a project module. A schema change (db_schema.xml) stops the fix and redirects to feature --mode=extend; a data repair stays in-skill via data-migration.
Read references/edge-cases.md from Phase 1 onward (cases: vendor/core bug, multi-module, cannot reproduce, schema, data repair, config-only).
Inputs
/fix "<bug description>"Optional flags:
--from-finding=<report.json>#<finding-id>— take the defect from an existing findings document (schemaVersion≥ 1.1) instead of a user description. Seereferences/from-finding.md.--module=<Vendor>_<Module>— constrain RCA to a single module.--log=<path>— additional log file beyond the defaults.--no-deploy— skip Phase 6.--severity=critical|high|medium|low— pre-classify.--docs-root=<path>— output-root override; see "Output root" below.
Outputs
{output_root}/bug-fixes/{slug}/ # {fingerprint-short} under --from-finding
├── collect.md # Phase 1 evidence
├── reproduction.md # Phase 2 recipe
├── rca.md # Phase 3 RCA
└── report.md # Phase 7 final report{output_root} defaults to .docs ({ctx.docs_root}), anchored at the project root, never
under {ctx.magento_root}, app/code, or a module dir. See the Artifact location rule in
context/SKILL.md.
Output root (--docs-root)
This skill accepts --docs-root=<path> (see
context/references/artifact-layout.md). When set, write the run report (and any
report artifacts) under <path>/bug-fixes/; otherwise default to
{ctx.docs_root}/bug-fixes/. feature passes this so a feature run's
reports collect under its folder. The dossier root for a given fix is
{output_root}/bug-fixes/{slug}/.
Plus per-task git commits per references/commit-format.md.
Reference Files
references/edge-cases.md— edge-case behaviour table (vendor/core bug, multi-module, cannot reproduce, schema/data/config-only).references/log-targets.md— bug-fix log-collection specifics; defers to the shareddebug/references/log-locations.mdfor the canonical log-path catalogue.references/reproduction-patterns.md— HTTP / CLI / cron / queue / GraphQL recipes.references/stack-trace-reading.md— how to follow a Magento stack trace through plugins.references/from-finding.md— report-driven entry: the phase deltas, what is NOT relaxed, the delegated approval gate, and the fingerprint-keyed dossier.references/rca-format.md— RCA document structure and required sections.references/regression-test-patterns.md— patterns by bug class (DI, plugin, observer, query, controller).references/deferred-bugs.md— when to file a new bug vs expand current scope.references/commit-format.md—[bug-fix]commit message format.
Templates
templates/rca.mdtemplates/report.mdtemplates/regression-test-unit.phptemplates/regression-test-integration.phptemplates/regression-test-controller.php
Related Skills
| Phase | Skill |
| 0 | context |
| 4 | data-migration (only when the fix is a data repair) |
| 5 | review (with --diff) |
| 6 | deploy (if user authorizes) |
| (alternative) | debug — when reproduction fails and you need to investigate logs/DI graph |
This skill does not invoke module-create (no new modules) or
feature (different shape).
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.

