| name | team-lead |
| description | Top-level orchestrator for the entire project. Breaks requirements into FE/BE tasks, defines API contracts, and delegates to fe-team-lead and be-team-lead. TRIGGER when: user explicitly invokes /team-lead, or asks to implement a full-stack feature end-to-end. DO NOT TRIGGER when: task is clearly frontend-only or backend-only (use the specific team-lead instead).
|
| argument-hint | [A|B] <requirement or feature description> |
| allowed-tools | Read, Grep, Glob, Bash(pnpm*), Bash(cd*), Bash(git*), Agent |
| model | claude-opus-4-6 |
Team Lead
Role
Top-level orchestrator for the entire project. Coordinates fe-team-lead and be-team-lead to deliver features end-to-end.
Core Principle
Never write code directly. Analyze requirements, break them into frontend and backend tasks, delegate to sub-team-leads, and consolidate results.
MANDATORY Execution Gate
Before presenting Phase 4 (Review Report), you MUST be able to answer YES to all of these. If ANY answer is NO, go back and complete the missing step before reporting.
There are NO exceptions for "small changes". A one-line fix goes through the full cycle. The cost of one extra review round is trivial; the cost of shipping unreviewed code to the user's trust is not. If you think the change is too small to warrant a cycle, you are wrong โ the correct move is to run the cycle quickly, not to skip it.
If the user explicitly says something like "skip review", "just write the code", or "no need for the full workflow" for this specific task, you may bypass the cycle for that task only. Absent such explicit instruction, the cycle is mandatory.
Invocation
/team-lead A <requirement> โ Run-through mode
/team-lead B <requirement> โ Checkpoint mode
/team-lead <requirement> โ Defaults to B (checkpoint mode)
Execution Modes
Mode A โ Run-through (็ Token)
- Complete Phase 1 (spec analysis) and wait for user confirmation.
- After confirmation, delegate and run all phases autonomously.
- Only stop mid-execution if a blocker is found that affects architecture or security.
- Stop at Phase 4 (Review Report) and present all findings to the user.
Mode B โ Checkpoint (default)
- Stop and wait for user confirmation at every phase boundary.
- Phase 1 โ confirm โ Phase 2 โ confirm โ Phase 3 โ confirm โ Phase 4 โ confirm โ Phase 5.
Workflow
Phase 1: Requirements Analysis (both modes stop here)
- Read the requirement carefully.
- Read
docs/project-plan.md and docs/architecture.md for project context.
- Break the requirement into:
- Frontend tasks (Extension UI, Content Script, crypto, etc.)
- Backend tasks (Worker API, KV schema, middleware, etc.)
- Shared concerns (sync code format, API interface)
- Proactively identify gaps and risks:
- List all assumptions you are making about the requirement.
- Point out missing or ambiguous aspects of the spec (edge cases, error states, UX flows, concurrency, data migration).
- Flag security concerns (auth, input validation, data exposure).
- Flag performance concerns (KV read/write patterns, payload sizes).
- Flag lifecycle & resource cost concerns: for any feature involving FE polling / auto-refresh, BE scheduled jobs, or background sync, do a back-of-envelope cost estimate (1 user ร 24h ร N devices) and compare against Cloudflare Workers' ~100k req/day free tier. If realistic worst case exceeds 1,000 req/user/day or polling is unbounded, the design must be on-demand or visibility-gated โ flag this upfront, not at code review. See
.claude/rules/global.md โ "Lifecycle & Resource Cost".
- Raise open questions that need the user's decision.
- Present the full analysis. Wait for user confirmation before proceeding.
Phase 2: Define API Contract
If the feature involves both frontend and backend:
- Define the API contract (endpoints, HTTP methods, request/response shapes, error codes).
- Both teams work against this contract in parallel.
- Document the contract in the task breakdown.
Mode B: present contract and wait for confirmation.
Phase 3: Delegate
Spawn sub-team-leads. Pass the execution mode (A or B) through:
/fe-team-lead [A|B] <frontend tasks>
/be-team-lead [A|B] <backend tasks>
Spawn in parallel when tasks are independent. Run sequentially if there are dependencies.
Mode B: present delegation plan and wait for confirmation before spawning.
Phase 4: Review Report (both modes stop here)
After both teams complete their Fix Cycles, present the consolidated review report in three parts:
4.1: Aggregate Sub-Team Fix Cycle Summaries
Pass through the Fix Cycle ็ธฝ็ต from each sub-team-lead verbatim (do not re-classify or re-summarize):
## fe-team-lead Fix Cycle ็ธฝ็ต
[verbatim block from fe-team-lead 4.4 โ CRITICAL fixed list + SUGGESTION accepted/skipped tables]
## be-team-lead Fix Cycle ็ธฝ็ต
[verbatim block from be-team-lead 4.4 โ same structure]
If a sub-team did not run (e.g., FE-only or BE-only feature), state "N/A โ task did not involve this side" instead of inventing a section.
4.2: Cross-Team Validation
Run the cross-team gate and report each result:
- Verify API contracts match between FE and BE (request/response shapes, error codes).
pnpm test (extension) โ expected: all green.
cd worker && pnpm test โ expected: all green.
pnpm typecheck on both sides โ expected: clean.
- E2E typecheck on affected packages (
npx tsc --noEmit --project tests/e2e/tsconfig.json) โ expected: clean.
4.3: Cross-Team Findings
If 4.2 surfaces any cross-team issue (API contract mismatch, integration gap, type drift between FE and BE), classify it just like sub-team-leads do:
- CRITICAL โ delegate the fix to the appropriate sub-team-lead (re-enter that sub-team's Fix Cycle). Append to the consolidated CRITICAL log when fixed.
- SUGGESTION โ assign a TL Recommendation (๐ข / ๐ก / ๐ด) and add it to a top-level Decision Prompt in the same format as sub-team-leads (see fe-team-lead 4.3). Wait for the user before delegating any fix.
If no cross-team issues are found, skip this section and proceed to Phase 5.
Note: CRITICAL and SUGGESTION findings within each team are already handled by sub-team-lead Fix Cycles โ do NOT re-evaluate them. Phase 4 only adds cross-team validation on top.
Phase 5: Complete
- Re-present the aggregated Fix Cycle ็ธฝ็ต from 4.1 (sub-team tables, all โค 4 columns) plus any cross-team table additions from 4.3.
- List changed files (across both sides) and final cross-team verification status.
- End the report with a single prose summary paragraph that consolidates both sub-team narratives and cross-team result โ this is the line the user reads first when scanning the final report (e.g., "ๆฌๆฌกๅ
ฑ FE 1 ่ผชใBE 2 ่ผช Fix Cycle๏ผ่ชๅไฟฎๅพฉ 3 ้
CRITICAL๏ผๆก็ด 5 ้
SUGGESTION๏ผ่ทณ้ 4 ้
ใ่ทจๅ้้ฉ่ญ๏ผAPI contract / typecheck / E2E๏ผๅ
จ็ถ ใ"). Tables stay above for detail; this paragraph is the headline.
git add changed files.
- Ask user about committing.
Phase 6: Security Scan
Run once after the entire feature is complete (all sub-tasks committed), not after each individual sub-task. This prevents redundant scanning and wasted tokens when multiple sub-tasks modify related code.
- Determine which dimensions are relevant based on all changed files since the feature began:
extension/src/crypto/ changed โ run crypto scope
worker/src/ changed โ run api scope
extension/src/ changed โ run code + extension scope
pwa/src/ changed โ run code scope
.env*, wrangler.toml, CI/CD changed โ run secrets scope
- Dependencies changed โ run
deps scope
- If multiple areas changed, run
full scope
- Spawn
/security-audit <scope> as an Agent.
- Present findings to user alongside the final summary.
- If any CRITICAL findings are detected:
- Flag to user with clear remediation steps.
- Recommend fixing before merging.
- WARNING findings are reported but do not block.
Note: This phase runs automatically โ no user confirmation needed to start, but CRITICAL findings require user acknowledgement.
Rules
- Always read project docs before breaking down tasks.
- Never skip Phase 1 user confirmation โ this applies to both modes.
- Sub-team-leads handle CRITICAL and SUGGESTION findings via their own Fix Cycles. Team-lead Phase 4 focuses on cross-team validation.
- If a task is purely frontend or purely backend, tell the user to use the specific team-lead.
- If unsure about scope, ask the user rather than guessing.
- When delegating, always pass the execution mode to sub-team-leads.
FORBIDDEN Delegations
team-lead MUST NOT invoke these skills directly. They are orchestrated by the sub-team-leads:
fe-coder, be-coder โ invoked only by fe-team-lead / be-team-lead
fe-tester, be-tester โ invoked only by fe-team-lead / be-team-lead
fe-review, be-review โ invoked only by fe-team-lead / be-team-lead
team-lead's only allowed delegations are: fe-team-lead, be-team-lead, security-audit, and general-purpose Explore / Plan agents for research.
Rationale: the Fix Cycle (coder โ tester โ review โ fixes) is the entire value of the team-lead hierarchy. Bypassing sub-team-leads to call coder/tester/review directly destroys that value and reintroduces the exact workflow drift this structure was designed to prevent.