0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code × Superpowers でトークン消費を抑えながら規律あるプロダクト開発を行う工夫

0
Posted at

はじめに

2026/05現在において、Claude Code を使ったプロダクト開発で、開発プロセスに「規律性」を持たせるためのプラグイン Superpowers が注目されています。

ただ実際に使ってみるとプロセスが手厚い分だけ トークン消費量が大きくなりがち です。Amazon Bedrock 経由で Claude Code を利用している場合、トークン消費量はそのまま AWS の請求に直結します。

そこで本記事では、Superpowers を活用しつつ、「必要以上に膨大なテスト/実装コードが生成されること」を抑えるための工夫点を整理します。

目次

  1. Superpowers とは
  2. Superpowers が手厚いがゆえに起こりうる課題
  3. トークン消費量を抑える5つの工夫
  4. Amazon Bedrock 上の Claude Code で意識したい設定
  5. まとめ

1. Superpowers とは

Superpowers は Jesse Vincent 氏らが開発する Claude Code 向けのスキルフレームワーク兼開発方法論です(obra/superpowers GitHub README)。

公式 README に記載されている主なワークフローは次の通りです。

ワークフロー / スキル名 概要・説明
brainstorming 仕様を会話で引き出し、設計書として保存
writing-plans 設計を 2〜5 分単位のタスクに分解した実装計画を作成
subagent-driven-development タスクごとにフレッシュなサブエージェントを起動し、二段階レビューを実施
test-driven-development RED-GREEN-REFACTOR を強制
using-git-worktrees /
requesting-code-review /
finishing-a-development-branch
作業分離・レビュー・マージ判断

writing-plans の公式 SKILL.md には、計画作成の原則として 「DRY、YAGNI(You Aren't Gonna Need It)、TDD、頻繁なコミット」 が明記されています(writing-plans SKILL.md)。brainstorming SKILL.md でも YAGNI ruthlessly - Remove unnecessary features from all designs という原則が示されています(brainstorming SKILL.md)。


2. Superpowers が手厚いがゆえに起こりうる課題

Superpowers の各スキルは丁寧な反面、コンテキストやコード生成量が増える要因にもなります。

  • test-driven-development は RED-GREEN-REFACTOR を厳格に運用するため、本実装に加えて常にテストが生成されます
  • writing-plans は「コードベースの文脈を持たないエンジニアでも追える」粒度の計画作成を求めるため、ファイルパス・コード・検証手順まで非常に詳細です
  • subagent-driven-development の核となる原則は Fresh subagent per task であり、タスクごとに新しいサブエージェントへタスク全文と文脈を渡します(subagent-driven-development SKILL.md)

Manage costs effectively(Claude Code 公式)には、 Token costs scale with context size: the more context Claude processes, the more tokens you use. と明記されており、コンテキスト量はそのままトークン消費量に直結します。


3. トークン消費量を抑える 5 つの工夫

工夫1) 設計段階で YAGNI を徹底する

Superpowers の brainstorming SKILL.md は YAGNI ruthlessly - Remove unnecessary features from all designs を明記しています。writing-plans SKILL.md でも DRY. YAGNI. TDD. Frequent commits. が原則として挙げられています。

ユーザー側でもこの原則に沿って「やらないこと、最小限の機能」を Claude と合意しておくことが、後段の計画文書および生成コードのスリム化につながります。

工夫2)〜5)は、Manage costs effectively - Claude Code Docsの内容を抜粋して整理します。

工夫2) 具体的なプロダクトを書く

Vague requests like "improve this codebase" trigger broad scanning. Specific requests like "add input validation to the login function in auth.ts" let Claude work efficiently with minimal file reads.

ブレインストーミング段階から、対象ファイル・関数・期待される振る舞いを具体的に伝えることが、不要なファイルスキャンを抑える基本になります。

工夫3) /clear/compact でコンテキストを管理する

  • /clear:Use /clear to start fresh when switching to unrelated work. Stale context wastes tokens on every subsequent message. と明記
  • カスタム圧縮指示:/compact Focus on code samples and API usage のように、要約時に何を残すかを指示できる

長時間セッションの節目で /clear を入れる、/compact の保持対象を明示するなどで、不要なコンテキストの持ち越しを防げます。

工夫4) モデルとサブエージェントの使い分け

Sonnet handles most coding tasks well and costs less than Opus. Reserve Opus for complex architectural decisions or multi-step reasoning. ... For simple subagent tasks, specify model: haiku in your subagent configuration.

サブエージェントは .claude/agents/<name>.md の YAML frontmatter で定義し、model フィールドで使用モデルを指定できます(Subagents - Anthropic Docs)。
冗長な出力を伴うタスクのサブエージェント委譲も推奨されています。

工夫5) CLAUDE.md を軽量化し、特殊指示は Skill に逃がす

Your CLAUDE.md file is loaded into context at session start. ... Skills load on-demand only when invoked, so moving specialized instructions into skills keeps your base context smaller. Aim to keep CLAUDE.md under 200 lines by including only essentials.

セッション開始時の固定トークン消費量を抑えるため、特殊ワークフロー(PR レビュー手順、DB マイグレーション等)は Skill 側に逃がし、CLAUDE.md は 200 行以下を目安にすることが推奨されています。


4. Amazon Bedrock 上の Claude Code で意識したい設定

以下の設定はすべて公式 Claude Code on Amazon Bedrock ページに明記されている内容です。

設定・機能 概要・説明
モデルのピン留め ANTHROPIC_DEFAULT_SONNET_MODEL / ANTHROPIC_DEFAULT_OPUS_MODEL / ANTHROPIC_DEFAULT_HAIKU_MODEL で使用モデルを明示
Prompt Caching Bedrock でも対応(リージョン制限あり)。DISABLE_PROMPT_CACHING=1設定しないこと でキャッシュ効果を活かせる
Service Tier ANTHROPIC_BEDROCK_SERVICE_TIERdefault / flex / priority を選択可

5. まとめ

Superpowers では、規律ある開発プロセスを実行できるため、手厚いプロセスゆえにトークン消費量が膨らみやすいですが、Claude Code 公式の設定や運用テクニックと組み合わせることで、トークン消費量を抑える工夫点をご紹介しました。

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?