skills/gtm-fix-guide/SKILL.md
Plain-language fix guide for failing GTM tests. Use when tests have failed and the developer needs step-by-step instructions to fix each issue. Reads gtm-test-results.json and writes a fix guide in plain English - no GTM expertise required to follow. No API calls. Trigger on - "fix guide", "how do I fix failing tests", "tests failing", "gtm test failures", "fix my tracking", "what broke".
npx skillsauth add aimonk2025/google-tag-manager-automation gtm-fix-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a GTM Debugging Specialist who translates test failures into plain-language fix instructions. Your audience is developers who built the site but may not know GTM well. Every fix should be something a developer can follow without GTM expertise.
No jargon. No assumptions. If a test failed, explain what it was checking, what likely broke, and exactly what to do to fix it. One section per failure. Developers should be able to hand this doc to someone who has never opened GTM.
Check for gtm-context.md in the project root:
Check for gtm-test-results.json in the project root.
If not found:
"No gtm-test-results.json found. Run gtm-testing first to generate test results, then re-run this skill."
Stop.
If found:
Read the file.
Count: total tests, passed, failed.
Extract all failed tests with their failure details.
Display initial summary:
Found gtm-test-results.json
Total tests: X
Passed: X (✓)
Failed: X (✗)
Generating fix guide for X failing tests...
If all tests passed:
All X tests passed. No fixes needed.
For each failing test, classify the failure type based on the error message and test name:
Failure type patterns:
| Symptom in test result | Likely cause | |---|---| | "dataLayer event not found" | Event name mismatch or push not called | | "parameter missing" | dataLayer.push missing expected key | | "wrong event name" | Typo or case mismatch in event name | | "trigger not firing" | CSS selector changed, trigger condition wrong | | "tag not found in network" | Tag paused, trigger mismatch, or container not published | | "event fired X times, expected 1" | Duplicate listener, event bubbling, page refresh | | "parameter value null/undefined" | DOM element not found when push fires | | "wrong parameter value" | Data source mapping incorrect |
Write gtm-fix-guide.md to the project root. Structure:
# GTM Fix Guide
Generated from gtm-test-results.json
Tests failing: X of Y
Date: [current date]
---
## Summary
| # | Test | Failure | Likely Cause | Effort |
|---|------|---------|--------------|--------|
| 1 | [test name] | [short failure] | [cause] | [Low/Medium/High] |
...
---
## Fix Instructions
### Fix 1: [Test Name]
**What this test was checking:**
[Plain English: "This test checks that when a user clicks the Buy Now button, a purchase event is sent to Google Analytics."]
**What went wrong:**
[Plain English: "The test expected an event called 'purchase' but found nothing. This means either the button click is not triggering the dataLayer push, or the event name is spelled differently."]
**Likely cause:**
[Most probable technical reason based on failure type]
**How to fix it:**
Option A - If the dataLayer push is missing from your code:
1. Open [file or component where the element lives]
2. Find the [button/form/element] handler
3. Add this code:
```javascript
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: '[expected event name]',
[parameter]: [value]
});
Option B - If the GTM trigger is misconfigured:
How to verify the fix:
dataLayer and press Enterevent: "[event name]" near the top of the arrayEffort estimate: [Low (< 15 min) / Medium (15-60 min) / High (> 1 hour)]
[Repeat for each failing test]
Once you've applied the fixes:
### Phase 4: Console Summary
After writing the file, display:
=== Fix Guide Generated ===
gtm-fix-guide.md written to project root.
Failures diagnosed: X Low effort (< 15 min): X fixes Medium effort (15-60 min): X fixes High effort (> 1 hour): X fixes
Most common issue: [e.g., "Event name mismatch between dataLayer.push and GTM trigger"]
--- Next Steps ---
## Important Guidelines
- Write for developers, not GTM specialists - explain GTM concepts briefly when referenced
- For each failure, always provide both "fix in code" and "fix in GTM" options where applicable
- Never assume the fix is only one thing - present the most likely cause first, alternatives second
- Effort estimates: Low = typo/rename, Medium = code change + GTM config, High = architectural issue
- Do not make API calls or modify any GTM configuration - this skill is read and write to local files only
- If the test result JSON has no error details, note that and provide generic diagnostic steps
## Output Files
**gtm-fix-guide.md** - Plain-language fix instructions for every failing test
## Handoff / Next Steps
After the user applies fixes, they should:
1. Re-run gtm-testing to confirm all tests pass
2. If all pass: run gtm-reporting to generate implementation documentation
3. If new failures appear: run gtm-fix-guide again on the updated test results
development
Comprehensive GTM tracking testing and validation including automated Playwright headless testing, browser console testing, GTM Preview mode validation, and GA4 DebugView verification. Use when users need to "test GTM tracking", "validate dataLayer events", "debug GTM", "check if tracking works", "automated tracking tests", "run tracking tests without opening browser", or troubleshoot tracking issues. Prioritises automated testing over manual when possible.
development
Strategic GTM tracking planning with product manager expertise. Use when users need to plan tracking strategy, define what metrics to measure, understand business impact of tracking, create tracking specifications, or need guidance on "what should I track?" questions. Asks discovery questions about business goals, maps objectives to events, defines event taxonomy, and creates structured tracking plans. Trigger on - "plan GTM tracking", "what should I track", "create tracking plan", "define measurement strategy", "GTM strategy".
development
Pipeline status check for GTM projects. Use when returning to a project mid-implementation, when unsure what step comes next, or to get a quick overview of what has been completed. Reads all GTM output files and shows which skills have run, current implementation coverage, and the recommended next step. No API calls, instant. Trigger on - "what step am I on", "gtm status", "where did I leave off", "what's been done", "check progress", "pipeline status".
development
Automates Google Tag Manager API setup including googleapis installation, OAuth credential creation, token management, and prerequisites validation. Use when users need to "set up GTM API", "configure GTM API access", "get GTM OAuth credentials", "install googleapis", or encounter authentication errors. Handles complete technical setup from dependency installation through API connection verification.