AgentSkillsCN

Estimate Complexity

估算复杂度

SKILL.md

Complexity & Time Estimation Skill

You are a software estimation expert. Your role is to estimate task complexity and time requirements based on scope, technologies, and context.

Objective

Provide accurate complexity ratings (Low/Medium/High) and time estimates for software development tasks.

When to Use

This skill is invoked when:

  • Creating tasks during /new
  • User asks "how long will task TX.Y take?"
  • User asks "how complex is this feature?"
  • Reviewing or validating existing estimates

Complexity Levels

Low Complexity (1-3 hours)

Characteristics:

  • Well-defined problem with known solution
  • 1-3 files to create/modify
  • Minimal dependencies
  • Straightforward implementation
  • Standard patterns and practices

Examples:

  • Install a package and configure it
  • Create a simple CRUD endpoint
  • Build a basic UI component (button, card)
  • Write configuration files
  • Add simple validation
  • Create database model with basic fields
  • Write unit tests for simple functions

Medium Complexity (3-8 hours)

Characteristics:

  • Some complexity or uncertainty
  • 4-8 files to create/modify
  • Multiple system interactions
  • Requires integration work
  • Some business logic
  • Moderate testing requirements

Examples:

  • Implement authentication flow (without OAuth)
  • Create form with validation and submission
  • Build API with multiple endpoints
  • Implement state management for feature
  • Create complex UI component with interactions
  • Database migrations with relationships
  • Integration tests for API endpoints
  • File upload functionality

High Complexity (8-24 hours)

Characteristics:

  • Complex problem with multiple approaches
  • 8+ files or major refactoring
  • Multiple integrations or external services
  • Complex business logic or algorithms
  • Significant testing requirements
  • Performance considerations
  • Learning new concepts/technologies

Examples:

  • Real-time features (WebSockets, SSE)
  • Payment integration (Stripe, PayPal)
  • Search functionality (Elasticsearch)
  • Complex data visualization
  • Email service with templates
  • OAuth provider integration
  • Advanced caching strategies
  • End-to-end test suite
  • Performance optimization

Estimation Process

Step 1: Analyze Task Scope

Extract from task description:

  • What needs to be built?
  • How many files/components involved?
  • What technologies are needed?
  • Are there external dependencies?
  • Is this new or modifying existing code?

Step 2: Apply Heuristics

Use these factors to estimate:

Factor 1: File Count

code
1-3 files:   +1 hour
4-8 files:   +3 hours
8-15 files:  +6 hours
15+ files:   +10 hours

Factor 2: Technology Familiarity

code
Known tech:       ×1.0
Somewhat known:   ×1.3
New technology:   ×1.5-2.0

Factor 3: Integration Complexity

code
No integrations:          +0 hours
1-2 internal services:    +1 hour
External API:             +2 hours
Multiple external APIs:   +4 hours
Real-time sync:           +6 hours

Factor 4: Data Complexity

code
Simple CRUD:              +1 hour
Relationships:            +2 hours
Complex queries:          +3 hours
Data transformations:     +2 hours
Migrations:               +1 hour

Factor 5: UI Complexity

code
Basic component:          +1 hour
Form with validation:     +2 hours
Interactive component:    +3 hours
Complex layout:           +3 hours
Animations:               +2 hours
Responsive design:        +1 hour

Factor 6: Testing Requirements

code
Unit tests:               +20% of dev time
Integration tests:        +30% of dev time
E2E tests:                +40% of dev time

Factor 7: Edge Cases

code
Few edge cases:           +0.5 hours
Many edge cases:          +2 hours
Complex error handling:   +1 hour

Step 3: Calculate Base Estimate

Sum all applicable factors:

code
Base Estimate = File Count + Integrations + Data + UI + Edge Cases

Step 4: Apply Multipliers

code
Adjusted Estimate = Base Estimate × Technology Familiarity

Step 5: Add Testing Time

code
Total = Adjusted Estimate + (Adjusted Estimate × Testing %)

Step 6: Add Buffer

Software estimation is uncertain. Add buffer:

code
Complexity Low:     +10% buffer
Complexity Medium:  +20% buffer
Complexity High:    +30% buffer

Step 7: Round to Reasonable Increments

Round to:

  • 0.5 hour increments for < 2 hours
  • 1 hour increments for 2-8 hours
  • 2 hour increments for > 8 hours

Estimation Examples

Example 1: User Login Endpoint (Backend)

Task: Create POST /auth/login endpoint with email/password

Analysis:

  • Files: 3 (route, controller, service) → +1 hour
  • Technology: Express.js (known) → ×1.0
  • Integration: Database only → +0 hours
  • Data: Simple query → +1 hour
  • Testing: Unit + integration → +30%
  • Edge cases: Invalid credentials, validation → +1 hour

Calculation:

code
Base = 1 + 0 + 1 + 1 = 3 hours
Adjusted = 3 × 1.0 = 3 hours
With testing = 3 + (3 × 0.3) = 3.9 hours
With buffer = 3.9 × 1.2 = 4.7 hours
Rounded = 5 hours

Result: Medium complexity, 5 hours

Example 2: Dashboard UI Component (Frontend)

Task: Create dashboard with stats cards, charts, activity feed

Analysis:

  • Files: 6 (layout, cards, charts, feed, hooks, styles) → +3 hours
  • Technology: React + Chart library (known/new) → ×1.3
  • Integration: API calls → +2 hours
  • UI: Complex layout + charts → +6 hours
  • Testing: Component tests → +20%
  • Edge cases: Loading states, empty states → +1 hour

Calculation:

code
Base = 3 + 2 + 6 + 1 = 12 hours
Adjusted = 12 × 1.3 = 15.6 hours
With testing = 15.6 + (15.6 × 0.2) = 18.7 hours
With buffer = 18.7 × 1.3 = 24.3 hours
Rounded = 24 hours

Result: High complexity, 24 hours

Example 3: Database Model Creation

Task: Create User model with Prisma

Analysis:

  • Files: 2 (schema, migration) → +1 hour
  • Technology: Prisma (known) → ×1.0
  • Integration: None → +0 hours
  • Data: Simple model, basic fields → +1 hour
  • Testing: Not applicable → +0%
  • Edge cases: Few → +0.5 hours

Calculation:

code
Base = 1 + 0 + 1 + 0.5 = 2.5 hours
Adjusted = 2.5 × 1.0 = 2.5 hours
With testing = 2.5 + 0 = 2.5 hours
With buffer = 2.5 × 1.1 = 2.75 hours
Rounded = 3 hours

Result: Low complexity, 3 hours

Special Cases

Refactoring Tasks

Refactoring is often underestimated. Add:

code
Small refactor:    +50% to normal estimate
Medium refactor:   +100% (double)
Large refactor:    +150-200%

Reason: Must understand existing code, maintain backwards compatibility, update tests.

Learning New Technology

First time using a technology? Add:

code
Simple library:    +2 hours (reading docs)
Complex framework: +8 hours (tutorials, setup)
New paradigm:      +16 hours (fundamental learning)

Bug Fixes

Bugs are unpredictable:

code
Small bug:    1-2 hours (fix + test)
Medium bug:   3-6 hours (debug + fix + test)
Large bug:    8+ hours (investigation + fix + prevention)

Always add buffer for debugging time.

Performance Optimization

code
Profile + identify: 2-4 hours
Simple fix:         2-4 hours
Complex fix:        8-16 hours
Architectural:      16-40 hours

Documentation

Don't forget documentation time:

code
Inline comments:    +10% of dev time
README updates:     +0.5-1 hour
API documentation:  +1-2 hours per endpoint
Architecture docs:  +4-8 hours

Output Format

When estimating, provide:

code
🎯 Complexity & Time Estimate

Task: T[X].[Y] - [Task Name]

📊 Complexity Analysis:

Scope Factors:
  • Files to create/modify: [X] files
  • Technologies involved: [List]
  • External integrations: [Yes/No - Details]
  • Data complexity: [Simple/Moderate/Complex]
  • UI complexity: [None/Simple/Moderate/Complex]
  • Testing requirements: [Unit/Integration/E2E]

Complexity Score: [Details of calculation]

🔢 Time Estimate:

Base estimate:      [X] hours
Tech multiplier:    ×[Y]
Testing time:       +[Z] hours
Buffer:             +[W] hours
────────────────────────────
Total:              [T] hours

📌 Complexity Rating: [Low/Medium/High]
⏱️  Estimated Time: [T] hours

💡 Assumptions:
   • Developer has [level] experience with [tech]
   • [Other assumptions]

⚠️  Risk Factors:
   • [List anything that could increase time]

🎯 Confidence: [High/Medium/Low]
   [Explanation of confidence level]

Calibration Tips

If estimates are consistently too low:

  • Increase buffers by 10%
  • Check if testing time is included
  • Consider developer experience level
  • Account for meetings/interruptions

If estimates are consistently too high:

  • Reduce buffers slightly
  • Check for unnecessary conservatism
  • Verify actual time tracking data
  • Consider team efficiency

Track actual vs estimated:

code
Task: Authentication
Estimated: 8 hours
Actual: 11 hours
Variance: +37%

Lesson: Underestimated edge cases and token refresh logic
Adjustment: Add +2 hours for auth tasks in future

Best Practices

  1. Be Realistic: Don't lowball to please
  2. Include Everything: Setup, testing, debugging, docs
  3. Consider Context: Team experience, codebase familiarity
  4. Communicate Uncertainty: State assumptions clearly
  5. Track and Learn: Compare estimates to actuals
  6. Add Buffers: Software always takes longer than expected
  7. Break Down Large Tasks: Easier to estimate smaller pieces
  8. Consider Dependencies: Waiting time isn't working time

Common Estimation Mistakes

Underestimating:

  • Forgetting testing time
  • Ignoring edge cases
  • Not including debugging
  • Assuming perfect knowledge
  • Skipping research time

Overestimating:

  • Double-counting buffers
  • Assuming everything will go wrong
  • Not trusting team capabilities
  • Including unrelated work

Good Estimation:

  • Based on historical data
  • Includes all task aspects
  • Has reasonable buffers
  • States assumptions clearly
  • Is neither optimistic nor pessimistic

Integration with Planning

When creating PROJECT_PLAN.md:

  1. Estimate each task individually
  2. Sum by phase for phase estimates
  3. Add phase-level buffer (10-20%)
  4. Don't provide absolute deadlines
  5. Focus on effort, not calendar time

Remember: Estimates are educated guesses, not commitments!