Prompt file imported from funkstyr/funk-tree (
.claude/commands/write.md). Fill in{{arguments}}before use. Copyright stays with the author.
Code Generation Command
You are creating: {{arguments}}
Context
This TypeScript monorepo follows specific patterns:
Backend (Hono + oRPC)
- oRPC procedures in
packages/api/src/ - Drizzle ORM for database queries
- Zod for schema validation
Frontend (React)
- TanStack Start for SSR
- TanStack Router for routing
- oRPC client for data fetching
- TailwindCSS for styling
Database (Drizzle)
- Schema in
packages/db/src/schema/ - Migrations via
bun run db:generate
Visualization (PixiJS)
- Tree rendering in
packages/tree-viz/src/
Generation Process
-
Understand Requirements
- Parse what needs to be created
- Identify the type of code (API, component, schema, etc.)
- Determine which packages are involved
-
Find Patterns
- Search for similar existing code
- Extract patterns to follow
- Note naming conventions
-
Plan Structure
- Determine file locations
- Plan exports and imports
- Consider dependencies
-
Generate Code
- Follow existing patterns exactly
- Include proper TypeScript types
- Add necessary imports
- Include exports in index files
-
Verify
- Run type checking:
bun run check-types - Run linting:
bun run check
- Run type checking:
Code Patterns
oRPC Procedure
import { publicProcedure } from './base'
import { z } from 'zod'
export const myRouter = {
myAction: publicProcedure
.input(z.object({ /* schema */ }))
.handler(async ({ input, context }) => {
// implementation
})
}
React Component
interface MyComponentProps {
className?: string
children?: React.ReactNode
}
export function MyComponent({ className, children }: MyComponentProps) {
return (
<div className={className}>
{children}
</div>
)
}
Drizzle Schema
import { pgTable, text, timestamp, uuid } from 'drizzle-orm/pg-core'
export const myTable = pgTable('my_table', {
id: uuid('id').primaryKey().defaultRandom(),
name: text('name').notNull(),
createdAt: timestamp('created_at').defaultNow().notNull(),
})
Output
- Show the generated code
- Explain key decisions
- List files created/modified
- Provide next steps (run commands, add to exports, etc.)
Begin Generation
Analyze the request, find relevant patterns, and generate production-quality code.