Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

analyze-yii2-project分析 yii2 项目

Agent Skill

analyze-yii2-project 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,247

周安装

53

GitHub Stars

1

下载量

437
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:analyze-yii2-project(分析 yii2 项目)
来源仓库:https://github.com/pearlthoughts/codecompass
仓库路径:skills/analyze-yii2-project
安装命令:
npx skills add https://github.com/pearlthoughts/codecompass --skill analyze-yii2-project
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/pearlthoughts/codecompass --skill analyze-yii2-project

简介

analyze-yii2-project 针对遗留 Yii2 项目进行全方位架构与业务逻辑提取,支持现代化迁移规划。

  • 适合接手未文档化项目或评估技术债务,输出包含模块划分、依赖关系与重构优先级。
  • 依赖 Weaviate、Ollama 与 PostgreSQL 基础设施,需本地部署后才能启动分析流程。
  • 支持自然语言提问与代码片段检索,但要求用户提供完整项目路径与必要环境准备。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Analyze Yii2 Project Workflow

Purpose

Comprehensive workflow for analyzing legacy Yii2 projects to extract business logic, understand architecture, and plan modernization.

When to Use

  • ✅ User provides Yii2 codebase for analysis
  • ✅ Planning Yii2 → NestJS/Modern framework migration
  • ✅ Need to understand undocumented Yii2 project
  • ✅ Extracting business requirements from Yii2 code
  • ✅ Technical debt assessment of Yii2 application

Prerequisites

Infrastructure Check

codecompass health

Verify:

  • ✅ Weaviate running (localhost:8081)
  • ✅ Ollama running (localhost:11434)
  • ✅ PostgreSQL running (localhost:5433)

Project Requirements

  • Yii2 project directory accessible
  • vendor/ directory present (run composer install if missing)
  • Read permissions on all files

Step-by-Step Workflow

Phase 1: Initial Scan (Quick Overview)

Step 1.1: Run Yii2 Analyzer

codecompass analyze:yii2 <path-to-yii2-project>

What this does:

  • Scans directory structure
  • Detects Yii2 version
  • Identifies conventions (controllers, models, views)
  • Extracts routing patterns
  • Maps database migrations

Expected output:

  • Framework version
  • Directory structure validation
  • Controller/Model counts
  • Migration history

Step 1.2: Validate Results Check for:

  • ❌ Missing vendor/ → Run composer install
  • ❌ Old Yii2 version (<2.0.40) → Check compatibility notes in docs/YII2_QUICK_REFERENCE.md
  • ❌ Non-standard structure → May need manual configuration

Phase 2: Business Capability Extraction

Step 2.1: Extract Controllers → Capabilities

# Analyzer automatically extracts business capabilities from controllers

What this maps:

Controller → Business Capability
├── UserController → User Management
├── OrderController → Order Processing
├── PaymentController → Payment Handling
└── ReportController → Reporting & Analytics

Step 2.2: Extract Models → Domain Entities Identifies:

  • ActiveRecord models → Database entities
  • Validation rules → Business rules
  • Relationships → Domain model connections

Step 2.3: Extract Migrations → Data Model Evolution Traces:

  • Schema changes over time
  • Business logic embedded in migrations
  • Data transformation patterns

Phase 3: Dependency Analysis

Step 3.1: Analyze Class Dependencies Uses: AstAnalyzerService for PHP parsing

Maps:

  • Tight coupling (classes depending on many others)
  • Circular dependencies (refactoring red flags)
  • Inheritance hierarchies
  • Service dependencies

Step 3.2: Identify Core vs Supporting Logic Categorizes:

  • Core Domain: Business-critical logic (preserve carefully)
  • Supporting: Infrastructure, utilities (can be replaced)
  • Generic: Framework boilerplate (discard in migration)

Phase 4: Requirements Extraction

Step 4.1: Run Requirements Extractor

codecompass requirements:extract --project-id <yii2-project-id>

Extracts:

  • Validation rules from models → Business constraints
  • Controller actions → Use cases
  • RBAC rules (if present) → Authorization requirements
  • Database constraints → Data integrity rules

Step 4.2: Generate Documentation Outputs:

  • Business capability map (Markdown)
  • Domain model diagram (Mermaid)
  • Use case catalog
  • Data dictionary

Phase 5: Semantic Indexing (Optional but Recommended)

Step 5.1: Index Codebase

codecompass batch:index <path-to-yii2-project>

Why:

  • Enables semantic search for "business logic for payment processing"
  • Cross-file pattern discovery
  • Similar code detection
  • Natural language queries

Step 5.2: Verify Indexing

curl http://localhost:8081/v1/schema
# Check for CodeContext or AtlasCode collection

Step 5.3: Test Semantic Search

codecompass search:semantic "validation rules for customer registration"

Should return: User model validators, controller logic, related code

Phase 6: Migration Planning

Step 6.1: Identify Migration Complexity Assess:

  • Low complexity: CRUD operations, standard patterns
  • Medium complexity: Custom workflows, business rules
  • High complexity: Legacy integrations, undocumented logic

Step 6.2: Prioritize by Business Value Map:

Business Capability → Migration Priority
├── Core Revenue Generating → HIGH (do first, carefully)
├── Customer-Facing → MEDIUM (visible impact)
└── Internal Tools → LOW (can defer)

Step 6.3: Generate Migration Roadmap Structure:

  1. Infrastructure setup (NestJS, TypeORM, etc.)
  2. Domain models (migrate ActiveRecords → TypeORM entities)
  3. Core business logic (preserve carefully)
  4. API layer (REST/GraphQL endpoints)
  5. Background jobs (if using Yii2 queue)
  6. Testing & validation

Common Patterns to Look For

Yii2 Controller Patterns

// CRUD pattern
public function actionIndex() // → LIST endpoint
public function actionView($id) // → GET/:id endpoint
public function actionCreate() // → POST endpoint
public function actionUpdate($id) // → PUT/:id endpoint
public function actionDelete($id) // → DELETE/:id endpoint

Maps to NestJS:

@Controller('users')
export class UsersController {
  @Get() findAll()
  @Get(':id') findOne()
  @Post() create()
  @Put(':id') update()
  @Delete(':id') remove()
}

Yii2 Model Patterns

// Validation rules
public function rules() {
  return [
    [['email'], 'required'],
    [['email'], 'email'],
  ];
}

Maps to NestJS DTO:

export class CreateUserDto {
  @IsNotEmpty()
  @IsEmail()
  email: string;
}

Yii2 Database Patterns

// ActiveRecord query
$users = User::find()
  ->where(['status' => User::STATUS_ACTIVE])
  ->orderBy('created_at DESC')
  ->all();

Maps to TypeORM:

const users = await this.userRepository.find({
  where: { status: UserStatus.ACTIVE },
  order: { createdAt: 'DESC' },
});

Output Artifacts

1. Architecture Diagram (Mermaid)

graph TD
  Controller[Controllers] --> Service[Business Logic]
  Service --> Model[ActiveRecord Models]
  Model --> DB[(Database)]
  Controller --> View[Views]

2. Business Capability Map

## Core Capabilities
- User Management (UserController, User model)
- Order Processing (OrderController, Order/OrderItem models)
- Payment Handling (PaymentController, Payment model)

## Supporting Capabilities
- Reporting (ReportController)
- Notifications (EmailService)

3. Migration Checklist

  • Set up NestJS project structure
  • Migrate database schema (Yii2 migrations → TypeORM migrations)
  • Port models (ActiveRecord → TypeORM entities)
  • Reimplement business logic (preserve rules!)
  • Create API endpoints (REST/GraphQL)
  • Port authentication/authorization
  • Migrate background jobs
  • Integration testing
  • Performance testing
  • Gradual rollout

Common Issues & Solutions

Issue 1: Cannot find controllers

Symptom: Analyzer reports 0 controllers Cause: Non-standard directory structure Solution: Check @app alias configuration in Yii2, adjust paths

Issue 2: Missing database schema

Symptom: Cannot extract models properly Cause: Database not accessible or migrations not run Solution: Ensure database connection configured, run pending migrations

Issue 3: Circular dependencies detected

Symptom: Dependency graph shows circular references Meaning: Code smell - tight coupling between modules Action: Plan refactoring to break cycles during migration

Issue 4: Undocumented business rules

Symptom: Complex logic in controllers with no comments Action:

  1. Use semantic search to find similar patterns
  2. Interview original developers if available
  3. Write tests to capture behavior before migration
  4. Document assumptions in requirements docs

Best Practices

✅ Do

  • Run full analysis before planning migration
  • Extract ALL business rules (even implicit ones)
  • Document assumptions and unknowns
  • Test semantic search to validate indexing
  • Create comprehensive capability map
  • Prioritize by business value, not technical ease

❌ Don't

  • Skip dependency analysis (will bite you later)
  • Assume standard Yii2 patterns everywhere
  • Ignore validation rules (they're business requirements!)
  • Start coding before understanding full architecture
  • Migrate everything at once (strangler fig pattern instead)

Related Skills

  • extract-requirements.md - For detailed requirements extraction
  • semantic-search.md - For code exploration
  • software-architect.md - For architecture perspective

Related Modules

From .ai/capabilities.json:

  • yii2-analyzer - Main analysis module
  • ast-analyzer - PHP parsing
  • database-analyzer - Schema extraction
  • requirements - Business rules extraction
  • business-analyzer - Capability mapping

Remember: The goal is not just to understand the code, but to preserve the business knowledge embedded in it.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.2%
按下载量换算141

Claude

31.35%
按下载量换算137

Cursor

19.49%
按下载量换算85

Gemini CLI

9.66%
按下载量换算42

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills