xiaohongshu
xiaohongshu
functional-designer
Designs functional architecture and detailed specifications for PHP/CakePHP applications based on analyzed requirements
Full skill instructions
A specialized skill for creating detailed functional designs and technical specifications for PHP/CakePHP applications.
Component Mapping:
Functional Component Design:
Controllers:
- name: [Controller]Controller
- actions: [list of actions]
- authentication: required|optional
- authorization: role-based permissions
Models:
- Tables: [list of Table classes]
- Entities: [list of Entity classes]
- Associations: [relationships]
- Validation: [rules]
Views:
- Templates: [list of .php files]
- Elements: [reusable components]
- Layouts: [page structures]
Components:
- Custom components needed
- Third-party integrations
RESTful Endpoint Design:
API Endpoint:
method: GET|POST|PUT|DELETE
path: /api/v1/[resource]
authentication: required|optional
request:
headers:
Content-Type: application/json
Authorization: Bearer [token]
body:
field1: type
field2: type
response:
success:
status: 200
body: {data: [...]}
error:
status: 400|401|404|500
body: {error: "message"}
Request Lifecycle:
1. Route → Controller
2. Controller → Authorization Check
3. Controller → Validation
4. Controller → Model/Service
5. Model → Database
6. Model → Entity
7. Controller → View/JSON Response
Data Transformation:
Input Data → Validation → Business Logic → Entity → Output Format
MVC Structure:
src/
├── Controller/
│ ├── AppController.php
│ ├── User/
│ │ └── UsersController.php
│ └── Api/
│ └── UsersController.php
├── Model/
│ ├── Table/
│ │ └── UsersTable.php
│ └── Entity/
│ └── User.php
├── View/
│ └── User/
│ └── Users/
│ ├── index.php
│ ├── view.php
│ ├── add.php
│ └── edit.php
└── Service/
└── UserService.php
# Functional Design: [Feature Name]
## 1. Overview
### Purpose
[Brief description of what this feature does]
### Scope
- In Scope: [what's included]
- Out of Scope: [what's not included]
## 2. Functional Components
### 2.1 Controllers
#### [Name]Controller
- **Purpose**: [description]
- **Actions**:
- index(): List all records
- view($id): Display single record
- add(): Create new record
- edit($id): Update existing record
- delete($id): Remove record
### 2.2 Models
#### [Name]Table
- **Fields**:
- id (integer, primary key)
- name (string, required)
- status (integer, default: 1)
- created (datetime)
- modified (datetime)
- **Associations**:
- belongsTo: [Parent]
- hasMany: [Children]
- **Validation Rules**:
- name: notEmpty, maxLength(255)
- email: email, unique
### 2.3 Business Logic
```php
// Pseudo-code for main logic
public function processOrder($data) {
// 1. Validate input
// 2. Calculate totals
// 3. Check inventory
// 4. Create order
// 5. Send notifications
// 6. Return result
}
CREATE TABLE orders (
id INT PRIMARY KEY AUTO_INCREMENT,
user_id INT NOT NULL,
total DECIMAL(10,2),
status INT DEFAULT 1,
created DATETIME,
modified DATETIME,
FOREIGN KEY (user_id) REFERENCES users(id)
);
| Method | Path | Description |
|---|---|---|
| GET | /api/orders | List orders |
| GET | /api/orders/{id} | Get order details |
| POST | /api/orders | Create order |
| PUT | /api/orders/{id} | Update order |
| DELETE | /api/orders/{id} | Delete order |
## Design Patterns
### 1. Service Layer Pattern
```php
// Service class for complex business logic
class OrderService
{
private $Orders;
private $Inventory;
public function createOrder($data)
{
// Complex logic separated from controller
}
}
// Custom finder methods in Table class
class OrdersTable extends Table
{
public function findPending(Query $query, array $options)
{
return $query->where(['status' => 'pending']);
}
}
// Event listeners for decoupled components
EventManager::instance()->on(
'Model.Order.afterCreate',
function ($event, $order) {
// Send notification
// Update inventory
// Log activity
}
);
// Company-specific data access
public function getCompanyOrders($companyId)
{
$conn = $this->MessageDeliveryDbAccessor
->getUserMessageDeliveryDbConnection($companyId);
$this->Orders->setConnection($conn);
return $this->Orders->find()->all();
}
Plugins to integrate:
- Authentication: CakePHP/Authentication
- Authorization: CakePHP/Authorization
- PDF Generation: FriendsOfCake/CakePdf
- Email: Built-in Mailer
// Async job processing
QueueManager::push(SendEmailJob::class, [
'to' => $user->email,
'template' => 'order_confirmation',
'data' => $orderData
]);
Feature: User Management
Controllers:
UsersController:
- index: List users with pagination
- add: Create user with role assignment
- edit: Update user profile
- delete: Soft delete with audit log
Models:
UsersTable:
fields: [id, email, password, role_id, status]
associations:
- belongsTo: Roles
- hasMany: Orders
validation:
- email: unique, valid format
- password: min 8 chars, complexity rules
Security:
- Password hashing: bcrypt
- Session management: 30 min timeout
- Role-based access: Admin, Manager, User
Feature: Sales Reporting
Components:
ReportGenerator:
- generateMonthly(): Create monthly report
- exportPdf(): Convert to PDF
- sendEmail(): Email to stakeholders
Data Sources:
- Orders table
- OrderItems table
- Products table
Performance:
- Use database views for complex queries
- Cache generated reports for 24 hours
- Background job for large reports
Remember: Good design makes implementation straightforward and maintenance easy.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience