返回列表

部落格

教學:使用 Tactic Remote 遠端建構全端應用程式

跟著我們使用從 iPhone 指揮的 Claude Code 建構一個完整的任務管理應用程式——證明從行動裝置上確實能完成大量的開發工作。

發布於 標籤: 入門教學 / fullstack / workflow / hands-on
部落格

繼續查看該欄目下的產品與工程更新。

瀏覽此分類

本教學將帶您完整建構一個全端應用程式——一個具有 React 前端的任務管理 API——完全透過 Tactic Remote。您將從 iPhone 指揮 Claude Code,而 Mac 負責繁重的工作。

完成後,您將擁有一個可運作的應用程式,以及 Tactic Remote 所實現的遠端開發工作流程的實務經驗。

前置條件

開始之前,請確認您已備妥:

  • Tactic Remote 已設定並連線(Getting Started 指南)
  • Mac 上已安裝 Node.js 18+
  • 一個可用的專案目錄(我們將使用 ~/projects/taskflow)

第一部分:專案設定(10 分鐘)

在 iPhone 上開啟 Tactic Remote,並啟動一個指向您專案目錄的新 session。

提示 1:建立專案架構

將以下提示發送給 Claude Code:

Create a full-stack task management application called TaskFlow.

Backend:
- Express.js server with TypeScript
- SQLite database with better-sqlite3
- RESTful API: CRUD for tasks and projects
- Input validation with zod

Frontend:
- React 18 with TypeScript
- Vite for bundling
- Tailwind CSS for styling
- React Query for data fetching

Set up the monorepo structure with packages/api and packages/web.
Use a root package.json with workspaces.

Claude Code 會花 3-5 分鐘處理這個任務。您會看到它建立目錄、撰寫設定檔和安裝相依性。這是個放下手機的好時機——Tactic Remote 會在任務完成或需要核准時通知您。

注意事項: Claude Code 可能會請求核准執行 npm install。從通知中核准——它正在安裝您專案的相依性。

提示 2:驗證設定

建立完成後,驗證一切正常運作:

Start both the API server and the frontend dev server.
Run any initial tests. Report the URLs where each is accessible.

您應該會看到 Claude Code 啟動伺服器並回報 URL,例如 API 在 http://localhost:3001,前端在 http://localhost:5173。

第二部分:建構 API(20 分鐘)

現在讓我們建構具有實質業務邏輯的後端 API。

提示 3:資料庫 Schema 和 Model

Create the database schema and models:

Tables:
- projects: id, name, description, color (hex), created_at, updated_at
- tasks: id, project_id (FK), title, description, status (todo/in_progress/done),
  priority (low/medium/high/urgent), due_date, created_at, updated_at

Include:
- Migration system that runs on server start
- Type-safe model layer with full TypeScript types
- Seed data: 2 sample projects with 5 tasks each

這個提示展示了 AI 輔助開發的一個關鍵優勢:您描述 要做什麼,Claude 負責 如何實作。結果會包含正確型別的 model、SQL migration 和種子資料——這些工作人類開發者需要 30-60 分鐘。

提示 4:帶驗證的 API 路由

Implement the full REST API:

Projects:
- GET /api/projects (list all, with task counts)
- POST /api/projects (create, validate with zod)
- PUT /api/projects/:id (update)
- DELETE /api/projects/:id (cascade delete tasks)

Tasks:
- GET /api/projects/:id/tasks (list by project, support ?status= filter)
- POST /api/projects/:id/tasks (create with validation)
- PUT /api/tasks/:id (update, including status transitions)
- DELETE /api/tasks/:id

Include proper error handling with consistent error response format.
Add request logging middleware.

核准提示: Claude Code 可能會請求核准修改多個檔案。在核准卡片中查看檔案清單——應該限制在您專案的 packages/api/ 目錄內。如果您看到任何超出此範圍的檔案,請拒絕並釐清提示。

提示 5:測試 API

Write integration tests for all API endpoints using vitest and supertest.
Test both success cases and error cases (invalid input, not found, etc.).
Run the tests and report results.

在終端機檢視中觀看測試結果串流。綠色的通過測試即使在手機螢幕上也令人滿足。如果有任何測試失敗,Claude Code 通常會自動診斷並修復問題。

第三部分:建構前端(25 分鐘)

提示 6:核心 UI 元件

Build the frontend UI:

1. Layout with sidebar (project list) and main area (task board)
2. ProjectList component: shows projects with task counts and color indicators
3. TaskBoard component: kanban-style columns for todo/in_progress/done
4. TaskCard component: shows title, priority badge, due date
5. Drag-and-drop between columns to change task status

Use React Query for all data fetching. Show loading skeletons.
Style with Tailwind - clean, modern look with the project color as accent.

這是目前為止最大的提示。Claude Code 會產生多個元件、設定路由、配置 React Query 並實作拖放功能。預計需要 5-8 分鐘的工作時間。

提示 7:表單與互動

Add interactive features:

1. Create Project modal: name, description, color picker
2. Create Task modal: title, description, priority selector, due date picker
3. Inline task editing: click to edit title, click priority to cycle through levels
4. Delete confirmation dialogs for projects and tasks
5. Toast notifications for successful operations

All forms should validate input and show helpful error messages.

提示 8:潤飾與響應式設計

Polish the UI:

1. Make everything fully responsive (mobile-friendly at 375px+)
2. Add empty states for projects and tasks (with calls-to-action)
3. Add a search/filter bar: filter tasks by title or status
4. Add keyboard shortcuts: N for new task, / for search
5. Add subtle animations for card transitions and modal open/close

Fix any visual issues you notice.

第四部分:整合與最終驗證(10 分鐘)

提示 9:端到端驗證

Verify the complete application:

1. Start the API server and frontend
2. Create a new project through the UI
3. Add several tasks with different priorities
4. Move tasks between columns
5. Edit and delete tasks
6. Test responsive layout at mobile sizes
7. Report any issues found and fix them

Provide the final URLs to access the application.

提示 10:文件

Create a README.md in the project root with:

1. Project description and screenshot placeholder
2. Tech stack overview
3. Getting started instructions (install, run, test)
4. API endpoint documentation with example requests/responses
5. Project structure explanation

您剛才建構了什麼

在大約一小時的時間裡,從手機指揮 Claude Code,您建立了:

  • 一個使用 SQLite 持久化的 TypeScript Express API
  • 一個具有拖放看板的 React 前端
  • 完整的 CRUD 操作與驗證
  • 整合測試
  • 響應式設計
  • 專案文件

這是一個具有相當規模的應用程式——橫跨數十個檔案的數百行程式碼。而您是在不坐在桌前的情況下建構的。

遠端全端開發技巧

將工作拆分為清晰的階段。 不要嘗試在一個提示中描述整個應用程式。分階段的提示能產生更好的結果,因為每個提示都建立在前一階段已驗證的工作之上。

每個階段後進行驗證。 在每個主要工作完成後,請 Claude Code 執行測試或啟動伺服器。早期發現問題能防止問題連鎖擴散。

善用核准通知。 核准流程不只是安全功能——它是一個檢查點,讓您可以檢視 Claude Code 正在做什麼,並在需要時進行修正。

不要持續盯著看。 遠端開發的重點就是自由。啟動一個提示,放下手機,收到通知時再回來。信任這個系統。

下一步

立即體驗 Tactic Remote

用手機遠端操作程式開發 Agent

連線到 Mac、Windows 或 Linux 電腦上的 Claude Code、Codex 等 Agent,在 iPhone 或 iPad 上查看進度並傳送下一個請求。