AI PRD Workflow
repository·main·Indexed 42 days ago
https://github.com/nurettincoban/ai-prd-workflowA lightweight, RFC-driven development workflow for AI coding agents. It uses structured markdown artifacts—PRDs, Features, Rules, and RFCs—to guide AI tools from initial ideas to verified code. The workflow can be installed as native slash commands for Claude Code and Cursor, or used via copy-paste prompts for other LLMs like GPT-4o, Gemini, and Llama. It includes a multi-lens inspection process with specific commands for PRD creation, feature extraction, rule generation, and RFC implementation and review.
What's inside AI PRD Workflow
- The LinkSnip URL Shortener project is defined by a prioritized feature set categorized by implementation urgency. This document serves as the source of truth for the product scope, defining specific acceptance criteria for each feature to guide development and testing.
Technology Stack for LinkSnip URL Shortener
mainThe LinkSnip URL Shortener project is built using the following stack:
- Runtime: Node.js 20+ with TypeScript 5.x (strict mode)
- Framework: Express.js (REST API)
- Database: PostgreSQL 16 (URL and analytics storage)
- Cache: Redis 7 (redirect caching)
- Frontend: React 18 with Vite (analytics dashboard)
- Testing: Jest (unit/integration), Playwright (e2e)
- Deployment: Docker with
docker-compose
Follow the Two-Phase Implementation approach
mainTo prevent uncontrolled code generation, the workflow requires a strict two-phase process:
Phase 1: Planning (No Code)
The agent must analyze requirements and present a plan including:
- Files to create or modify
- Key components, data structures, and APIs
- Proposed implementation sequence
- Technical decisions and trade-offs
- Potential impacts on existing functionality
Crucial: The agent must wait for explicit user approval before moving to Phase 2.
Phase 2: Implementation (After Approval Only)
Once approved, the agent implements the plan in logical segments, explains complex sections, and performs a self-review.
Implement Custom Aliases for URL Shortening
mainTo allow users to specify custom identifiers for short URLs, extend the
POST /api/urlsendpoint to accept an optionalaliasfield.Validation Rules:
- Length: 3 to 30 characters.
- Format: Alphanumeric and hyphens only (Regex:
^[a-zA-Z0-9-]{3,30}$). - Reserved Aliases: Reject specific system aliases such as
api,docs,health, oradminwith a400 Bad Request. - Uniqueness: If the alias is already in use, return a
409 Conflicterror.
Understand the RFC-driven development workflow
mainThe AI PRD Workflow follows a structured, multi-step process designed to catch defects that single-pass 'plan-then-code' agents miss. Each step acts as a different 'lens' to inspect the project.
The Pipeline
- Idea → PRD: Develop a vague idea into a complete
PRD.mdvia guided interview. - Verification: Identify gaps in the PRD before building.
- Feature Extraction: Organize the PRD into prioritized
FEATURES.md. - Rule Generation: Establish technical guidelines (
RULES.md) for the AI to follow. - RFC Generation: Break the project into sequenced, logical implementation units (RFCs).
- Testing Strategy: Plan coverage based on acceptance criteria before writing code.
- Implementation: Execute RFCs one by one. The AI must plan, get approval, code, and then run builds/tests to prove acceptance criteria.
- Code Review: Review implementations against RFCs, rules, security, and performance in a fresh session.
Key Concepts
- Cross-referenced Artifacts: Artifacts like
FEATURES.mdandRFCs/use stable IDs. This ensures that when new features are added, existing citations in RFCs remain valid and do not break. - Defect Detection: The workflow is designed to catch specific classes of errors at specific stages (e.g.,
/verify-prdcatches specification contradictions, while/review-rfccatches implementation leaks or unvalidated inputs).
- Idea → PRD: Develop a vague idea into a complete
Implement URL Validation Logic
mainEnsure all submitted URLs are safe and valid during the creation process:
- Protocol Validation: Must be a valid
http://orhttps://URL. - Pattern Rejection: Reject URLs containing suspicious patterns, specifically
data:URIs andjavascript:URIs. - Security (Optional): Integrate a malware blocklist API check at the time of creation.
- Protocol Validation: Must be a valid
Resolve Conflicts Between Project Artifacts
mainWhen different project documents provide conflicting instructions, follow this strict order of authority:
PRD.md(Highest authority)FEATURES.mdRULES.mdRFCs- Generated plans (Lowest authority)
Important: If the prompt's generic guidance conflicts with
RULES.md,RULES.mdalways wins. Never resolve contradictions silently. You must state the contradiction, specify which artifact you followed and why, and flag the conflicting artifact for correction.Implement Click Analytics for URL Shortener
mainThis RFC outlines the implementation of click tracking and analytics for a URL shortener service. The goal is to track every redirect and provide endpoints to query performance data such as click counts, timelines, referrers, and geographic breakdowns.Architecture and Layering Standards
mainThe project uses a layered architecture. Each layer must reside in its own directory under
src/:- Routes
- Controllers
- Services
- Repositories
Additional requirements:
- Place shared types in
src/types/. - Use environment variables for all configuration; do not hardcode values.
Architecture and Deployment Pattern
mainThe system follows these architectural patterns:
- Layered Architecture: Express app organized as
routes->controllers->services->repositories. - Caching: Redis cache-aside pattern used for high-performance redirect lookups.
- Infrastructure: Docker Compose orchestration including Node.js, PostgreSQL, and Redis services.
- Layered Architecture: Express app organized as
Resolve artifact conflicts using the Order of Authority
mainIf instructions in the prompt conflict with project documentation, follow this hierarchy of authority:
PRD.md(Highest)FEATURES.mdRULES.mdRFCsgenerated plans(Lowest)
Note:
RULES.mdalways overrides the generic guidance in the implementation prompt. If a contradiction is found, the agent must not resolve it silently; it must state which artifact it followed and why, then flag the other for correction.Understand the AI PRD Workflow vs. Built-in Agent Planning
mainThe AI PRD Workflow is designed for product-level planning, whereas built-in AI agent planning modes are tactical and task-oriented. Use this workflow for greenfield products or multi-week builds to prevent scope creep and ensure decisions persist across sessions.
Feature Built-in Plan Mode AI PRD Workflow Scope Plans one task (implementation) Plans the product (what, for whom, scope) Persistence Dies with the session PRD, features, rules, and RFCs persist across sessions Input Takes requests at face value /create-prdinterviews you to extract decisionsVerification Reviews code by "looks right" /review-rfcverifies against acceptance criteriaThe Sweet Spot: Use this workflow for building real products where scope creep and forgotten decisions are the primary risks. For small fixes in existing code, standard agent planning is sufficient.