Files
Claude-Code-Workflow/docs/guide/first-workflow.md
catlog22 c3ddf7e322 docs: add VitePress documentation site
- Add docs directory with VitePress configuration
- Add GitHub Actions workflow for docs build and deploy
- Support bilingual (English/Chinese) documentation
- Include search, custom theme, and responsive design
2026-02-28 16:14:09 +08:00

2.1 KiB

First Workflow: Build a Simple API

Complete your first CCW workflow in 30 minutes. We'll build a simple REST API from specification to implementation.

What We'll Build

A simple users API with:

  • GET /users - List all users
  • GET /users/:id - Get user by ID
  • POST /users - Create new user
  • PUT /users/:id - Update user
  • DELETE /users/:id - Delete user

Prerequisites

Step 1: Create Project (5 minutes)

# Create project directory
mkdir user-api
cd user-api

# Initialize npm project
npm init -y

# Install dependencies
npm install express
npm install --save-dev typescript @types/node @types/express

Step 2: Generate Specification (5 minutes)

# Use CCW to generate API specification
ccw cli -p "Generate a REST API specification for a users resource with CRUD operations" --mode analysis

CCW will analyze your request and generate a specification document.

Step 3: Implement API (15 minutes)

# Implement the API
ccw cli -p "Implement the users API following the specification with Express and TypeScript" --mode write

CCW will:

  1. Create the project structure
  2. Implement the routes
  3. Add type definitions
  4. Include error handling

Step 4: Review Code (5 minutes)

# Review the implementation
ccw cli -p "Review the users API code for quality, security, and best practices" --mode analysis

Step 5: Test and Run

# Compile TypeScript
npx tsc

# Run the server
node dist/index.js

# Test the API
curl http://localhost:3000/users

Expected Result

You should have:

  • src/index.ts - Main server file
  • src/routes/users.ts - User routes
  • src/types/user.ts - User types
  • src/middleware/error.ts - Error handling

Next Steps

::: tip Congratulations! 🎉 You've completed your first CCW workflow. You can now use CCW for more complex projects. :::