xiaohongshu
xiaohongshu
extract-requirements
Use this when user needs to document business requirements from undocumented legacy code. Provides systematic 6-phase extraction: automated analysis, validation rules, use cases, business rules, data models, and workflow mapping. Apply for legacy system documentation, migration planning, complian...
Full skill instructions
Systematic process for extracting business requirements from undocumented or poorly documented codebases.
codecompass batch:index <path>
codecompass health
Step 1.1: Run Requirements Extractor
codecompass requirements:extract --project-id <id> --output requirements.md
What this extracts:
Step 1.2: Review Output
Check generated requirements.md:
From Models/Entities:
// Yii2 Model example
public function rules() {
return [
[['email', 'password'], 'required'],
['email', 'email'],
['password', 'string', 'min' => 8],
['age', 'integer', 'min' => 18],
];
}
Extracted Requirements:
### User Registration Requirements
- REQ-001: Email address is mandatory
- REQ-002: Email must be valid format
- REQ-003: Password is mandatory
- REQ-004: Password minimum length: 8 characters
- REQ-005: User must be at least 18 years old
From Controllers:
// Controller actions → Use cases
public function actionCreate() {
// Use Case: Create New Order
}
public function actionApprove($id) {
// Use Case: Approve Order (with authorization check)
}
public function actionCancel($id) {
// Use Case: Cancel Order (business rules apply)
}
Extracted Use Cases:
## Order Management Use Cases
### UC-001: Create New Order
**Actor**: Customer
**Preconditions**: User authenticated
**Steps**:
1. User selects products
2. System validates inventory
3. User provides shipping address
4. System calculates total
5. Order created in pending status
### UC-002: Approve Order
**Actor**: Manager
**Preconditions**:
- Order in pending status
- User has 'manager' role
**Steps**:
1. Manager reviews order details
2. System validates business rules
3. Order status changed to approved
4. Notification sent to customer
Semantic Search for Rules:
codecompass search:semantic "business validation rules for order approval"
codecompass search:semantic "conditions for discount calculation"
codecompass search:semantic "authorization checks for admin actions"
Common Patterns to Find:
From Database Schema:
CREATE TABLE orders (
id INT PRIMARY KEY,
status ENUM('pending', 'approved', 'shipped', 'cancelled'),
total DECIMAL(10,2) NOT NULL CHECK (total >= 0),
customer_id INT NOT NULL FOREIGN KEY REFERENCES customers(id),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Extracted Requirements:
### Data Requirements
- REQ-010: Order must have unique identifier
- REQ-011: Order status: pending, approved, shipped, or cancelled
- REQ-012: Order total must be non-negative
- REQ-013: Order must be associated with a customer
- REQ-014: Order creation timestamp must be recorded
Identify State Machines:
Order Status Flow:
pending → approved → shipped → delivered
↓
cancelled
Extract Transitions:
### Order Workflow
**States**: pending, approved, shipped, cancelled, delivered
**Transitions**:
- pending → approved (requires: manager approval)
- approved → shipped (requires: items in stock)
- shipped → delivered (requires: delivery confirmation)
- pending|approved → cancelled (requires: cancellation reason)
**Business Rules**:
- Cannot cancel after shipped
- Cannot approve if out of stock
- Refund required if cancelled after payment
Look for:
if statements → Business conditionsswitch/case → State transitionsTests reveal:
codecompass search:semantic "test cases for order validation"
Config files contain:
Find related code:
# Find all code related to "discount calculation"
codecompass search:semantic "discount calculation logic"
# Find all code related to "inventory management"
codecompass search:semantic "inventory stock management"
Group results by business capability
# Business Requirements - [System Name]
## Functional Requirements
### FR-001: User Authentication
**Priority**: High
**Description**: System must authenticate users via email and password
**Acceptance Criteria**:
- Email validation follows RFC 5322
- Password minimum 8 characters
- Account locked after 5 failed attempts
**Source**: UserController::actionLogin(), User::validatePassword()
### FR-002: Order Approval Workflow
...
{
"capabilities": {
"user_management": {
"features": ["register", "login", "reset_password"],
"rules": ["email_unique", "password_complexity"],
"roles": ["user", "admin"]
},
"order_processing": {
"features": ["create", "approve", "cancel", "ship"],
"rules": ["approval_required", "inventory_check"],
"workflow": "pending→approved→shipped→delivered"
}
}
}
| UC ID | Use Case Name | Actor | Complexity |
|-------|---------------|-------|------------|
| UC-001 | Create Order | Customer | Medium |
| UC-002 | Approve Order | Manager | Low |
| UC-003 | Cancel Order | Customer/Manager | High |
Compare extracted requirements with test cases:
# For each requirement, verify in code
codecompass search:semantic "password must be at least 8 characters"
Should find validator implementation
Map requirements to code:
| Requirement | Source Files | Tests |
|-------------|--------------|-------|
| REQ-001 | User.php:45, UserController.php:102 | UserTest.php:23 |
| REQ-002 | Order.php:78 | OrderTest.php:56 |
Code:
if ($order->total < 1000) {
// No approval needed
}
Requirement:
REQ: Orders under $1000 do not require manager approval
Code:
$discount = ($customer->vip) ? 0.20 : 0.10;
Requirement:
REQ: VIP customers receive 20% discount, regular customers 10%
Code:
if (strtotime($order->created_at) > strtotime('-30 days')) {
// Can cancel
}
Requirement:
REQ: Orders can only be cancelled within 30 days of creation
0-discover-capabilities.md - Find relevant modulessemantic-search.md - Search for business logicanalyze-yii2-project.md - Framework-specific extractionFrom .ai/capabilities.json:
requirements - RequirementsExtractionServicebusiness-analyzer - CapabilityCatalogServicesearch - Semantic code searchanalyzers - Code analysis for extractionRemember: Requirements are what the system must do, not how it does it. Focus on business value, not technical implementation.
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