@juicesharp/rpiv-pi 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/agents/codebase-analyzer.md +121 -0
- package/agents/codebase-locator.md +107 -0
- package/agents/codebase-pattern-finder.md +207 -0
- package/agents/integration-scanner.md +97 -0
- package/agents/precedent-locator.md +130 -0
- package/agents/test-case-locator.md +121 -0
- package/agents/thoughts-analyzer.md +147 -0
- package/agents/thoughts-locator.md +138 -0
- package/agents/web-search-researcher.md +107 -0
- package/extensions/rpiv-core/agents.ts +312 -0
- package/extensions/rpiv-core/git-context.ts +81 -0
- package/extensions/rpiv-core/guidance.ts +213 -0
- package/extensions/rpiv-core/index.ts +275 -0
- package/extensions/rpiv-core/package-checks.ts +51 -0
- package/package.json +36 -0
- package/scripts/migrate.js +242 -0
- package/scripts/types.js +1 -0
- package/skills/annotate-guidance/SKILL.md +303 -0
- package/skills/annotate-guidance/examples/root-dotnet-clean-arch.md +38 -0
- package/skills/annotate-guidance/examples/root-nodejs-monorepo.md +42 -0
- package/skills/annotate-guidance/examples/subfolder-database-layer.md +81 -0
- package/skills/annotate-guidance/examples/subfolder-dotnet-application.md +64 -0
- package/skills/annotate-guidance/examples/subfolder-schemas-layer.md +50 -0
- package/skills/annotate-guidance/templates/root-architecture.md +46 -0
- package/skills/annotate-guidance/templates/subfolder-architecture.md +57 -0
- package/skills/annotate-inline/SKILL.md +299 -0
- package/skills/annotate-inline/examples/root-dotnet-clean-arch.md +38 -0
- package/skills/annotate-inline/examples/root-nodejs-monorepo.md +42 -0
- package/skills/annotate-inline/examples/subfolder-database-layer.md +81 -0
- package/skills/annotate-inline/examples/subfolder-dotnet-application.md +64 -0
- package/skills/annotate-inline/examples/subfolder-schemas-layer.md +50 -0
- package/skills/annotate-inline/templates/root-claude-md.md +46 -0
- package/skills/annotate-inline/templates/subfolder-claude-md.md +57 -0
- package/skills/code-review/SKILL.md +184 -0
- package/skills/commit/SKILL.md +65 -0
- package/skills/create-handoff/SKILL.md +91 -0
- package/skills/design/SKILL.md +416 -0
- package/skills/discover/SKILL.md +242 -0
- package/skills/explore/SKILL.md +261 -0
- package/skills/implement/SKILL.md +74 -0
- package/skills/migrate-to-guidance/SKILL.md +88 -0
- package/skills/outline-test-cases/SKILL.md +348 -0
- package/skills/outline-test-cases/templates/feature-meta.md +43 -0
- package/skills/outline-test-cases/templates/outline-readme.md +36 -0
- package/skills/plan/SKILL.md +281 -0
- package/skills/research/SKILL.md +304 -0
- package/skills/resume-handoff/SKILL.md +207 -0
- package/skills/revise/SKILL.md +242 -0
- package/skills/validate/SKILL.md +175 -0
- package/skills/write-test-cases/SKILL.md +322 -0
- package/skills/write-test-cases/examples/customer-auth-flow.md +50 -0
- package/skills/write-test-cases/examples/order-management-suite.md +57 -0
- package/skills/write-test-cases/examples/order-placement-flow.md +54 -0
- package/skills/write-test-cases/examples/team-management-flow.md +56 -0
- package/skills/write-test-cases/examples/team-management-suite.md +54 -0
- package/skills/write-test-cases/templates/coverage-map.md +64 -0
- package/skills/write-test-cases/templates/regression-suite.md +63 -0
- package/skills/write-test-cases/templates/test-case.md +65 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Express API + React frontend in a Turborepo monorepo.
|
|
4
|
+
|
|
5
|
+
## Project map
|
|
6
|
+
|
|
7
|
+
- `apps/api/` - Express REST API
|
|
8
|
+
- `apps/web/` - React SPA
|
|
9
|
+
- `packages/db/` - Prisma schema and client
|
|
10
|
+
- `packages/ui/` - Shared component library
|
|
11
|
+
- `packages/config/` - Shared configuration
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
| Command | What it does |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `turbo build` | Build all packages |
|
|
18
|
+
| `turbo test` | Run all tests |
|
|
19
|
+
| `turbo lint` | Lint all packages |
|
|
20
|
+
| `turbo dev` | Start dev server |
|
|
21
|
+
| `turbo db:generate` | Regenerate Prisma client after schema changes |
|
|
22
|
+
| `turbo db:migrate` | Run database migrations |
|
|
23
|
+
|
|
24
|
+
<important if="you are adding or modifying API routes">
|
|
25
|
+
- All routes go in `apps/api/src/routes/`
|
|
26
|
+
- Use Zod for request validation — see `apps/api/src/routes/connections.ts` for the pattern
|
|
27
|
+
- Error responses follow RFC 7807 format
|
|
28
|
+
- Authentication via JWT middleware
|
|
29
|
+
</important>
|
|
30
|
+
|
|
31
|
+
<important if="you are writing or modifying tests">
|
|
32
|
+
- API: Jest + Supertest, Frontend: Vitest + Testing Library
|
|
33
|
+
- Test fixtures in `__fixtures__/` directories
|
|
34
|
+
- Use `createTestClient()` helper for API integration tests
|
|
35
|
+
- Mock database with `prismaMock` from `packages/db/test`
|
|
36
|
+
</important>
|
|
37
|
+
|
|
38
|
+
<important if="you are working with client-side state, stores, or data fetching">
|
|
39
|
+
- Zustand for global client state
|
|
40
|
+
- React Query for server state
|
|
41
|
+
- URL state via `nuqs`
|
|
42
|
+
</important>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Database Layer Architecture
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
SQLite persistence with better-sqlite3, repository pattern (plain types), QueryQueue concurrency, type transformations.
|
|
5
|
+
|
|
6
|
+
## Dependencies
|
|
7
|
+
- **better-sqlite3**: Native SQLite (requires rebuild for Electron)
|
|
8
|
+
- **@redis-ui/core**: Domain types
|
|
9
|
+
- **p-queue**: Query serialization
|
|
10
|
+
|
|
11
|
+
## Consumers
|
|
12
|
+
- **@redis-ui/services**: Repositories via RepositoryFactory
|
|
13
|
+
- **Main process**: DatabaseManager initialization
|
|
14
|
+
|
|
15
|
+
## Module Structure
|
|
16
|
+
```
|
|
17
|
+
src/
|
|
18
|
+
├── DatabaseManager.ts, QueryQueue.ts # Singleton, concurrency
|
|
19
|
+
├── BaseRepository.ts, RepositoryFactory.ts
|
|
20
|
+
├── schema.ts
|
|
21
|
+
└── repositories/ # One repo per entity
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Repository Boundary (CRITICAL: Plain Types, NOT Result<T>)
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
export class ConnectionRepository extends BaseRepository<ConnectionDB, Connection, ConnectionId> {
|
|
28
|
+
protected toApplication(db: ConnectionDB): Connection {
|
|
29
|
+
return {
|
|
30
|
+
id: ConnectionId.create(db.id),
|
|
31
|
+
host: db.host,
|
|
32
|
+
port: db.port,
|
|
33
|
+
sslEnabled: Boolean(db.ssl_enabled), // DB int → boolean
|
|
34
|
+
createdAt: new Date(db.created_at), // timestamp → Date
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async findById(id: ConnectionId): Promise<Connection | null> {
|
|
39
|
+
return this.queue.enqueueRead((db) => {
|
|
40
|
+
const row = db.prepare('SELECT * FROM connections WHERE id = ?').get(id);
|
|
41
|
+
return row ? this.toApplication(row) : null;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Service: Wraps repository in Result<T>
|
|
47
|
+
async createConnection(input: CreateInput): Promise<Result<Connection>> {
|
|
48
|
+
try {
|
|
49
|
+
const connection = await this.connectionRepo.create(input);
|
|
50
|
+
return Result.ok(connection);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return Result.fail(new InfrastructureError(error.message));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## QueryQueue Pattern (Write Serialization)
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
export class QueryQueue {
|
|
61
|
+
private writeQueue = new PQueue({ concurrency: 1 }) // Single writer
|
|
62
|
+
private readQueue = new PQueue({ concurrency: 5 }) // Multiple readers
|
|
63
|
+
|
|
64
|
+
async enqueueWrite<T>(op: (db: Database) => T): Promise<T> {
|
|
65
|
+
return this.writeQueue.add(() => op(this.db))
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Architectural Boundaries
|
|
71
|
+
- **NO Result<T> in repos**: Services wrap with Result
|
|
72
|
+
- **NO unqueued DB ops**: Always use QueryQueue
|
|
73
|
+
- **NO raw SQL in services**: Use repositories
|
|
74
|
+
|
|
75
|
+
<important if="you are adding a new repository to this layer">
|
|
76
|
+
## Adding a New Repository
|
|
77
|
+
1. Create `XRepository.ts` extending `BaseRepository<XDB, X, XId>`
|
|
78
|
+
2. Implement `toApplication()` and `toDatabase()` type mappers
|
|
79
|
+
3. Register in `RepositoryFactory`
|
|
80
|
+
4. Add table schema in `schema.ts`
|
|
81
|
+
</important>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Application Layer (CQRS + MediatR)
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
Command/query handlers orchestrating domain logic via MediatR pipeline. Sits between API controllers and Domain layer.
|
|
5
|
+
|
|
6
|
+
## Dependencies
|
|
7
|
+
- **MediatR**: Command/query dispatch
|
|
8
|
+
- **FluentValidation**: Request validation via pipeline behavior
|
|
9
|
+
- **AutoMapper**: Domain ↔ DTO mapping
|
|
10
|
+
|
|
11
|
+
## Consumers
|
|
12
|
+
- **API Controllers**: Send commands/queries via `IMediator`
|
|
13
|
+
- **Integration tests**: Direct handler invocation
|
|
14
|
+
|
|
15
|
+
## Module Structure
|
|
16
|
+
```
|
|
17
|
+
Application/
|
|
18
|
+
├── Common/
|
|
19
|
+
│ ├── Behaviors/ # MediatR pipeline (validation, logging)
|
|
20
|
+
│ └── Mappings/ # AutoMapper profiles
|
|
21
|
+
├── Features/ # One folder per aggregate
|
|
22
|
+
│ └── Orders/
|
|
23
|
+
│ ├── Commands/ # CreateOrder/, UpdateOrder/ (handler + validator + DTO)
|
|
24
|
+
│ └── Queries/ # GetOrder/, ListOrders/
|
|
25
|
+
└── DependencyInjection.cs # Service registration
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Handler Pattern (Command with Validation)
|
|
29
|
+
|
|
30
|
+
```csharp
|
|
31
|
+
public record CreateOrderCommand(string CustomerId, List<LineItemDto> Items)
|
|
32
|
+
: IRequest<Result<OrderDto>>;
|
|
33
|
+
|
|
34
|
+
public class CreateOrderValidator : AbstractValidator<CreateOrderCommand> {
|
|
35
|
+
public CreateOrderValidator(IOrderRepository repo) {
|
|
36
|
+
RuleFor(x => x.CustomerId).NotEmpty();
|
|
37
|
+
RuleFor(x => x.Items).NotEmpty();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public class CreateOrderHandler : IRequestHandler<CreateOrderCommand, Result<OrderDto>> {
|
|
42
|
+
public async Task<Result<OrderDto>> Handle(
|
|
43
|
+
CreateOrderCommand request, CancellationToken ct) {
|
|
44
|
+
var order = Order.Create(request.CustomerId, request.Items); // Domain factory
|
|
45
|
+
await _repo.AddAsync(order, ct);
|
|
46
|
+
await _unitOfWork.SaveChangesAsync(ct);
|
|
47
|
+
return Result.Ok(_mapper.Map<OrderDto>(order));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Architectural Boundaries
|
|
53
|
+
- **NO domain logic in handlers**: Handlers orchestrate, domain objects contain logic
|
|
54
|
+
- **NO direct DbContext access**: Use repository abstractions
|
|
55
|
+
- **NO cross-feature references**: Features are independent vertical slices
|
|
56
|
+
|
|
57
|
+
<important if="you are adding a new feature or command/query handler">
|
|
58
|
+
## Adding a New Feature
|
|
59
|
+
1. Create folder under `Features/{Aggregate}/{Commands|Queries}/`
|
|
60
|
+
2. Add `Command`/`Query` record implementing `IRequest<Result<TDto>>`
|
|
61
|
+
3. Add `Validator` extending `AbstractValidator<TCommand>`
|
|
62
|
+
4. Add `Handler` implementing `IRequestHandler<TCommand, Result<TDto>>`
|
|
63
|
+
5. Add AutoMapper profile in `Common/Mappings/` if new DTO
|
|
64
|
+
</important>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Schemas Layer Architecture
|
|
2
|
+
|
|
3
|
+
## Responsibility
|
|
4
|
+
Zod validation schemas for dual-layer validation (preload UX + main security), type inference via z.infer<>.
|
|
5
|
+
|
|
6
|
+
## Dependencies
|
|
7
|
+
- **zod**: Runtime validation
|
|
8
|
+
|
|
9
|
+
## Consumers
|
|
10
|
+
- **@redis-ui/ipc**: Main process validation (security)
|
|
11
|
+
- **Preload**: Fail-fast validation (UX)
|
|
12
|
+
- **TypeScript**: Type inference
|
|
13
|
+
|
|
14
|
+
## Module Structure
|
|
15
|
+
```
|
|
16
|
+
src/
|
|
17
|
+
├── connection.ts, backup.ts # Domain schemas
|
|
18
|
+
└── __tests__/ # Validation tests
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Complete Schema Pattern (Types + Validation + Composition)
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
export const createConnectionSchema = z.object({
|
|
25
|
+
name: z.string().min(1).max(255),
|
|
26
|
+
host: z.string().min(1),
|
|
27
|
+
port: z.number().int().min(1).max(65535),
|
|
28
|
+
password: z.string().optional(),
|
|
29
|
+
database: z.number().int().min(0).max(15).default(0),
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Type inference
|
|
33
|
+
export type CreateConnectionInput = z.infer<typeof createConnectionSchema>
|
|
34
|
+
|
|
35
|
+
// Update schema (partial + ID required)
|
|
36
|
+
export const updateConnectionSchema = createConnectionSchema.partial().extend({
|
|
37
|
+
id: z.string().min(1)
|
|
38
|
+
})
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Dual-Validation Flow
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
Renderer input → Preload (Zod parse, fail fast) → IPC → Main (Zod parse again, security)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Architectural Boundaries
|
|
48
|
+
- **NO any types**: Use z.unknown()
|
|
49
|
+
- **NO skipping validation**: Always validate at boundaries
|
|
50
|
+
- **NO business logic**: Structure validation only
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
```markdown
|
|
2
|
+
# Project Overview
|
|
3
|
+
[1-2 sentences: what it is, tech stack]
|
|
4
|
+
|
|
5
|
+
# Architecture
|
|
6
|
+
[monorepo structure tree + dependency flow diagram]
|
|
7
|
+
[process architecture if applicable]
|
|
8
|
+
|
|
9
|
+
# Commands
|
|
10
|
+
[key commands table — always bare, never wrapped in <important if>]
|
|
11
|
+
|
|
12
|
+
# Business Context
|
|
13
|
+
[1-2 sentences if applicable]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The sections above (Overview, Architecture, Commands, Business Context) are foundational — they stay bare because they're relevant to virtually every task.
|
|
17
|
+
|
|
18
|
+
Cross-cutting patterns and domain-specific conventions go in `<important if>` blocks with narrow, action-specific conditions. Do NOT group unrelated rules under a single broad condition like "you are writing or modifying code". Instead, shard by trigger.
|
|
19
|
+
|
|
20
|
+
Root conditional blocks are for **cross-cutting conventions that don't belong to any single layer**. Layer-specific recipes (like "adding a new controller" or "adding a new repository") belong in the subfolder CLAUDE.md, not the root.
|
|
21
|
+
|
|
22
|
+
**Deduplication rule:** If a layer has its own subfolder CLAUDE.md, do NOT add a root conditional block summarizing that layer's conventions. The subfolder file is the authoritative guide — the agent will see it when working in that directory. Root conditionals that mirror subfolder content waste attention budget and create staleness risk.
|
|
23
|
+
|
|
24
|
+
Root MAY include cross-layer vertical-slice checklists (e.g., "adding a new domain entity end-to-end") that reference multiple subfolder CLAUDE.md files — but each step should point to the relevant subfolder for details, not inline them.
|
|
25
|
+
|
|
26
|
+
Good root conditions — things that span multiple layers:
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
<important if="you are writing or modifying tests">
|
|
30
|
+
- Unit: xUnit + NSubstitute / Jest + Testing Library
|
|
31
|
+
- Integration: WebApplicationFactory / Supertest
|
|
32
|
+
- Test fixtures in `__fixtures__/` or `tests/Fixtures/`
|
|
33
|
+
</important>
|
|
34
|
+
|
|
35
|
+
<important if="you are adding or modifying database migrations">
|
|
36
|
+
- Never modify existing migrations — always create new ones
|
|
37
|
+
- Run `dotnet ef migrations add` / `turbo db:migrate` after schema changes
|
|
38
|
+
</important>
|
|
39
|
+
|
|
40
|
+
<important if="you are adding or modifying environment configuration">
|
|
41
|
+
- All config via `IOptions<T>` pattern / environment variables
|
|
42
|
+
- Secrets in user-secrets locally, Key Vault in production
|
|
43
|
+
</important>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Each block should contain only rules that share the same trigger condition. If a codebase has 3 distinct convention areas, that's 3 blocks — not 1 block with a broad condition. Layer-specific checklists (adding a controller, adding a repository) go in the subfolder CLAUDE.md using `<important if="you are adding a new [entity] to this layer">`.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
```markdown
|
|
2
|
+
# [Layer/Component Name]
|
|
3
|
+
|
|
4
|
+
## Responsibility
|
|
5
|
+
[1-2 sentences: what this layer does, where it sits in architecture]
|
|
6
|
+
|
|
7
|
+
## Dependencies
|
|
8
|
+
[List only architectural dependencies — frameworks and libraries that shape how you write code in this layer.
|
|
9
|
+
Do NOT list utility libraries discoverable from package.json/imports (e.g., lodash, moment, xlsx).
|
|
10
|
+
A dependency is worth listing if it imposes patterns, constraints, or conventions on the code.]
|
|
11
|
+
- **[dep]**: Why it's used
|
|
12
|
+
|
|
13
|
+
## Consumers
|
|
14
|
+
- **[consumer]**: How it uses this layer
|
|
15
|
+
|
|
16
|
+
## Module Structure
|
|
17
|
+
[Compact directory tree — aim for 4-7 top-level entries, not 15.
|
|
18
|
+
Group related files on one line (e.g., "Service.ts, Handler.ts").
|
|
19
|
+
Use architectural annotations for directories (e.g., "# One repo per entity", "# Domain schemas").
|
|
20
|
+
DO NOT enumerate individual files inside directories — describe the convention.
|
|
21
|
+
When a layer has many directories (10+), group related concerns on one line
|
|
22
|
+
(e.g., "guards/, interceptors/, pipes/ — infrastructure plumbing") rather than listing each separately.
|
|
23
|
+
The structure must stay valid when non-architectural files are added.]
|
|
24
|
+
|
|
25
|
+
## [Pattern Name] ([Key Constraint or Characterization])
|
|
26
|
+
[Each distinct pattern gets its own H2 section — NOT a generic "## Key Patterns" umbrella.
|
|
27
|
+
Include a fenced code block with an idiomatic, generalized example showing:
|
|
28
|
+
- Constructor / dependencies
|
|
29
|
+
- Key method signatures and return types
|
|
30
|
+
- Error handling / wrapping conventions
|
|
31
|
+
- Inline comments for important conventions (e.g., "// throws on error — service wraps in Result")
|
|
32
|
+
If a pattern spans a layer boundary, show both sides briefly.
|
|
33
|
+
Multiple patterns = multiple H2 sections.]
|
|
34
|
+
|
|
35
|
+
## [Additional Pattern Name]
|
|
36
|
+
[Second pattern with code block if applicable]
|
|
37
|
+
|
|
38
|
+
## Architectural Boundaries
|
|
39
|
+
- **NO [X]**: [Why]
|
|
40
|
+
- **NO [Y]**: [Why]
|
|
41
|
+
|
|
42
|
+
<important if="you are adding a new [entity type] to this layer">
|
|
43
|
+
## Adding a New [Entity Type]
|
|
44
|
+
[Step-by-step checklist inferred from existing code:
|
|
45
|
+
1. Create file following naming convention
|
|
46
|
+
2. Extend/implement base class or interface
|
|
47
|
+
3. Register in factory/container/index
|
|
48
|
+
4. Add related artifacts (schema, test, migration)]
|
|
49
|
+
</important>
|
|
50
|
+
|
|
51
|
+
<important if="you are writing or modifying tests for this layer">
|
|
52
|
+
## Testing Conventions
|
|
53
|
+
[Test patterns, helpers, fixture locations, mocking approach — if detectable from code]
|
|
54
|
+
</important>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Conditional sections are OPTIONAL — only include them if the pattern-finder skill detects testable patterns or clear "add new entity" workflows. Conditions must be narrow and action-specific. These sections contain checklists/recipes, not code examples (those stay in the unconditional pattern sections). Conditional sections do NOT count toward the 100-line budget for unconditional content.
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Conduct comprehensive code reviews by analyzing changes in parallel. Produces review documents in thoughts/shared/reviews/. Use when changes are ready for review.
|
|
4
|
+
argument-hint: [scope]
|
|
5
|
+
allowed-tools: Read, Bash(git *), Glob, Grep, Agent
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Code Review System
|
|
9
|
+
|
|
10
|
+
You are tasked with conducting comprehensive code reviews by invoking parallel skills to analyze changes and synthesize their findings into actionable feedback.
|
|
11
|
+
|
|
12
|
+
## Initial Setup:
|
|
13
|
+
|
|
14
|
+
When this command is invoked, respond with:
|
|
15
|
+
```
|
|
16
|
+
I'm ready to perform a code review. Please specify what you'd like reviewed:
|
|
17
|
+
- Latest commit(s)
|
|
18
|
+
- Staged changes (git diff --cached)
|
|
19
|
+
- Working directory changes (git diff)
|
|
20
|
+
- Specific commit hash or range
|
|
21
|
+
- Pull request (provide PR number or branch)
|
|
22
|
+
|
|
23
|
+
You can also specify focus areas or review depth.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then wait for the user's review request.
|
|
27
|
+
|
|
28
|
+
## Steps to follow after receiving the review request:
|
|
29
|
+
|
|
30
|
+
1. **Read the changes to review:**
|
|
31
|
+
- Determine what needs reviewing based on user input
|
|
32
|
+
- Use appropriate git commands to get the diff:
|
|
33
|
+
- Latest commit: `git diff HEAD~1 HEAD`
|
|
34
|
+
- Staged: `git diff --cached`
|
|
35
|
+
- Working: `git diff`
|
|
36
|
+
- **IMPORTANT**: Read the full diff output FIRST before invoking any skills
|
|
37
|
+
- Get list of changed files and understand the scope
|
|
38
|
+
- Note commit messages for context
|
|
39
|
+
|
|
40
|
+
2. **Analyze and decompose the review:**
|
|
41
|
+
- Break down the changes into reviewable areas
|
|
42
|
+
- Take time to ultrathink about patterns, security implications, and architectural impacts
|
|
43
|
+
- Identify which components are affected
|
|
44
|
+
- Create a review plan using the `todo` tool to track all aspects
|
|
45
|
+
- Consider which existing patterns and historical decisions are relevant
|
|
46
|
+
|
|
47
|
+
3. **Spawn parallel agents for comprehensive review:**
|
|
48
|
+
- Plan first then spawn multiple agents to review different aspects concurrently using the Agent tool. Those MUST be run simultaneously to boost efficiency.
|
|
49
|
+
**For codebase research:**
|
|
50
|
+
- Use the **codebase-locator** agent to find WHERE files and components live
|
|
51
|
+
- Use the **codebase-analyzer** agent to understand HOW specific code works
|
|
52
|
+
- Use the **codebase-pattern-finder** agent if you need examples of similar implementations
|
|
53
|
+
|
|
54
|
+
**For thoughts directory:**
|
|
55
|
+
- Use the **thoughts-locator** agent to discover what documents exist about the topic
|
|
56
|
+
- Use the **thoughts-analyzer** agent to extract key insights from specific documents
|
|
57
|
+
|
|
58
|
+
**For web research (only if user explicitly asks):**
|
|
59
|
+
- Use the **web-search-researcher** agent for external documentation and resources
|
|
60
|
+
- IF you use web-research agents, instruct them to return LINKS with their findings, and please INCLUDE those links in your final report
|
|
61
|
+
|
|
62
|
+
The key is to use these agents intelligently:
|
|
63
|
+
1. Start with locator agents to understand scope and find context
|
|
64
|
+
2. Then use analyzer agents on the most critical changes
|
|
65
|
+
- Run multiple agents in parallel when reviewing different aspects
|
|
66
|
+
- Each agent works in isolation — provide complete context in the prompt
|
|
67
|
+
|
|
68
|
+
4. **Wait for all agents to complete and synthesize findings:**
|
|
69
|
+
- IMPORTANT: Wait for ALL agent invocations to complete before proceeding
|
|
70
|
+
- Compile all findings from agents
|
|
71
|
+
- Classify issues by severity:
|
|
72
|
+
- 🔴 Critical: Security vulnerabilities, data loss, crashes
|
|
73
|
+
- 🟡 Important: Bugs, performance issues, pattern violations
|
|
74
|
+
- 🔵 Suggestions: Style improvements, minor optimizations
|
|
75
|
+
- 💭 Discussion: Architecture decisions, trade-offs
|
|
76
|
+
- Cross-reference patterns found by agents with actual changes
|
|
77
|
+
- Check if historical decisions are being respected
|
|
78
|
+
- Verify test coverage based on existing patterns
|
|
79
|
+
|
|
80
|
+
5. **Determine metadata and filename:**
|
|
81
|
+
- Filename format: `thoughts/shared/reviews/YYYY-MM-DD_HH-MM-SS_[scope].md`
|
|
82
|
+
- YYYY-MM-DD_HH-MM-SS: Current date and time (e.g., 2025-10-11_14-30-22)
|
|
83
|
+
- [scope]: Brief kebab-case description of what was reviewed
|
|
84
|
+
- Repository name: from git root basename, or current directory basename if not a git repo
|
|
85
|
+
- Use the git branch and commit from the git context injected at the start of the session (or run `git branch --show-current` / `git rev-parse --short HEAD` directly); falls back to "no-branch" / "no-commit" if not a git repo
|
|
86
|
+
- Reviewer: use the User from the git context injected at the start of the session (fallback: "unknown")
|
|
87
|
+
- If metadata unavailable: use "unknown" for commit/branch
|
|
88
|
+
|
|
89
|
+
6. **Generate review document:**
|
|
90
|
+
- Use the metadata gathered in step 5
|
|
91
|
+
- Structure the document with YAML frontmatter followed by content:
|
|
92
|
+
```markdown
|
|
93
|
+
---
|
|
94
|
+
date: [Current date and time with timezone]
|
|
95
|
+
reviewer: [Reviewer name]
|
|
96
|
+
repository: [Repository name]
|
|
97
|
+
branch: [Current branch]
|
|
98
|
+
commit: [Commit hash]
|
|
99
|
+
review_type: [commit|pr|staged|working]
|
|
100
|
+
scope: "[What was reviewed]"
|
|
101
|
+
files_changed: [Number]
|
|
102
|
+
critical_issues: [Count]
|
|
103
|
+
important_issues: [Count]
|
|
104
|
+
suggestions: [Count]
|
|
105
|
+
status: [approved|needs_changes|requesting_changes]
|
|
106
|
+
tags: [code-review, relevant-components]
|
|
107
|
+
last_updated: [Current date in YYYY-MM-DD format]
|
|
108
|
+
last_updated_by: [Reviewer name]
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
# Code Review: [Scope Description]
|
|
112
|
+
|
|
113
|
+
**Date**: [Current date and time]
|
|
114
|
+
**Reviewer**: [Reviewer name]
|
|
115
|
+
**Repository**: [Repository]
|
|
116
|
+
**Branch**: [Branch name]
|
|
117
|
+
**Commit**: [Commit hash]
|
|
118
|
+
|
|
119
|
+
## Review Summary
|
|
120
|
+
[Overall assessment of the changes]
|
|
121
|
+
|
|
122
|
+
## Issues Found
|
|
123
|
+
|
|
124
|
+
### Critical Issues (Must Fix)
|
|
125
|
+
[None | List of critical issues with file:line references and suggested fixes]
|
|
126
|
+
|
|
127
|
+
### Important Issues (Should Fix)
|
|
128
|
+
[List of important issues with evidence from skills]
|
|
129
|
+
|
|
130
|
+
### Suggestions
|
|
131
|
+
[Minor improvements and optimizations]
|
|
132
|
+
|
|
133
|
+
## Pattern Analysis
|
|
134
|
+
[How changes align with existing patterns found by pattern-finder]
|
|
135
|
+
|
|
136
|
+
## Impact Assessment
|
|
137
|
+
[Files and tests affected based on locator findings]
|
|
138
|
+
|
|
139
|
+
## Historical Context
|
|
140
|
+
[Relevant decisions and past issues from thoughts/]
|
|
141
|
+
|
|
142
|
+
## Recommendation
|
|
143
|
+
[Clear verdict: Approved / Needs Changes / Requesting Changes]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
7. **Present findings:**
|
|
147
|
+
- Present a concise summary to the user
|
|
148
|
+
- Include the most critical issues first
|
|
149
|
+
- Provide concrete examples from the codebase
|
|
150
|
+
- Ask if they need clarification on any findings
|
|
151
|
+
|
|
152
|
+
8. **Handle follow-up questions:**
|
|
153
|
+
- If the user has follow-up questions, append to the same review document
|
|
154
|
+
- Update the frontmatter fields `last_updated` and `last_updated_by`
|
|
155
|
+
- Add a new section: `## Follow-up [timestamp]`
|
|
156
|
+
- Spawn new agents as needed for deeper investigation
|
|
157
|
+
- Continue updating the document and syncing
|
|
158
|
+
|
|
159
|
+
## Important notes:
|
|
160
|
+
- Always use parallel Agent tool calls to maximize efficiency
|
|
161
|
+
- Always read the diff FULLY before spawning agents
|
|
162
|
+
- Focus on finding concrete issues with evidence from agents
|
|
163
|
+
- Review documents should be actionable with specific fixes
|
|
164
|
+
- Each agent prompt should be focused on specific analysis
|
|
165
|
+
- Consider patterns, security, performance, and maintainability
|
|
166
|
+
- Include historical context when relevant
|
|
167
|
+
- Keep the main agent focused on synthesis, not deep analysis
|
|
168
|
+
- Encourage agents to find examples and patterns, not make judgments
|
|
169
|
+
- **Critical ordering**: Follow the numbered steps exactly
|
|
170
|
+
- ALWAYS read diff first before spawning agents (step 1)
|
|
171
|
+
- ALWAYS wait for all agents to complete before synthesizing (step 4)
|
|
172
|
+
- ALWAYS gather metadata before writing the document (step 5 before step 6)
|
|
173
|
+
- **Agent roles:**
|
|
174
|
+
- **codebase-locator**: WHERE code lives (find files)
|
|
175
|
+
- **codebase-analyzer**: HOW code works (implementation details)
|
|
176
|
+
- **codebase-pattern-finder**: Examples of similar code
|
|
177
|
+
- **thoughts-locator**: Find historical documentation
|
|
178
|
+
- **thoughts-analyzer**: Extract insights from documents
|
|
179
|
+
- **web-search-researcher**: External sources (sparingly)
|
|
180
|
+
- **Severity classification**:
|
|
181
|
+
- Use evidence from agents to justify each issue's severity
|
|
182
|
+
- Provide specific file:line references for all issues
|
|
183
|
+
- Include examples of correct patterns when available
|
|
184
|
+
- Suggest concrete fixes, not vague improvements
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: commit
|
|
3
|
+
description: Create structured git commits. Groups related changes logically with clear, descriptive messages. Use when code changes are ready to commit.
|
|
4
|
+
argument-hint: [message]
|
|
5
|
+
allowed-tools: Bash(git *), Read, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Commit Changes
|
|
9
|
+
|
|
10
|
+
You are tasked with creating git commits for repository changes.
|
|
11
|
+
|
|
12
|
+
## Commit hint
|
|
13
|
+
|
|
14
|
+
If the user has already provided a specific commit hint or message, use it as guidance. Otherwise the user may have provided no hint — their input will appear as a follow-up paragraph after this skill body if they did.
|
|
15
|
+
|
|
16
|
+
## Context:
|
|
17
|
+
- **In-session**: If there's conversation history, use it to understand what was built/changed
|
|
18
|
+
- **Standalone**: If no context available, rely entirely on git state and file inspection
|
|
19
|
+
|
|
20
|
+
## Process:
|
|
21
|
+
|
|
22
|
+
0. **Check git availability:**
|
|
23
|
+
- Run `git status --short` to determine whether the current directory is a git repository
|
|
24
|
+
- If not a git repo, tell the user: "This directory is not a git repository. Run `git init` to initialize one."
|
|
25
|
+
- Stop — do not proceed with commit.
|
|
26
|
+
|
|
27
|
+
1. **Think about what changed:**
|
|
28
|
+
- **If in-session**: Review the conversation history to understand what was accomplished
|
|
29
|
+
- **Always**: Run `git diff` to understand the modifications in detail
|
|
30
|
+
- If needed, inspect file contents to understand purpose and scope
|
|
31
|
+
- Consider whether changes should be one commit or multiple logical commits
|
|
32
|
+
|
|
33
|
+
2. **Plan your commit(s):**
|
|
34
|
+
- Identify which files belong together
|
|
35
|
+
- Draft clear, descriptive commit messages
|
|
36
|
+
- Use imperative mood in commit messages
|
|
37
|
+
- Focus on why the changes were made, not just what
|
|
38
|
+
- Check for sensitive information (API keys, credentials) before committing
|
|
39
|
+
|
|
40
|
+
3. **Present your plan to the user:**
|
|
41
|
+
- List the files you plan to add for each commit
|
|
42
|
+
- Show the commit message(s) you'll use
|
|
43
|
+
- Use the `ask_user_question` tool to confirm the commit plan. Question: "[N] commit(s) with [M] files. Proceed?". Header: "Commit". Options: "Commit (Recommended)" (Create the commit(s) as planned); "Adjust" (Change the grouping or commit messages); "Review files" (Show me the full diff before committing).
|
|
44
|
+
|
|
45
|
+
4. **Execute upon confirmation:**
|
|
46
|
+
- Use `git add` with specific files (never use `-A` or `.`)
|
|
47
|
+
- Create commits with your planned messages
|
|
48
|
+
- Show the result with `git log --oneline -n X` (where X = number of commits you just created)
|
|
49
|
+
|
|
50
|
+
## Important:
|
|
51
|
+
|
|
52
|
+
- **NEVER add co-author information or Claude attribution**
|
|
53
|
+
- Commits should be authored solely by the user
|
|
54
|
+
- Do not include any "Generated with Claude" messages
|
|
55
|
+
- Do not add "Co-Authored-By" lines
|
|
56
|
+
- Write commit messages as if the user wrote them
|
|
57
|
+
|
|
58
|
+
## Remember:
|
|
59
|
+
|
|
60
|
+
- Adapt your approach: use conversation context if available, otherwise infer from git state
|
|
61
|
+
- In-session: you have full context of what was done; Standalone: infer from git analysis
|
|
62
|
+
- Group related changes by purpose (feature, fix, refactor, docs)
|
|
63
|
+
- Keep commits atomic: one logical change per commit
|
|
64
|
+
- Split into multiple commits if: different features, mixing bugs with features, or unrelated concerns
|
|
65
|
+
- The user trusts your judgment - they asked you to commit
|