Master backend architectures, REST API design, microservices, and server-side development across multiple languages. Use this as a central index to access specialized sub-skills.
中文简介正在准备中。当前显示原文说明。
Generates code examples for PHP documentation. Creates minimal, copy-paste ready examples with expected output.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
Generate effective code examples for documentation.
| Type | Purpose | Length | Use When |
|---|---|---|---|
| Minimal | Show single concept | 5-10 lines | Teaching one thing |
| Complete | Show full usage | 20-50 lines | Production reference |
| Progressive | Build complexity | 3+ examples | Tutorial style |
<?php
use Vendor\Package\Client;
$client = new Client();
$result = $client->process('data');
echo $result->status; // "success"
Characteristics:
<?php
declare(strict_types=1);
require 'vendor/autoload.php';
use Vendor\Package\Client;
use Vendor\Package\Config;
use Vendor\Package\Exception\ClientException;
// Configuration
$config = new Config(
apiKey: getenv('API_KEY') ?: throw new RuntimeException('API_KEY required'),
timeout: 30,
retries: 3,
);
// Initialize client
$client = new Client($config);
try {
// Make request
$result = $client->process([
'data' => 'input value',
'options' => ['validate' => true],
]);
// Handle success
echo "Status: {$result->status}\n";
echo "ID: {$result->id}\n";
} catch (ClientException $e) {
// Handle error
echo "Error: {$e->getMessage()}\n";
exit(1);
}
/* Output:
Status: success
ID: res_abc123
*/
Characteristics:
## Basic Usage
Start with the simplest case:
```php
$client = new Client();
$result = $client->ping();
// "pong"
Add configuration options:
$client = new Client([
'timeout' => 30,
]);
$result = $client->ping();
// "pong"
Add authentication:
$client = new Client([
'api_key' => 'your-key',
'timeout' => 30,
]);
$result = $client->process('data');
// {"status": "success", "id": "..."}
Full example with error handling:
try {
$client = new Client([
'api_key' => getenv('API_KEY'),
'timeout' => 30,
'retries' => 3,
]);
$result = $client->process('data');
echo $result->status;
} catch (ClientException $e) {
error_log($e->getMessage());
exit(1);
}
## Example Patterns
### Before/After Pattern
```markdown
### Refactoring Example
**Before (Anti-pattern):**
```php
// ❌ Don't do this
$data = file_get_contents('data.json');
$json = json_decode($data);
if ($json === null) {
die('Invalid JSON');
}
After (Recommended):
// ✅ Do this instead
use Vendor\Package\JsonLoader;
$loader = new JsonLoader();
$data = $loader->load('data.json');
// Throws JsonException on invalid data
### Input/Output Pattern
```markdown
### String Transformation
**Input:**
```php
$input = "Hello World";
Code:
$result = $transformer->slugify($input);
Output:
$result = "hello-world";
### Comparison Pattern
```markdown
### Framework Comparison
**Symfony:**
```php
use Symfony\Component\HttpFoundation\Response;
return new Response('Hello', 200);
Laravel:
return response('Hello', 200);
Native:
http_response_code(200);
echo 'Hello';
## Code Block Guidelines
### Language Tags
```markdown
```php # PHP code
```bash # Shell commands
```json # JSON data
```yaml # YAML config
```sql # Database queries
```diff # Code changes
<?php
$client = new Client([
// highlight-next-line
'api_key' => 'your-key', // <-- This is important
'timeout' => 30,
]);
```php {1,3-5}
<?php // Line 1
// Line 2
$config = new Config(); // Line 3
$config->setTimeout(30); // Line 4
$config->setRetries(3); // Line 5
## Common Patterns
### CRUD Operations
```markdown
### Create
```php
$item = $client->items->create([
'name' => 'New Item',
'price' => 99.99,
]);
echo $item->id; // "item_abc123"
$item = $client->items->get('item_abc123');
echo $item->name; // "New Item"
$item = $client->items->update('item_abc123', [
'price' => 79.99,
]);
echo $item->price; // 79.99
$client->items->delete('item_abc123');
// No return value, throws on error
$items = $client->items->list(['limit' => 10]);
foreach ($items as $item) {
echo "{$item->name}: {$item->price}\n";
}
### Error Handling
```markdown
### Handling Errors
```php
use Vendor\Package\Exception\{
NotFoundException,
ValidationException,
RateLimitException,
};
try {
$result = $client->process($data);
} catch (NotFoundException $e) {
// Resource doesn't exist
echo "Not found: {$e->getMessage()}";
} catch (ValidationException $e) {
// Invalid input
foreach ($e->getErrors() as $field => $messages) {
echo "{$field}: " . implode(', ', $messages) . "\n";
}
} catch (RateLimitException $e) {
// Too many requests
sleep($e->getRetryAfter());
// Retry...
}
### Async Operations
```markdown
### Async Processing
```php
// Start async job
$job = $client->jobs->create([
'type' => 'export',
'params' => ['format' => 'csv'],
]);
echo "Job started: {$job->id}\n";
// Poll for completion
while ($job->status !== 'completed') {
sleep(5);
$job = $client->jobs->get($job->id);
echo "Status: {$job->status}\n";
}
// Get result
$result = $client->jobs->getResult($job->id);
file_put_contents('export.csv', $result->content);
## Quality Checklist
### Every Example Should
- [ ] Run without modification (except config)
- [ ] Show expected output
- [ ] Use realistic data (not foo/bar)
- [ ] Include necessary imports
- [ ] Follow PSR-12 style
- [ ] Match current API version
### Avoid
- [ ] Abstract examples that don't run
- [ ] Missing `<?php` tag when standalone
- [ ] Outdated syntax or deprecated methods
- [ ] Foo/Bar/Baz placeholder names
- [ ] Missing required configuration
- [ ] Unexplained magic values
## Generation Instructions
When generating code examples:
1. **Choose example type** based on purpose
2. **Use realistic data** (emails, names, prices)
3. **Include expected output** in comments
4. **Show imports** when needed
5. **Add error handling** in complete examples
6. **Test examples** actually run
7. **Match coding style** of the project
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Master backend architectures, REST API design, microservices, and server-side development across multiple languages. Use this as a central index to access specialized sub-skills.
中文简介正在准备中。当前显示原文说明。
在每次回复中使用固定前缀并列出本次实际参考的指令/文件,便于校验是否遵循上下文与规则。
中文简介正在准备中。当前显示原文说明。
Automate 21risk tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Automate 2chat tasks via Rube MCP (Composio). Always search tools first for current schemas.
中文简介正在准备中。当前显示原文说明。
Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.
中文简介正在准备中。当前显示原文说明。
[00] META. Orchestrate skills into dynamic chains for complex tasks. Analyzes the task, discovers available skills, builds an optimal chain, explains why each skill is needed, and executes step-by-step with user confirmation. Use for any complex task requiring multiple thinking/research/analysis steps. Triggers on "plan this", "how to approach", "what's the strategy", "build a plan", or any multi-step problem requiring skill orchestration.
中文简介正在准备中。当前显示原文说明。