DEV Community
Follow
我讓三個 AI 各司其職寫程式:Codex 出測試、Grok 寫實作、Claude 驗收
This experiment tests a multi-agent coding pipeline where a single feature is broken down into three distinct roles: test generation, implementation, and verification. Codex generated tests and minimal stubs, initially causing tests to compile but fail assertions. Claude reviewed these tests against the source code for accuracy and symbol existence. Claude then placed the code into an isolated environment to ensure tests were genuinely failing for specific reasons. Grok was tasked with writing the implementation to pass the failing tests without altering the tests themselves. Finally, Claude independently verified Grok's work by running the tests, checking for memory leaks, and reviewing the code changes. The core benefit identified is not replacing human effort but shifting error detection earlier and making it more independent by creating clear test contracts between agents. This approach differs from a single agent performing TDD, where self-verification risks are higher. It also contrasts with human-written tests and agent implementation, which is more reliable but requires significant human cost. The experiment encountered specific issues, including a parameter incompatibility with Grok and a Zig build system detail requiring manual test discovery. The pipeline is deemed viable under strict testing protocols, particularly for projects with static typing and robust testing frameworks. It is less suitable for exploratory work or features where the specifications are still undefined. The author concludes that the success of this multi-agent workflow hinges on the project's ability to treat tests as concrete contracts.