Skip to content

Claude Workflow: The Complete Guide to Structured AI-Assisted Development

21 min read4185 words

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

Templates

Advanced


Why You Need a Structured Workflow

When I started using Claude Code for serious development work, I noticed recurring problems:

  1. Inconsistent patterns - Claude would use different approaches for similar problems across sessions
  2. Lost context - Previous decisions and learnings were forgotten between sessions
  3. Incomplete testing - Only happy paths were tested, edge cases were missed
  4. Poor documentation - Components were built without proper documentation
  5. Repeated mistakes - The same failed approaches were tried multiple times

The Claude Workflow framework addresses each of these by providing:

FeatureBenefit
8-Phase Development CycleStructured approach from discovery to review
Never Commits CodeYou maintain full control over version history
Lessons Learned TrackingFailed approaches documented to prevent repetition
Testing StrategySupports both Playwright automation and manual testing
Component DocumentationEvery 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 document

The 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 CommandReason
git commitUser must review all changes first
git pushUser 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:

SectionContents
Files ModifiedEvery file created, modified, or deleted with full paths
Changes MadeDetailed description of each change with code snippets
Why Changes Were MadeReasoning connected to original requirements
Testing StatusWhat was tested and what needs manual testing
Next StepsRemaining 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 ItemOptions
Project TypeNew project or existing codebase
FrameworkReact, Vue, Angular, Svelte, Next.js, Nuxt, etc.
StructureMonorepo or single package
Package Managernpm, yarn, pnpm, bun
TypeScriptYes/No with version

Step 0.2: Initial Questions

Claude asks these mandatory questions before starting work:

QuestionPurpose
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:

FilePurpose
docs/PROJECT_OVERVIEW.mdProject understanding document
docs/ARCHITECTURE.mdTechnical architecture decisions
docs/COMPONENTS.mdComponent documentation index
docs/DECISIONS.mdArchitectural Decision Records
docs/LESSONS_LEARNED.mdFailed approaches and anti-patterns
docs/TESTING_STRATEGY.mdTesting approach documentation
docs/SETUP.mdDevelopment 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.tsx

Phase 2: Requirements Gathering

For each new task or feature request, Claude follows a requirements checklist:

Requirements Checklist

QuestionCategory
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

RuleDescription
Single SessionEach task completable in one session
Clear AcceptanceTasks have clear acceptance criteria
Explicit DependenciesDependencies between tasks are explicit
Complexity EstimateLow, 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 image

Task Status Flow

Current StatusCan Move ToWhen
PENDINGIN_PROGRESSWork begins
IN_PROGRESSCOMPLETEDWork finished successfully
IN_PROGRESSBLOCKEDExternal dependency needed
IN_PROGRESSFAILEDApproach does not work
BLOCKEDIN_PROGRESSBlocker resolved
FAILEDIN_PROGRESSAlternative 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

CheckStatus
Understood the requirement completelyRequired
Identified affected files/componentsRequired
Checked for existing similar implementationsRequired
Reviewed LESSONS_LEARNED.md for anti-patternsRequired
Planned the implementation approachRequired
Identified test scenariosRequired

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

StepAction
1CREATE component file with proper structure
2ADD TypeScript interfaces for props
3IMPLEMENT core functionality
4ADD error handling
5INCLUDE loading states
6ADD debug logging (removable in production)
7DOCUMENT the component
8WRITE 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
YESUse Playwright for E2E testing
NOUse Manual Testing Protocol

When using Playwright:

  1. Create Page Object Model
  2. Write test scenarios
  3. Run in CI/CD
  4. Document test coverage

When using Manual Testing:

  1. Add comprehensive debug logs
  2. Create test checklist
  3. Ask user to test manually
  4. Request logs for verification
  5. Document test results

Server Management Protocol

Before running tests, Claude checks for existing development servers:

StepAction
1CHECK if server is already running on ports 3000, 3001, 5173, 8080, 4200
2IF RUNNING: Use existing server, do not start another
3IF ISSUES: Inform user first before killing server
4IF 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 TypeItems to Test
Happy PathMain user flow works correctly
Edge CasesEmpty state, max values, special characters
Error ScenariosInvalid 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 grows

Phase 7: Review and Iteration

Before considering any task complete, Claude runs through a self-review checklist.

Self-Review Checklist

Code Quality

CheckStatus
Follows project coding standardsRequired
No console.log statements (except debug utility)Required
No commented-out codeRequired
Proper error handlingRequired
No hardcoded values that should be configurableRequired

Functionality

CheckStatus
Meets all acceptance criteriaRequired
Edge cases handledRequired
Error states implementedRequired
Loading states implementedRequired

Performance

CheckStatus
No unnecessary re-rendersRequired
Proper memoization where neededRequired
No memory leaksRequired
Bundle size consideredRequired

Accessibility

CheckStatus
Semantic HTML usedRequired
ARIA attributes where neededRequired
Keyboard navigation worksRequired
Color contrast sufficientRequired

Security

CheckStatus
No XSS vulnerabilitiesRequired
Input validation presentRequired
No sensitive data exposedRequired

Documentation

CheckStatus
Component documentation updatedRequired
README updated if neededRequired
Inline comments for complex logicRequired
ADR created for significant decisionsRequired

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 view

Templates Library

The workflow includes six comprehensive templates.

Project Overview Template

Used to document project understanding and architecture:

SectionContents
Basic DetailsName, framework, package manager, TypeScript
Purpose and GoalsPrimary purpose, target audience, business goals
Technical StackCore technologies with versions
Environment ConfigurationEnvironment variables and required values

Component Documentation Template

Standardized documentation for every component:

SectionContents
OverviewWhat the component does
PropsAll props with types and defaults
Usage ExamplesBasic and advanced usage code
StatesLoading, error, empty states
AccessibilityKeyboard navigation, WCAG compliance
TestingTest file locations

ADR Template

For tracking architectural decisions:

SectionContents
StatusProposed, Accepted, Deprecated, Superseded
ContextProblem statement, requirements, constraints
OptionsEach option with pros, cons, effort, risk
Decision MatrixWeighted scoring of options
DecisionChosen option with rationale
ConsequencesPositive and negative outcomes

Lessons Learned Template

For tracking failed approaches:

SectionContents
Quick ReferenceCommon pitfalls table
Log EntriesDate, feature, tags, what was attempted
What Went WrongExplanation and error messages
Root CauseUnderlying reason for failure
Better AlternativeWhat worked instead with code
PreventionHow to avoid in future

Testing Strategy Template

Comprehensive testing approach:

Test LevelCoverage TargetFocus
Unit Tests80%+Functions, hooks, utilities
IntegrationKey pathsComponent interactions
E2ECritical flowsUser journeys

Coverage Requirements:

AreaMinimumTarget
Utilities/Helpers90%100%
Hooks85%95%
Components75%85%
Pages70%80%
Overall75%85%

Manual Test Checklist Template

When automated testing is not available:

SectionContents
Pre-Test SetupEnvironment, cache, console settings
Test ScenariosStep-by-step with expected results
Edge CasesEmpty state, max values, special chars
AccessibilityKeyboard nav, focus, screen reader
ResponsiveMobile, tablet, desktop viewports
SummaryPass/fail counts by category

MCP Tools Integration

The workflow supports these MCP (Model Context Protocol) tools:

ToolWhen to Use
PerplexityWeb search, latest practices, error solutions
PlaywrightE2E browser testing and automation
FigmaDesign-to-code implementation
Context7Language/framework documentation

Research Protocol

For New Library/API:

  1. Use Perplexity to search: "[library] best practices [year]"
  2. Verify compatibility with project stack
  3. Check for known issues
  4. Document findings

For Error Resolution:

  1. Search exact error message
  2. Look for framework-specific solutions
  3. Check for version-specific fixes
  4. 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-PatternWrong ApproachCorrect Approach
Committing CodeRunning git commit/pushLet user review and commit
AssumingImplementing based on assumptionsAsk for clarification
Over-EngineeringAdding features "just in case"Implement exactly what requested
Ignoring PatternsIntroducing inconsistent patternsFollow established project patterns
Skipping DocumentationImplementing without documentingDocument as part of implementation
Not Tracking FailuresRepeating failed approachesRecord and learn from failures
Incomplete TestingOnly testing happy pathTest edge cases and errors
Hardcoding ValuesMagic numbers and stringsUse configuration and constants
Ignoring AccessibilityBuilding inaccessible UIsFollow WCAG guidelines
Duplicate ServersRunning npm run dev blindlyCheck if server already running

Recovery Protocol

When stuck, follow these steps:

StepAction
1. Step BackRe-read requirement, check if approach matches
2. Document IssueWhat was attempted, what went wrong, what error
3. Search SolutionsUse Perplexity, check existing patterns
4. Ask for HelpPresent issue clearly, show attempts, ask specific questions
5. Try AlternativeDo 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:

TaskStatus
Review previous session stateRequired
Check pending tasksRequired
Review any user feedbackRequired
Load context from documentationRequired

Session End:

TaskStatus
Update all documentationRequired
Mark completed tasksRequired
Document incomplete workRequired
Summarize progress for userRequired
List next stepsRequired

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:

BenefitHow It Works
ConsistencySame approach across sessions and projects
QualityMandatory testing and review for every task
Knowledge RetentionLessons learned tracking prevents repeated mistakes
User ControlNever allows automated commits
DocumentationComprehensive 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.