Snilld

project-code-review

project-code-review

Performs project-specific code review for Snilld CRM. Use when the user asks for a code review, PR review, or validation of changes against project standards (file structure, WPCS, security, styling, naming).

# Project-Specific Code Review

Performs code review against Snilld CRM project rules and conventions. Apply when reviewing patches, PRs, or new code before merge.

## When to Use

- User asks for "code review", "review this change", "check this PR", or "validate against project standards".
- User wants compliance check before committing (file placement, naming, security, styling).

## Review Checklist (Project Standards)

Use this checklist and cite **file path + line** for each finding. Reference project rules: `important.mdc`, `file-structure.mdc`, `snilld-crm-extension-validator` skill.

### 1. File Structure and Placement

- [ ] **Admin**: Core admin logic → `includes/class-snilld-crm-admin.php` and `includes/admin/`; settings only → `admin/`.
- [ ] **JS**: Speech recognition changes → `assets/js/admin/speech-recognition.js` only (not legacy `assets/js/speech-recognition.js`).
- [ ] **CSS**: All styles in `assets/css/admin-optimized.styl` only; no CSS in PHP or JS; do not edit `admin-optimized.css`.

### 2. Naming and Prefixes

- [ ] **Classes**: Prefix `Snilld_CRM_`.
- [ ] **DB tables**: Prefix `snilld_crm_`.
- [ ] **Custom post types**: Prefix `snilld_` (e.g. `snilld_customer`, `snilld_project`, `snilld_task`, `snilld_log`).

### 3. Security and WordPress

- [ ] **Input**: Sanitized (e.g. `sanitize_text_field`, `intval`, `sanitize_key`).
- [ ] **Output**: Escaped (`esc_html`, `esc_attr`, `esc_url`).
- [ ] **AJAX**: `check_ajax_referer()` and capability checks.
- [ ] **SQL**: `$wpdb->prepare()`; no concatenated SQL.

### 4. Project-Specific Don’ts

- [ ] No `error_log()`; use JavaScript console for errors when possible.
- [ ] No duplicate files or duplicate functions; extend existing code.
- [ ] No Composer dependency (production has no shell/Composer).

### 5. Documentation and Quality

- [ ] PHPDoc on classes and methods.
- [ ] WordPress Coding Standards (WPCS) where applicable.

## Output

Deliver review in the format defined by the **Code Review Agent** rule: Summary, Critical, Warnings, Suggestions, with file:line and rule reference for each finding.

    Gør brugeroplevelsen bedre.
    Hvilket firma arbejder du for?