Slow or flaky tests are the #1 cause of wasted tokens. Each retry costs a full response cycle.
テストの特徴
トークンへの影響
高速テスト(30秒未満)
Droidが変更を即座に検証
低速テスト(2分超)
Droidが検証をスキップするか、待機中にコンテキストを無駄にする可能性
不安定なテスト
誤った失敗がデバッグサイクルを引き起こす
テストなし
Droidが変更を検証できず、やりとりが増加
アクション項目:
## In your AGENTS.md## Testing- Run single file: `npm test -- path/to/file.test.ts`- Run fast smoke tests: `npm test -- --testPathPattern=smoke`- Full suite takes ~3 minutes, use `--bail` for early exit on failure
## In your AGENTS.md## Validation Commands- Lint (auto-fix): `npm run lint:fix`- Type check: `npm run typecheck`- Full validation: `npm run validate` (lint + typecheck + test)Always run `npm run lint:fix` after making changes.
## In your AGENTS.md## Project Structure- `src/components/` - React components (one per file)- `src/hooks/` - Custom React hooks- `src/services/` - API and business logic- `src/types/` - TypeScript type definitions- `tests/` - Test files mirror src/ structureWhen adding a new component:1. Create component in `src/components/ComponentName/`2. Add index.ts for exports3. Add ComponentName.test.tsx in same directory
Turn 1: Start implementing → wrong approach → wasted tokensTurn 2: Undo and try different approach → more tokensTurn 3: Finally get it rightTotal: 3 turns of implementation tokens
Specモードあり:
Turn 1: Plan with exploration → correct approach identifiedTurn 2: Implement correctlyTotal: 1 turn of planning + 1 turn of implementation
Use Spec Mode (Shift+Tab or /spec) for any task that:
Turn 1: "Add logging to userService"Turn 2: "Add logging to orderService"Turn 3: "Add logging to paymentService"(3 turns, context rebuilt each time)
効率的:
Turn 1: "Add structured logging to all services in src/services/. Use the pattern from src/lib/logger.ts. Services: user, order, payment."(1 turn, pattern established once)
1. Set up your project └─ AGENTS.md with commands └─ Fast tests └─ Linting configured └─ IDE plugin installed2. Start each task right └─ Use Spec Mode for complex work └─ Be specific about the goal └─ Reference existing patterns3. Choose the right model └─ Simple → Haiku/Droid Core └─ Standard → Codex/Sonnet └─ Complex → Opus (with reasoning)4. Monitor and adjust └─ Check /cost periodically └─ Identify expensive patterns └─ Refine your approach