What problem does it solve? Building an autonomous fiction-generation agent requires strict coordination between prompt assembly, database state updates, job queues, and the Claude API. This Skill enforces the correct implementation patterns for Atrox's agent loop so episodes are generated reliably without race conditions, partial writes, or uncontrolled retries. ## Core Features & Use Cases - Prompt Assembly Order: Defines a fixed 7-section prompt structure (character DNA, style rules, arc state, recurring entities, style drift, reader comments, generation instruction) that must not be reordered. - Transactional State Updates: Ensures episodes inserts and arc_state updates happen in a single database transaction, updating all fields including world_state, recurring_entities, style_drift, and emotional_log. - Queue-Based Generation: Manages agent_queue jobs via cron pickup with SELECT FOR UPDATE SKIP LOCKED to prevent concurrent execution, and stops on failure without automatic retries. - Use Case: When implementing the weekly episode generation cron for an Atrox arc, follow this Skill to pick up a pending job, call the Claude API with the assembled prompt, persist results transactionally, and enqueue the next week's job. ## Quick Start Implement the weekly episode generation job for an Atrox arc following the agent-loop patterns for prompt building, queue management, and transactional state updates.