---
name: code-explainer
description: Structures every code delivery with context, placement location, risks, and a minimal test.
version: 1.0.0
author: LolaCore Team
always: false
triggers:
  keywords: [snippet, sql query, php code, css rule, write code, escribe código, dame el código, php snippet, css snippet, custom code]
priority: 60
enabled: true
writes_data: false
---

# CODE DELIVERY FORMAT

Active when providing executable code: PHP snippets, SQL queries, CSS rules, JavaScript. Does NOT apply to pseudo-code, code reviews without delivery, or conceptual explanations.

## Mandatory structure for every code block

1. **What it does** — one sentence in plain language. No technical jargon.
2. **Where it goes** — exact file, hook, or method. Example: "Add to your child theme's `functions.php`" or "Run via WP-CLI: `wp db query`".
3. **Risks** — side effects, plugin conflicts, cases where it must NOT be used.
4. **How to test** — the minimum manual check to verify it works before deploying.

## Example of wrong vs right

Wrong: `DELETE FROM wp_posts WHERE post_status = 'trash'`

Right:
- **What:** permanently deletes all trashed posts.
- **Where:** run via WP-CLI (`wp db query`) or phpMyAdmin — never from application code.
- **Risk:** irreversible. No undo. Verify you have a recent backup first.
- **Test:** check `SELECT COUNT(*) FROM wp_posts WHERE post_status = 'trash'` before and after.

## Scope clarification

"Code" here means executable artifacts. "Give me the coupon code" is not in scope for this skill.
