Skip to content

Stack-Specific CLAUDE.md Templates for Project Bootstrapping #112

@dean0x

Description

@dean0x

Summary

Ship stack-specific CLAUDE.md templates that users can select during devflow init to bootstrap a project with relevant conventions, patterns, and skill activations. Inspired by Harness Alpha's example CLAUDE.md library.

Motivation

Harness Alpha ships 6 example CLAUDE.md files for different stacks, each containing stack-specific conventions, database rules, auth patterns, and file structure guidance:

Template Stack Key Content
Generic Any Coding standards, error handling, testing
User-level Global config Personal preferences, agent roster, rules references
SaaS/Next.js Next.js + Supabase + Stripe RLS policies, Server Components, Stripe webhooks, edge functions
Django API Django + DRF + PostgreSQL Model conventions, serializer patterns, migration rules, viewset structure
Go Microservice Go + gRPC/REST Repository pattern, error wrapping, interface design, testing conventions
Rust API Rust + Actix/Axum Lifetime patterns, Result types, async/await, error handling chains

Each template is copy-paste-ready — a user picks the closest match and customizes from there instead of starting from scratch.

Why This Matters for DevFlow

Currently devflow init installs plugins, skills, and hooks but doesn't help users write their project's CLAUDE.md. A good CLAUDE.md is the single biggest lever for Claude Code quality — it tells the model what conventions matter, what patterns to follow, and what mistakes to avoid.

Templates lower the barrier from "write CLAUDE.md from scratch" to "pick a template, customize 20%."

Technical Approach

1. Template Directory

templates/
├── generic.md           # Universal coding standards
├── nextjs-saas.md       # Next.js + Supabase/Prisma + Stripe
├── django-api.md        # Django + DRF + PostgreSQL
├── express-api.md       # Express/Fastify + TypeScript + Prisma
├── go-service.md        # Go microservice patterns
├── rust-api.md          # Rust web API patterns
└── monorepo.md          # Turborepo/Nx monorepo conventions

2. CLI Integration

devflow init --template=nextjs-saas   # Copy template to ./CLAUDE.md
devflow init --template               # Interactive: list templates, let user pick
devflow init                          # No template (current behavior, unchanged)
  • Only writes CLAUDE.md if one doesn't already exist (no-clobber)
  • If CLAUDE.md exists, offer to append template content
  • Templates include DevFlow-specific sections (skill activation, workflow hints)

3. Template Content Structure

Each template follows a consistent structure:

# [Project Name] Development Guide

## Tech Stack
[Framework, database, deployment targets]

## Architecture
[Key patterns, directory structure, data flow]

## Conventions
[Naming, file organization, import order]

## Database Rules
[ORM patterns, migration rules, query conventions]

## Testing
[Framework, coverage targets, test organization]

## Security
[Auth patterns, input validation, secret management]

## DevFlow Integration
[Which skills matter most, workflow hints]

4. Auto-Detection (Optional Enhancement)

Detect stack from project files and suggest the best template:

  • next.config.* → nextjs-saas
  • manage.py + requirements.txt → django-api
  • go.mod → go-service
  • Cargo.toml → rust-api
  • package.json with express/fastify → express-api
  • turbo.json or nx.json → monorepo

Effort & Impact

  • Effort: Medium (template content authoring is the bulk; CLI integration is small)
  • Impact: Medium — significantly improves onboarding experience for new projects
  • Risk: Low — additive feature, no-clobber by default, doesn't change existing behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpost-v1.0.0Deferred to post-v1.0.0 release

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions