<task>
Ensure team comprehension for $0 in $1 so any team member can work effectively in the codebase.
Code structure should be self-evident, with clear organization that makes finding things intuitive. Complex business logic needs thorough explanation since it embeds domain knowledge that may not be obvious. Setup and development workflows must be documented so new team members can contribute quickly. Testing approaches should be clear and repeatable, not tribal knowledge that only seniors understand.
Follow this process:
Organize code structure clearly:
Use standard project layout (src/, tests/, docs/)
Group related files in feature folders
Name files and directories descriptively
Follow consistent file naming conventions
Provide navigation guide (ARCHITECTURE.md)
Explain complex business logic:
Document business rules and constraints
Explain domain concepts and terminology
Clarify calculations and algorithms
Provide examples of edge cases
Link to business requirements or tickets
Document development workflows:
<context>
Component to ensure comprehension:
$0
<thinking>
Before ensuring comprehension, analyze:
1. Can a new team member find relevant code easily?
2. Are business rules documented or only in code?
3. Is development setup documented step-by-step?
4. Can anyone run and understand tests?
5. What knowledge is tribal vs documented?
</thinking>
<output-format>
Create architecture guide following this pattern:
</output-format>
<instructions>
CRITICAL: Team comprehension ensures any team member can work effectively in the codebase.
<examples>
✅ GOOD Code Organization Pattern (intuitive):
1. Entry point → [location]
2. Authentication → [location]
3. Validation → [location]
4. Business logic → [location]
5. Data access → [location]
6. Response → [location]
Finding Things Pattern:
Task: [Common development task]
Steps:
1. [First file to modify]
2. [Second file to modify]
3. [Testing location]
Business Logic Documentation Pattern:
Document domain-specific rules and concepts:
Documentation Structure:
Business Rules:
Rule description
Rationale (why it exists)
Implementation reference
Domain Concepts:
Concept name
Definition
Relationships
Storage/ownership
Identifier pattern
Edge Cases:
Scenario description
Handling approach
Recovery mechanism
Business Rule Pattern:
Rule: [Constraint or behavior]
Rationale:
- [Business reason]
- [Technical reason]
- [Regulatory reason if applicable]
Implementation: [Where to find code]
Domain Concept Pattern:
Concept: [Entity or pattern]
Definition: [What it represents]
Relationships: [How it relates to other concepts]
Storage: [Where/how persisted]
Identifier: [ID pattern]
Lifecycle: [State transitions if applicable]
1. [Task description]
[Command to execute]
2. [Task description]
[Command to execute]
3. Verify: [How to confirm success]
[Verification command]
[Expected result]
Development Cycle Pattern:
1. Create branch: [naming convention]
2. Make changes: [development server command]
3. Test: [test commands]
4. Code style: [linting/formatting commands]
5. Commit: [convention format]
6. Push and review: [PR creation]
Troubleshooting Pattern:
Issue: [Problem description]
Symptom: [What you see]
Cause: [Why it happens]
Solution: [How to fix]
[Diagnostic commands]
[Fix commands]
Testing Guide Documentation Pattern:
Document testing philosophy and practices:
Testing Guide Structure:
Testing Philosophy:
Test types used (unit/integration/contract)
Testing pyramid ratios
When to use each type
Running Tests:
All test commands
Filtered test commands
Watch mode and coverage
Writing Tests:
Test structure pattern (AAA)
Mocking guidelines
Test data management
Debugging Tests:
Running single tests
Debug mode techniques
Verbose output
Common Patterns:
Async testing
Error testing
State change testing
Test Structure Pattern:
describe('[Component]', () => {
describe('[Method]', () => {
it('[Behavior]', () => {
// Arrange: Set up test data
[Setup code]
// Act: Execute function
[Execution code]
// Assert: Verify result
[Assertion code]
});
});
});
Mocking Guidelines:
Mock:
- External APIs
- Database queries
- Time/randomness
- File system
Don't mock:
- Your own code
- Pure functions
- Simple utilities
Test Data Pattern:
Create fixtures for reusable test data:
- Standard valid cases
- Standard error cases
- Edge cases
- Shared constants
NEVER ensure comprehension by:
Creating complex folder structures (hard to navigate)
Leaving business logic undocumented (domain knowledge lost)
Assuming everyone knows development workflow (tribal knowledge)
Making testing approaches implicit (newcomers confused)
Using inconsistent naming (hard to find things)
Hiding edge cases in code (maintainers surprised)
DO NOT:
Skip ARCHITECTURE.md (navigation guide)
Leave business rules only in code
Forget to document development setup
Assume testing patterns are obvious
Use jargon without explanation
Create deep nesting (hard to find files)
ALWAYS:
Use standard project layout
Document business rules and domain concepts
Explain development workflows step-by-step
Make testing approaches explicit
Name files and folders descriptively
Provide troubleshooting guides
Document edge cases and constraints
Include examples for common tasks
Write for team members without context
Update docs when workflows change
REPEAT: Any team member should understand codebase. Clear structure. Business logic documented. Development workflows explicit. Testing approaches clear.
</instructions>
Technical debt accumulates
</examples>3d:["$","$L45",null,{"content":"$46","frontMatter":{"name":"ensure-team-comprehension","description":"Ensure team comprehension so any team member can work effectively in the codebase"}}]