---
name: estimate
description: Estimate the token cost and dollar amount for an AI task before starting work. Use when the user asks about cost, tokens, or wants to know how expensive a task will be.
argument-hint: "[task description]"
---

# Estimate Task Cost

Estimate how many tokens and dollars a task will cost before the user starts working on it.

## Input

The user provides a task description via $ARGUMENTS. If no arguments provided, ask what task they want to estimate.

## Task Type Mapping

Map the user's description to one of these task types:
- **scaffold**: Project setup, boilerplate, initial structure
- **api-endpoint**: REST/GraphQL endpoints, server routes, handlers
- **react-component**: UI components, pages, forms, layouts
- **complex-ui**: Animations, data visualizations, interactive widgets
- **database-schema**: Schema design, migrations, ORM models
- **integration**: Third-party APIs, OAuth, webhooks, external services
- **test-unit**: Unit tests, test utilities, mocking
- **test-e2e**: End-to-end tests, integration tests, test infrastructure
- **devops**: CI/CD, Docker, deployment configs, infrastructure
- **documentation**: README, API docs, guides, comments
- **refactoring**: Code restructuring, performance optimization, cleanup
- **architecture**: System design, major structural changes
- **debugging**: Bug fixes, error investigation, troubleshooting

## Complexity Guide

- **S**: Quick change, 1-2 files, well-understood pattern
- **M**: Standard feature, 3-5 files, some design decisions
- **L**: Complex feature, 5-10 files, significant design work
- **XL**: Major system change, 10+ files, cross-cutting concerns

## Steps

1. Infer taskType and complexity from the description
2. Call `fathom_estimate_task_cost` with taskType and complexity
3. Present results as a clear summary

## Output Format

| Metric | Value |
|--------|-------|
| Task | {taskType} ({complexity}) |
| Tokens | {input + output with overhead} |
| Cost | ${estimatedCost} |
| Model | {recommendedModel} |

If overhead is significant, briefly note the breakdown (retries, context loading, iteration).

## Error Handling

If the `fathom_estimate_task_cost` MCP tool is not available, tell the user to check their MCP configuration. They may need to run `npx fathom-token-mcp` or verify that the Fathom MCP server is configured in their `.mcp.json`.
