Coding Archetype
Coding Archetype
Section titled “Coding Archetype”The coding archetype is for teams that write and modify code—implementing features, fixing bugs, refactoring, and writing tests.
What It Does
Section titled “What It Does”Coding teams:
- Analyze existing codebases
- Implement new features
- Fix bugs and issues
- Refactor code
- Write and update tests
- Create pull requests
Output: Code changes (commits, pull requests)
Lifecycle States
Section titled “Lifecycle States”preparing ↓implementing ↓testing ↓pr-open ↓pr-review ↓pr-approved ↓merged ↓complete
(any state) → failed(any non-terminal state) → paused| State | Description | Typical Duration |
|---|---|---|
preparing | Reading mission, planning work | 2-5 minutes |
implementing | Writing code, making changes | 15-30 minutes |
testing | Running tests, fixing failures | 10-20 minutes |
pr-open | Pull request created, awaiting review | (external) |
pr-review | Addressing review comments | 5-15 minutes |
pr-approved | PR approved by reviewers | (external) |
merged | Changes merged to main branch | <1 minute |
complete | Work finished | (terminal) |
failed | Error occurred | (terminal) |
paused | Manually paused | (indefinite) |
State Transitions
Section titled “State Transitions”preparing → implementing
- Read mission from inbox signal
- Analyze codebase structure
- Identify files to modify
- Plan implementation approach
implementing → testing
- Write or modify code
- Commit changes
- Run test suite
testing → pr-open
- All tests pass
- No linting errors
- Build succeeds
- Open pull request
pr-open → pr-review
- Reviewers request changes
- Team reads review comments
pr-review → pr-approved
- Address all review comments
- Push additional commits
- Re-run tests
pr-approved → merged
- Reviewers approve PR
- Merge to main branch
merged → complete
- Cleanup temporary files
- Write deliverable summary
(any state) → failed
- Build fails and cannot be fixed
- Tests fail repeatedly
- Critical error prevents progress
Skills
Section titled “Skills”Coding teams have access to domain-specific skills in .squad/skills/:
- git-workflow.md — Git conventions (branching, commits, PRs)
- testing-standards.md — Test coverage requirements, naming conventions
- code-review.md — Review checklist, merge criteria
Example Skill: Git Workflow
Section titled “Example Skill: Git Workflow”---tags: [git, workflow, conventions]category: convention---
# Git Workflow
## Branching
- Feature branches: `squad/{domain}/{feature}`- Never commit to `main` directly
## Commits
- Use conventional commits: `feat:`, `fix:`, `refactor:`- Keep commits focused (one logical change)- Write descriptive messages
## Pull Requests
- Link to issue or signal- Include description of changes- Add attribution: `Co-authored-by: {TeamName} (Squad) <noreply@squad.ai>`Teams automatically read these skills when performing related work.
Agent Configuration
Section titled “Agent Configuration”Lead Agent
Section titled “Lead Agent”Role: Primary developer and implementer
Model: claude-sonnet-4
Temperature: 0.1 (low, precise execution)
Tools: bash, edit, view, grep, glob
Responsibilities:
- Scan codebase for relevant files
- Implement features or fixes
- Run tests and linting
- Create pull requests
- Address review feedback
Typical Workflow
Section titled “Typical Workflow”Phase 1: Preparing
Section titled “Phase 1: Preparing”- Team receives signal: “Implement password reset flow”
- Agent scans codebase for auth-related files
- Identifies where changes are needed:
src/auth/AuthService.tssrc/api/routes/auth.tssrc/auth/AuthService.test.ts
- Creates implementation plan
- Transitions to
implementing
Phase 2: Implementing
Section titled “Phase 2: Implementing”- Agent writes new code:
- Adds
requestPasswordReset()method - Adds
/auth/reset-requestendpoint - Adds
/auth/reset-passwordendpoint
- Adds
- Commits changes with message:
feat: add password reset flow - Transitions to
testing
Phase 3: Testing
Section titled “Phase 3: Testing”- Agent runs test suite:
npm test - Sees 2 failing tests (new endpoints not tested)
- Writes tests:
src/auth/AuthService.test.ts— Unit tests
- Re-runs tests — all pass
- Runs linting:
npm run lint— no errors - Transitions to
pr-open
Phase 4: PR Open
Section titled “Phase 4: PR Open”- Agent creates pull request:
- Title: “feat: add password reset flow”
- Description: Links to signal, lists changes
- Attribution:
Co-authored-by: Backend Team (Squad) <noreply@squad.ai>
- Waits for external review
- When review comments arrive, transitions to
pr-review
Phase 5: PR Review
Section titled “Phase 5: PR Review”- Agent reads review feedback:
- “Add rate limiting to reset endpoints”
- “Use bcrypt for token hashing”
- Implements requested changes
- Commits:
fix: add rate limiting and bcrypt hashing - Pushes to PR branch
- Transitions to
pr-approved
Phase 6: Merged → Complete
Section titled “Phase 6: Merged → Complete”- Reviewers approve PR
- Agent merges to
main - Writes deliverable summary
- Transitions to
complete
Deliverable Format
Section titled “Deliverable Format”Coding teams produce deliverable.md with:
- Summary — High-level overview
- Changes Made — List of modified files
- Testing — Test results and coverage
- Next Steps — Follow-up actions (if any)
Example:
# Password Reset Implementation
## Summary
Implemented JWT-based password reset flow with email token delivery, rate limiting, and rollback validation.
## Changes Made
1. **src/auth/AuthService.ts** - Added `requestPasswordReset(email)` method - Added `resetPassword(token, newPassword)` method - Implemented token generation and validation
2. **src/api/routes/auth.ts** - Added POST `/auth/reset-request` endpoint - Added POST `/auth/reset-password` endpoint - Applied rate limiting (5 requests per 15 min)
3. **src/auth/AuthService.test.ts** - Added unit tests for password reset methods - Added tests for token expiration (1 hour) - Added tests for rate limiting
## Testing
- ✅ Unit tests: 45/45 passing- ✅ Integration tests: 12/12 passing- ✅ No linting errors- ✅ Build succeeds
## Pull Request
PR #123: https://github.com/repo/pull/123
**Reviewers:** Alice, Bob
**Status:** Merged to main
## Next Steps
1. Update API documentation with new endpoints2. Create email templates for reset notifications3. Monitor reset endpoint usage in productionCommon Use Cases
Section titled “Common Use Cases”Feature Implementation
Section titled “Feature Implementation”Mission: “Implement password reset flow”
States: preparing → implementing → testing → pr-open → pr-review → pr-approved → merged → complete
Duration: 1-2 hours
Output:
- New endpoints and methods
- Unit and integration tests
- Pull request merged to main
Bug Fix
Section titled “Bug Fix”Mission: “Fix logout redirect issue”
States: preparing → implementing → testing → pr-open → pr-approved → merged → complete
Duration: 30-60 minutes
Output:
- Fixed redirect logic
- Updated existing test
- Hotfix PR merged
Refactoring
Section titled “Refactoring”Mission: “Extract auth logic into custom hook”
States: preparing → implementing → testing → pr-open → pr-review → pr-approved → merged → complete
Duration: 1-2 hours
Output:
- New
useAuth.tshook - Refactored components to use hook
- Tests updated for new structure
Best Practices
Section titled “Best Practices”Clear Missions
Section titled “Clear Missions”✅ Good: “Implement login form with email/password validation and error handling”
❌ Bad: “Do auth stuff”
Scoped Work
Section titled “Scoped Work”Keep missions focused:
- One feature per team
- Avoid multi-step epics
- Break large tasks into smaller teams
Test Coverage
Section titled “Test Coverage”Encourage testing in mission:
“Implement password reset flow with full test coverage and integration tests”
Learning Capture
Section titled “Learning Capture”Teams automatically log discoveries to .squad/signals/learnings.jsonl:
{ "id": "learning-abc123", "timestamp": "2025-01-30T12:00:00Z", "domain": "backend-api", "category": "pattern", "content": "Rate limiting should apply per-IP, not per-user (unauthenticated endpoints)", "tags": ["rate-limiting", "security", "auth"], "confidence": "high", "context": "Implemented reset-request endpoint"}These learnings can be graduated to skills for future teams.
Monitoring
Section titled “Monitoring”Coding teams emit telemetry (when enabled):
code.files_changed— Files modified countcode.test_count— Tests written/updatedcode.build_success— Build status (boolean)code.pr_number— Pull request number
Health checks:
- Status updated within 10 minutes
- Tests passing in latest commit
- No unhandled errors in logs