pw-docs-architect
Use when creating or updating module documentation, package READMEs, architecture guides, or CLI command references for ProcessWire projects.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when creating or updating module documentation, package READMEs, architecture guides, or CLI command references for ProcessWire projects.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when building, structuring, or refactoring native backend modules for ProcessWire using PHP 8.4 and strict typing.
Use when designing, structuring, or rendering HTML for ProcessWire Admin interfaces, custom Process modules, or Inputfields.
Use when brainstorming or designing ProcessWire modules, templates, field schemas, or hooks to resolve ambiguity and validate architecture before implementation.
Use when creating, executing, or managing Pest tests within ProcessWire or ProcessWire modules, including Test-Driven Development (TDD) tasks.
Use when encountering any bug, test failure, blank screen of death, or unexpected behavior in ProcessWire before proposing fixes.
Use when creating implementation plans from approved specifications to ensure ProcessWire-native architecture, safe migration structures, and strict test-driven task execution.
| name | pw-docs-architect |
| description | Use when creating or updating module documentation, package READMEs, architecture guides, or CLI command references for ProcessWire projects. |
| risk | safe |
| source | processwire-boost |
| date_added | 2026-04-08 |
Create comprehensive, long-form technical documentation for ProcessWire modules, packages, and systems. Captures both the what and the why of every component.
vendor/bin/wire commandsBefore writing anything, analyze the codebase:
# Understand the schema
pw_schema_read
# List installed modules
pw_module_list
# Check module structure
ls site/modules/MyModule/
# Review existing docs
cat site/modules/MyModule/README.md
Key questions to answer:
Organize documentation with progressive disclosure:
1. Executive Summary → 1 paragraph, what it does
2. Installation → Composer, module install, config
3. Quick Start → Working example in 30 seconds
4. Configuration → All module config options
5. Usage → Core features with examples
6. CLI Commands → Full command reference
7. Architecture → How it works internally
8. API Reference → Hooks, methods, events
9. Security → RBAC, sanitization, CSRF
10. Troubleshooting → Common issues and solutions
Follow these ProcessWire-specific conventions:
# ModuleName
> One-line description of what the module does.
## Requirements
- ProcessWire >= 3.0.200
- PHP >= 8.3
- [Other module dependencies]
## Installation
\`\`\`bash
composer require vendor/module-name
\`\`\`
Then install via ProcessWire admin:
**Modules → Refresh → Find → Install**
Or via CLI:
\`\`\`bash
wire module:install ModuleName
\`\`\`
## Configuration
| Setting | Type | Default | Description |
|---------|------|---------|-------------|
| `apiKey` | string | `''` | API key for external service |
| `cacheTime` | int | `3600` | Cache duration in seconds |
## Quick Start
\`\`\`php
// In a template file
$result = $modules->get('ModuleName')->process($page);
echo $result->output;
\`\`\`
## Features
### Feature A
Description with code example...
### Feature B
Description with code example...
For modules exposing public methods, always create an API.md file alongside README.md.
# MyModuleClass
> API reference for interacting with MyModule from templates or hooks.
## Value Types
- Returns `\ProcessWire\WireArray` for grouped items.
- Returns `\ProcessWire\NullPage` on search failure.
## Selectors
\`\`\`php
$results = $modules->get('MyModuleClass')->find("status=active");
\`\`\`
For Fieldtype modules, document properties by creating a companion [Type]Field.php class with PHPDoc annotations. This is how IDEs understand the Field settings.
<?php namespace ProcessWire;
/**
* Companion class for IDE autocompletion
*
* @property int $maxLength Maximum string length
* @property string $defaultText Default fallback text
*/
class FieldtypeMyCustomField extends Field {}
## CLI Commands
### `domain:action`
Brief description of what this command does.
**Usage:**
\`\`\`bash
wire domain:action [options] [arguments]
\`\`\`
**Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `name` | Yes | The resource name |
**Options:**
| Option | Short | Default | Description |
|--------|-------|---------|-------------|
| `--json` | `-j` | `false` | Output as JSON |
| `--dry-run` | | `false` | Preview without changes |
| `--force` | `-f` | `false` | Skip confirmation |
**Examples:**
\`\`\`bash
# Basic usage
wire domain:action my-resource
# With JSON output
wire domain:action my-resource --json
# Force without confirmation
wire domain:action my-resource --force
\`\`\`
## Hooks
### `Pages::saved`
Triggered after a page is saved. Updates the search index.
\`\`\`php
$wire->addHookAfter('Pages::saved', function (HookEvent $event) {
$page = $event->arguments(0);
if ($page->template->name !== 'article') return;
$indexer = $event->wire()->modules->get('SearchIndexer');
$indexer->reindex($page);
});
\`\`\`
### URL Hook: `/api/search/`
Returns search results as JSON.
**Method:** GET
**Authentication:** None required
**Rate Limit:** 60/minute
**Parameters:**
| Param | Type | Required | Description |
|-------|------|----------|-------------|
| `q` | string | Yes | Search query (sanitized via `selectorValue`) |
| `limit` | int | No | Max results (default: 20, max: 100) |
**Response:**
\`\`\`json
{
"count": 5,
"results": [
{"id": 1042, "title": "Example", "url": "/blog/example/"}
]
}
\`\`\`
## Architecture
### Overview
Brief description of how the module works internally.
### Data Flow
\`\`\`
User Input → $sanitizer → Selector Query → $pages->find()
↓
Page Processing
↓
Template Rendering → Output
\`\`\`
### Database Schema
This module creates the following fields:
| Field | Type | Description |
|-------|------|-------------|
| `ai_summary` | FieldtypeTextarea | AI-generated page summary |
| `ai_status` | FieldtypeOptions | Processing status (pending/done/error) |
### Design Decisions
**Why Page References instead of Repeaters?**
Page references allow cross-template querying and independent lifecycle management.
Repeaters would constrain data to a single parent context.
**Why URL hooks instead of template-based routing?**
The API endpoints have no corresponding page tree structure.
URL hooks provide cleaner separation between data API and content pages.
Before publishing documentation:
API.md is generated for modules exposing public API methods[Type]Field.php companion class is created for Fieldtypes$sanitizer for user input