본문으로 건너뛰기
cccskills
무료GitHub에 공개

wordpress-ability

Use this skill when adding or modifying WordPress abilities

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구WordPress
설치 방법 보기

포함된 파일(1)

  • SKILL.md3.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

WordPress ability core functions

  • wp_register_ability( string $name, array $args ) to register a new ability
  • wp_register_ability_category( string $slug, array $args ) to register a new ability category

Always check if the function exists before calling it, to ensure compatibility with WordPress versions prior to 6.9:

if ( ! function_exists( 'wp_register_ability' ) ) {
    return;
}

Adding a new ability

To add a new ability, follow these steps:

  • One ability = one class implementing AbilitiesInterface
  • Place the class adjacent to the feature it belongs to
  • Register the ability class in the feature's ServiceProvider
  • Register the ability in the related subscriber, using the wp_abilities_api_init hook

An ability name must be unique and follow the format wp-rocket/ability-name, where wp-rocket is the vendor name and ability-name is a descriptive name for the ability. Use hyphens to separate words in the ability name.

The check_permissions()method should always verify against the current user capabilities, using current_user_can( 'rocket_manage_options ) by default, to ensure that only authorized users can execute the ability, except explicitly required otherwise.

An ability must be associated to an ability category. If the category doesn't exist yet, register a new one in the related subscriber using the wp_abilities_api_categories_init hook.

Make the ability available to the REST API and the MCP by adding meta.show_in_rest=true and meta.mcp.public=true when registering the ability, unless explicitly required otherwise.

Annotations should be added to the meta field when registering the ability, as an array of key-value pairs:

  • readonly: true or false, to indicate if the ability doesn't modify data
  • destructive: true or false, to indicate if the ability may delete/destroy data
  • idempotent: true or false, to indicate Same input → same output

An example of an ability class can be found in the /inc/Engine/Abilities/Options/GetOptions.php file.

Input and Output Schema

If an ability requires input parameters, the parameters of the execute() method should always match the input schema defined when registering the ability.

The return value of the execute() method of an ability should always match the output schema defined when registering the ability.

Testing

Unit tests

Test only the execute() method of the ability class, which contains the logic to perform the action associated with the ability. Mock any dependencies and assert that the method behaves as expected under different conditions.

An example of unit tests for an ability class can be found in the /tests/Unit/inc/Engine/Abilities/Options/GetOptions/ExecuteTest.php file.

Integration tests

Check for WordPress version compatibility, abilities are available starting WordPress 6.9. Mark skip test if version under test is lower than 6.9.

Set up user to ensure ability permissions are correctly applied. Add scenario where user has the ability and another where they don't, and assert that the expected outcomes occur in both cases.

Test ability execution output by getting the ability WP_Ability object using wp_get_ability( $ability_name ) and calling the execute() method. Assert that the output is correct based on the input parameters and the expected behavior of the ability.

An example of integration tests for an ability class can be found in the /tests/Integration/inc/Engine/Abilities/Options/GetOptions/RegisterGetOptionsAbilityTest.php file.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

challenge

무료

Adversarially review a grooming spec before implementation starts. Finds hidden risks, unvalidated assumptions, and missing dependencies. Standalone entry point for the challenger agent.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

Check a change against WordPress.org plugin rules and PHPCS standards.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

docs

무료

Update developer-facing documentation to reflect code changes on the current branch. Runs as an inline skill inside backend-agent and frontend-agent (step 2.5 of the internal sequence) after implementation and before DOD. Receives the explicit list of changed files from the implementation agent. No-op if no public API changes occurred.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

dod

무료

Run the Definition of Done checklist for the current wp-rocket branch and report PASS/WARN/FAIL with evidence. Two modes: layer 1 (self-correction inside backend-agent / frontend-agent — resolves FAILs before handoff) and layer 2 (independent orchestrator gate — fresh perspective after handoff). Pass layer: "1" or layer: "2" when invoking.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

e2e

무료

Run a basic E2E behavioral probe — one primary scenario smoke test for the grooming step.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

groom

무료

Groom a single GitHub issue — produce an implementation spec and optionally post the grooming summary as a GitHub comment. Standalone entry point for the grooming-agent.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

wp-media/wp-rocket7672026년 10월 17일 업데이트

wp-media의 스킬 모두 보기

이 스킬의 문제 신고