AGENT SKILL

roots-reviewing

Use when asked to review or audit code in a Roots-stack WordPress project - "review my diff", "check before the MR", a pre-merge or convention audit of providers, hooks, Blade, blocks, post types, routes, Livewire, assets and security. Read-only, fixed report template. For understanding a project use roots-onboarding; for fixing a bug use roots-debugging.

License 许可
MIT
所属仓库
hekivo/kivo-wise
最近更新
2026-11-08
Stars
★ 14
Forks
0

01 前言 Front Matter

name
roots-reviewing
description
Use when asked to review or audit code in a Roots-stack WordPress project - "review my diff", "check before the MR", a pre-merge or convention audit of providers, hooks, Blade, blocks, post types, routes, Livewire, assets and security. Read-only, fixed report template. For understanding a project use roots-onboarding; for fixing a bug use roots-debugging.

02 资源文件 1

03 SKILL.md 正文

Roots reviewing: convention audit by profile

Reviews a diff or a folder against the conventions of the active profile and reports findings in one fixed template. It reads and reports; it does not edit, commit or push.

When to use

  • Before opening or merging a change request, or when the user asks for a review or a health check.
  • After generating code (a block, a provider, a component) to confirm it follows the project's pattern.
  • For a second, independent read: run the acorn-reviewer agent on the same scope.

Inputs required

  • Scope: files, a folder, or the diff against the default branch (git diff <default branch>...HEAD --stat to list it). Default: everything changed on the branch.
  • Active profile and app path from the session context or the detector JSON (scripts/detect-roots-project.mjs).
  • Project rules: AGENTS.md, .ai/, .claude/rules/. A project rule overrides any default below; cite it when it decides a finding.
  • Runner placeholders for any command you suggest: {{runner.test}}, {{runner.cache}}, {{runner.acorn}}.

Procedure

  1. Fix the scope and the profile. List changed files; group them by area (providers, views, blocks, post types, routes, Livewire, assets, config, tests).

  2. Load the project rules and note anything stricter than the defaults (language of code, commit rules, native-first gates).

  3. Apply the checks for each area that appears in the scope. The full greppable checklist is in references/checklists.md; the profile decides which checks apply:

    Area sage-theme acorn-mu-plugin radicle-app
    Theme provider ThemeServiceProvider extends Roots\Acorn\Sage\SageServiceProvider not applicable not applicable
    Other providers extend Illuminate\Support\ServiceProvider; registered in config/app.php or functions.php registered where the boot code lists them (configurator, config/app.php, composer extra) registered in composer.json extra.acorn.providers
    Post types Poet config or the project's classes classes or Poet, as the project does config/post-types.php (roots/acorn-post-types)
    Blocks ACF Composer class + Blade view ACF Composer class + Blade view native block.json + Blade render; ACF checks do not apply
    Livewire only if installed version 4 rules (see acorn-livewire) only if installed
    Tests project suite project suite Pest
  4. Native-first check. For every custom class or hook in the diff, ask which native WordPress / ACF / Acorn mechanism covers it and whether the diff says why not. Missing reason on a duplicate of a native mechanism is a finding.

  5. Security and escaping pass on every view and endpoint touched (checklist section "Security").

  6. Run the tests the scope implies ({{runner.test}}) when the user allows it; a failing test is a Critical finding with the output line.

  7. Report with the template below. Every finding has file:line, the rule, and the skill that explains it. Count findings by severity. Acknowledge what is done well.

  8. Do not fix unless the user asks afterwards; then hand each finding to the owning skill.

Severity

Severity Meaning Examples
Critical Breaks behaviour, security or data unescaped output, missing permission_callback, double escape that corrupts a URL, provider never registered, raw SQL without prepare
Improvement Convention or maintainability hooks outside boot(), logic in a Blade view, custom code duplicating a native mechanism
Good practice Worth keeping tests added, native hook used with a verified reason

Report template (fixed)

## Review: <scope>
Profile: <kind> at <path>   Rules read: <files>

### Critical
- **<file>:<line>** - <issue>. Rule: <rule>. See `<skill>`.

### Improvement
- **<file>:<line>** - <issue>. Rule: <rule>. See `<skill>`.

### Good practices
- <observation>

### Not checked
- <area and why, for example "Livewire: not installed">

### Summary
<X> critical, <Y> improvements, <Z> good practices. Verdict: <ready | ready after fixes | needs rework>.

Verification

  • Each finding points to a real line you read; no finding is inferred from a file name alone.
  • Checks for packages the profile lacks (ACF on radicle-app, Livewire when not installed) are listed under "Not checked", not reported as violations.
  • The report uses the template exactly and states the profile.
  • Suggested commands use runner placeholders; none runs wp, composer, php, yarn or npm bare.

Failure modes

Symptom Cause Fix
ACF findings on a project without ACF Applied the sage-theme checks to radicle-app Re-read the profile; move them to "Not checked"
"Provider not registered" false alarm Registration lives in composer.json extra or a configurator Check the profile's registration place with scripts/inventory-project.mjs --app <path>
Review flags a project convention as wrong Project rule stricter or different from the default Follow the project rule; cite it
Findings without line numbers Reviewed the summary, not the file Open the file and cite the line
Verdict "ready" but tests were not run Skipped step 6 silently State that tests were not run

Escalation

  • Disagreement between a project rule and a native mechanism: report both and ask the user which wins.
  • A suspected security issue in code outside the scope: report it separately, do not widen the review silently.
  • Large diffs (over about 40 files): ask whether to split the review by area and run acorn-reviewer per area.

<!-- verified: refs/roots-sage/app/Providers/ThemeServiceProvider.php:7 — extends SageServiceProvider; refs/roots-acorn/src/Roots/Acorn/Sage/SageServiceProvider.php:9 — SageServiceProvider extends Illuminate ServiceProvider; vendor/illuminate/view/Compilers/BladeCompiler.php:124 — echo format e(%s); vendor/illuminate/support/helpers.php:124 — e() double-encodes by default; vendor/log1x/acf-composer/src/Console/BlockMakeCommand.php:18 — acf:block; src/Console/stubs/block.localized.stub:146,156 — with() and fields(); upstream design-system checks (R-css-vars, R-component-reuse, R-nl2br) dropped as project-specific -->

04 同仓库更多 Skills

hekivo
hekivo/kivo-wise

wp-rest-api

Use when building, extending, or debugging WordPress REST API endpoints/routes: register_rest_route, WP_REST_Controller/controller classes, schema/argument validation, permission_callback/authentication, response shaping, register_rest_field/register_meta, or exposing CPTs/taxonomies via show_in_rest.

开发工程师后端与接口
★ 14
hekivo
hekivo/kivo-wise

wp-abilities-api

Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients.

开发工程师后端与接口
★ 14
hekivo
hekivo/kivo-wise

wp-security-escaping

Use when writing or reviewing code that outputs data, handles input or checks permissions in a WordPress + Acorn project - Blade {{ }} vs {!! !!}, esc_html, esc_attr, esc_url, wp_kses_post, "&#038; in the URL", double escaping, sanitize_text_field, nonces, current_user_can, map_meta_cap, permission_callback, $wpdb->prepare, whereRaw, file uploads, escaping ACF values, secrets in .env. For route middleware use acorn-routes-api; for ACF validation use acf-native; for Livewire actions use acorn-livewire.

★ 14
hekivo
hekivo/kivo-wise

wp-phpstan

Use when configuring, running or fixing PHPStan in a WordPress project that uses Acorn - phpstan.neon, baseline, szepeviktor/phpstan-wordpress stubs, larastan, level raising, "Cannot access property on mixed", get_field() types, paths for app/. For Pint or Mago formatting use testing-wp; for runtime errors use roots-debugging.

★ 14
hekivo
hekivo/kivo-wise

wp-performance

Use when a WordPress page, query or request is slow or needs profiling - TTFB, slow or N+1 queries, Query Monitor, Server-Timing, wp profile and wp doctor, autoloaded options, Redis object cache hit rate, transients, WP_CACHE_KEY_SALT. Adds the runner and Redis notes on top of the official procedure. For Eloquent query design use acorn-data; for PHP type errors use wp-phpstan.

★ 14
hekivo
hekivo/kivo-wise

wp-hooks-lifecycle

Use when adding, moving or debugging WordPress actions and filters in an Acorn project - add_action/add_filter priority and accepted_args, where a hook belongs (setup or filters files vs a provider boot()), load order (mu-plugins, plugins_loaded, after_setup_theme, init), when Acorn boots per profile, hooks that never fire on Acorn routes, REST or Livewire requests (template_redirect, wp_head), save_post firing twice in the block editor, the_content priorities. For ACF hooks use acf-native; for provider structure use acorn-stack.

★ 14