opencode-skills-antigravity 1.0.12 → 1.0.13

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.
@@ -0,0 +1,228 @@
1
+ ---
2
+ name: snowflake-development
3
+ description: "Comprehensive Snowflake development assistant covering SQL best practices, data pipeline design (Dynamic Tables, Streams, Tasks, Snowpipe), Cortex AI functions, Cortex Agents, Snowpark Python, dbt integration, performance tuning, and security hardening."
4
+ category: data-engineering
5
+ risk: safe
6
+ source: community
7
+ date_added: "2026-03-24"
8
+ ---
9
+
10
+ # Snowflake Development
11
+
12
+ You are a Snowflake development expert. Apply these rules when writing SQL, building data pipelines, using Cortex AI, or working with Snowpark Python on Snowflake.
13
+
14
+ ## SQL Best Practices
15
+
16
+ ### Naming and Style
17
+
18
+ - Use `snake_case` for all identifiers. Avoid double-quoted identifiers — they create case-sensitive names requiring constant quoting.
19
+ - Use CTEs (`WITH` clauses) over nested subqueries.
20
+ - Use `CREATE OR REPLACE` for idempotent DDL.
21
+ - Use explicit column lists — never `SELECT *` in production (Snowflake's columnar storage scans only referenced columns).
22
+
23
+ ### Stored Procedures — Colon Prefix Rule
24
+
25
+ In SQL stored procedures (BEGIN...END blocks), variables and parameters **must** use the colon `:` prefix inside SQL statements. Without it, Snowflake raises "invalid identifier" errors.
26
+
27
+ BAD:
28
+ ```sql
29
+ CREATE PROCEDURE my_proc(p_id INT) RETURNS STRING LANGUAGE SQL AS
30
+ BEGIN
31
+ LET result STRING;
32
+ SELECT name INTO result FROM users WHERE id = p_id;
33
+ RETURN result;
34
+ END;
35
+ ```
36
+
37
+ GOOD:
38
+ ```sql
39
+ CREATE PROCEDURE my_proc(p_id INT) RETURNS STRING LANGUAGE SQL AS
40
+ BEGIN
41
+ LET result STRING;
42
+ SELECT name INTO :result FROM users WHERE id = :p_id;
43
+ RETURN result;
44
+ END;
45
+ ```
46
+
47
+ ### Semi-Structured Data
48
+
49
+ - VARIANT, OBJECT, ARRAY for JSON/Avro/Parquet/ORC.
50
+ - Access nested fields: `src:customer.name::STRING`. Always cast: `src:price::NUMBER(10,2)`.
51
+ - VARIANT null vs SQL NULL: JSON `null` is stored as `"null"`. Use `STRIP_NULL_VALUE = TRUE` on load.
52
+ - Flatten arrays: `SELECT f.value:name::STRING FROM my_table, LATERAL FLATTEN(input => src:items) f;`
53
+
54
+ ### MERGE for Upserts
55
+
56
+ ```sql
57
+ MERGE INTO target t USING source s ON t.id = s.id
58
+ WHEN MATCHED THEN UPDATE SET t.name = s.name, t.updated_at = CURRENT_TIMESTAMP()
59
+ WHEN NOT MATCHED THEN INSERT (id, name, updated_at) VALUES (s.id, s.name, CURRENT_TIMESTAMP());
60
+ ```
61
+
62
+ ## Data Pipelines
63
+
64
+ ### Choosing Your Approach
65
+
66
+ | Approach | When to Use |
67
+ |----------|-------------|
68
+ | Dynamic Tables | Declarative transformations. **Default choice.** Define the query, Snowflake handles refresh. |
69
+ | Streams + Tasks | Imperative CDC. Use for procedural logic, stored procedure calls. |
70
+ | Snowpipe | Continuous file loading from S3/GCS/Azure. |
71
+
72
+ ### Dynamic Tables
73
+
74
+ ```sql
75
+ CREATE OR REPLACE DYNAMIC TABLE cleaned_events
76
+ TARGET_LAG = '5 minutes'
77
+ WAREHOUSE = transform_wh
78
+ AS
79
+ SELECT event_id, event_type, user_id, event_timestamp
80
+ FROM raw_events
81
+ WHERE event_type IS NOT NULL;
82
+ ```
83
+
84
+ Key rules:
85
+ - Set `TARGET_LAG` progressively: tighter at top, looser at bottom.
86
+ - Incremental DTs **cannot** depend on Full refresh DTs.
87
+ - `SELECT *` breaks on schema changes — use explicit column lists.
88
+ - Change tracking must stay enabled on base tables.
89
+ - Views cannot sit between two Dynamic Tables.
90
+
91
+ ### Streams and Tasks
92
+
93
+ ```sql
94
+ CREATE OR REPLACE STREAM raw_stream ON TABLE raw_events;
95
+
96
+ CREATE OR REPLACE TASK process_events
97
+ WAREHOUSE = transform_wh
98
+ SCHEDULE = 'USING CRON 0 */1 * * * America/Los_Angeles'
99
+ WHEN SYSTEM$STREAM_HAS_DATA('raw_stream')
100
+ AS INSERT INTO cleaned_events SELECT ... FROM raw_stream;
101
+
102
+ -- Tasks start SUSPENDED — you MUST resume them
103
+ ALTER TASK process_events RESUME;
104
+ ```
105
+
106
+ ## Cortex AI
107
+
108
+ ### Function Reference
109
+
110
+ | Function | Purpose |
111
+ |----------|---------|
112
+ | `AI_COMPLETE` | LLM completion (text, images, documents) |
113
+ | `AI_CLASSIFY` | Classify into categories (up to 500 labels) |
114
+ | `AI_FILTER` | Boolean filter on text/images |
115
+ | `AI_EXTRACT` | Structured extraction from text/images/documents |
116
+ | `AI_SENTIMENT` | Sentiment score (-1 to 1) |
117
+ | `AI_PARSE_DOCUMENT` | OCR or layout extraction |
118
+ | `AI_REDACT` | PII removal |
119
+
120
+ **Deprecated (do NOT use):** `COMPLETE`, `CLASSIFY_TEXT`, `EXTRACT_ANSWER`, `PARSE_DOCUMENT`, `SUMMARIZE`, `TRANSLATE`, `SENTIMENT`, `EMBED_TEXT_768`.
121
+
122
+ ### TO_FILE — Common Error Source
123
+
124
+ Stage path and filename are **SEPARATE** arguments:
125
+
126
+ ```sql
127
+ -- BAD: TO_FILE('@stage/file.pdf')
128
+ -- GOOD:
129
+ TO_FILE('@db.schema.mystage', 'invoice.pdf')
130
+ ```
131
+
132
+ ### Use AI_CLASSIFY for Classification (Not AI_COMPLETE)
133
+
134
+ ```sql
135
+ SELECT AI_CLASSIFY(ticket_text,
136
+ ['billing', 'technical', 'account']):labels[0]::VARCHAR AS category
137
+ FROM tickets;
138
+ ```
139
+
140
+ ### Cortex Agents
141
+
142
+ ```sql
143
+ CREATE OR REPLACE AGENT my_db.my_schema.sales_agent
144
+ FROM SPECIFICATION $spec$
145
+ {
146
+ "models": {"orchestration": "auto"},
147
+ "instructions": {
148
+ "orchestration": "You are SalesBot...",
149
+ "response": "Be concise."
150
+ },
151
+ "tools": [{"tool_spec": {"type": "cortex_analyst_text_to_sql", "name": "Sales", "description": "Queries sales..."}}],
152
+ "tool_resources": {"Sales": {"semantic_model_file": "@stage/model.yaml"}}
153
+ }
154
+ $spec$;
155
+ ```
156
+
157
+ Agent rules:
158
+ - Use `$spec$` delimiter (not `$$`).
159
+ - `models` must be an object, not an array.
160
+ - `tool_resources` is a separate top-level object, not nested inside tools.
161
+ - Do NOT include empty/null values in edit specs — clears existing values.
162
+ - Tool descriptions are the #1 quality factor.
163
+ - Never modify production agents directly — clone first.
164
+
165
+ ## Snowpark Python
166
+
167
+ ```python
168
+ from snowflake.snowpark import Session
169
+ import os
170
+
171
+ session = Session.builder.configs({
172
+ "account": os.environ["SNOWFLAKE_ACCOUNT"],
173
+ "user": os.environ["SNOWFLAKE_USER"],
174
+ "password": os.environ["SNOWFLAKE_PASSWORD"],
175
+ "role": "my_role", "warehouse": "my_wh",
176
+ "database": "my_db", "schema": "my_schema"
177
+ }).create()
178
+ ```
179
+
180
+ - Never hardcode credentials.
181
+ - DataFrames are lazy — executed on `collect()`/`show()`.
182
+ - Do NOT use `collect()` on large DataFrames — process server-side.
183
+ - Use **vectorized UDFs** (10-100x faster) for batch/ML workloads instead of scalar UDFs.
184
+
185
+ ## dbt on Snowflake
186
+
187
+ Dynamic table materialization (streaming/near-real-time marts):
188
+ ```sql
189
+ {{ config(materialized='dynamic_table', snowflake_warehouse='transforming', target_lag='1 hour') }}
190
+ ```
191
+
192
+ Incremental materialization (large fact tables):
193
+ ```sql
194
+ {{ config(materialized='incremental', unique_key='event_id') }}
195
+ ```
196
+
197
+ Snowflake-specific configs (combine with any materialization):
198
+ ```sql
199
+ {{ config(transient=true, copy_grants=true, query_tag='team_daily') }}
200
+ ```
201
+
202
+ - Do NOT use `{{ this }}` without `{% if is_incremental() %}` guard.
203
+ - Use `dynamic_table` materialization for streaming/near-real-time marts.
204
+
205
+ ## Performance
206
+
207
+ - **Cluster keys**: Only multi-TB tables, on WHERE/JOIN/GROUP BY columns.
208
+ - **Search Optimization**: `ALTER TABLE t ADD SEARCH OPTIMIZATION ON EQUALITY(col);`
209
+ - **Warehouse sizing**: Start X-Small, scale up. `AUTO_SUSPEND = 60`, `AUTO_RESUME = TRUE`.
210
+ - **Separate warehouses** per workload.
211
+ - Estimate AI costs first: `SELECT SUM(AI_COUNT_TOKENS('claude-4-sonnet', text)) FROM table;`
212
+
213
+ ## Security
214
+
215
+ - Follow least-privilege RBAC. Use database roles for object-level grants.
216
+ - Audit ACCOUNTADMIN regularly: `SHOW GRANTS OF ROLE ACCOUNTADMIN;`
217
+ - Use network policies for IP allowlisting.
218
+ - Use masking policies for PII columns and row access policies for multi-tenant isolation.
219
+
220
+ ## Common Error Patterns
221
+
222
+ | Error | Cause | Fix |
223
+ |-------|-------|-----|
224
+ | "Object does not exist" | Wrong context or missing grants | Fully qualify names, check grants |
225
+ | "Invalid identifier" in proc | Missing colon prefix | Use `:variable_name` |
226
+ | "Numeric value not recognized" | VARIANT not cast | `src:field::NUMBER(10,2)` |
227
+ | Task not running | Forgot to resume | `ALTER TASK ... RESUME` |
228
+ | DT refresh failing | Schema change or tracking disabled | Use explicit columns, check change tracking |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: wordpress
3
- description: "Complete WordPress development workflow covering theme development, plugin creation, WooCommerce integration, performance optimization, and security hardening."
3
+ description: "Complete WordPress development workflow covering theme development, plugin creation, WooCommerce integration, performance optimization, and security hardening. Includes WordPress 7.0 features: Real-Time Collaboration, AI Connectors, Abilities API, DataViews, and PHP-only blocks."
4
4
  category: workflow-bundle
5
5
  risk: safe
6
6
  source: personal
@@ -13,6 +13,54 @@ date_added: "2026-02-27"
13
13
 
14
14
  Comprehensive WordPress development workflow covering theme development, plugin creation, WooCommerce integration, performance optimization, and security. This bundle orchestrates skills for building production-ready WordPress sites and applications.
15
15
 
16
+ ## WordPress 7.0 Features (Backward Compatible)
17
+
18
+ WordPress 7.0 (April 9, 2026) introduces significant features while maintaining backward compatibility:
19
+
20
+ ### Real-Time Collaboration (RTC)
21
+ - Multiple users can edit simultaneously using Yjs CRDT
22
+ - HTTP polling provider (configurable via `WP_COLLABORATION_MAX_USERS`)
23
+ - Custom transport via `sync.providers` filter
24
+ - **Backward Compatibility**: Falls back to post locking when legacy meta boxes detected
25
+
26
+ ### AI Connectors API
27
+ - Provider-agnostic AI interface in core (`wp_ai_client_prompt()`)
28
+ - Settings > Connectors for centralized API credential management
29
+ - Official providers: OpenAI, Anthropic Claude, Google Gemini
30
+ - **Backward Compatibility**: Works with WordPress 6.9+ via plugin
31
+
32
+ ### Abilities API (Stable in 7.0)
33
+ - Standardized capability declaration system
34
+ - REST API endpoints: `/wp-json/abilities/v1/manifest`
35
+ - MCP adapter for AI agent integration
36
+ - **Backward Compatibility**: Can be used as Composer package in 6.x
37
+
38
+ ### DataViews & DataForm
39
+ - Replaces WP_List_Table on Posts, Pages, Media screens
40
+ - New layouts: table, grid, list, activity
41
+ - Client-side validation (pattern, minLength, maxLength, min, max)
42
+ - **Backward Compatibility**: Plugins using old hooks still work
43
+
44
+ ### PHP-Only Block Registration
45
+ - Register blocks entirely via PHP without JavaScript
46
+ - Auto-generated Inspector controls
47
+ - **Backward Compatibility**: Existing JS blocks continue to work
48
+
49
+ ### Interactivity API Updates
50
+ - `watch()` replaces `effect` from @preact/signals
51
+ - State navigation changes
52
+ - **Backward Compatibility**: Old syntax deprecated but functional
53
+
54
+ ### Admin Refresh
55
+ - New default color scheme
56
+ - View transitions between admin screens
57
+ - **Backward Compatibility**: CSS-level changes, no breaking changes
58
+
59
+ ### Pattern Editing
60
+ - ContentOnly mode defaults for unsynced patterns
61
+ - `disableContentOnlyForUnsyncedPatterns` setting
62
+ - **Backward Compatibility**: Existing patterns work
63
+
16
64
  ## When to Use This Workflow
17
65
 
18
66
  Use this workflow when:
@@ -22,6 +70,7 @@ Use this workflow when:
22
70
  - Setting up WooCommerce stores
23
71
  - Optimizing WordPress performance
24
72
  - Hardening WordPress security
73
+ - Implementing WordPress 7.0 features (RTC, AI, DataViews)
25
74
 
26
75
  ## Workflow Phases
27
76
 
@@ -33,11 +82,21 @@ Use this workflow when:
33
82
 
34
83
  #### Actions
35
84
  1. Set up local development environment (LocalWP, Docker, or Valet)
36
- 2. Install WordPress
85
+ 2. Install WordPress (recommend 7.0+ for new projects)
37
86
  3. Configure development database
38
87
  4. Set up version control
39
88
  5. Configure wp-config.php for development
40
89
 
90
+ #### WordPress 7.0 Configuration
91
+ ```php
92
+ // wp-config.php - Collaboration settings
93
+ define('WP_COLLABORATION_MAX_USERS', 5);
94
+
95
+ // AI Connector is enabled by installing a provider plugin
96
+ // (e.g., OpenAI, Anthropic Claude, or Google Gemini connector)
97
+ // No constant needed - configure via Settings > Connectors in admin
98
+ ```
99
+
41
100
  #### Copy-Paste Prompts
42
101
  ```
43
102
  Use @app-builder to scaffold a new WordPress project with modern tooling
@@ -59,6 +118,13 @@ Use @app-builder to scaffold a new WordPress project with modern tooling
59
118
  5. Add custom post types and taxonomies
60
119
  6. Implement theme customization options
61
120
  7. Add responsive design
121
+ 8. Test with WordPress 7.0 admin refresh
122
+
123
+ #### WordPress 7.0 Theme Considerations
124
+ - Block API v3 now reference model
125
+ - Pseudo-element support in theme.json
126
+ - Global Styles custom CSS honors block-defined selectors
127
+ - View transitions for admin navigation
62
128
 
63
129
  #### Theme Structure
64
130
  ```
@@ -108,6 +174,56 @@ Use @tailwind-patterns to style WordPress theme with modern CSS
108
174
  6. Implement REST API endpoints
109
175
  7. Add settings and options pages
110
176
 
177
+ #### WordPress 7.0 Plugin Considerations
178
+ - **RTC Compatibility**: Register post meta with `show_in_rest => true`
179
+ - **AI Integration**: Use `wp_ai_client_prompt()` for AI features
180
+ - **DataViews**: Consider new admin UI patterns
181
+ - **Meta Boxes**: Migrate to block-based UIs for collaboration support
182
+
183
+ #### RTC-Compatible Post Meta Registration
184
+ ```php
185
+ register_post_meta('post', 'custom_field', [
186
+ 'type' => 'string',
187
+ 'single' => true,
188
+ 'show_in_rest' => true, // Required for RTC
189
+ 'sanitize_callback' => 'sanitize_text_field',
190
+ ]);
191
+ ```
192
+
193
+ #### AI Connector Example
194
+ ```php
195
+ // Using WordPress 7.0 AI Connector
196
+ // Note: Requires an AI provider plugin (OpenAI, Claude, or Gemini) to be installed and configured
197
+
198
+ // Basic text generation
199
+ $response = wp_ai_client_prompt('Summarize this content.')
200
+ ->generate_text();
201
+
202
+ // With temperature for deterministic output
203
+ $response = wp_ai_client_prompt('Summarize this content.')
204
+ ->using_temperature(0.2)
205
+ ->generate_text();
206
+
207
+ // With model preference (tries first available in list)
208
+ $response = wp_ai_client_prompt('Summarize this content.')
209
+ ->using_model_preference('gpt-4', 'claude-3-opus', 'gemini-2-pro')
210
+ ->generate_text();
211
+
212
+ // For JSON structured output
213
+ $schema = [
214
+ 'type' => 'object',
215
+ 'properties' => [
216
+ 'summary' => ['type' => 'string'],
217
+ 'keywords' => ['type' => 'array', 'items' => ['type' => 'string']]
218
+ ],
219
+ 'required' => ['summary']
220
+ ];
221
+ $response = wp_ai_client_prompt('Analyze this content and return JSON.')
222
+ ->using_system_instruction('You are a content analyzer.')
223
+ ->as_json_response($schema)
224
+ ->generate_text();
225
+ ```
226
+
111
227
  #### Plugin Structure
112
228
  ```
113
229
  plugin-name/
@@ -150,6 +266,12 @@ Use @backend-dev-guidelines to create a WordPress plugin with proper architectur
150
266
  7. Implement subscription products
151
267
  8. Add custom email templates
152
268
 
269
+ #### WordPress 7.0 + WooCommerce Considerations
270
+ - Test checkout with new admin interfaces
271
+ - AI connectors for product descriptions
272
+ - DataViews for order management screens
273
+ - RTC for collaborative order editing
274
+
153
275
  #### Copy-Paste Prompts
154
276
  ```
155
277
  Use @payment-integration to set up WooCommerce with Stripe
@@ -175,6 +297,12 @@ Use @billing-automation to create subscription products in WooCommerce
175
297
  7. Configure OPcache
176
298
  8. Set up Redis/Memcached
177
299
 
300
+ #### WordPress 7.0 Performance
301
+ - Client-side media processing
302
+ - Font Library enabled for all themes
303
+ - Responsive grid block optimizations
304
+ - View transitions reduce perceived load time
305
+
178
306
  #### Performance Checklist
179
307
  - [ ] Page load time < 3 seconds
180
308
  - [ ] Time to First Byte < 200ms
@@ -204,8 +332,14 @@ Use @web-performance-optimization to audit and improve WordPress performance
204
332
  7. Configure security logging
205
333
  8. Set up malware scanning
206
334
 
335
+ #### WordPress 7.0 Security Considerations
336
+ - PHP 7.4 minimum (drops 7.2/7.3 support)
337
+ - Test Abilities API permission boundaries
338
+ - Verify collaboration data isolation
339
+ - AI connector credential security
340
+
207
341
  #### Security Checklist
208
- - [ ] WordPress core updated
342
+ - [ ] WordPress core updated (7.0+ recommended)
209
343
  - [ ] All plugins/themes updated
210
344
  - [ ] Strong passwords enforced
211
345
  - [ ] Two-factor authentication enabled
@@ -240,6 +374,13 @@ Use @security-auditor to perform comprehensive security review
240
374
  6. Performance testing
241
375
  7. Security testing
242
376
 
377
+ #### WordPress 7.0 Testing Priorities
378
+ - Test with iframed post editor
379
+ - Verify DataViews integration
380
+ - Test collaboration (RTC) workflows
381
+ - Validate AI connector functionality
382
+ - Test Interactivity API with watch()
383
+
243
384
  #### Copy-Paste Prompts
244
385
  ```
245
386
  Use @playwright-skill to create E2E tests for WordPress site
@@ -269,7 +410,7 @@ Use @deployment-engineer to set up WordPress deployment pipeline
269
410
 
270
411
  ## WordPress-Specific Workflows
271
412
 
272
- ### Custom Post Type Development
413
+ ### Custom Post Type Development (RTC-Compatible)
273
414
  ```php
274
415
  register_post_type('book', [
275
416
  'labels' => [...],
@@ -277,6 +418,15 @@ register_post_type('book', [
277
418
  'has_archive' => true,
278
419
  'supports' => ['title', 'editor', 'thumbnail', 'excerpt'],
279
420
  'menu_icon' => 'dashicons-book',
421
+ 'show_in_rest' => true, // Enable for RTC
422
+ ]);
423
+
424
+ // Register meta with REST API for collaboration
425
+ register_post_meta('book', 'isbn', [
426
+ 'type' => 'string',
427
+ 'single' => true,
428
+ 'show_in_rest' => true,
429
+ 'sanitize_callback' => 'sanitize_text_field',
280
430
  ]);
281
431
  ```
282
432
 
@@ -291,6 +441,130 @@ add_action('rest_api_init', function() {
291
441
  });
292
442
  ```
293
443
 
444
+ ### WordPress 7.0 AI Connector Usage
445
+ ```php
446
+ // Auto-generate post excerpt with AI
447
+ add_action('save_post', function($post_id, $post) {
448
+ if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) {
449
+ return;
450
+ }
451
+
452
+ // Skip if excerpt already exists
453
+ if (!empty($post->post_excerpt)) {
454
+ return;
455
+ }
456
+
457
+ $content = strip_tags($post->post_content);
458
+ if (empty($content)) {
459
+ return;
460
+ }
461
+
462
+ // Check if AI client is available
463
+ if (!function_exists('wp_ai_client_prompt')) {
464
+ return;
465
+ }
466
+
467
+ // Build prompt with input
468
+ $result = wp_ai_client_prompt(
469
+ 'Create a brief 2-sentence summary of this content: ' . substr($content, 0, 1000)
470
+ );
471
+
472
+ if (is_wp_error($result)) {
473
+ return; // Silently fail - don't block post saving
474
+ }
475
+
476
+ // Use temperature for consistent output
477
+ $result->using_temperature(0.3);
478
+ $summary = $result->generate_text();
479
+
480
+ if ($summary && !is_wp_error($summary)) {
481
+ wp_update_post([
482
+ 'ID' => $post_id,
483
+ 'post_excerpt' => sanitize_textarea_field($summary)
484
+ ]);
485
+ }
486
+ }, 10, 2);
487
+ ```
488
+
489
+ ### PHP-Only Block Registration (WordPress 7.0)
490
+ ```php
491
+ // Register block entirely in PHP
492
+ register_block_type('my-plugin/hello-world', [
493
+ 'render_callback' => function($attributes, $content) {
494
+ return '<p class="hello-world">Hello, World!</p>';
495
+ },
496
+ 'attributes' => [
497
+ 'message' => ['type' => 'string', 'default' => 'Hello!']
498
+ ],
499
+ ]);
500
+ ```
501
+
502
+ ### Abilities API Registration
503
+ ```php
504
+ // Register ability category on correct hook
505
+ add_action('wp_abilities_api_categories_init', function() {
506
+ wp_register_ability_category('content-creation', [
507
+ 'label' => __('Content Creation', 'my-plugin'),
508
+ 'description' => __('Abilities for generating and managing content', 'my-plugin'),
509
+ ]);
510
+ });
511
+
512
+ // Register abilities on correct hook
513
+ add_action('wp_abilities_api_init', function() {
514
+ wp_register_ability('my-plugin/generate-summary', [
515
+ 'label' => __('Generate Post Summary', 'my-plugin'),
516
+ 'description' => __('Creates an AI-powered summary of a post', 'my-plugin'),
517
+ 'category' => 'content-creation',
518
+ 'input_schema' => [
519
+ 'type' => 'object',
520
+ 'properties' => [
521
+ 'post_id' => ['type' => 'integer', 'description' => 'The post ID to summarize']
522
+ ],
523
+ 'required' => ['post_id']
524
+ ],
525
+ 'output_schema' => [
526
+ 'type' => 'object',
527
+ 'properties' => [
528
+ 'summary' => ['type' => 'string', 'description' => 'The generated summary']
529
+ ]
530
+ ],
531
+ 'execute_callback' => 'my_plugin_generate_summary_handler',
532
+ 'permission_callback' => function() {
533
+ return current_user_can('edit_posts');
534
+ }
535
+ ]);
536
+ });
537
+
538
+ // Handler function for the ability
539
+ function my_plugin_generate_summary_handler($input) {
540
+ $post_id = isset($input['post_id']) ? absint($input['post_id']) : 0;
541
+ $post = get_post($post_id);
542
+
543
+ if (!$post) {
544
+ return new WP_Error('invalid_post', 'Post not found');
545
+ }
546
+
547
+ $content = strip_tags($post->post_content);
548
+ if (empty($content)) {
549
+ return ['summary' => ''];
550
+ }
551
+
552
+ if (!function_exists('wp_ai_client_prompt')) {
553
+ return new WP_Error('ai_unavailable', 'AI client not available');
554
+ }
555
+
556
+ $result = wp_ai_client_prompt('Summarize in 2 sentences: ' . substr($content, 0, 1000))
557
+ ->using_temperature(0.3)
558
+ ->generate_text();
559
+
560
+ if (is_wp_error($result)) {
561
+ return $result;
562
+ }
563
+
564
+ return ['summary' => sanitize_textarea_field($result)];
565
+ }
566
+ ```
567
+
294
568
  ### WooCommerce Custom Product Type
295
569
  ```php
296
570
  add_action('init', function() {
@@ -309,6 +583,7 @@ Before moving to next phase, verify:
309
583
  - [ ] Cross-browser tested
310
584
  - [ ] Mobile responsive verified
311
585
  - [ ] Accessibility checked (WCAG 2.1)
586
+ - [ ] WordPress 7.0 compatibility verified (for new projects)
312
587
 
313
588
  ## Related Workflow Bundles
314
589
 
@@ -316,3 +591,5 @@ Before moving to next phase, verify:
316
591
  - `security-audit` - Security testing
317
592
  - `testing-qa` - Testing workflow
318
593
  - `ecommerce` - E-commerce development
594
+
595
+ (End of file - total 440 lines)