/unwind:uw-analyze-servicefrom unwind
Analyzes service layer code to document business logic, use cases, service orchestration, DTOs, mappers, and business formulas. Generates structured documentation in docs/unwind/layers/service-layer/.
Ships in unwind. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Output: docs/unwind/layers/service-layer/ (folder with index.md + section files)
Principles: See analysis-principles.md - completeness, machine-readable, link to source, no commentary, incremental writes.
docs/unwind/layers/service-layer/
├── index.md # Overview, service count, dependency graph
├── services.md # Service class definitions
├── dtos.md # Data transfer objects
├── mappers.md # Mapping logic
├── formulas.md # Business calculations [MUST]
└── clients.md # External client integrations
For large codebases (20+ services), split by domain:
docs/unwind/layers/service-layer/
├── index.md
├── users-domain.md
├── orders-domain.md
└── ...
Step 1: Setup
mkdir -p docs/unwind/layers/service-layer/
Write initial index.md:
# Service Layer
## Sections
- [Services](services.md) - _pending_
- [DTOs](dtos.md) - _pending_
- [Mappers](mappers.md) - _pending_
- [Formulas](formulas.md) - _pending_
- [External Clients](clients.md) - _pending_
## Summary
_Analysis in progress..._
Step 2: Analyze and write services.md
services.md immediatelyindex.mdStep 3: Analyze and write dtos.md
dtos.md immediatelyindex.mdStep 4: Analyze and write mappers.md
mappers.md immediatelyindex.mdStep 5: Analyze and write formulas.md
formulas.md immediatelyindex.mdStep 6: Analyze and write clients.md (if applicable)
clients.md immediatelyindex.mdStep 7: Finalize index.md Add dependency graph and final counts
# Service Layer
## Services
### UserService
[UserService.java](https://github.com/owner/repo/blob/main/src/service/UserService.java)
```java
@Service
@RequiredArgsConstructor
public class UserService {
private final UserRepository userRepository;
private final PasswordEncoder passwordEncoder;
private final EmailService emailService;
@Transactional
public User createUser(CreateUserRequest request) {
if (userRepository.existsByEmail(request.email())) {
throw new DuplicateEmailException(request.email());
}
User user = new User(request.email(), passwordEncoder.encode(request.password()));
user = userRepository.save(user);
emailService.sendWelcome(user);
return user;
}
@Transactional(readOnly = true)
public User getUser(Long id) {
return userRepository.findById(id)
.orElseThrow(() -> new UserNotFoundException(id));
}
}
[Continue for ALL services...]
public record CreateUserRequest(
@NotBlank @Email String email,
@NotBlank @Size(min = 8) String password,
@NotBlank String name
) {}
public record UserResponse(
Long id,
String email,
String name,
UserStatus status,
Instant createdAt
) {}
[Continue for ALL DTOs...]
@Mapper(componentModel = "spring")
public interface UserMapper {
UserResponse toResponse(User user);
@Mapping(target = "id", ignore = true)
@Mapping(target = "status", constant = "ACTIVE")
User toEntity(CreateUserRequest request);
}
@Component
public class StripeClient {
@Retryable(maxAttempts = 3, backoff = @Backoff(delay = 1000))
public PaymentResult charge(String token, Money amount) {
// Stripe API call
}
}
graph TD
UserService --> UserRepository
UserService --> PasswordEncoder
UserService --> EmailService
OrderService --> OrderRepository
OrderService --> UserService
OrderService --> PaymentService
PaymentService --> StripeClient
## Additional Requirements
### Formula Documentation [MUST]
For every calculation or business formula:
1. **Document with exact source reference:**
```markdown
### Cost Calculation [MUST]
**Source:** `snapshot-operations.ts:186`
```typescript
total = periods[rate.interval] * rate.rate * fteBasis * allocation * holidayPercentage
2. **Document ALL edge cases and conditional logic:**
```markdown
### Rate Interval Edge Cases [MUST]
| Interval | Formula | Note |
|----------|---------|------|
| hours | workingDays * 8 * rate * fte * allocation | 8 hours/day hardcoded |
| days | workingDays * rate * fte * allocation | Standard |
| weeks | ceil(workingDays/5) * rate * fte * allocation | Rounds up |
| months | rate * fte * allocation | **NO period multiplier** |
| years | (workingDays/365) * rate * fte * allocation | Prorated |
### Constants [MUST]
| Constant | Value | Location |
|----------|-------|----------|
| hoursPerDay | 8 | builder.ts:185 |
| daysInYear | 365 | builder.ts:208 |
Document any fallback chains or resolution hierarchies:
### Rate Resolution Chain [MUST]
1. **Primary:** supplier + employmentType + roleLevel + calendar + branch
2. **Fallback:** supplier + calendar + branch (null employmentType/roleLevel)
3. **Missing:** Logged to missingRates array, uses 0
Note where transactions begin/end and any batch processing patterns.
Every service, function, and formula must have a [MUST], [SHOULD], or [DON'T] tag in its heading.
Default categorizations for service layer:
Example:
### BudgetBuilder [MUST]
### CostCalculation formula [MUST]
### RateResolutionChain [MUST]
### CacheService [SHOULD]
See analysis-principles.md section 9 for full tagging rules.
If docs/unwind/layers/service-layer/ exists, compare current state and add ## Changes Since Last Review section to index.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nearform/unwind --plugin unwind25 skills in this plugin
/uw-analyzeUse after unwind:uw-scan to orchestrate layer-by-layer analysis using specialist subagents/uw-analyze-apiUse when analyzing REST/GraphQL API endpoints, contracts, authentication, and client-facing interfaces/uw-analyze-databaseUse when analyzing the database layer including schema, migrations, ORM configuration, and data access patterns/uw-analyze-domainUse when analyzing domain entities, value objects, aggregates, and business rules encoded in the model/uw-analyze-e2e-testsUse when analyzing end-to-end tests including browser automation, API workflows, and full system testing/uw-analyze-frontendUse when analyzing frontend/UI layer including components, state management, routing, and API integration (optional - skip if no frontend exists)Other plugins' skills for the same job