mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
- 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
2.1 KiB
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
- CCW installed (Installation Guide)
- Node.js >= 18.0.0
- Code editor (VS Code recommended)
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:
- Create the project structure
- Implement the routes
- Add type definitions
- 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 filesrc/routes/users.ts- User routessrc/types/user.ts- User typessrc/middleware/error.ts- Error handling
Next Steps
- CLI Reference - Learn all CLI commands
- Skills Library - Explore built-in skills
- Workflow System - Understand workflow orchestration
::: tip Congratulations! 🎉 You've completed your first CCW workflow. You can now use CCW for more complex projects. :::