تخطى إلى المحتوى الرئيسي

How Do I Get AI to Follow a Detailed Spec?

Dora
DoraEngineer
مشاركة

How Do I Get AI to Follow a Detailed Spec?

Get an AI agent to follow a detailed spec by turning the document into a traceable contract. Give each requirement an ID, map it to implementation and verification, and require explicit approval before the agent changes the interpretation or scope.

Ask for a traceability table before coding:

RequirementPlanned changeVerificationStatus
`REQ-01`Files or components affectedTest or observable behaviorPending

The table forces hidden gaps into view. A requirement without a planned change may have been overlooked. A change without a requirement may be scope creep. A requirement without verification is not ready to implement.

Define precedence when the spec conflicts with the repository. For example, security rules and public contracts may outrank an outdated implementation detail, but the agent should report the conflict rather than choose silently. Include non-goals and forbidden changes so the specification does not expand through convenient assumptions.

During implementation, require the agent to reference requirement IDs in its progress notes and final summary. Tests should cover behavior, boundary cases, and stated failure conditions, not merely confirm that code runs. At the end, compare the completed diff with the traceability table and list any deviation.

A detailed spec works when it controls decisions throughout the task. Repeating “follow the spec” in a prompt is weaker than making every change accountable to a requirement and every requirement accountable to evidence.

Related reading: What makes a good AI coding-agent prompt? and What is Plan Mode in an AI coding agent?.

Dora
كتبهDoraEngineer

Hi, Dora here! I’m an engineer focused on building AI-native developer tools and multi-agent coding systems. I work across the full stack to design, implement, and optimize intelligent workflows that help developers ship faster and collaborate more effectively with AI. My interests include agent orchestration, developer experience, and practical applications of large language models in real-world software engineering.

أدلة ذات صلة