Chapter 3

Project for working professionals

Suitable for professionals seeking to improve work efficiency. Through enterprise development processes and legacy system refactoring, you can master the practical use of AI tools in enterprise environments and understand the importance of team collaboration and knowledge management.

Project 1: internal tool development

Project Overview

1
Project goals: Develop an internal data dashboard tool to help the team quickly view and analyze business data and improve decision-making efficiency
2
Tool stack: Spec-driven + Cursor (development) + Skill (knowledge reuse)
3
Time estimate: 20-30 hours (including requirement clarification, design, development, testing)
4
Difficulty level: Intermediate to advanced (enterprise development experience required)

Technical selection analysis: Why choose Spec-driven + Cursor + Skill?

Spec-driven: the bridge from requirements to code

  • Requirements clarification:Through Reverse Interview and user stories, ensure a true understanding of real needs
  • PRD writing: clarify target users, functional requirements, and non-functional requirements
  • API Spec: Using the OpenAPI specification, AI can directly generate code
  • UI Spec: Describe the interface and interactions in detail to reduce rework
  • WBS decomposition: Break large tasks into small, actionable tasks
  • DoD definition: Clarify completion criteria to ensure quality

Cursor: AI-assisted development

  • From spec to code:Automatically generate code structure based on the Spec
  • Feature implementation: use Agent mode to implement complex features
  • Code optimization: apply best practices and design patterns
  • Bug fixes: Quickly identify and fix issues

Skill: knowledge reuse and team collaboration

  • Knowledge accumulation: Package best practices as Skills for team sharing
  • Quick reuse: Quickly implement common features with Skill
  • Consistency guarantee: use Skill to ensure code style and pattern consistency
  • Team collaboration: The Skill library becomes the team's knowledge asset

Tool synergy: Spec-driven development ensures clear requirements and the correct development direction, Cursor handles efficient implementation, and Skill is responsible for knowledge reuse and team collaboration. This combination delivers a complete enterprise-grade development process from requirements to delivery, ensuring development efficiency while also guaranteeing code quality and team collaboration.

Complete development process

Phase 1: Requirements clarification (3-4 hours)

Reverse Interview technique

  • • Ask "why" instead of "what": understand the reasons behind the real needs
  • • Ask “when”: understand usage scenarios and frequency
  • • Ask “who”: understand the target users and users
  • • Ask “what if...?”: explore edge cases and exception handling

User story writing

"As a product manager,
I want to quickly view sales data,
So that you can keep track of business conditions in a timely manner and make decisions.

Acceptance criteria:
- Can view sales for today/this week/this month
- Able to filter data by product category
- Data update delay does not exceed 5 minutes"

Phase 2: Spec writing (4–6 hours)

PRD writing

  • • Target users: product managers, business analysts
  • • Functional requirements: data display, filtering, export
  • • Non-functional requirements: performance (load time <2 seconds), availability (99.9%), security

API Spec(OpenAPI)

GET /api/dashboard/sales Query Parameters: - startDate: string (ISO date) - endDate: string (ISO date) - category: string (optional) Response: { totalSales: number, salesByCategory: Array, trend: Array }

UI Spec: describe the interface layout, interaction flow, and state changes in detail

Phase 3: WBS breakdown (2-3 hours)

Task decomposition principles

  • Granularity Control: each task is completed in 2-4 hours
  • Dependencies: Clearly define dependencies between tasks
  • Testability: Each task has clear acceptance criteria

WBS example

1. Database design (2 hours)
1.1 Design the data model
1.2 Create database tables
2. Backend API development (8 hours)
2.1 Implement the data query API (depends on 1)
2.2 Implement the data filtering API
3. Front-end UI development (6 hours)
3.1 Create the dashboard component (depends on 2.1)
3.2 Implement the filtering function

Phase 4: DoD Definition (1 hour)

Quality Standards

  • • Code quality: Passed ESLint checks, no serious warnings
  • • Test coverage: unit test coverage >80%
  • • Complete documentation: API documentation and user manual are complete

Acceptance criteria

  • • Functional acceptance: all features are implemented according to the Spec and pass tests
  • • Performance acceptance: page load time <2 seconds, API response time <500ms
  • • Security acceptance: pass security scans, with no high-risk vulnerabilities

Phase 5: Development implementation (8-12 hours)

1. Use Cursor Agent to generate the project structure based on the Spec

2. Use Skill to quickly implement common features:

  • • Use "Data Query Skill" to implement API query logic
  • • Use the "Chart Component Skill" to create visualization components
  • • Use the "Error Handling Skill" to standardize error handling

3. Use Cursor Agent to implement complex business logic

4. Code review and optimization

5. Write test cases

Phase 6: Testing and delivery (2-3 hours)

1. Run the test cases and fix bugs

2. User Acceptance Testing (UAT)

3. Deploy to production

4. Write user manuals and operation guides

5. Team training and knowledge sharing

Team collaboration and knowledge management

Skill library development

  • Create Skill: Encapsulate common functions as Skills, such as "Data Query Skill" and "Chart Component Skill"
  • Skill Documentation: write usage instructions and examples for each Skill
  • Skill version management: Use Git to manage Skill versions, supporting version rollback
  • Skill sharing: share the Skill library across the team to improve reuse

Knowledge accumulation

  • Best Practices Document: Record best practices during the development process
  • Problem solution: Record common issues and solutions
  • Code review record: record issues found during code review and improvement suggestions
  • Project retrospective: after the project ends, conduct a retrospective and summarize lessons learned

Project checklist

Requirements clarification is complete, and user stories and acceptance criteria are clear
PRD, API Spec, and UI Spec are complete, and the team review has passed
WBS breakdown completed, task granularity is appropriate, and dependencies are clear
DoD defines done, with clear quality standards and acceptance criteria
Development complete, code meets Spec requirements, passed code review
Tests passed, coverage met, UAT passed
Updated the Skill library, and documented the newly added Skills
Project documentation is complete, and the user manual and operation guide have been written

Project 2: Legacy system refactoring

Project Overview

1
Project goals: Refactor the legacy PHP system into a modern Node.js system to improve performance, maintainability, and scalability
2
Tool stack: Windsurf (codebase analysis) + Cursor Agent (architecture design) + Fabric (code optimization)
3
Time estimate: 40–60 hours (including analysis, design, refactoring, and testing)
4
Difficulty level: Advanced (requires experience in system architecture and refactoring)

Technology selection analysis: why choose Windsurf + Cursor Agent + Fabric?

Windsurf: Large codebase analysis

  • Fast Context technology: Quickly understand the structure and logic of a large codebase
  • Codebase Q&A:Understand code functionality and dependencies through Q&A
  • Architecture analysis: Identify system architecture patterns and design issues
  • Dependency analysis: Analyze dependencies between modules

Cursor Agent: architecture design and refactoring

  • Architecture Design: Design a new architecture based on the analysis results
  • Code migration: Migrate legacy code to a new architecture
  • Feature implementation: implement new features or improve existing ones
  • Test generation: Generate test cases to ensure the functionality is correct

Fabric: code quality optimization

  • Code review: Review the quality of the refactored code
  • Performance optimization: Optimize code performance and improve system efficiency
  • Best practices: Apply modern development best practices
  • Security audit: Check security vulnerabilities and risks

Tool synergy: Windsurf is responsible for understanding the legacy system, Cursor Agent is responsible for designing and implementing the new system, and Fabric is responsible for optimizing code quality. This combination enables a complete refactoring process from analysis to refactoring to optimization, ensuring both the correctness of the refactoring and the quality of the new system.

Refactoring strategy

Strategy 1: Codebase Analysis (using Windsurf Fast Context)

1. Use Windsurf to analyze the legacy codebase:

  • • Understand the overall system architecture and module decomposition
  • • Identify core business logic and data flows
  • • Analyze database structure and data model
  • • Identify technical debt and design issues

2. Generate the system analysis report:

  • • Architecture diagram: system modules and dependencies
  • • Feature list: list of all functional modules
  • • Data model: database table structures and relationships
  • • Issue list: technical debt and risk points

Strategy 2: Architecture Design (using Cursor Agent)

1. Use Cursor Agent to design a new architecture:

"Design a new Node.js architecture based on the analysis results of the legacy PHP system:
- Adopt a microservices architecture, split by business modules
- Use Express.js as the Web framework
- Use Prisma as the ORM
- Use PostgreSQL as the database
- Implement RESTful API design
- Add API documentation (Swagger)
- Implement authentication and authorization (JWT)"

2. Design a data migration plan:

  • • Data model mapping: PHP models to Node.js models
  • • Data migration script: migrate historical data
  • • Data validation: ensure data integrity

Strategy 3: Progressive refactoring (using Fabric Patterns)

1. Adopt the Strangler Fig pattern:

  • • Gradually replace old features instead of rewriting everything at once
  • • Run old and new systems in parallel, gradually shifting traffic
  • • Reduce refactoring risks and ensure business continuity

2. Optimize code using Fabric Patterns:

  • • Application design patterns
  • • Application performance optimization pattern
  • • Application security best-practice Pattern

Strategy 4: Test Coverage (TDD approach)

1. Write the tests first, then the implementation:

  • • Write test cases for each feature
  • • Ensure new features behave consistently with existing ones
  • • Use test-driven development (TDD)

2. Test types:

  • • Unit tests: test individual functions and modules
  • • Integration testing: test the integration between modules
  • • End-to-end testing: test the complete business process

Risk analysis and mitigation strategies

Risk 1: Business interruption

Response strategy: Use progressive refactoring, run the old and new systems in parallel, and gradually switch traffic over. Establish a rollback mechanism and roll back immediately if problems occur.

Risk 2: data migration failure

Response strategy: Write detailed data migration scripts and test them thoroughly. Establish data validation mechanisms to ensure data integrity. Keep backups of the old data.

Risk 3: performance degradation

Response strategy: Perform performance testing to identify performance bottlenecks. Use Fabric to optimize code performance. Establish performance monitoring to detect issues promptly.

Risk 4: Missing Features

Response strategy: Analyze the functions of the existing system in detail and create a feature list. Use Windsurf to ensure nothing is missed. Perform thorough functional testing.

Project checklist

The legacy system analysis is complete, with architecture diagrams and a complete feature list
The new architecture design is complete, the technology choices are reasonable, and the team review has been approved
The data migration plan is complete, and the script tests have passed
Refactoring plan completed, adopting a gradual refactoring strategy
Test coverage completed, all functional tests passed
Performance tests passed, performance metrics met
The rollback plan is ready, and a rollback can be performed quickly.
The new system has been deployed, is running stably, and business operations are normal

Learning outcomes

After completing this chapter, you will:

  • 1Master the complete process of enterprise development (requirements clarification → Spec writing → WBS breakdown → DoD definition → development → testing → delivery)
  • 2Understand the methodology of Spec-driven development and know how to write clear PRDs, API Specs, and UI Specs
  • 3Master team collaboration and knowledge management methods, and be able to build a Skill library and accumulate best practices
  • 4Understand the strategies and risks of legacy system refactoring, and be able to formulate a reasonable refactoring plan
  • 5Possesses enterprise-level project management and quality control capabilities, ensuring successful project delivery