Claude Code: Practical: Chrome Extension and Parallel Tasks

Last updated: 2026-08-31

Time for real combat. This chapter demonstrates Claude Code's capabilities through two practical scenarios — Chrome extension development and parallel task management.

💡 Tip: Claude Code's value in practice isn't single-shot output, but the "understand requirements → decompose tasks → execute → verify → iterate" complete closed loop.

📋 Prerequisites: Chapter 20 - Checkpoints and Rollback

1. What You'll Learn


2. Practice 1: Chrome Extension Development

(1) Project Overview

Alice needs a Chrome extension — "Webpage Highlight Annotation Tool":

(2) Let Claude Code Handle Development

TEXT 📖 Display only
> Create a Chrome extension: Webpage highlight annotation tool

Features:
1. Right-click menu "Highlight" after selecting text
2. Support 4 colors: yellow/green/blue/red
3. Persistent annotations (Chrome storage API)
4. Popup panel to manage annotation list
5. One-click export to Markdown

Tech: Manifest V3, TypeScript, no framework, native DOM

Claude Code:
  → Creating project structure (7 source files)
  → Creating manifest.json (Manifest V3)
  → Creating background.ts, content.ts, popup UI
  → Creating storage.ts, export.ts
  → Running: npm run build ✓
  Project created! Features complete.

▶ Example 1: Iterative Enhancement

TEXT 📖 Display only
# Round 1: Base features complete, start iterating

> Add feature: Click existing highlight to remove annotation
Claude Code: ✅ Added click-to-remove handler

> Add feature: Annotation list search support
Claude Code: ✅ Added search with filter

> Add feature: Support annotation in PDF pages
Claude Code: ✅ Added PDF.js integration

(3) Project Structure

TEXT 📖 Display only
chrome-highlighter/
├── manifest.json
├── src/
│   ├── background.ts
│   ├── content.ts
│   ├── popup/
│   ├── storage.ts
│   ├── export.ts
│   └── pdf-viewer.ts
├── dist/
├── package.json
└── tsconfig.json

3. Practice 2: Parallel Task Management

(1) Scenario

Bob needs to handle 4 independent tasks simultaneously:

  1. Add user avatar upload
  2. Implement data export API
  3. Refactor logging system
  4. Add missing tests

(2) Serial vs Parallel

TEXT 📖 Display only
# Serial: 8 + 6 + 10 + 5 = 29 min total

# Parallel: max(8, 6, 10, 5) = 10 min total
# 65% time savings

▶ Example 2: Parallel Task Caveats

TEXT 📖 Display only
# Problem: Parallel modifications to same file cause conflicts

# Solution: Each task modifies different files
> Avatar only touches avatar.ts files
> Export only touches export.ts files
> Don't modify index.ts (I'll register routes manually)

Claude Code:
  Sub-agent 1 [avatar files] → ✅
  Sub-agent 2 [export files] → ✅
  Main agent: Generates route registration code for manual insertion

4. Large Task Decomposition Strategy

(1) Decomposition Principles

Principle Description
Independence No file dependencies between sub-tasks
Atomicity Each sub-task has clear completion criteria
Verifiability Each sub-task can be independently tested
Reversibility Each sub-task can be individually rolled back

(2) Decomposition Steps

TEXT 📖 Display only
Original task: "Migrate project from REST to GraphQL"

Decomposition:
1. Define GraphQL Schema (independent)
2. Create User Resolver (independent, after Schema)
3. Create Order Resolver (independent, after Schema)
4. Create Payment Resolver (independent, after Schema)
5. Add DataLoader for N+1 optimization (independent)
6. Migrate route layer (after all Resolvers)
7. Delete old REST routes (last step)

▶ Example 3: Phased Execution

TEXT 📖 Display only
# Phase 1: Schema → /checkpoint "schema-complete"
# Phase 2: Parallel Resolvers → /checkpoint "resolvers-complete"
# Phase 3: Route migration → /checkpoint "migration-complete"
# Verification: All 134 tests passed ✅

5. Practice Cost Control

TEXT 📖 Display only
Phase 1 (Schema):    $0.45
Phase 2 (Resolvers): $2.30 (4 sub-agents)
Phase 3 (Migration): $1.80
Total:               $4.55

vs. Manual development: ~4 hours × $50/h = $200+

❓ FAQ

Q Can Claude Code build complete apps?
A Yes, with iteration. First generation usually achieves 80%; remaining 20% needs multiple iterations.
Q Max parallel tasks?
A No hard limit, but 5-6 recommended. More increases conflict probability and Token consumption.
Q Chrome extension special considerations?
A Manifest V3 limitations, content script CSP issues, async messaging. Specify Manifest V3 in CLAUDE.md.
Q Most important practical technique?
A Task decomposition + checkpoints. Split big tasks into small ones, verify at each checkpoint, precise rollback on errors.

📖 Summary


📝 Exercises

  1. Basic (⭐): Create a simple Chrome extension (e.g., page timer) with Claude Code.
  2. Intermediate (⭐⭐): Develop a Chrome extension and iteratively add 2 features using checkpoints.
  3. Advanced (⭐⭐⭐): Design a 4-task parallel plan, compare actual time and Token consumption vs serial.
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏