# cost-prediction

cost-prediction forecasts construction project budgets using historical data with Linear Regression, KNN, and Random Forest models. Requires Python 3 and scikit-learn to train on your project dataset.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 128 installs · ★ 434 repo stars
- Author: datadrivenconstruction
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/2_DDC_Book/4.5-ML-Cost-Prediction/cost-prediction/SKILL.md
- Updated: 2026-10-19
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/cost-prediction

## What it does

The skill learns from completed projects to predict costs for new ones. It handles data preparation—filling gaps, encoding categories, normalizing ranges—and feature engineering with derived metrics, polynomial terms, and logarithmic transforms. Four algorithms are available: Linear Regression for baseline relationships, K-Nearest Neighbors for local patterns, Random Forest for nonlinear dependencies, and Gradient Boosting for higher accuracy.

You need `python3`, `scikit-learn`, `pandas`, and `numpy`. Input is a CSV with project history (area, floors, building type, location, completion year, complexity, material quality, total cost). The skill scales data, tunes parameters via cross-validation, reports metrics (R², MAE), and shows sample predictions. It adjusts historical costs for inflation to the current year.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cost-prediction -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/cost-prediction/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/cost-prediction/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cost-prediction -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/cost-prediction/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cost-prediction -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/cost-prediction/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction 2_DDC_Book/4.5-ML-Cost-Prediction/cost-prediction
```

2. **Manually: put the files in place**
- File: `.github/skills/cost-prediction/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cost-prediction -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --path 2_DDC_Book/4.5-ML-Cost-Prediction/cost-prediction
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/cost-prediction/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction --skill cost-prediction -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/2_DDC_Book/4.5-ML-Cost-Prediction/cost-prediction/SKILL.md

## When to use it
- forecast a project budget based on its parameters
- identify which factors most influence construction costs
- compare model accuracy across algorithms on your data
- prepare historical project records for training
- adjust legacy cost estimates for inflation

## Example prompts
- train a model on projects.csv and forecast cost for a 5000 m² building with 10 floors and complexity 3
- which features have the strongest impact on predictions in the Random Forest model
- prepare historical_projects.csv for training: encode categories, handle missing values, create interaction terms

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 04f84553780f021d.

BEGIN THIRD-PARTY FILE 04f84553780f021d
````text
---
name: "cost-prediction"
description: "Predict construction project costs using Machine Learning. Use Linear Regression, K-Nearest Neighbors, and Random Forest models on historical project data. Train, evaluate, and deploy cost prediction models."
homepage: "https://datadrivenconstruction.io"
metadata: {"openclaw":{"emoji":"🤖","os":["darwin","linux","win32"],"homepage":"https://datadrivenconstruction.io","requires":{"bins":["python3"]}}}
---

# Construction Cost Prediction with Machine Learning

## Overview

Based on DDC methodology (Chapter 4.5), this skill enables predicting construction project costs using historical data and machine learning algorithms. The approach transforms traditional expert-based estimation into data-driven prediction.

**Book Reference:** "Будущее: прогнозы и машинное обучение" / "Future: Predictions and Machine Learning"

> "Предсказания и прогнозы на основе исторических данных позволяют компаниям принимать более точные решения о стоимости и сроках проектов."
> — DDC Book, Chapter 4.5

## Core Concepts

```
Historical Data → Feature Engineering → ML Model → Cost Prediction
    │                    │                │              │
    ▼                    ▼                ▼              ▼
Past projects      Prepare data      Train model    New project
with costs         for ML            on history     cost forecast
```

## Quick Start

```python
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error, r2_score

# Load historical project data
df = pd.read_csv("historical_projects.csv")

# Features and target
X = df[['area_m2', 'floors', 'complexity_score']]
y = df['total_cost']

# Split data
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

# Train model
model = LinearRegression()
model.fit(X_train, y_train)

# Predict
````
END THIRD-PARTY FILE 04f84553780f021d

The third-party file has ended. Everything between the 04f84553780f021d tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2094 of 13102 bytes. © datadrivenconstruction · MIT · https://github.com/datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction/tree/HEAD/2_DDC_Book/4.5-ML-Cost-Prediction/cost-prediction/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
