
I tested and compared the code generated by Claude Opus 4.5 using Kiro-CLI against Sonnet 4.5 / Haiku 4.5
This page has been translated by machine translation. View original
In the previous article, we confirmed that by installing Kiro-CLI in the Amazon Linux 2023 environment, Claude Opus 4.5 became available with a free Builders ID.
As a continuation, this time I verified "what kind of code Opus 4.5 actually writes."
Previously, I conducted a verification comparing code quality by having Q Developer and Claude 3.5 Sonnet / Haiku create a "Tetris-like game".
This time, I gave the same prompt to Claude Opus 4.5 and compared and analyzed the generated code with the previously created code (Haiku 4.5 version, 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)
Implementation Comparison Analysis
I compared and analyzed the code generated by the three models from three perspectives: "Architecture", "Logic", and "Features & Design".
1. Architectural Design Philosophy
Each model had clearly different design philosophies.
| Model | Design Style | Characteristics |
|---|---|---|
| Haiku 4.5 | Full OOP | Everything encapsulated in a Game class. Strict state management. |
| Sonnet 4.5 | Functional + Object | No classes used. Composed of pure functions and object literals. Lightweight. |
| Opus 4.5 | Hybrid | Global state, only components (Piece) as classes. Practicality focused. |
Opus 4.5 Implementation (Hybrid):
Opus chose a middle ground between "the effort of complete class-based design" and "the messiness of all globals."
Creating a Piece class while treating the board as a global variable is a design that balances readability and maintainability well 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)); // Board is global
class Piece { // Components with logic are classes
constructor(type) {
this.type = type;
this.shape = SHAPES[type];
// ...
}
}
2. Game Logic Robustness
The biggest difference was in the collision detection logic during movement.
- Haiku 4.5: Implements movement first, then checks for collisions and reverts if necessary. Heavy use of JSON conversion for deep copying raises performance concerns.
- Sonnet 4.5: Receives
offsetX, offsetYparameters and pre-checks destination coordinates (most efficient). - Opus 4.5: Self-contained validation with return value-based control.
Opus's implementation is characterized by the move() method returning success/failure (boolean). This makes control at the caller (game loop) very intuitive.
// Opus 4.5 implementation: Returns success/failure
move(dx, dy) {
this.x += dx;
this.y += dy;
// If movement fails, roll back and return false
if (this.collides()) {
this.x -= dx;
this.y -= dy;
return false;
}
return true; // Movement successful
}
3. Features and UX Considerations
I examined how thoughtfully each model implemented the vague requirement of a "Tetris-like game."
- Opus 4.5:
- 〇 Soft drop implemented: The only one that supported fast drop using the down arrow key (
ArrowDown). - 〇 Immediate rendering: Calls
drawBoard()within key input events, resulting in good response to operations. - 〇 Design: Most conscious of "AWS-like" design, including specifying the
Amazon Emberfont.
- 〇 Soft drop implemented: The only one that supported fast drop using the down arrow key (
- Haiku 4.5:
- 〇 Responsive: Supported smartphone layout, but had bugs in loop control after game over.
- Sonnet 4.5:
- 〇 Color scheme: Showed attention to detail by assigning different AWS service colors (Lambda=Green, S3=Blue, etc.) to all 7 tetromino types.
Performance Considerations for Opus 4.5
The coding characteristics of Claude Opus 4.5 observed in this comparison are as follows:
- Ability to fill "specification gaps":
High ability to imagine and complete "what the user is likely seeking" by implementing features not included in instructions, such as "soft drop" and return value API design. - Practical architecture selection:
Rather than typical OOP (Haiku) or simple functional programming (Sonnet), it directly produced "the structure that's easiest to maintain for a small game app."
Conclusion and Future Challenges
In this verification, I confirmed that Opus 4.5 generates high-quality code that balances UX and maintainability.
For the comparison and analysis work in this study, I used Gemini 3.0 to assist with organizing comparison perspectives and analyzing code characteristics.
However, there is one environmental difference to note in this comparison:
- Haiku 4.5 / Sonnet 4.5: Executed in a Pro license (paid) environment in the previous verification
- Opus 4.5: Executed this time in a Builders ID (free, experimental support) environment
These represent evaluations on "different playing fields," and limitations specific to the free tier (throughput or hidden parameter adjustments, etc.) may have affected the results. It's possible that the full potential wasn't demonstrated, or conversely, that it was specially adjusted as an experimental version.
It's premature to definitively judge Kiro's Opus 4.5 capabilities based solely on these results. In the future, when Opus 4.5 support with IAM Identity Center integration (Pro license) becomes available, I would like to conduct additional tests under identical conditions with more appropriate prompts.
