Claude Workflow: The Complete Guide to Structured AI-Assisted Development
Building software with Claude Code is powerful, but without structure it leads to inconsistent code patterns, undocumented decisions, repeated mistakes, and incomplete implementations. After months of refining my AI-assisted development process, I have created a comprehensive workflow framework that solves these problems.
Claude Workflow is an 8-phase development framework that Claude Code follows when assisting with frontend projects. It ensures every task is properly planned, implemented, tested, and documented.
The framework is open source and available on GitHub: github.com/mikulgohil/Claude-workflow
Table of Contents
Getting Started
The 8 Phases
- Phase 0: Session Initialization
- Phase 1: Project Discovery
- Phase 2: Requirements Gathering
- Phase 3: Task Planning
- Phase 4: Implementation
- Phase 5: Testing and Validation
- Phase 6: Documentation
- Phase 7: Review and Iteration
Templates
- Project Overview Template
- Component Documentation Template
- ADR Template
- Lessons Learned Template
- Testing Strategy Template
- Manual Test Checklist Template
Advanced
Why You Need a Structured Workflow
When I started using Claude Code for serious development work, I noticed recurring problems:
- Inconsistent patterns - Claude would use different approaches for similar problems across sessions
- Lost context - Previous decisions and learnings were forgotten between sessions
- Incomplete testing - Only happy paths were tested, edge cases were missed
- Poor documentation - Components were built without proper documentation
- Repeated mistakes - The same failed approaches were tried multiple times
The Claude Workflow framework addresses each of these by providing:
| Feature | Benefit |
|---|---|
| 8-Phase Development Cycle | Structured approach from discovery to review |
| Never Commits Code | You maintain full control over version history |
| Lessons Learned Tracking | Failed approaches documented to prevent repetition |
| Testing Strategy | Supports both Playwright automation and manual testing |
| Component Documentation | Every component gets proper documentation |
| Decision Records (ADR) | Significant decisions tracked with context |
Project Structure
When you add Claude Workflow to your project, here is the structure you get:
your-project/
├── .github/
│ ├── workflows/
│ │ └── validate-markdown.yml # CI for markdown linting
│ └── mlc_config.json # Markdown link checker config
├── templates/ # Documentation templates
│ ├── PROJECT_OVERVIEW.template.md
│ ├── COMPONENT_DOC.template.md
│ ├── ADR.template.md
│ ├── LESSONS_LEARNED.template.md
│ ├── TESTING_STRATEGY.template.md
│ └── MANUAL_TEST_CHECKLIST.template.md
├── docs/ # Generated documentation
│ ├── PROJECT_OVERVIEW.md
│ ├── ARCHITECTURE.md
│ ├── COMPONENTS.md
│ ├── DECISIONS.md
│ ├── LESSONS_LEARNED.md
│ ├── TESTING_STRATEGY.md
│ └── SETUP.md
├── .gitignore
├── LICENSE
├── README.md
└── WORKFLOW.md # Main workflow documentThe WORKFLOW.md file is the core document that Claude Code reads and follows. The templates/ folder contains ready-to-use documentation templates that Claude uses to create documentation in your project's ./docs/ folder.
Critical Rules
The workflow enforces two critical rules that Claude Code must never break:
Rule 1: Never Commit Code
Claude Code will never run these commands:
| Forbidden Command | Reason |
|---|---|
git commit | User must review all changes first |
git push | User controls when code goes to remote |
git add (for commits) | User decides what gets staged |
If asked to commit, Claude responds: "I do not commit code. Please review the changes and commit manually when ready."
Why this matters:
- You must review all changes before they become permanent
- It prevents accidental commits of incomplete or broken code
- It maintains clean git history under your control
- It allows you to write meaningful commit messages
- It protects against committing sensitive data accidentally
Rule 2: Always Provide Detailed Task Summary
After completing every task, Claude must provide a comprehensive summary:
| Section | Contents |
|---|---|
| Files Modified | Every file created, modified, or deleted with full paths |
| Changes Made | Detailed description of each change with code snippets |
| Why Changes Were Made | Reasoning connected to original requirements |
| Testing Status | What was tested and what needs manual testing |
| Next Steps | Remaining work and dependencies |
Phase 0: Session Initialization
When starting with a new project, Claude completes these initialization steps:
Step 0.1: Project Type Detection
| Detection Item | Options |
|---|---|
| Project Type | New project or existing codebase |
| Framework | React, Vue, Angular, Svelte, Next.js, Nuxt, etc. |
| Structure | Monorepo or single package |
| Package Manager | npm, yarn, pnpm, bun |
| TypeScript | Yes/No with version |
Step 0.2: Initial Questions
Claude asks these mandatory questions before starting work:
| Question | Purpose |
|---|---|
| What is the primary purpose of this project? | Understand scope |
| Who is the target audience? | Define user needs |
| Are there specific coding standards to follow? | Match conventions |
| What is the deployment target? | Vercel, AWS, Azure, etc. |
| Any existing design systems in use? | Reuse components |
| What is your preferred testing strategy? | TDD, Test-after, Manual |
| Any accessibility requirements? | WCAG level |
| What browsers/devices must be supported? | Compatibility targets |
Step 0.3: Create Documentation Structure
Claude creates this documentation structure in your project:
| File | Purpose |
|---|---|
docs/PROJECT_OVERVIEW.md | Project understanding document |
docs/ARCHITECTURE.md | Technical architecture decisions |
docs/COMPONENTS.md | Component documentation index |
docs/DECISIONS.md | Architectural Decision Records |
docs/LESSONS_LEARNED.md | Failed approaches and anti-patterns |
docs/TESTING_STRATEGY.md | Testing approach documentation |
docs/SETUP.md | Development environment setup |
Phase 1: Project Discovery
Before any development work, Claude thoroughly analyzes the project:
Analysis Areas
1. Project Structure
- Directory organization
- Entry points
- Build configuration
- Environment variables
2. Technology Stack
- Framework version
- State management solution
- Styling approach (CSS Modules/Tailwind/Styled-components)
- API integration patterns
- Authentication method
3. Existing Patterns
- Component structure
- Naming conventions
- Import/export patterns
- Error handling approach
- Logging strategy
4. Dependencies
- Key packages and their purposes
- Outdated or vulnerable packages
- Dev vs production dependencies
Pattern Documentation Example
## Existing Patterns Found
### Component Pattern
- Functional components with hooks
- Props interface defined inline
- Local state with useState
### Styling Pattern
- Tailwind CSS for styling
- Custom theme in tailwind.config.js
- Mobile-first responsive design
### Data Fetching Pattern
- React Query for server state
- Axios for HTTP client
- Error boundary for failures
### File Naming Convention
- Component files: PascalCase (UserProfile.tsx)
- Utility files: camelCase (formatDate.ts)
- Test files: ComponentName.test.tsxPhase 2: Requirements Gathering
For each new task or feature request, Claude follows a requirements checklist:
Requirements Checklist
| Question | Category |
|---|---|
| What is the user trying to achieve? | Goal |
| What is the expected behavior? | Functionality |
| What are the edge cases? | Edge cases |
| Are there any constraints? | Performance/Accessibility |
| Is there a design/mockup to reference? | Design |
| What data is required? | Data |
| Are there dependencies on other features? | Dependencies |
Clarification Protocol
Never assume. Always ask when unclear.
When multiple approaches exist:
"I see two approaches for this:
Option A: [Description] - Pros: [list] Cons: [list]
Option B: [Description] - Pros: [list] Cons: [list]
Which approach do you prefer?"When requirements are ambiguous:
"To clarify the requirement:
- Did you mean [interpretation A] or [interpretation B]?
- What should happen when [edge case]?"When design decisions are needed:
"This requires a design decision:
- Should this be [option 1] or [option 2]?
- What is the priority: performance, readability, or flexibility?"When breaking changes are possible:
"This change may affect [components/features].
Should I proceed with the breaking change or maintain backward compatibility?"Phase 3: Task Planning
Claude breaks down every feature into atomic, trackable tasks.
Task Breakdown Rules
| Rule | Description |
|---|---|
| Single Session | Each task completable in one session |
| Clear Acceptance | Tasks have clear acceptance criteria |
| Explicit Dependencies | Dependencies between tasks are explicit |
| Complexity Estimate | Low, Medium, or High complexity |
Task Format
- [ ] Add user avatar component | Priority: High | Complexity: M
Dependencies: UserProfile component exists
Acceptance: Avatar displays with fallback for missing imageTask Status Flow
| Current Status | Can Move To | When |
|---|---|---|
| PENDING | IN_PROGRESS | Work begins |
| IN_PROGRESS | COMPLETED | Work finished successfully |
| IN_PROGRESS | BLOCKED | External dependency needed |
| IN_PROGRESS | FAILED | Approach does not work |
| BLOCKED | IN_PROGRESS | Blocker resolved |
| FAILED | IN_PROGRESS | Alternative approach chosen |
When a task is BLOCKED, document the blocker.
When a task FAILED, document it in LESSONS_LEARNED.md and try an alternative approach.
Phase 4: Implementation
Before writing any code, Claude completes a pre-implementation checklist.
Pre-Implementation Checklist
| Check | Status |
|---|---|
| Understood the requirement completely | Required |
| Identified affected files/components | Required |
| Checked for existing similar implementations | Required |
| Reviewed LESSONS_LEARNED.md for anti-patterns | Required |
| Planned the implementation approach | Required |
| Identified test scenarios | Required |
Implementation Rules
1. Minimal Changes
- Only modify what is necessary
- Do not refactor unrelated code
- Do not add "nice to have" features
2. Follow Existing Patterns
- Match the project's code style
- Use existing utilities/helpers
- Follow established naming conventions
3. Security First
- Sanitize user inputs
- Avoid XSS vulnerabilities
- Never hardcode secrets
- Use proper authentication/authorization
4. Performance Conscious
- Avoid unnecessary re-renders
- Use proper memoization
- Lazy load when appropriate
- Optimize bundle size
5. Accessibility (A11Y)
- Use semantic HTML
- Include proper ARIA attributes
- Ensure keyboard navigation
- Test with screen readers
Component Development Pattern
| Step | Action |
|---|---|
| 1 | CREATE component file with proper structure |
| 2 | ADD TypeScript interfaces for props |
| 3 | IMPLEMENT core functionality |
| 4 | ADD error handling |
| 5 | INCLUDE loading states |
| 6 | ADD debug logging (removable in production) |
| 7 | DOCUMENT the component |
| 8 | WRITE tests or prepare manual test plan |
Error Handling Standard
try {
// Operation
} catch (error) {
// 1. Log for debugging
console.error('[ComponentName] Operation failed:', error);
// 2. User-friendly error state
setError('A user-friendly message');
// 3. Optional: Report to error tracking service
errorTracker.capture(error);
}Debug Logging Standard
const DEBUG = process.env.NODE_ENV === 'development';
function debugLog(component: string, action: string, data?: unknown) {
if (DEBUG) {
console.log(
`[${component}] ${action}`,
data ? JSON.stringify(data, null, 2) : ''
);
}
}
// Usage
debugLog('UserProfile', 'Fetching user data', { userId });
debugLog('UserProfile', 'User data received', userData);Phase 5: Testing and Validation
The workflow includes a testing decision tree based on available tools.
Testing Decision Tree
| Playwright Available? | Action |
|---|---|
| YES | Use Playwright for E2E testing |
| NO | Use Manual Testing Protocol |
When using Playwright:
- Create Page Object Model
- Write test scenarios
- Run in CI/CD
- Document test coverage
When using Manual Testing:
- Add comprehensive debug logs
- Create test checklist
- Ask user to test manually
- Request logs for verification
- Document test results
Server Management Protocol
Before running tests, Claude checks for existing development servers:
| Step | Action |
|---|---|
| 1 | CHECK if server is already running on ports 3000, 3001, 5173, 8080, 4200 |
| 2 | IF RUNNING: Use existing server, do not start another |
| 3 | IF ISSUES: Inform user first before killing server |
| 4 | IF NOT RUNNING: Start server and wait for ready state |
Playwright Testing Protocol
Page Object Template:
import { Page, Locator, expect } from '@playwright/test';
export class LoginPage {
readonly page: Page;
readonly emailInput: Locator;
readonly passwordInput: Locator;
readonly submitButton: Locator;
readonly errorMessage: Locator;
constructor(page: Page) {
this.page = page;
this.emailInput = page.getByLabel('Email');
this.passwordInput = page.getByLabel('Password');
this.submitButton = page.getByRole('button', { name: 'Sign in' });
this.errorMessage = page.getByRole('alert');
}
async goto() {
await this.page.goto('/login');
}
async login(email: string, password: string) {
await this.emailInput.fill(email);
await this.passwordInput.fill(password);
await this.submitButton.click();
}
async expectError(message: string) {
await expect(this.errorMessage).toContainText(message);
}
async expectLoggedIn() {
await expect(this.page).toHaveURL('/dashboard');
}
}E2E Test Template:
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/LoginPage';
test.describe('Login Flow', () => {
let loginPage: LoginPage;
test.beforeEach(async ({ page }) => {
loginPage = new LoginPage(page);
await loginPage.goto();
});
test('successful login redirects to dashboard', async () => {
await loginPage.login('test@example.com', 'password123');
await loginPage.expectLoggedIn();
});
test('invalid credentials shows error message', async () => {
await loginPage.login('wrong@example.com', 'wrongpassword');
await loginPage.expectError('Invalid credentials');
});
});Manual Testing Protocol
Step 1: Add Debug Logs
- Entry/exit of key functions
- State changes
- API calls and responses
- User interactions
Step 2: Create Test Checklist
| Test Type | Items to Test |
|---|---|
| Happy Path | Main user flow works correctly |
| Edge Cases | Empty state, max values, special characters |
| Error Scenarios | Invalid input, network failure, unauthorized |
Step 3: Request User Testing
"Please test the following and share the console logs:
1. [Test scenario 1]
2. [Test scenario 2]
3. [Test scenario 3]"Step 4: Verify From Logs
- Check debug log sequence
- Verify expected states
- Identify any errors
Phase 6: Documentation
Every component gets attached documentation following a standard format.
Component Documentation Standard
# ComponentName
## Overview
Brief description of what this component does.
## Props
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| prop1 | string | Yes | - | Description |
| prop2 | number | No | 0 | Description |
## Usage
[Code example]
## States
- Loading state description
- Error state description
- Empty state description
## Events
| Event | Payload | Description |
|-------|---------|-------------|
| onClick | void | Triggered when clicked |
## Accessibility
- Keyboard navigation support
- Screen reader compatibility
- ARIA attributes used
## Testing
- Automated: Yes/No - test file location
- Manual: test checklist location
## Changelog
| Date | Change | Author |
|------|--------|--------|
| YYYY-MM-DD | Initial implementation | AI |Decision Documentation (ADR)
For significant decisions, Claude creates an Architectural Decision Record:
# ADR-001: State Management Choice
## Status
Accepted
## Context
We need to manage complex client state across multiple components.
## Options Considered
### Option 1: Redux Toolkit
- Pros: Mature ecosystem, devtools, middleware support
- Cons: Boilerplate, learning curve
### Option 2: Zustand
- Pros: Simple API, minimal boilerplate, TypeScript friendly
- Cons: Smaller ecosystem
## Decision
We will use Zustand because the application does not require
middleware and simplicity is preferred.
## Consequences
### Positive
- Faster development
- Less boilerplate code
### Negative
- May need to migrate if complexity growsPhase 7: Review and Iteration
Before considering any task complete, Claude runs through a self-review checklist.
Self-Review Checklist
Code Quality
| Check | Status |
|---|---|
| Follows project coding standards | Required |
| No console.log statements (except debug utility) | Required |
| No commented-out code | Required |
| Proper error handling | Required |
| No hardcoded values that should be configurable | Required |
Functionality
| Check | Status |
|---|---|
| Meets all acceptance criteria | Required |
| Edge cases handled | Required |
| Error states implemented | Required |
| Loading states implemented | Required |
Performance
| Check | Status |
|---|---|
| No unnecessary re-renders | Required |
| Proper memoization where needed | Required |
| No memory leaks | Required |
| Bundle size considered | Required |
Accessibility
| Check | Status |
|---|---|
| Semantic HTML used | Required |
| ARIA attributes where needed | Required |
| Keyboard navigation works | Required |
| Color contrast sufficient | Required |
Security
| Check | Status |
|---|---|
| No XSS vulnerabilities | Required |
| Input validation present | Required |
| No sensitive data exposed | Required |
Documentation
| Check | Status |
|---|---|
| Component documentation updated | Required |
| README updated if needed | Required |
| Inline comments for complex logic | Required |
| ADR created for significant decisions | Required |
Task Completion Summary Template
## Task Summary: Add User Avatar Component
### Files Changed
| File | Action | Description |
|------|--------|-------------|
| src/components/Avatar.tsx | Created | New avatar component |
| src/components/UserProfile.tsx | Modified | Integrated avatar |
| src/styles/avatar.css | Created | Avatar styling |
### Changes Made
#### 1. Avatar Component
**What:** Created reusable avatar component with fallback
**Why:** Display user profile images consistently
**Code:**
[Key code snippet]
### Testing Status
- Tested: Component renders with image
- Tested: Fallback displays when image missing
- Needs Manual Testing: Screen reader announcement
### Manual Testing Required
1. Load page with valid avatar URL - Expected: Image displays
2. Load page with broken URL - Expected: Initials fallback shows
3. Tab to avatar - Expected: Focus ring visible
### Next Steps
- [ ] Add unit tests
- [ ] Add hover state for enlarged viewTemplates Library
The workflow includes six comprehensive templates.
Project Overview Template
Used to document project understanding and architecture:
| Section | Contents |
|---|---|
| Basic Details | Name, framework, package manager, TypeScript |
| Purpose and Goals | Primary purpose, target audience, business goals |
| Technical Stack | Core technologies with versions |
| Environment Configuration | Environment variables and required values |
Component Documentation Template
Standardized documentation for every component:
| Section | Contents |
|---|---|
| Overview | What the component does |
| Props | All props with types and defaults |
| Usage Examples | Basic and advanced usage code |
| States | Loading, error, empty states |
| Accessibility | Keyboard navigation, WCAG compliance |
| Testing | Test file locations |
ADR Template
For tracking architectural decisions:
| Section | Contents |
|---|---|
| Status | Proposed, Accepted, Deprecated, Superseded |
| Context | Problem statement, requirements, constraints |
| Options | Each option with pros, cons, effort, risk |
| Decision Matrix | Weighted scoring of options |
| Decision | Chosen option with rationale |
| Consequences | Positive and negative outcomes |
Lessons Learned Template
For tracking failed approaches:
| Section | Contents |
|---|---|
| Quick Reference | Common pitfalls table |
| Log Entries | Date, feature, tags, what was attempted |
| What Went Wrong | Explanation and error messages |
| Root Cause | Underlying reason for failure |
| Better Alternative | What worked instead with code |
| Prevention | How to avoid in future |
Testing Strategy Template
Comprehensive testing approach:
| Test Level | Coverage Target | Focus |
|---|---|---|
| Unit Tests | 80%+ | Functions, hooks, utilities |
| Integration | Key paths | Component interactions |
| E2E | Critical flows | User journeys |
Coverage Requirements:
| Area | Minimum | Target |
|---|---|---|
| Utilities/Helpers | 90% | 100% |
| Hooks | 85% | 95% |
| Components | 75% | 85% |
| Pages | 70% | 80% |
| Overall | 75% | 85% |
Manual Test Checklist Template
When automated testing is not available:
| Section | Contents |
|---|---|
| Pre-Test Setup | Environment, cache, console settings |
| Test Scenarios | Step-by-step with expected results |
| Edge Cases | Empty state, max values, special chars |
| Accessibility | Keyboard nav, focus, screen reader |
| Responsive | Mobile, tablet, desktop viewports |
| Summary | Pass/fail counts by category |
MCP Tools Integration
The workflow supports these MCP (Model Context Protocol) tools:
| Tool | When to Use |
|---|---|
| Perplexity | Web search, latest practices, error solutions |
| Playwright | E2E browser testing and automation |
| Figma | Design-to-code implementation |
| Context7 | Language/framework documentation |
Research Protocol
For New Library/API:
- Use Perplexity to search: "[library] best practices [year]"
- Verify compatibility with project stack
- Check for known issues
- Document findings
For Error Resolution:
- Search exact error message
- Look for framework-specific solutions
- Check for version-specific fixes
- Try solutions in order of relevance
Option Presentation Format
When multiple valid approaches exist:
"I have identified 2 approaches for this task:
**Option 1: React Query** (Recommended)
- Description: Server state management library
- Pros: Caching, background refetch, devtools
- Cons: Additional dependency
- Effort: Low
- Risk: Low
**Option 2: Custom useEffect + useState**
- Description: Build data fetching from scratch
- Pros: No dependencies
- Cons: Manual cache management, more code
- Effort: Medium
- Risk: Medium
My recommendation is Option 1 because it provides
built-in caching and reduces boilerplate.
Which approach would you like to proceed with?"Anti-Patterns to Avoid
The workflow documents common anti-patterns that Claude must avoid:
| Anti-Pattern | Wrong Approach | Correct Approach |
|---|---|---|
| Committing Code | Running git commit/push | Let user review and commit |
| Assuming | Implementing based on assumptions | Ask for clarification |
| Over-Engineering | Adding features "just in case" | Implement exactly what requested |
| Ignoring Patterns | Introducing inconsistent patterns | Follow established project patterns |
| Skipping Documentation | Implementing without documenting | Document as part of implementation |
| Not Tracking Failures | Repeating failed approaches | Record and learn from failures |
| Incomplete Testing | Only testing happy path | Test edge cases and errors |
| Hardcoding Values | Magic numbers and strings | Use configuration and constants |
| Ignoring Accessibility | Building inaccessible UIs | Follow WCAG guidelines |
| Duplicate Servers | Running npm run dev blindly | Check if server already running |
Recovery Protocol
When stuck, follow these steps:
| Step | Action |
|---|---|
| 1. Step Back | Re-read requirement, check if approach matches |
| 2. Document Issue | What was attempted, what went wrong, what error |
| 3. Search Solutions | Use Perplexity, check existing patterns |
| 4. Ask for Help | Present issue clearly, show attempts, ask specific questions |
| 5. Try Alternative | Do not repeat failed approach, document why switching |
Getting Started Guide
Option 1: Copy to Your Project (Recommended)
# Clone the repository
git clone https://github.com/mikulgohil/Claude-workflow.git
# Copy to your project
cp -r Claude-workflow/ your-project/workflow/
# Or copy just the essential files
cp Claude-workflow/WORKFLOW.md your-project/
cp -r Claude-workflow/templates/ your-project/templates/Option 2: Reference Globally
Point Claude Code to this workflow at the start of each session by including the WORKFLOW.md file in your project root or referencing the GitHub repository.
Session Checklists
Session Start:
| Task | Status |
|---|---|
| Review previous session state | Required |
| Check pending tasks | Required |
| Review any user feedback | Required |
| Load context from documentation | Required |
Session End:
| Task | Status |
|---|---|
| Update all documentation | Required |
| Mark completed tasks | Required |
| Document incomplete work | Required |
| Summarize progress for user | Required |
| List next steps | Required |
Conclusion
The Claude Workflow framework transforms AI-assisted development from ad-hoc interactions into a structured, repeatable process. By enforcing clear phases, documentation standards, and quality checks, it ensures:
| Benefit | How It Works |
|---|---|
| Consistency | Same approach across sessions and projects |
| Quality | Mandatory testing and review for every task |
| Knowledge Retention | Lessons learned tracking prevents repeated mistakes |
| User Control | Never allows automated commits |
| Documentation | Comprehensive docs for every component and decision |
The workflow is a living document that evolves as new patterns, tools, and learnings emerge. I encourage you to fork it, customize it for your needs, and contribute improvements back to the community.
GitHub Repository: github.com/mikulgohil/Claude-workflow
The future of AI-assisted development is not about replacing developers. It is about creating structured collaboration between human expertise and AI capabilities. This workflow is my contribution to making that collaboration more effective.