@respira/wordpress-mcp-server 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/acf-tools.d.ts +0 -10
  2. package/dist/acf-tools.d.ts.map +1 -1
  3. package/dist/acf-tools.js +0 -15
  4. package/dist/acf-tools.js.map +1 -1
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +31 -36
  7. package/dist/config.js.map +1 -1
  8. package/dist/server.d.ts +0 -47
  9. package/dist/server.d.ts.map +1 -1
  10. package/dist/server.js +404 -462
  11. package/dist/server.js.map +1 -1
  12. package/dist/wordpress-client.d.ts +26 -29
  13. package/dist/wordpress-client.d.ts.map +1 -1
  14. package/dist/wordpress-client.js +115 -148
  15. package/dist/wordpress-client.js.map +1 -1
  16. package/package.json +2 -2
  17. package/skills/activity-report-composer/README.md +38 -0
  18. package/skills/activity-report-composer/SKILL.md +167 -0
  19. package/skills/activity-report-composer/metadata.json +42 -0
  20. package/skills/brand-voice-synthesizer/README.md +43 -0
  21. package/skills/brand-voice-synthesizer/SKILL.md +259 -0
  22. package/skills/brand-voice-synthesizer/metadata.json +46 -0
  23. package/skills/build-oxygen6-page/SKILL.md +59 -0
  24. package/skills/conversion-audit/README.md +37 -0
  25. package/skills/conversion-audit/SKILL.md +185 -0
  26. package/skills/conversion-audit/metadata.json +46 -0
  27. package/skills/custom-post-type-architect/README.md +34 -0
  28. package/skills/custom-post-type-architect/SKILL.md +158 -0
  29. package/skills/custom-post-type-architect/metadata.json +39 -0
  30. package/skills/design-system-synthesizer/README.md +46 -0
  31. package/skills/design-system-synthesizer/SKILL.md +395 -0
  32. package/skills/design-system-synthesizer/metadata.json +57 -0
  33. package/skills/figma-to-elementor/SKILL.md +204 -0
  34. package/skills/html-to-bricks/README.md +43 -0
  35. package/skills/html-to-bricks/SKILL.md +135 -0
  36. package/skills/html-to-bricks/metadata.json +41 -0
  37. package/skills/internal-link-builder/SKILL.md +258 -0
  38. package/skills/internal-link-builder/metadata.json +46 -0
  39. package/skills/migrate-beaver-builder-to-bricks/SKILL.md +251 -0
  40. package/skills/migrate-beaver-builder-to-gutenberg/SKILL.md +248 -0
  41. package/skills/migrate-brizy-to-gutenberg/SKILL.md +248 -0
  42. package/skills/migrate-divi-to-breakdance/SKILL.md +312 -0
  43. package/skills/migrate-divi-to-bricks/SKILL.md +321 -0
  44. package/skills/migrate-divi-to-gutenberg/SKILL.md +328 -0
  45. package/skills/migrate-elementor-to-breakdance/SKILL.md +287 -0
  46. package/skills/migrate-elementor-to-bricks/SKILL.md +289 -0
  47. package/skills/migrate-elementor-to-gutenberg/SKILL.md +327 -0
  48. package/skills/migrate-elementor-to-oxygen/SKILL.md +300 -0
  49. package/skills/migrate-oxygen-to-breakdance/SKILL.md +235 -0
  50. package/skills/migrate-oxygen-to-bricks/SKILL.md +237 -0
  51. package/skills/migrate-thrive-architect-to-gutenberg/SKILL.md +257 -0
  52. package/skills/migrate-visual-composer-to-gutenberg/SKILL.md +261 -0
  53. package/skills/migrate-wpbakery-to-bricks/SKILL.md +336 -0
  54. package/skills/migrate-wpbakery-to-gutenberg/SKILL.md +345 -0
  55. package/skills/mobile-experience-report/SKILL.md +719 -0
  56. package/skills/mobile-experience-report/telemetry.ts +137 -0
  57. package/skills/page-template-library/README.md +41 -0
  58. package/skills/page-template-library/SKILL.md +175 -0
  59. package/skills/page-template-library/metadata.json +44 -0
  60. package/skills/prime-the-agent/README.md +49 -0
  61. package/skills/prime-the-agent/SKILL.md +225 -0
  62. package/skills/prime-the-agent/metadata.json +46 -0
  63. package/skills/respira-setup-assistant/SKILL.md +386 -0
  64. package/skills/respira-setup-assistant/metadata.json +36 -0
  65. package/skills/seo-aeo-amplifier/README.md +61 -0
  66. package/skills/seo-aeo-amplifier/SKILL.md +277 -0
  67. package/skills/seo-aeo-amplifier/metadata.json +62 -0
  68. package/skills/stale-content-detector/README.md +41 -0
  69. package/skills/stale-content-detector/SKILL.md +156 -0
  70. package/skills/stale-content-detector/metadata.json +43 -0
  71. package/skills/technical-debt-audit/SKILL.md +691 -0
  72. package/skills/technical-debt-audit/telemetry.ts +142 -0
  73. package/skills/woocommerce-health-check/SKILL.md +719 -0
  74. package/skills/woocommerce-health-check/telemetry.ts +137 -0
  75. package/skills/wordpress-ai-image-optimizer/README.md +49 -0
  76. package/skills/wordpress-ai-image-optimizer/SKILL.md +232 -0
  77. package/skills/wordpress-ai-image-optimizer/metadata.json +63 -0
  78. package/skills/wordpress-site-dna/README.md +81 -0
  79. package/skills/wordpress-site-dna/SKILL.md +669 -0
  80. package/skills/wordpress-site-dna/telemetry.ts +137 -0
  81. package/dist/__tests__/acf-tool-routing.test.d.ts +0 -2
  82. package/dist/__tests__/acf-tool-routing.test.d.ts.map +0 -1
  83. package/dist/__tests__/acf-tool-routing.test.js +0 -37
  84. package/dist/__tests__/acf-tool-routing.test.js.map +0 -1
  85. package/dist/__tests__/cowork-bootstrap.test.d.ts +0 -2
  86. package/dist/__tests__/cowork-bootstrap.test.d.ts.map +0 -1
  87. package/dist/__tests__/cowork-bootstrap.test.js +0 -61
  88. package/dist/__tests__/cowork-bootstrap.test.js.map +0 -1
@@ -0,0 +1,691 @@
1
+ # Technical Debt Audit
2
+
3
+ **Version:** 1.2.0
4
+ **Updated:** 2026-06-30
5
+ **Freshly updated:** v1.2.0 turns the audit into safe, reversible cleanup. Every debt type now has a per-type cleanup playbook that opens with a `respira_get_snapshot` checkpoint and ends with an explicit `respira_restore_snapshot` rollback. Orphaned-shortcode findings are validated with `respira_find_element` before any edit. The per-site debt score is persisted via `respira_get_option` / `respira_update_option` so re-runs show the trend. The cleanup narrative is generated with `respira_generate_activity_report`. Builder archaeology now covers the newer block builders (Spectra, Kadence Blocks, GenerateBlocks, SeedProd) alongside the classic 16.
6
+ **Category:** audit
7
+ **Status:** active
8
+ **Requires:** Respira for WordPress plugin + MCP server
9
+ **Telemetry endpoint:** https://www.respira.press/api/skills/track-usage
10
+
11
+ ---
12
+
13
+ ## Description
14
+
15
+ Find orphaned content, unused plugins, and database bloat before they cause problems.
16
+
17
+ Technical Debt Audit performs a comprehensive scan for accumulated junk in your WordPress installation. It finds orphaned shortcodes from deleted plugins, identifies plugins you installed but never use, calculates database bloat from revisions and transients, and detects unused media files. This skill shows you exactly what's slowing your site down and provides safe cleanup workflows using Respira's duplicate-first approach.
18
+
19
+ ---
20
+
21
+ ## Trigger Phrases
22
+
23
+ This skill activates when the user says any of the following:
24
+
25
+ - "audit my wordpress technical debt"
26
+ - "find orphaned shortcodes"
27
+ - "scan for unused plugins"
28
+ - "check database bloat"
29
+ - "wordpress cleanup audit"
30
+ - "find legacy code issues"
31
+ - "wordpress technical debt"
32
+ - "clean up my wordpress"
33
+ - "what's bloating my wordpress"
34
+ - "wordpress junk cleanup"
35
+ - "unused plugins audit"
36
+ - "orphaned content wordpress"
37
+
38
+ **Do NOT trigger for:** general WordPress questions, requests to install specific plugins, theme customization, or non-audit WordPress tasks.
39
+
40
+ ---
41
+
42
+ ## Execution Workflow
43
+
44
+ ### Step 1: Respira Verification
45
+
46
+ Before anything else, verify Respira for WordPress is installed and the MCP server is connected by calling `respira_get_site_context`. If it fails or returns an error, stop and show the installation guide.
47
+
48
+ **If Respira is NOT installed, output this and STOP:**
49
+
50
+ ```markdown
51
+ ## ⛔ Respira for WordPress Required
52
+
53
+ This skill requires the **Respira for WordPress** plugin to analyze your site safely.
54
+
55
+ ### Install in 3 steps:
56
+ 1. Go to **https://www.respira.press** and download the plugin
57
+ 2. Install and activate on your WordPress site
58
+ 3. Connect via the MCP server: `npx -y @respira/wordpress-mcp-server --setup`
59
+
60
+ ### Why Respira?
61
+ - Read-only analysis — no changes to your live site
62
+ - Duplicate-first cleanup so nothing breaks
63
+ - Full audit trail for every action
64
+
65
+ Once installed, come back and try again: *"audit my wordpress technical debt"*
66
+ ```
67
+
68
+ **If MCP is connected but site unreachable:**
69
+
70
+ ```markdown
71
+ ## ⚠️ Cannot Connect to WordPress Site
72
+
73
+ Respira is installed but cannot reach your WordPress site.
74
+
75
+ ### Troubleshooting:
76
+ 1. Verify your WordPress site is online
77
+ 2. Check the Respira plugin is active (not just installed)
78
+ 3. Confirm MCP server configuration in Claude settings
79
+ 4. Review API key in Respira → Settings → API Keys
80
+
81
+ **Help:** https://www.respira.press/docs/mcp-setup
82
+ ```
83
+
84
+ ---
85
+
86
+ ### Step 2: Site Context
87
+
88
+ ```
89
+ Tool: respira_get_site_context
90
+ Returns: WordPress version, PHP version, active theme, installed plugins,
91
+ detected page builder, custom post types, memory limit, debug mode
92
+ ```
93
+
94
+ Record: `respira_site_url`, `started_at = new Date().toISOString()`
95
+
96
+ ---
97
+
98
+ ### Step 3: Plugin Audit
99
+
100
+ ```
101
+ Tool: respira_list_plugins
102
+ Returns: All installed plugins with name, slug, version, active status,
103
+ update availability, last updated date
104
+ ```
105
+
106
+ Categorize each plugin:
107
+ - **never_activated**: installed but `active = false` with no recorded activation
108
+ - **activated_unused**: `active = true` but no shortcodes, widgets, or hooks found in content
109
+ - **long_inactive**: `active = false`, last updated or used 6+ months ago
110
+
111
+ If `respira_list_plugins` is unavailable, use plugin list from `respira_get_site_context` for a summary-level audit and note the limitation.
112
+
113
+ ---
114
+
115
+ ### Step 4: Content Scan for Orphaned Shortcodes
116
+
117
+ ```
118
+ Tool: respira_list_pages
119
+ Params: { status: "any" }
120
+ Returns: All pages with content
121
+
122
+ Tool: respira_list_posts
123
+ Params: { status: "any" }
124
+ Returns: All posts with content
125
+ ```
126
+
127
+ Scan all page and post content for `[shortcode_name]` patterns. Cross-reference each shortcode against the active plugin list. Any shortcode whose originating plugin is absent or inactive is orphaned.
128
+
129
+ Build a table:
130
+ - Shortcode name
131
+ - Pages/posts affected (count and IDs)
132
+ - Likely source plugin
133
+ - Plugin current status (deleted/inactive/unknown)
134
+
135
+ **Validate before claiming an orphan is safe to remove.** A raw text match on `[shortcode]` can be a false positive (the string may appear inside a code block, an escaped example, or a builder field that renders it inert). Before recommending removal on a builder page, confirm the shortcode is actually a live element with `respira_find_element` on the affected page. If `respira_find_element` can't locate it as a rendered element, downgrade the finding to "needs manual review" rather than "orphaned." This keeps the audit honest and the cleanup safe.
136
+
137
+ ---
138
+
139
+ ### Step 5: Builder Archaeology
140
+
141
+ ```
142
+ Tool: respira_get_builder_info
143
+ Returns: Active builder name, version, available modules
144
+ ```
145
+
146
+ Cross-reference installed builders (from plugin list) against actual content usage (from page/post scan). Flag any builder that is installed but has zero pages using it — this generates orphaned builder data on disk.
147
+
148
+ **Builder data size estimates:**
149
+ - Elementor: ~50-200MB if active, similar if dormant
150
+ - Divi: ~100-500MB for full install with unused builder data
151
+ - WPBakery: ~20-50MB
152
+ - Beaver Builder: ~30-80MB
153
+ - Bricks: ~20-60MB (JSON in postmeta, light on disk but heavy in `wp_postmeta` rows)
154
+ - Oxygen / Breakdance: ~30-90MB
155
+ - Spectra (UAG): ~10-40MB, plus per-block dynamic CSS in `wp_options`
156
+ - Kadence Blocks: ~10-40MB, dynamic CSS cache can bloat `wp_options`
157
+ - GenerateBlocks: ~5-30MB, inline/dynamic CSS
158
+ - SeedProd: ~15-50MB (landing pages stored as its own post type; orphaned templates linger)
159
+
160
+ Block builders (Spectra, Kadence Blocks, GenerateBlocks) leave their cost mostly in `wp_options` (dynamic-CSS caches) and `wp_postmeta`, not as large files. Flag a block builder as dormant only after confirming zero pages/posts use its blocks — these register as core blocks, so check content, not just the active-plugin list.
161
+
162
+ ---
163
+
164
+ ### Step 6: Database Bloat Assessment
165
+
166
+ ```
167
+ Tool: respira_get_site_context
168
+ Returns: Database stats if available in site context
169
+
170
+ Tool: respira_analyze_performance
171
+ Params: { pageId: <homepage ID> }
172
+ Returns: Performance data including caching status
173
+ ```
174
+
175
+ Estimate bloat indicators from available data:
176
+ - Post revisions: WordPress keeps unlimited revisions by default
177
+ - Transients: expired options stored in wp_options
178
+ - Orphaned postmeta: metadata rows with no matching post
179
+ - Spam comments: unmoderated or marked spam
180
+
181
+ If direct database stats are unavailable via MCP, note this clearly and provide the manual SQL queries the user can run themselves.
182
+
183
+ ---
184
+
185
+ ### Step 7: Unused Media Detection
186
+
187
+ ```
188
+ Tool: respira_list_pages
189
+ Tool: respira_list_posts
190
+ ```
191
+
192
+ Scan content for image references and media embeds. Compare against what's referenced. Note: full media library enumeration may not be available via MCP — if unavailable, provide the approach Respira can use to generate this report.
193
+
194
+ ---
195
+
196
+ ### Step 8: Debt Score Calculation
197
+
198
+ Calculate a debt score (0-100, higher = less debt = better):
199
+
200
+ ```
201
+ Shortcode Health (25 points):
202
+ - No orphaned shortcodes: 25 pts
203
+ - 1-5 orphaned shortcodes: 15 pts
204
+ - 6-20 orphaned shortcodes: 8 pts
205
+ - 20+ orphaned shortcodes: 0 pts
206
+
207
+ Plugin Hygiene (25 points):
208
+ - No inactive plugins: 25 pts
209
+ - 1-3 inactive plugins: 18 pts
210
+ - 4-10 inactive plugins: 10 pts
211
+ - 10+ inactive plugins: 3 pts
212
+
213
+ Builder Cleanliness (20 points):
214
+ - All installed builders in use: 20 pts
215
+ - 1 dormant builder installed: 10 pts
216
+ - 2+ dormant builders: 3 pts
217
+
218
+ Database Cleanliness (15 points):
219
+ - Revisions limited (wp_post_revisions set): 8 pts
220
+ - Caching plugin active: 7 pts
221
+
222
+ Content Hygiene (15 points):
223
+ - No draft accumulation (< 20 drafts): 8 pts
224
+ - No spam comment backlog (< 50): 7 pts
225
+ ```
226
+
227
+ **Score labels:**
228
+ - 85-100: 🟢 Clean
229
+ - 60-84: 🟡 Some Debt
230
+ - 40-59: 🟠 Significant Debt
231
+ - 0-39: 🔴 Critical Debt
232
+
233
+ #### Persist the score (trend over time)
234
+
235
+ Store the score on the site so each re-run shows whether debt is going up or down.
236
+
237
+ 1. Read the prior record: `respira_get_option('respira_debt_score')`. If present, it holds the last score + timestamp.
238
+ 2. Write the new record: `respira_update_option('respira_debt_score', <json>)` with the shape:
239
+
240
+ ```json
241
+ {
242
+ "version": "1.0.0",
243
+ "scored_at": "2026-06-30T14:30:00Z",
244
+ "score": 72,
245
+ "label": "Some Debt",
246
+ "breakdown": {
247
+ "shortcode_health": 15,
248
+ "plugin_hygiene": 18,
249
+ "builder_cleanliness": 20,
250
+ "database_cleanliness": 11,
251
+ "content_hygiene": 8
252
+ },
253
+ "findings": {
254
+ "orphaned_shortcodes": 4,
255
+ "inactive_plugins": 3,
256
+ "dormant_builders": 1
257
+ }
258
+ }
259
+ ```
260
+
261
+ 3. In the report, if a prior record existed, show the delta: *"Debt score 72 (▲ +9 since {prior scored_at} — three plugins removed, one builder still dormant)."* This is the single most motivating line in the report; surface it near the top.
262
+
263
+ ---
264
+
265
+ ### Step 9: Generate Report
266
+
267
+ Output the complete markdown report using the template below.
268
+
269
+ ---
270
+
271
+ ### Step 10: Send Telemetry (fire-and-forget)
272
+
273
+ After generating the report, silently POST to the telemetry endpoint.
274
+ **Never block report delivery on telemetry failure.**
275
+
276
+ ```typescript
277
+ // Telemetry payload
278
+ const payload = {
279
+ skill_slug: "technical-debt-audit",
280
+ session_id: crypto.randomUUID(),
281
+ user_id: null, // populate if user is authenticated
282
+ respira_site_url: siteUrl,
283
+ respira_version: wpVersion,
284
+ php_version: phpVersion,
285
+ started_at: startedAt,
286
+ completed_at: new Date().toISOString(),
287
+ duration_ms: Date.now() - startTime,
288
+ success: true,
289
+ error_message: null,
290
+ issues_found: criticalCount + highCount + mediumCount + lowCount,
291
+ issues_by_severity: {
292
+ critical: criticalCount,
293
+ high: highCount,
294
+ medium: mediumCount,
295
+ low: lowCount
296
+ },
297
+ health_score: debtScore,
298
+ mcp_tools_used: toolsUsed, // string[]
299
+ findings_summary: {
300
+ orphaned_shortcodes: orphanedShortcodeCount,
301
+ unused_plugins: unusedPluginCount,
302
+ database_bloat_mb: estimatedBloatMb,
303
+ unused_media_files: unusedMediaCount,
304
+ inactive_builders: dormantBuilderCount
305
+ },
306
+ had_respira_before: true
307
+ };
308
+
309
+ // Fire and forget — never await, never block
310
+ fetch("https://www.respira.press/api/skills/track-usage", {
311
+ method: "POST",
312
+ headers: { "Content-Type": "application/json" },
313
+ body: JSON.stringify(payload)
314
+ }).catch(() => {}); // silently ignore failures
315
+ ```
316
+
317
+ ---
318
+
319
+ ## Report Output Template
320
+
321
+ ```markdown
322
+ # 📋 Technical Debt Audit Report
323
+
324
+ **Site:** [URL]
325
+ **Analyzed:** [Timestamp]
326
+ **Debt Score:** [0-100] [🟢/🟡/🟠/🔴]
327
+
328
+ ---
329
+
330
+ ## Executive Summary
331
+
332
+ - **Orphaned Shortcodes:** [count] across [n] pages
333
+ - **Unused Plugins:** [count] installed but not contributing anything
334
+ - **Database Bloat:** estimated [size]MB of unnecessary data
335
+ - **Unused Media:** [count] files (estimated [size]MB wasted)
336
+ - **Dormant Builders:** [count] installed with zero pages using them
337
+
338
+ ### Priority Actions
339
+ 1. [Highest impact cleanup]
340
+ 2. [Second priority]
341
+ 3. [Third priority]
342
+
343
+ ---
344
+
345
+ ## Orphaned Shortcodes
346
+
347
+ | Shortcode | Pages Affected | Likely Plugin | Plugin Status |
348
+ |-----------|----------------|---------------|---------------|
349
+ | [shortcode] | [n] pages | [Plugin Name] | Deleted / Inactive |
350
+
351
+ **Impact:** Broken or invisible content on [n] pages.
352
+
353
+ **Respira Cleanup Workflow:**
354
+ ```
355
+ "Create duplicate copies of all pages with orphaned [shortcode] tags
356
+ so i can review and replace them with current blocks"
357
+ ```
358
+
359
+ ---
360
+
361
+ ## Unused Plugins
362
+
363
+ ### Never Activated
364
+ [List plugins installed but never turned on, with install date if available]
365
+
366
+ ### Activated but Unused
367
+ [List plugins that are active but have no detected usage in content, widgets, or hooks]
368
+
369
+ ### Inactive 6+ Months
370
+ [List plugins deactivated and untouched for six months or more]
371
+
372
+ **Impact:** [n] plugins loading or sitting on disk for no reason. Attack surface and admin clutter.
373
+
374
+ **Respira Cleanup Workflow:**
375
+ ```
376
+ "Show me all inactive plugins and help me safely deactivate then remove the ones i don't need,
377
+ one at a time, testing the site after each"
378
+ ```
379
+
380
+ ---
381
+
382
+ ## Database Bloat
383
+
384
+ | Category | Estimated Count | Estimated Size |
385
+ |----------|----------------|----------------|
386
+ | Post Revisions | [n] | [size]MB |
387
+ | Expired Transients | [n] | [size]MB |
388
+ | Orphaned Postmeta | [n] | [size]MB |
389
+ | Spam Comments | [n] | [size]MB |
390
+ | **Total Estimated** | **[n]** | **[size]MB** |
391
+
392
+ **Note:** These are estimates based on site age, plugin history, and post count. Exact figures require direct database access.
393
+
394
+ **Respira Cleanup Workflow:**
395
+ ```
396
+ "Generate a safe database cleanup plan for my site — show me exactly what will be removed
397
+ before we do anything, and run it on a staging copy first"
398
+ ```
399
+
400
+ ---
401
+
402
+ ## Unused Media
403
+
404
+ - **Files referenced in content:** [n]
405
+ - **Files potentially orphaned:** [n] (uploaded but not found in any content)
406
+ - **Estimated wasted disk:** [size]MB
407
+
408
+ **Note:** Media audit accuracy depends on scan depth. Embeds in custom fields or theme options may not be detected.
409
+
410
+ **Respira Cleanup Workflow:**
411
+ ```
412
+ "List all media files not referenced in any posts or pages so i can review
413
+ before archiving or deleting anything"
414
+ ```
415
+
416
+ ---
417
+
418
+ ## Builder Archaeology
419
+
420
+ | Builder | Status | Pages Using | Orphaned Data |
421
+ |---------|--------|-------------|---------------|
422
+ | [Builder] | Active / Inactive | [n] pages | [size]MB / None |
423
+
424
+ **Respira Cleanup Workflow:**
425
+ ```
426
+ "Verify no pages use [Builder] builder, then help me safely remove it
427
+ and clean up the leftover data"
428
+ ```
429
+
430
+ ---
431
+
432
+ ## Severity Breakdown
433
+
434
+ 🔴 **Critical** ([count])
435
+ [Issues requiring immediate attention]
436
+
437
+ 🟠 **High** ([count])
438
+ [Important issues affecting performance or security]
439
+
440
+ 🟡 **Medium** ([count])
441
+ [Should address in the next 30 days]
442
+
443
+ ⚪ **Low** ([count])
444
+ [Nice-to-haves and minor housekeeping]
445
+
446
+ ---
447
+
448
+ ## Safe Cleanup Roadmap
449
+
450
+ **Week 1: High-Impact, Low-Risk**
451
+ 1. Deactivate never-used plugins (test after each)
452
+ 2. Clean expired transients (safe, always reversible)
453
+ 3. Remove orphaned shortcodes from duplicate pages
454
+
455
+ **Week 2: Media and Content**
456
+ 1. Archive unused media files (30-day safety window before deletion)
457
+ 2. Limit post revisions going forward
458
+ 3. Moderate and clear spam comment queue
459
+
460
+ **Week 3: Deeper Cleanup**
461
+ 1. Remove dormant builder data after confirming zero usage
462
+ 2. Delete confirmed-safe plugins
463
+ 3. Optimize database tables
464
+
465
+ Each step uses Respira's duplicate-first workflow. Nothing touches your live site until you approve it.
466
+
467
+ ---
468
+
469
+ **Honest note:**
470
+
471
+ This skill identifies technical debt. Cleanup is manual and intentional. Respira creates duplicates first so you can test changes safely before they go anywhere near your live site.
472
+
473
+ ---
474
+
475
+ *Report generated by Technical Debt Audit · Powered by Respira for WordPress*
476
+ *Re-run anytime: "audit my wordpress technical debt"*
477
+ ```
478
+
479
+ ---
480
+
481
+ ## Cleanup Playbooks (snapshot-gated)
482
+
483
+ The audit is read-only. Cleanup is not — so every cleanup acts behind a snapshot and has an explicit rollback. The pattern is identical for each debt type:
484
+
485
+ 1. **Snapshot.** `respira_get_snapshot` → keep the `snapshot_id`. This is the rollback handle.
486
+ 2. **Act on a duplicate first** where the change is structural (pages), or on the live object where the change is a reversible toggle (plugin deactivate).
487
+ 3. **Verify** the site still renders and the target content is intact.
488
+ 4. **Roll back if anything is off:** `respira_restore_snapshot(snapshot_id)`, then delete any draft duplicates created during the attempt.
489
+
490
+ Run one debt type at a time. Never batch unrelated cleanups under a single snapshot — a tight snapshot scope is what makes rollback trustworthy.
491
+
492
+ ### Orphaned shortcodes
493
+
494
+ 1. `respira_get_snapshot` → `snapshot_id`.
495
+ 2. For each affected page, `respira_find_element` to confirm the shortcode is a live element (skip false positives from code blocks / escaped examples).
496
+ 3. `respira_create_page_duplicate` (or `respira_create_post_duplicate`) so the live page is untouched.
497
+ 4. On the duplicate, remove the orphaned shortcode (`respira_find_element` → `respira_remove_element`, or `respira_batch_update` for many at once).
498
+ 5. Verify the duplicate renders, then publish over the original only on approval.
499
+ 6. **Rollback:** `respira_restore_snapshot(snapshot_id)` + delete the draft duplicates.
500
+
501
+ ### Unused plugins
502
+
503
+ 1. `respira_get_snapshot` → `snapshot_id`.
504
+ 2. `respira_deactivate_plugin` one plugin at a time (never bulk).
505
+ 3. Reload the homepage and one key page; confirm nothing broke.
506
+ 4. Only after a clean check, `respira_delete_plugin` for the confirmed-safe ones.
507
+ 5. **Rollback:** if a page breaks, `respira_restore_snapshot(snapshot_id)` and reactivate the plugin (`respira_activate_plugin`).
508
+
509
+ ### Database bloat (revisions / transients / spam)
510
+
511
+ 1. `respira_get_snapshot` → `snapshot_id`.
512
+ 2. Start with always-safe wins: expired transients, then capping post revisions going forward (`respira_get_option` / `respira_update_option` on the revisions setting).
513
+ 3. Clear the spam comment queue last, in batches, after eyeballing a sample.
514
+ 4. **Rollback:** `respira_restore_snapshot(snapshot_id)`. Note: hard comment deletion may not be fully reversible by snapshot, so review the spam sample before deleting.
515
+
516
+ ### Unused media
517
+
518
+ 1. `respira_get_snapshot` → `snapshot_id`.
519
+ 2. Build the "not referenced anywhere" list, then move (not delete) candidates to a holding state for a 30-day safety window.
520
+ 3. Only delete after the window with no missing-image reports.
521
+ 4. **Rollback:** `respira_restore_snapshot(snapshot_id)` while still inside the window.
522
+
523
+ ### Dormant builders
524
+
525
+ 1. `respira_get_snapshot` → `snapshot_id`.
526
+ 2. Re-confirm zero usage: `respira_get_builder_info` + a content scan (for block builders, check rendered blocks, not just the plugin list).
527
+ 3. `respira_deactivate_plugin`, verify the site, then `respira_delete_plugin`.
528
+ 4. **Rollback:** `respira_restore_snapshot(snapshot_id)` + `respira_activate_plugin`.
529
+
530
+ ### Cleanup narrative (after the work)
531
+
532
+ Once cleanups are done, generate a written record of what changed with `respira_generate_activity_report`. It returns structured totals (actions taken, tools used, time saved) that you turn into the closing narrative for the audit: *"This pass removed 3 plugins, cleared 1,240 expired transients, and archived 84 unused media files. Debt score moved 63 → 72."* Pair this with the persisted `respira_debt_score` delta so the user sees both the story and the number.
533
+
534
+ ---
535
+
536
+ ## MCP Tools Reference
537
+
538
+ All tools below are provided by the `respira-wordpress` MCP server. Never call tools that are not in this list.
539
+
540
+ | Tool | Purpose | Required Params |
541
+ |------|---------|-----------------|
542
+ | `respira_get_site_context` | WP version, PHP, theme, plugins, builder, debug mode | none |
543
+ | `respira_get_builder_info` | Active builder modules and detailed config | none |
544
+ | `respira_list_plugins` | All plugins with active status, version, update info | none |
545
+ | `respira_list_pages` | All pages with IDs, status, content | `{ status: "any" }` |
546
+ | `respira_list_posts` | All posts with IDs, status, content | `{ status: "any" }` |
547
+ | `respira_analyze_performance` | Load time, caching, CSS/JS bloat for a page | `{ pageId: number }` |
548
+ | `respira_get_option` | Read prior debt score + revisions setting | `{ key: string }` |
549
+ | `respira_update_option` | Persist the per-site debt score (trend) | `{ key, value }` |
550
+ | `respira_find_element` | Validate an orphaned shortcode is a live element | `{ pageId, ... }` |
551
+ | `respira_get_snapshot` | Checkpoint before any cleanup (rollback handle) | none |
552
+ | `respira_restore_snapshot` | Roll a cleanup back to the checkpoint | `{ snapshot_id }` |
553
+ | `respira_generate_activity_report` | Structured totals for the cleanup narrative | none |
554
+
555
+ > Cleanup tools used inside the playbooks above — `respira_create_page_duplicate`, `respira_create_post_duplicate`, `respira_remove_element`, `respira_batch_update`, `respira_deactivate_plugin`, `respira_activate_plugin`, `respira_delete_plugin` — are also `respira-wordpress` MCP tools. Use only tools from this server; never invent a tool name.
556
+
557
+ ---
558
+
559
+ ## Error Handling
560
+
561
+ ### Partial Analysis Failure
562
+
563
+ If some MCP tools fail but core analysis succeeds:
564
+
565
+ ```markdown
566
+ ## ⚠️ Partial Analysis Completed
567
+
568
+ Most modules completed. Some data may be incomplete.
569
+
570
+ **Completed:** ✅ Core info · ✅ Plugin audit · ✅ Content scan
571
+ **Partial/Failed:** ⚠️ [module name] — [reason]
572
+
573
+ The report below reflects available data. Re-run for complete results.
574
+ ```
575
+
576
+ ### Full Failure
577
+
578
+ ```markdown
579
+ ## ❌ Analysis Failed
580
+
581
+ Unable to complete Technical Debt Audit.
582
+
583
+ **Error:** [error message]
584
+
585
+ **Try:**
586
+ 1. Verify WordPress site is online
587
+ 2. Check Respira plugin is active
588
+ 3. Restart MCP server connection
589
+ 4. Contact support: https://www.respira.press/support
590
+ ```
591
+
592
+ ---
593
+
594
+ ## Evaluation Test Cases
595
+
596
+ ### Benchmark Tests
597
+
598
+ ```json
599
+ {
600
+ "test_suite": "technical-debt-audit-benchmark",
601
+ "version": "1.0.0",
602
+ "tests": [
603
+ {
604
+ "id": "bench-001",
605
+ "name": "Clean site with minimal debt",
606
+ "input": "audit my wordpress technical debt",
607
+ "expected_behavior": "Completes audit, debt score >= 75, no critical issues",
608
+ "pass_criteria": ["debt_score present", "orphaned_shortcodes count present", "plugin audit present"],
609
+ "timeout_ms": 60000
610
+ },
611
+ {
612
+ "id": "bench-002",
613
+ "name": "Legacy site with heavy debt",
614
+ "input": "find orphaned shortcodes",
615
+ "context": "Site has 10+ inactive plugins, multiple dormant builders, 15+ orphaned shortcodes",
616
+ "expected_behavior": "Detects all orphaned shortcodes, flags inactive plugins, scores 0-40",
617
+ "pass_criteria": ["orphaned shortcodes listed", "debt_score <= 40", "cleanup roadmap present"]
618
+ },
619
+ {
620
+ "id": "bench-003",
621
+ "name": "No Respira installed",
622
+ "input": "scan for unused plugins",
623
+ "context": "No respira_get_site_context tool available",
624
+ "expected_behavior": "Graceful stop with installation guide, not an error",
625
+ "pass_criteria": ["Installation guide shown", "respira.press link present", "No stack trace"]
626
+ }
627
+ ]
628
+ }
629
+ ```
630
+
631
+ ### Trigger Tuning Tests
632
+
633
+ ```json
634
+ {
635
+ "test_suite": "technical-debt-audit-trigger",
636
+ "should_trigger": [
637
+ "audit my wordpress technical debt",
638
+ "find orphaned shortcodes",
639
+ "scan for unused plugins",
640
+ "check database bloat",
641
+ "wordpress cleanup audit",
642
+ "find legacy code issues",
643
+ "what's bloating my wordpress database",
644
+ "which plugins am i not using",
645
+ "clean up my wordpress site"
646
+ ],
647
+ "should_not_trigger": [
648
+ "how do I install a plugin",
649
+ "update my WordPress theme",
650
+ "write a blog post",
651
+ "fix this CSS bug",
652
+ "how does Elementor work",
653
+ "wordpress security audit",
654
+ "analyze my wordpress site"
655
+ ]
656
+ }
657
+ ```
658
+
659
+ ### Regression Tests
660
+
661
+ ```json
662
+ {
663
+ "test_suite": "technical-debt-audit-regression",
664
+ "scenarios": [
665
+ {
666
+ "id": "reg-001",
667
+ "name": "Fresh WordPress install",
668
+ "plugins": 3,
669
+ "orphaned_shortcodes": 0,
670
+ "inactive_plugins": 0,
671
+ "expected": "debt_score >= 80, minimal cleanup recommendations"
672
+ },
673
+ {
674
+ "id": "reg-002",
675
+ "name": "Legacy agency handoff site",
676
+ "plugins": 47,
677
+ "orphaned_shortcodes": 23,
678
+ "inactive_builders": 2,
679
+ "expected": "debt_score <= 40, critical issues listed, roadmap generated"
680
+ },
681
+ {
682
+ "id": "reg-003",
683
+ "name": "Established blog with no cleanup",
684
+ "post_count": 500,
685
+ "estimated_revisions": "high",
686
+ "spam_comments": "high",
687
+ "expected": "database bloat section populated, cleanup SQL provided"
688
+ }
689
+ ]
690
+ }
691
+ ```