Standard 5-phase workflow for most development tasks - bugs, small features, refactors (30-60 min)
Perfect for (80% of tasks):
Time estimate: 30-60 minutes
Success criteria:
Phase 1: Research → Understand current implementation
Phase 2: Plan → Design approach
Phase 3: Implement → Make changes + tests
Phase 4: Review → Edge cases + security
Phase 5: Deploy → Full test suite + deployment
Goal: Understand the current implementation and identify all affected files.
Find all related files
# Search for relevant code patterns
grep -r "featureName" src/
grep -r "ComponentName" src/
# Find component/function usage
grep -r "import.*ComponentName" src/
Understand current implementation
Check for existing patterns
Identify potential impacts
For data/state changes:
For UI changes:
For API/integration changes:
Files to modify:
- /src/services/api/userService.js (main API logic)
- /src/store/userStore.js (state updates)
- /src/utils/validation.js (data validation)
Current implementation:
- API calls use fetch with manual error handling
- State updates use direct mutations
- No data validation on responses
Risks:
- Must preserve backward compatibility with existing API consumers
- Need to handle edge cases for malformed responses
Goal: Design the approach and create a file-by-file implementation plan.
Design the solution
List file changes
Identify dependencies
Plan testing approach
State management strategy:
Code organization:
Testing strategy:
Solution Design:
- Refactor API error handling into reusable utility
- Add response validation layer
- Update state management to use immutable updates
File Changes:
1. /src/utils/apiHelpers.js
- Create handleApiError() function
- Create validateResponse() function
- Add retry logic for network failures
2. /src/services/api/userService.js
- Replace inline error handling with apiHelpers
- Add response validation before state updates
3. /src/store/userStore.js
- Update state mutations to use immutable patterns
- Add error state management
4. /tests/services/api/userService.test.js
- Add test: "handles API errors gracefully"
- Add test: "validates response structure"
- Add test: "retries failed requests"
Testing Approach:
- Unit tests for error handling utilities
- Integration test for full API flow
- Manual test: Simulate network failure scenarios
Goal: Make the changes and update tests.
Implement changes file-by-file
Update/add tests
Verify locally
npm test (or your test command)npm run lint (or your lint command)Follow project conventions
Before writing code:
During implementation:
After implementation:
State updates:
// Follow your project's state management pattern
// Examples:
// Redux pattern:
dispatch(updateUser(userData))
// Zustand pattern:
useStore.getState().updateUser(userData)
// Context pattern:
setUser(prevUser => ({ ...prevUser, ...userData }))
Error handling:
// Consistent error handling
try {
const result = await riskyOperation()
return result
} catch (error) {
logger.error('Operation failed', error)
throw new AppError('User-friendly message', error)
}
Conditional debugging:
// Debug logs only in development
if (process.env.NODE_ENV === 'development') {
console.log('Debug info:', data)
}
// Or use your project's logger
logger.debug('Debug info:', data) // Won't log in production
// File: /src/utils/apiHelpers.js
/**
* Handles API errors consistently across the application
*/
export const handleApiError = (error) => {
// Log for debugging (only in development)
if (process.env.NODE_ENV === 'development') {
console.error('API Error:', error)
}
// Extract user-friendly message
const message = error.response?.data?.message ||
error.message ||
'An unexpected error occurred'
// Return standardized error object
return {
type: 'API_ERROR',
message,
status: error.response?.status,
originalError: error
}
}
/**
* Validates API response structure
*/
export const validateResponse = (response, schema) => {
if (!response) {
throw new Error('Response is null or undefined')
}
// Validate against expected schema
if (schema.required) {
for (const field of schema.required) {
if (!(field in response)) {
throw new Error(`Missing required field: ${field}`)
}
}
}
return response
}
Goal: Peer review for edge cases and security check.
Self-review first
Run validation commands
npm run lint
npm test
npm run build # Ensure it builds
Invoke peer-reviewer (if using Atlas agents)
Security check (if applicable)
Code quality:
Project conventions:
Platform compatibility (if applicable):
Edge cases:
Testing:
Security:
Issue 1: Inconsistent error handling
// Found during review
try {
await operation()
} catch (e) {
console.log(e) // Inconsistent with project pattern
}
// Fixed
try {
await operation()
} catch (error) {
logger.error('Operation failed', error)
throw new AppError('User-friendly message', error)
}
Issue 2: Missing validation
// Found during review
const user = response.data
setUser(user) // No validation!
// Fixed
const user = validateResponse(response.data, userSchema)
setUser(user)
Issue 3: Edge case not handled
// Found during review
const firstItem = items[0] // Crashes if empty
// Fixed
const firstItem = items.length > 0 ? items[0] : null
if (!firstItem) return null
Goal: Run full test suite and deploy via project process.
Document changes (follow your project's process)
Run full validation
npm run lint
npm test
npm run build
# Add any project-specific validation commands
Deploy using project process
Verify deployment
Pre-deployment:
Deployment:
Post-deployment:
Most projects enforce these automatically:
If checks fail:
# 1. Document changes (example: update CHANGELOG.md)
## [1.2.3] - 2025-01-15
### Fixed
- API error handling now consistently formats errors
- Added response validation to prevent malformed data
- Improved retry logic for network failures
### Added
- New apiHelpers utility module for reusable API functions
- Comprehensive test coverage for error scenarios
# 2. Run full validation
npm run lint # Pass
npm test # Pass (45/45 tests)
npm run build # Success
# 3. Deploy via project process
git add .
git commit -m "Fix API error handling and add validation"
git push origin feature/api-error-handling
# Or use automated deployment:
npm run deploy:staging
# CI/CD pipeline runs, tests pass, deploys automatically
# 4. Verify
# Check deployment logs, test in staging environment
Atlas Standard works with any codebase. Customize by creating project-specific configuration:
.atlas/conventions.mdDocument your project's conventions:
# Project Conventions
## State Management
- Use Redux Toolkit for global state
- Use local state (useState) for component-only state
- Always use selectors, never access state directly
## Naming Conventions
- Components: PascalCase (UserProfile.jsx)
- Utilities: camelCase (apiHelpers.js)
- Constants: UPPER_SNAKE_CASE (API_BASE_URL)
## Code Quality Standards
- No console.log in production code
- Use TypeScript strict mode
- Minimum 80% test coverage
## Platform Rules (if multi-platform)
- Web: Support Chrome, Firefox, Safari latest 2 versions
- Mobile: iOS 14+, Android 10+
- Use feature detection, not browser detection
.atlas/validation.shAdd project-specific validation:
#!/bin/bash
# Project-specific validation checks
check_project_antipatterns() {
echo "Checking project anti-patterns..."
# Example: Check for direct state mutations
if grep -r "state\[" src/ | grep -v "node_modules"; then
echo "Error: Direct state mutation found (use immutable updates)"
return 1
fi
# Example: Check for hardcoded API URLs
if grep -r "https://api.example.com" src/ | grep -v "config"; then
echo "Error: Hardcoded API URL (use config)"
return 1
fi
return 0
}
# Export for use by Atlas validation scripts
export -f check_project_antipatterns
.atlas/deployment.mdDocument deployment process:
# Deployment Process
## Environments
- **Development**: Local development, any changes
- **Staging**: Pre-production testing, deployed from main branch
- **Production**: Live environment, deployed from release tags
## Deployment Steps
### To Staging
1. Ensure all tests pass: `npm test`
2. Merge to main branch
3. CI/CD automatically deploys to staging
4. Verify in staging environment
### To Production
1. Create release branch: `git checkout -b release/v1.2.3`
2. Update version: `npm version 1.2.3`
3. Create PR to main
4. After approval and merge, tag: `git tag v1.2.3`
5. Push tag: `git push origin v1.2.3`
6. CI/CD automatically deploys to production
## Release Checklist
- [ ] All tests passing
- [ ] Version updated
- [ ] CHANGELOG.md updated
- [ ] Documentation updated
- [ ] Security review (if needed)
- [ ] Stakeholders notified
The Atlas validation script will automatically load your custom configuration:
# In scripts/validate-standard.sh
if [ -f .atlas/conventions.md ]; then
echo "Loading project conventions..."
fi
if [ -f .atlas/validation.sh ]; then
source .atlas/validation.sh
check_project_antipatterns # Run custom checks
fi
resources/research-patterns.mdscripts/validate-standard.sh.atlas/conventions.md (create if needed).atlas/deployment.md (create if needed)# Find API-related files
grep -r "fetch\|axios" src/services/
grep -r "error" src/services/api/
# Files found:
# - /src/services/api/userService.js (API calls)
# - /src/store/userStore.js (state management)
# - /src/utils/errorHandling.js (error utilities)
Understanding:
Solution:
Files to change:
/src/utils/apiHelpers.js - error handling utilities/src/services/api/userService.js - use new error handler/src/store/userStore.js - add error state/tests/utils/apiHelpers.test.js - test error handling// apiHelpers.js
export const handleApiError = (error) => {
const message = error.response?.data?.message ||
'An unexpected error occurred'
return {
type: 'API_ERROR',
message,
status: error.response?.status
}
}
// userService.js
export const fetchUser = async (id) => {
try {
const response = await fetch(`/api/users/${id}`)
return await response.json()
} catch (error) {
const apiError = handleApiError(error)
throw apiError
}
}
// Add tests
test('handleApiError formats error correctly', () => {
const error = { response: { data: { message: 'Not found' }, status: 404 } }
const result = handleApiError(error)
expect(result.message).toBe('Not found')
expect(result.status).toBe(404)
})
Self-review checklist:
Run validation:
npm run lint # Pass
npm test # Pass (12/12 tests)
# Update CHANGELOG.md
## [1.2.1] - 2025-01-15
### Fixed
- API errors now handled gracefully without crashing
- Added user-friendly error messages
# Run validation
npm test # Pass
npm run build # Success
# Deploy via project process
git add .
git commit -m "Fix API error handling"
git push origin main
# CI/CD deploys automatically
Total time: ~50 minutes
The Standard workflow is your daily driver for most development tasks. It provides the right balance of:
When in doubt, choose Standard workflow - it's correct for 80% of tasks.