1 Hour Guide1 Hour Guide
Remaining:60 min
← Back to Tutorials
šŸ¤– AI Tools•60 min•Beginner•Jun 19, 2026

1 Hour to Claude Code

Build a real CLI tool using Claude as your AI pair programmer - from idea to working code in 60 minutes

#ai#cli#claude#pair-programming#development

By the end of this hour, you'll have built a functional CLI tool with Claude's help and learned the core patterns of AI pair programming.

šŸŽÆ What You'll Build

A weather CLI tool that fetches current conditions for any city. Claude will help you design the architecture, write the code, and debug issues.

$ weather-cli "San Francisco"
šŸŒ¤ļø  San Francisco, CA
Temperature: 68°F (20°C)
Conditions: Partly Cloudy
Humidity: 72%
Wind: 8 mph SW

ā±ļø Time Breakdown

0–10min
Set up Claude conversation and define project scope
10–25min
Design architecture with Claude and scaffold project
25–40min
Implement core functionality with AI assistance
40–55min
Add features, handle errors, and test edge cases
55–60min
Package and deploy your CLI tool

šŸ“‹ Prerequisites

  • Node.js 18+ installed
  • Basic command line familiarity
  • Claude account (free tier works)
  • Text editor or IDE
  • OpenWeatherMap API key (free)

Step 1: Start Your AI Pair Programming Session (0–10 min)

Open Claude and establish your coding partnership with this prompt:

I want to build a CLI weather tool in Node.js in the next hour. I'm a [your skill level] developer.

Requirements:
- Takes city name as argument
- Shows current weather with nice formatting
- Handles errors gracefully
- Uses a free weather API

Help me plan the architecture, then we'll build it step by step. What's the best approach?

Claude will suggest an architecture. Follow up with:

Perfect! Let's use the OpenWeatherMap API. Can you help me:
1. Set up the project structure
2. Choose the right npm packages
3. Plan the main functions we'll need

Show me the initial file structure and package.json.

Create your project directory:

mkdir weather-cli
cd weather-cli
npm init -y
āœ…

Checkpoint

Ask Claude: "What npm packages should I install first and why?"

Step 2: Scaffold with Claude's Guidance (10–25 min)

Install the packages Claude recommended:

npm install axios commander chalk dotenv
npm install -D nodemon

Ask Claude to generate your initial file structure:

Now create the basic file structure. I need:
- Main CLI entry point
- Weather service module  
- Configuration handling
- Error handling utilities

Show me the code for each file, starting with package.json scripts and the main index.js.

Create the files Claude suggests. Typically this includes:

touch index.js lib/weather-service.js lib/config.js lib/utils.js

Add Claude's suggested package.json scripts:

{
  "scripts": {
    "start": "node index.js",
    "dev": "nodemon index.js"
  },
  "bin": {
    "weather-cli": "./index.js"
  }
}

Set up your .env file:

echo "OPENWEATHER_API_KEY=your_api_key_here" > .env

Get your free API key from OpenWeatherMap and replace the placeholder.

āœ…

Checkpoint

Ask Claude: "Can you show me a basic version of index.js that just parses arguments and prints them?"

Step 3: Implement Core Weather Fetching (25–40 min)

Now build the weather service with Claude's help:

Let's implement the weather service. I need a function that:
- Takes a city name
- Calls OpenWeatherMap API  
- Returns formatted weather data
- Handles API errors

Show me the complete weather-service.js code with error handling.

Implement Claude's suggested code. The weather service should look similar to:

// lib/weather-service.js
const axios = require('axios');
require('dotenv').config();

class WeatherService {
  constructor() {
    this.apiKey = process.env.OPENWEATHER_API_KEY;
    this.baseUrl = 'https://api.openweathermap.org/data/2.5/weather';
  }

  async getCurrentWeather(city) {
    // Claude will provide the implementation
  }
}

module.exports = WeatherService;

Test your API connection:

node -e "
const WeatherService = require('./lib/weather-service');
const ws = new WeatherService();
ws.getCurrentWeather('London').then(console.log);
"

Ask Claude to help debug any issues:

I'm getting [specific error]. Here's my code: [paste code]
What's wrong and how do I fix it?

Step 4: Add Polish and Error Handling (40–55 min)

Enhance your CLI with Claude's help:

Now let's make this production-ready:
1. Add colorful output with chalk
2. Handle all error cases (no API key, invalid city, network issues)  
3. Add a help command
4. Format the output beautifully

Show me the updated index.js with proper error handling and formatting.

Implement Claude's suggestions for error handling:

// Example error handling Claude might suggest
try {
  const weather = await weatherService.getCurrentWeather(city);
  console.log(formatWeatherOutput(weather));
} catch (error) {
  if (error.response?.status === 404) {
    console.error(chalk.red(`City "${city}" not found`));
  } else if (error.code === 'ENOTFOUND') {
    console.error(chalk.red('Network error - check your connection'));
  } else {
    console.error(chalk.red(`Error: ${error.message}`));
  }
  process.exit(1);
}

Test edge cases Claude suggests:

npm start "InvalidCityName123"
npm start ""
npm start "London,UK"
āœ…

Checkpoint

Ask Claude: "What are the 3 most important error cases I should handle for a weather CLI?"

Step 5: Ship It (55–60 min)

Make your CLI globally installable:

npm link

Test the global command:

weather-cli "Tokyo"
weather-cli "New York"

Ask Claude for final improvements:

What finishing touches would make this CLI tool more professional?
Should I add features like:
- Multiple cities at once
- Different unit systems  
- Colored output based on conditions
- Configuration file support

Implement one quick enhancement Claude suggests.

šŸŽ‰ Your weather CLI is complete! You've successfully used Claude as a pair programmer to build a real tool from scratch.

šŸŽ Bonus

  • Add weather icons using Unicode symbols based on conditions
  • Implement a 5-day forecast option with --forecast flag
  • Create a config file system for default cities and units

šŸ“š Next Steps

→
1 Hour to Cursor: Ship Your First AI-Powered Project
Build and deploy a complete AI-powered web app using Cursor's code generation in 60 minutes
60 min

šŸ”— Resources