Workflow Configuration
agentful workflows are defined as slash commands. You can customize existing commands, create new workflows, and integrate with your development processes.
Command Structure
Commands are Markdown files with YAML frontmatter in .claude/commands/:
---
name: command-name
description: What this command does
---
# Command Name
Detailed instructions...Built-in Commands
| Command | File | Purpose |
|---|---|---|
/agentful-start | agentful-start.md | Start autonomous development |
/agentful-status | agentful-status.md | Check progress |
/agentful-decide | agentful-decide.md | Answer pending decisions |
/agentful-validate | agentful-validate.md | Run quality checks |
Customizing Existing Commands
Modifying /agentful-start
Edit .claude/commands/agentful-start.md:
---
name: agentful-start
description: Start or resume autonomous development with custom workflow
---
# agentful Start
## Custom Startup Sequence
### 1. Pre-Flight Checks
- [ ] Check if git working directory is clean
- [ ] Verify all dependencies installed
- [ ] Confirm database is running
- [ ] Validate environment variables
### 2. Load State
Read in order:
1. `PRODUCT.md` - Product requirements
2. `.agentful/state.json` - Current state
3. `.agentful/completion.json` - Progress
4. `.agentful/decisions.json` - Pending decisions
### 3. Custom Initialization
If state.json doesn't exist:
```bash
# Run custom setup
npm run setup:dev
# Seed database if needed
npm run db:seed
# Run initial validation
npx tsc --noEmit4. Delegate to Orchestrator
Task("orchestrator", "Run autonomous development loop with custom priorities")
### Custom Status Display
Edit `.claude/commands/agentful-status.md`:
```markdown
---
name: agentful-status
description: Display detailed project status with custom metrics
---
# agentful Status
## Display Format
### Progress Overview━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ agentful Development Status ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Progress: [████████████░░░░░░░░] 60%
Features: ✅ Authentication (100%) 🔄 User Profile (75%) ⏳ Dashboard (0%)
Quality Gates: ✅ Tests passing (47/47) ✅ No type errors ❌ Dead code (3 issues) ⚠️ Coverage (72%, needs 80%)
Last Activity: Implementing user avatar upload Next Task: Complete dashboard layout
### Custom Metrics
Add project-specific metrics:Database Migrations: ✅ Up to date API Documentation: ⏳ Not generated Deployment Status: ✅ Production v2.3.1
Creating Custom Commands
Feature-Specific Commands
Create .claude/commands/deploy.md:
---
name: deploy
description: Deploy application to production with safety checks
---
# Deploy Command
## Pre-Deployment Checklist
1. **Run all tests**
```bash
npm test- Type check
npx tsc --noEmit- Build production bundle
npm run build- Check for security issues
npm audit --production- Run E2E tests
npm run test:e2eDeployment Steps
If all checks pass:
- Create git tag
- Push to main branch
- Trigger deployment pipeline
- Verify health checks
- Run smoke tests
Rollback Plan
If deployment fails:
- Identify failure point
- Revert to previous version
- Investigate logs
- Fix issue
- Retry deployment
Usage: `/deploy`
### Database Migration Command
Create `.claude/commands/migrate.md`:
```markdown
---
name: migrate
description: Run database migrations with safety checks
---
# Database Migration
## Safety Checks
1. **Backup database**
```bash
npm run db:backup- Check current migration status
npm run db:status- Review migration files
# Read migration files to validate safetyMigration Process
- Generate migration if needed:
npx prisma migrate dev --name migration_name- Review generated SQL
- Test migration on staging
- Apply to production:
npx prisma migrate deploy- Verify data integrity
- Update application schema
Rollback Plan
If migration fails:
- Restore from backup
- Identify issue in migration
- Fix migration
- Retry process
Usage: `/migrate`
### Code Review Command
Create `.claude/commands/review.md`:
```markdown
---
name: review
description: Perform comprehensive code review of changes
---
# Code Review
## Review Scope
1. **Git Changes**
```bash
git diff main...HEAD-
Changed Files Identify all modified, added, and deleted files
- Review Checklist
- Code follows project patterns
- TypeScript strict mode passes
- Tests added/updated
- Documentation updated
- No security vulnerabilities
- Performance considered
- Error handling proper
- Logging added where needed
Review Process
- Delegate to reviewer agent:
Task("reviewer", "Perform comprehensive review of recent changes")- If issues found:
Task("fixer", "Fix issues found during review")- Re-review until clean
Report Format
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Code Review Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Files Changed: 7
Lines Added: +342
Lines Removed: -89
Issues Found:
🔴 Critical: 0
🟡 Warning: 3
🔵 Info: 5
Recommendations:
1. Add error handling to AuthService.login
2. Extract magic strings to constants
3. Add JSDoc comments to public APIs
Status: ✅ Approved (with minor suggestions)
Usage: `/review`
### Documentation Generation Command
Create `.claude/commands/docs.md`:
```markdown
---
name: docs
description: Generate API documentation from code
---
# Generate Documentation
## API Documentation
1. **Scan for API routes**
```bash
find src/app/api -name "route.ts"- Extract endpoints
- HTTP methods
- Request/response schemas
- Authentication requirements
- Rate limits
- Generate OpenAPI spec
npm run docs:generateComponent Documentation
- Scan for components
find src/components -name "*.tsx" -o -name "*.jsx"- Extract component props
- Generate usage examples
- Create Storybook stories
Output
Generate:
docs/api/- API referencedocs/components/- Component catalogOPENAPI.json- OpenAPI specification
Usage: `/docs`
## Workflow Automation
### Pre-Commit Workflow
Create `.claude/commands/pre-commit.md`:
```markdown
---
name: pre-commit
description: Run all checks before committing code
---
# Pre-Commit Checks
## Sequence
1. **Type Check**
```bash
npx tsc --noEmit- Lint
npm run lint- Tests
npm test- Coverage
npm test -- --coverage- Dead Code
npx knip- Security
npm audit --productionResults
If all pass:
✅ All checks passed - Ready to commitIf any fail:
❌ Pre-commit checks failed:
- TypeScript: 3 errors
- Lint: 7 warnings
- Coverage: 72% (needs 80%)
Run /fix to auto-fix issues
### Integration with Git Hooks
Add to `package.json`:
```json
{
"scripts": {
"prepare": "husky install",
"pre-commit": "echo 'Running agentful pre-commit checks' && claude /pre-commit || exit 1"
}
}Or use .husky/pre-commit:
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
# Run agentful pre-commit checks
npx agentful pre-commit
# Exit on failure
if [ $? -ne 0 ]; then
echo "❌ Pre-commit checks failed. Commit aborted."
exit 1
fiCI/CD Integration
GitHub Actions
Create .github/workflows/agentful.yml:
name: agentful Validation
on:
pull_request:
branches: [main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: npm ci
- name: Run agentful validation
run: |
npx @itz4blitz/agentful init --bare
npx agentful validate
- name: Upload validation report
uses: actions/upload-artifact@v3
with:
name: validation-report
path: .agentful/last-validation.jsonGitLab CI
Create .gitlab-ci.yml:
stages:
- validate
agentful-validation:
stage: validate
image: node:18
script:
- npm ci
- npx @itz4blitz/agentful init --bare
- npx agentful validate
artifacts:
paths:
- .agentful/last-validation.json
reports:
junit: .agentful/validation-report.xmlAdvanced Workflows
Feature Development Workflow
Create .claude/commands/feature.md:
---
name: feature
description: Complete workflow for implementing a new feature
---
# Feature Development
## Inputs
Feature name from user input or PRODUCT.md
## Workflow
### 1. Planning Phase
- Read PRODUCT.md for feature requirements
- Create feature branch
- Document implementation plan
### 2. Design Phase
Task("architect", "Design database schema and API endpoints for feature")
### 3. Backend Phase
Task("backend", "Implement backend services and API routes")
### 4. Frontend Phase
Task("frontend", "Implement UI components and pages")
### 5. Testing Phase
Task("tester", "Write comprehensive tests")
### 6. Review Phase
Task("reviewer", "Review implementation")
### 7. Fix Phase (if needed)
Task("fixer", "Fix any issues found in review")
### 8. Documentation Phase
Task("docs", "Generate API documentation")
### 9. Validation Phase
Run all quality checks
### 10. Completion
- Update completion.json
- Mark feature as complete
- Report summary
## Example Usage
User: `/feature user-profile`
agentful:
1. Reads user-profile from PRODUCT.md
2. Creates feature branch feature/user-profile
3. Implements all requirements
4. Validates quality
5. Reports completionRefactoring Workflow
Create .claude/commands/refactor.md:
---
name: refactor
description: Safe refactoring workflow with automated testing
---
# Refactor Workflow
## Pre-Refactor
1. **Baseline tests**
```bash
npm test- Create backup branch
git checkout -b refactor/backup-$(date +%s)- Document current state
- Capture test results
- Document current behavior
- Create rollback point
Refactor Process
-
Make changes
- Small, incremental changes
- Run tests after each change
- Commit working states
- Validate behavior
# All tests must pass
npm test
# No regressions
npm run test:e2e
# Performance maintained
npm run benchmark- Code review
Task("reviewer", "Review refactored code")Post-Refactor
- Update tests
- Update documentation
- Remove deprecated code
- Update CHANGELOG
Safety
If tests fail at any point:
- Stop immediately
- Identify breaking change
- Fix or revert
- Re-validate
Example
User: /refactor Extract user service logic
agentful:
- Reads current user service code
- Identifies extraction points
- Creates new service modules
- Updates all imports
- Runs tests continuously
- Completes when all tests pass
### Hotfix Workflow
Create `.claude/commands/hotfix.md`:
```markdown
---
name: hotfix
description: Emergency fix workflow for production issues
---
# Hotfix Workflow
## Priority: CRITICAL
This workflow bypasses normal process for urgent fixes.
## Process
1. **Create hotfix branch**
```bash
git checkout -b hotfix/$(date +%s)- Minimal fix only
- Fix the specific issue
- No refactoring
- No new features
- Minimal changes
- Quick validation
# Type check only
npx tsc --noEmit
# Critical tests only
npm test -- --testNamePattern="critical"- Deploy to staging
npm run deploy:staging- Smoke test
npm run test:smoke- Deploy to production
npm run deploy:prod- Verify fix
- Check production logs
- Verify issue resolved
- Monitor metrics
- Follow-up
- Create regular issue for proper fix
- Add tests for issue
- Update documentation
Example
User: /hotfix Users cannot login due to auth token error
agentful:
- Identifies auth token bug
- Creates minimal fix
- Runs type check
- Deploys to staging
- Verifies fix works
- Deploys to production
- Creates follow-up ticket
## Environment-Specific Workflows
### Development Workflow
`.claude/commands/dev.md`:
```markdown
---
name: dev
description: Start development environment with watchers
---
# Development Mode
## Start Services
1. **Database**
```bash
npm run db:start- Backend (if separate)
npm run dev:api- Frontend
npm run dev- Watchers
# TypeScript watcher
npx tsc --watch
# Test watcher
npm test -- --watch
# Lint watcher
npm run lint -- --watchDevelopment Features
- Hot module replacement
- Fast refresh
- Source maps
- Error overlay
- Debug logging
Integration
Open browser to http://localhost:3000 with dev tools enabled.
### Staging Workflow
`.claude/commands/staging.md`:
```markdown
---
name: staging
description: Deploy to staging environment for testing
---
# Staging Deployment
## Pre-Deploy
1. **Run full test suite**
```bash
npm test
npm run test:e2e- Build staging bundle
npm run build:staging- Security scan
npm audit --productionDeploy
- Deploy to staging
npm run deploy:staging- Run smoke tests
npm run test:smoke:staging- Verify deployment
- Check staging URL
- Verify key features
- Check error logs
Report
✅ Deployed to staging
URL: https://staging.example.com
Commit: abc123
Tests: ✅ All passing
### Production Workflow
`.claude/commands/production.md`:
```markdown
---
name: production
description: Deploy to production with full validation
---
# Production Deployment
## Pre-Deploy Checklist
- [ ] All tests passing (100%)
- [ ] Coverage ≥ 80%
- [ ] No type errors (adapts to stack)
- [ ] No lint errors
- [ ] No dead code
- [ ] No security vulnerabilities
- [ ] Staging tests passed
- [ ] Performance benchmarks met
- [ ] Documentation updated
- [ ] CHANGELOG updated
- [ ] Migration plan tested
- [ ] Rollback plan ready
## Deployment Steps
1. **Create release tag**
```bash
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0- Run database migrations
npm run db:migrate:prod- Deploy application
npm run deploy:prod- Smoke tests
npm run test:smoke:prod- Monitor
- Error rates
- Response times
- Resource usage
- Business metrics
Rollback Plan
If deployment fails:
npm run rollback:prod
git revert HEAD
npm run deploy:prodPost-Deploy
- Monitor for 1 hour
- Check error logs
- Verify key metrics
- Notify team of success
## Workflow Best Practices
### 1. Keep Workflows Simple
- One purpose per workflow
- Clear success criteria
- Handle failures gracefully
### 2. Always Validate
- Type check before committing
- Test before deploying
- Monitor after deploying
### 3. Provide Feedback
- Show progress clearly
- Report errors helpfully
- Suggest next actions
### 4. Enable Automation
- Integrate with CI/CD
- Use git hooks
- Automate repetitive tasks
### 5. Document Everything
- Comment complex logic
- Provide examples
- Maintain CHANGELOG
## Workflow Examples Repository
See `.claude/workflows/` for more examples:
- `feature.mdx` - Feature development
- `bugfix.mdx` - Bug fixing workflow
- `release.mdx` - Release management
- `performance.mdx` - Performance optimization
- `security.mdx` - Security audit workflow
## Next Steps
- [Configuration Overview](./index) - Back to configuration overview
- [Project Structure](./project-structure) - File and directory requirements