Agentic Coding Starter Kit

repository·master·Indexed 19 days ago

https://github.com/leonvanzyl/agentic-coding-starter-kit

A production-ready Next.js starter kit designed for agentic development workflows. It provides a full stack including Auth (Better Auth), DB (PostgreSQL/Drizzle), AI (Vercel AI SDK, OpenRouter), and Storage (Local or Vercel Blob). The kit includes the `create-agentic-app` CLI for automated scaffolding and is optimized for AI coding agents via specialized context files like AGENTS.md, CLAUDE.md, and DESIGN.md.

Tokens
58.8K
Snippets
150
Records
197
Agent score
63%

What's inside agentic-coding-starter-kit

  1. Overview of UI Polish & Responsive Improvements

    master

    The UI Polish & Responsive Improvements specification outlines a plan to enhance the visual quality, component consistency, and responsive behavior of the boilerplate UI.

    Key objectives include:

    • Refreshing the color palette with a subtle blue accent.
    • Replacing bare HTML elements with shadcn components.
    • Adding hover and transition effects using a reusable utility class.
    • Implementing sm: breakpoints throughout the application for improved tablet and mobile scaling.

    Styling Constraint: All custom styling must be implemented in globals.css. Do not use inline styles or custom CSS directly on components.

  2. UI Polish & Responsive Improvements Overview

    master

    This specification outlines the process for improving the visual quality, component consistency, and responsive behavior of the boilerplate UI.

    Key Objectives:

    • Refresh the color palette with a subtle blue accent.
    • Replace bare HTML elements with shadcn components.
    • Add hover and transition effects using a reusable utility class.
    • Introduce sm: breakpoints throughout the application for better tablet and mobile scaling.

    Styling Constraint: All custom styling must be implemented in globals.css. Do not use inline styles or custom CSS directly on components.

  3. Understand the Agentic Coding Starter Kit Tech Stack

    master

    The starter kit provides a pre-configured foundation with the following technologies:

    • Framework: Next.js 16 (App Router)
    • Language: TypeScript
    • Styling: Tailwind CSS
    • Authentication: Better Auth (includes Google OAuth integration)
    • Database/ORM: Drizzle ORM with PostgreSQL
    • AI Integration: Vercel AI SDK (configured for OpenAI)
    • UI Components: shadcn/ui and Lucide React icons

    Existing Routes (to be replaced):

    • / - Home page (setup instructions/overview)
    • /dashboard - Protected dashboard (requires auth)
    • /chat - AI chat interface (requires OpenAI API key)
  4. Understand the project's technology stack

    master

    The project uses a modern web stack centered around Next.js and Tailwind CSS v4. All new components and pages must adhere to these technologies:

    • Framework: Next.js (App Router) + React + TypeScript
    • Styling: Tailwind CSS v4 (configured via @theme inline in globals.css rather than tailwind.config.ts)
    • Components: shadcn/ui (new-york style, neutral base)
    • Icons: Lucide React
    • Fonts: Geist (sans) and Geist Mono (mono) via next/font/google
    • Dark mode: next-themes (class-based, system default)
    • Utilities: cn() from @/lib/utils (combines clsx and tailwind-merge)
  5. Enable multi-step tool calls with stopWhen

    master

    By default, the AI SDK's streamText function stops generation after the first step when tool results are present (equivalent to stopWhen: stepCountIs(1)). To allow a model to use tool results to perform further reasoning or call additional tools (e.g., calling a weather tool and then a conversion tool), you must increase the stopWhen condition.

    Use stepCountIs(n) to allow the model up to n steps of interaction (tool calls and subsequent model generations) within a single request. This enables complex multi-step workflows where the model gathers information and processes it sequentially.

    import { streamText, stepCountIs } from "ai";
    
    // ... inside your POST handler
    const result = streamText({
      model: openrouter("openai/gpt-5-mini"),
      messages: convertToModelMessages(messages),
      stopWhen: stepCountIs(5), // Allows up to 5 steps of tool usage/reasoning
      tools: {
        // ... your tools
      },
    });
  6. Implement Dark Mode and Theme Switching

    master

    Dark mode is implemented using next-themes with a class-based approach (attribute="class").

    • Default Behavior: Follows the user's system preference.
    • Switching: A 3-way dropdown (Light / Dark / System) is provided for manual overrides.
    • Styling: All semantic color tokens automatically swap via the .dark CSS selector. For component-specific overrides, use the dark: Tailwind prefix (e.g., dark:bg-input/30).
  7. Configure output strategies for structured data

    master

    The AI SDK supports different output strategies to define the shape of the generated data:

    • object (Default): Returns the data as a single object. No explicit setting required.
    • array: Generates an array of objects. The schema should define the shape of a single element in that array. When using streamObject, you can use elementStream to iterate over individual elements as they are generated.
    • enum (Available with generateObject only): Used for classification tasks. Provide a list of allowed values in the enum parameter.
    • no-schema: Used when you want structured output but don't want to enforce a specific schema (e.g., for dynamic user requests).
    // Array strategy example
    const { elementStream } = streamObject({
      model: openai("gpt-4.1"),
      output: "array",
      schema: z.object({
        name: z.string(),
        class: z.string().describe("Character class, e.g. warrior, mage, or thief."),
        description: z.string(),
      }),
      prompt: "Generate 3 hero descriptions for a fantasy role playing game.",
    });
    
    for await (const hero of elementStream) {
      console.log(hero);
    }
    
    // Enum strategy example
    const { object } = await generateObject({
      model: "openai/gpt-4.1",
      output: "enum",
      enum: ["action", "comedy", "drama", "horror", "sci-fi"],
      prompt: "Classify the genre of this movie plot...",
    });
    
    // No-schema example
    const { object } = await generateObject({
      model: openai("gpt-4.1"),
      output: "no-schema",
      prompt: "Generate a lasagna recipe.",
    });
  8. When to use Specs vs. Normal Agent Workflow

    master

    While the default agent workflow is sufficient for most POCs, you should use the Spec Workflow for large, risky, or long-running features that require multiple implementation sessions or parallel work by multiple agents.

    The Spec Workflow

    1. Create a Spec: Use the create-spec skill to turn a planning conversation into a directory in specs/{feature}/ containing requirements, task files, and dependency waves.
    2. Implement Feature: Use the implement-feature skill to coordinate implementation wave-by-wave with review gates.

    Example Commands

    • Create a spec for the billing and subscriptions feature we just planned. Break it into parallel implementation waves and include any manual setup steps.
    • Implement the billing and subscriptions spec from specs/billing-subscriptions.
  9. How to use the starter with a coding agent

    master

    The starter is optimized for agentic workflows using files like AGENTS.md, CLAUDE.md, and DESIGN.md to provide context and rules.

    1. Planning Mode: Describe your app in plain language. Let the agent ask clarifying questions and confirm a plan (goals, scope, constraints).
    2. Edit Mode: Ask the agent to implement the plan. The agent should split work into parallel streams or feature chunks.
    3. Verification: The agent should run lint, typecheck, and build before finishing.

    Starter Prompt

    Use this prompt to initialize your agent:

    I am using the Agentic Coding Starter Kit. Treat the existing app as boilerplate that should be replaced by the product I describe.
    
    Use the project instructions in AGENTS.md or CLAUDE.md. During planning, ask clarifying questions before making assumptions. During implementation, split the work into small chunks, use sub-agents where useful, follow DESIGN.md for UI, preserve the existing tech stack unless there is a good reason to change it, and run lint, typecheck, and build before finishing.
    
    What I want to build:
    [Describe your app here]
  10. How to create a streaming Route Handler

    master

    To create a backend endpoint for streaming AI responses in Next.js, use the streamText function from the ai package and the toUIMessageStreamResponse method from the StreamTextResult object.

    Workflow:

    1. Extract Messages: Receive UIMessage[] from the request body.
    2. Convert Messages: Use convertToModelMessages(messages) to strip UI-specific metadata (like timestamps) and convert them into the ModelMessage[] format required by the LLM.
    3. Initialize Provider: Use a provider like createOpenRouter to initialize the model.
    4. Stream Text: Call streamText with the model and converted messages.
    5. Return Response: Return result.toUIMessageStreamResponse() to enable streaming to the client.

    Configuration Tip: Use export const maxDuration = 30; to allow longer-running streaming requests in Next.js.

    import { createOpenRouter } from "@openrouter/ai-sdk-provider";
    import { streamText, convertToModelMessages } from "ai";
    
    export const maxDuration = 30;
    
    export async function POST(req: Request) {
      const { messages } = await req.json();
      const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
    
      const result = streamText({
        model: openrouter(process.env.OPENROUTER_MODEL),
        messages: convertToModelMessages(messages),
      });
    
      return result.toUIMessageStreamResponse();
    }
  11. Enable multi-step tool calls using `stopWhen`

    master

    By default, the AI SDK stops generation after the first step when tool calls are involved (using stepCountIs(1)). To allow a model to use tool results to perform further reasoning or call additional tools (e.g., calling a weather tool and then a conversion tool), you must configure the stopWhen property in streamText.

    Use stepCountIs(n) to allow the model up to n steps of interaction. This enables complex, multi-turn reasoning where the model can gather information and process it sequentially.

    import { streamText, stepCountIs } from 'ai';
    
    // ... inside your route handler
    const result = streamText({
      model: openrouter('openai/gpt-5-mini'),
      messages: convertToModelMessages(messages),
      stopWhen: stepCountIs(5), // Allows up to 5 steps of tool usage/reasoning
      tools: {
        // ... your tools
      },
    });
  12. Configure File Storage (Local vs. Vercel Blob)

    master

    The starter uses a storage abstraction that automatically switches based on your environment variables.

    Local Development

    Leave BLOB_READ_WRITE_TOKEN empty in your .env. Files will be stored locally under public/uploads/.

    Production (Vercel Blob)

    1. Create a Blob store in Vercel.
    2. Copy the BLOB_READ_WRITE_TOKEN.
    3. Add it to your production environment variables.

    The application will automatically use the Vercel Blob backend when the token is present.