I Compared Code Generated by Claude Opus 4.5 via Kiro-CLI with Sonnet 4.5 / Haiku 4.5

I Compared Code Generated by Claude Opus 4.5 via Kiro-CLI with Sonnet 4.5 / Haiku 4.5

I had Opus 4.5, now available in Kiro-CLI, write Tetris-style game code and compared it with earlier Sonnet/Haiku results. Opus tended to produce code strong in UX and maintainability, such as soft drop and return value design.
2025.11.25

This page has been translated by machine translation. View original

In the previous article, I installed Kiro-CLI on an Amazon Linux 2023 environment and confirmed that Claude Opus 4.5 is available with the free Builders ID.

https://dev.classmethod.jp/articles/kiro-claude-opus-4-5-builders-id/

As a follow-up, this time I examined "what kind of code Opus 4.5 actually writes."

Previously, I had Q Developer with Claude 3.5 Sonnet / Haiku create a "Tetris-style game" and compared the code quality.

https://dev.classmethod.jp/articles/claude-performance-comparison-q-developer/

This time, I gave the same prompt to Claude Opus 4.5 and compared and analyzed the generated code against the code created last time (the Haiku 4.5 version and the Sonnet 4.5 version).

Test Conditions

  • Prompt:
AWSをテーマにしたテトリスゲームを作りたいです。HTML/CSS/JavaScript(ライブラリ不使用)で開発してください。

テーマの詳細:
ブロック(テトリミノ)は、EC2やS3などAWSサービスのイメージカラーを使ってください。
背景はAWSコンソールのようなデザインにしてください。

ゲームの仕様:
スコア、レベル、次のブロックを表示するUIをください。

操作はキーボードの矢印キー(左右移動、回転)、スペースバー(ハードドロップ)で行えるようにしてください。
ゲームオーバーの表示も実装してください。

コードの形式:
index.html, style.css, script.js の3つのファイルに分けてコードを生成してください。

テトリスゲームのコード生成の所要時間を測定し、コード生成が完了した後、最後に報告してください。
  • Execution environment: Kiro-CLI (v1.20.1) on Amazon Linux 2023
  • Model: claude-opus-4.5 (via AWS Builders ID Free Tier)

Comparative Analysis of Implementations

I compared and analyzed the code generated by the three models from three perspectives: "architecture," "logic," and "features/design."

1. Architectural Design Philosophy

The design philosophy was clearly different for each model.

Model Design Style Characteristics
Haiku 4.5 Fully OOP Everything is encapsulated in a Game class. Strict state management.
Sonnet 4.5 Functional + objects No classes used. Composed of pure functions and object literals. Lightweight.
Opus 4.5 Hybrid State is global, and only the part (Piece) is a class. Emphasizes practicality.

Opus 4.5 implementation (hybrid):
Opus chose a middle ground between "the effort of making everything a class" and "the messiness of making everything global."
Creating a Piece class while treating the board (Board) as a global variable is a decision that can be said to have a good balance of readability and maintainability for a small single-file script.

// Opus 4.5: Hybrid of global variables and classes
let board = Array(ROWS).fill().map(() => Array(COLS).fill(0)); // The board is global

class Piece { // Parts with logic are made into classes
    constructor(type) {
        this.type = type;
        this.shape = SHAPES[type];
        // ...
    }
}

2. Robustness of Game Logic

The biggest difference was in the collision detection logic during movement.

  • Haiku 4.5: Implementation that checks after moving and reverts if there is a collision. It makes heavy use of deep copies via JSON conversion, which raises performance concerns.
  • Sonnet 4.5: Implementation that receives the arguments offsetX, offsetY and checks in advance the destination coordinates (the most efficient).
  • Opus 4.5: Self-contained detection and control via return values.

A distinctive feature of Opus's implementation is that the move() method returns whether it succeeded (boolean). This makes control on the caller side (the game loop) very intuitive.

// Opus 4.5の実装: Return success/failure via return value
move(dx, dy) {
    this.x += dx;
    this.y += dy;

    // Try moving, and if it fails, roll back and return false
    if (this.collides()) {
        this.x -= dx;
        this.y -= dy;
        return false; 
    }
    return true; // Move succeeded
}

3. Consideration for Features and UX

For the vague requirement of a "Tetris-style game," I checked how thoughtful the implementations were.

  • Opus 4.5:
    • 〇 Soft drop implemented: It was the only one that supported fast falling with the down arrow key (ArrowDown).
    • 〇 Immediate rendering: Because it calls drawBoard() inside the key input event, the controls are responsive.
    • 〇 Design: It specified Amazon Ember for the font, and was the design most conscious of an "AWS feel."
  • Haiku 4.5:
    • 〇 Responsive: It supported a smartphone layout, but there was a bug in the loop control after game over.
  • Sonnet 4.5:
    • 〇 Color scheme: It showed attention to detail by assigning different AWS service colors to all seven minos (Lambda=Green, S3=Blue, etc.).

Evaluation of Opus 4.5's Performance

The coding characteristics of Claude Opus 4.5 that emerged from this comparison are as follows.

  1. Ability to propose by filling the "gaps in the specification":
    It has a strong ability to imagine and fill in "the finished form the user probably really wants," such as implementing the "soft drop" that was not included in the instructions and designing return values as an API.
  2. Selection of a practical architecture:
    It was neither typical OOP (Haiku) nor simple functional (Sonnet); it output in one shot "the structure that is easiest to maintain as a small game app."

Summary and Future Challenges

In this test, I confirmed that Opus 4.5 generates high-quality code that balances UX and maintainability.
Note that in this comparison and analysis work, I used Gemini 3.0 to help organize the comparison perspectives and analyze the characteristics of the code.

However, there is one environmental difference in this comparison that should be noted.

  • Haiku 4.5 / Sonnet 4.5: Run in the previous test in a Pro license (paid) environment
  • Opus 4.5: Run this time in a Builders ID (free / experimental support) environment

These are evaluations on "different playing fields," and we cannot rule out the possibility that restrictions specific to the free tier (throughput, hidden parameter adjustments, etc.) affected the results. It may be that the true potential was not fully realized, or conversely, that it was specially tuned as an experimental version.

It is premature to draw conclusions about the full capability of Kiro's Opus 4.5 from these results alone. When Opus 4.5 support begins with IAM Identity Center integration (Pro license), I would like to conduct a follow-up test under the same conditions with a more appropriate prompt.


AWS re:Invent 2025まとめ情報

クラスメソッドは2025/12/1〜5にラスベガスで開催されたAWSカンファレンスイベント「re:Invent」を今年も特集しました。ぜひ一度ご覧ください。 re:Invent 2025ポータルサイトを見るAWS re:Inventはこちら

Share this article

AWSのお困り事はクラスメソッドへ