@dv.nghiem/flowdeck 0.1.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 +136 -0
- package/bin/flowdeck.js +108 -0
- package/dist/agents/architect.d.ts +3 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/code-explorer.d.ts +3 -0
- package/dist/agents/code-explorer.d.ts.map +1 -0
- package/dist/agents/coder.d.ts +3 -0
- package/dist/agents/coder.d.ts.map +1 -0
- package/dist/agents/debug.d.ts +4 -0
- package/dist/agents/debug.d.ts.map +1 -0
- package/dist/agents/doc-updater.d.ts +3 -0
- package/dist/agents/doc-updater.d.ts.map +1 -0
- package/dist/agents/flowdeck.d.ts +5 -0
- package/dist/agents/flowdeck.d.ts.map +1 -0
- package/dist/agents/index.d.ts +38 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/mapper.d.ts +3 -0
- package/dist/agents/mapper.d.ts.map +1 -0
- package/dist/agents/orchestrator.d.ts +10 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/performance.d.ts +4 -0
- package/dist/agents/performance.d.ts.map +1 -0
- package/dist/agents/planner.d.ts +3 -0
- package/dist/agents/planner.d.ts.map +1 -0
- package/dist/agents/policy-enforcer.d.ts +3 -0
- package/dist/agents/policy-enforcer.d.ts.map +1 -0
- package/dist/agents/researcher.d.ts +3 -0
- package/dist/agents/researcher.d.ts.map +1 -0
- package/dist/agents/reviewer.d.ts +3 -0
- package/dist/agents/reviewer.d.ts.map +1 -0
- package/dist/agents/risk-analyst.d.ts +3 -0
- package/dist/agents/risk-analyst.d.ts.map +1 -0
- package/dist/agents/security-auditor.d.ts +3 -0
- package/dist/agents/security-auditor.d.ts.map +1 -0
- package/dist/agents/specialist.d.ts +5 -0
- package/dist/agents/specialist.d.ts.map +1 -0
- package/dist/agents/tester.d.ts +3 -0
- package/dist/agents/tester.d.ts.map +1 -0
- package/dist/agents/types.d.ts +20 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/writer.d.ts +3 -0
- package/dist/agents/writer.d.ts.map +1 -0
- package/dist/commands/analysis/analysis.test.d.ts +2 -0
- package/dist/commands/analysis/analysis.test.d.ts.map +1 -0
- package/dist/commands/analysis/analyze-change.d.ts +148 -0
- package/dist/commands/analysis/analyze-change.d.ts.map +1 -0
- package/dist/commands/analysis/evaluate-risk.d.ts +77 -0
- package/dist/commands/analysis/evaluate-risk.d.ts.map +1 -0
- package/dist/commands/analysis/guarded-edit.d.ts +72 -0
- package/dist/commands/analysis/guarded-edit.d.ts.map +1 -0
- package/dist/commands/execution/deploy-check.d.ts +91 -0
- package/dist/commands/execution/deploy-check.d.ts.map +1 -0
- package/dist/commands/execution/fix-bug.d.ts +187 -0
- package/dist/commands/execution/fix-bug.d.ts.map +1 -0
- package/dist/commands/execution/new-feature.d.ts +171 -0
- package/dist/commands/execution/new-feature.d.ts.map +1 -0
- package/dist/commands/execution/review-code.d.ts +130 -0
- package/dist/commands/execution/review-code.d.ts.map +1 -0
- package/dist/commands/execution/write-docs.d.ts +94 -0
- package/dist/commands/execution/write-docs.d.ts.map +1 -0
- package/dist/commands/governance/approve.d.ts +80 -0
- package/dist/commands/governance/approve.d.ts.map +1 -0
- package/dist/commands/intelligence/blast-radius.d.ts +67 -0
- package/dist/commands/intelligence/blast-radius.d.ts.map +1 -0
- package/dist/commands/intelligence/impact-radar.d.ts +71 -0
- package/dist/commands/intelligence/impact-radar.d.ts.map +1 -0
- package/dist/commands/intelligence/intelligence.test.d.ts +2 -0
- package/dist/commands/intelligence/intelligence.test.d.ts.map +1 -0
- package/dist/commands/intelligence/regression-predict.d.ts +75 -0
- package/dist/commands/intelligence/regression-predict.d.ts.map +1 -0
- package/dist/commands/intelligence/review-route.d.ts +65 -0
- package/dist/commands/intelligence/review-route.d.ts.map +1 -0
- package/dist/commands/intelligence/test-gap.d.ts +73 -0
- package/dist/commands/intelligence/test-gap.d.ts.map +1 -0
- package/dist/commands/intelligence/translate-intent.d.ts +87 -0
- package/dist/commands/intelligence/translate-intent.d.ts.map +1 -0
- package/dist/commands/intelligence/volatility-map-cmd.d.ts +68 -0
- package/dist/commands/intelligence/volatility-map-cmd.d.ts.map +1 -0
- package/dist/commands/planning/ask.d.ts +62 -0
- package/dist/commands/planning/ask.d.ts.map +1 -0
- package/dist/commands/planning/ask.test.d.ts +2 -0
- package/dist/commands/planning/ask.test.d.ts.map +1 -0
- package/dist/commands/planning/dashboard.d.ts +30 -0
- package/dist/commands/planning/dashboard.d.ts.map +1 -0
- package/dist/commands/planning/discuss.d.ts +39 -0
- package/dist/commands/planning/discuss.d.ts.map +1 -0
- package/dist/commands/planning/plan.d.ts +67 -0
- package/dist/commands/planning/plan.d.ts.map +1 -0
- package/dist/commands/planning/roadmap.d.ts +105 -0
- package/dist/commands/planning/roadmap.d.ts.map +1 -0
- package/dist/commands/setup/doctor.d.ts +10 -0
- package/dist/commands/setup/doctor.d.ts.map +1 -0
- package/dist/commands/setup/map-codebase.d.ts +62 -0
- package/dist/commands/setup/map-codebase.d.ts.map +1 -0
- package/dist/commands/setup/new-project.d.ts +19 -0
- package/dist/commands/setup/new-project.d.ts.map +1 -0
- package/dist/commands/setup/settings.d.ts +57 -0
- package/dist/commands/setup/settings.d.ts.map +1 -0
- package/dist/commands/state/checkpoint.d.ts +27 -0
- package/dist/commands/state/checkpoint.d.ts.map +1 -0
- package/dist/commands/state/multi-repo.d.ts +63 -0
- package/dist/commands/state/multi-repo.d.ts.map +1 -0
- package/dist/commands/state/progress.d.ts +57 -0
- package/dist/commands/state/progress.d.ts.map +1 -0
- package/dist/commands/state/resume.d.ts +11 -0
- package/dist/commands/state/resume.d.ts.map +1 -0
- package/dist/commands/state/workspace-commands.d.ts +207 -0
- package/dist/commands/state/workspace-commands.d.ts.map +1 -0
- package/dist/dashboard/lib/port-finder.d.ts +10 -0
- package/dist/dashboard/lib/port-finder.d.ts.map +1 -0
- package/dist/dashboard/lib/port-finder.test.d.ts +2 -0
- package/dist/dashboard/lib/port-finder.test.d.ts.map +1 -0
- package/dist/dashboard/lib/state-reader.d.ts +3 -0
- package/dist/dashboard/lib/state-reader.d.ts.map +1 -0
- package/dist/dashboard/server.d.ts +2 -0
- package/dist/dashboard/server.d.ts.map +1 -0
- package/dist/dashboard/server.mjs +13649 -0
- package/dist/dashboard/types.d.ts +72 -0
- package/dist/dashboard/types.d.ts.map +1 -0
- package/dist/dashboard/views/index.ejs +391 -0
- package/dist/dashboard/views/partials/blockers.ejs +10 -0
- package/dist/dashboard/views/partials/header.ejs +20 -0
- package/dist/dashboard/views/partials/phase-timeline.ejs +40 -0
- package/dist/dashboard/views/partials/progress.ejs +12 -0
- package/dist/hooks/approval-hook.d.ts +13 -0
- package/dist/hooks/approval-hook.d.ts.map +1 -0
- package/dist/hooks/compaction-hook.d.ts +23 -0
- package/dist/hooks/compaction-hook.d.ts.map +1 -0
- package/dist/hooks/context-window-monitor.d.ts +21 -0
- package/dist/hooks/context-window-monitor.d.ts.map +1 -0
- package/dist/hooks/decision-trace-hook.d.ts +13 -0
- package/dist/hooks/decision-trace-hook.d.ts.map +1 -0
- package/dist/hooks/file-tracker.d.ts +29 -0
- package/dist/hooks/file-tracker.d.ts.map +1 -0
- package/dist/hooks/guard-rails.d.ts +33 -0
- package/dist/hooks/guard-rails.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/notifications.d.ts +21 -0
- package/dist/hooks/notifications.d.ts.map +1 -0
- package/dist/hooks/patch-trust.d.ts +27 -0
- package/dist/hooks/patch-trust.d.ts.map +1 -0
- package/dist/hooks/patch-trust.test.d.ts +2 -0
- package/dist/hooks/patch-trust.test.d.ts.map +1 -0
- package/dist/hooks/session-events.d.ts +8 -0
- package/dist/hooks/session-events.d.ts.map +1 -0
- package/dist/hooks/session-idle-hook.d.ts +21 -0
- package/dist/hooks/session-idle-hook.d.ts.map +1 -0
- package/dist/hooks/session-start.d.ts +10 -0
- package/dist/hooks/session-start.d.ts.map +1 -0
- package/dist/hooks/shell-env-hook.d.ts +21 -0
- package/dist/hooks/shell-env-hook.d.ts.map +1 -0
- package/dist/hooks/telemetry-hook.d.ts +25 -0
- package/dist/hooks/telemetry-hook.d.ts.map +1 -0
- package/dist/hooks/todo-hook.d.ts +25 -0
- package/dist/hooks/todo-hook.d.ts.map +1 -0
- package/dist/hooks/tool-guard.d.ts +41 -0
- package/dist/hooks/tool-guard.d.ts.map +1 -0
- package/dist/hooks/tool-guard.test.d.ts +2 -0
- package/dist/hooks/tool-guard.test.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6639 -0
- package/dist/lib/confirmation.d.ts +20 -0
- package/dist/lib/confirmation.d.ts.map +1 -0
- package/dist/lib/impact-radar.d.ts +35 -0
- package/dist/lib/impact-radar.d.ts.map +1 -0
- package/dist/lib/signatures.d.ts +12 -0
- package/dist/lib/signatures.d.ts.map +1 -0
- package/dist/lib/timestamps.d.ts +23 -0
- package/dist/lib/timestamps.d.ts.map +1 -0
- package/dist/mcp/index.d.ts +20 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/services/agent-performance.d.ts +29 -0
- package/dist/services/agent-performance.d.ts.map +1 -0
- package/dist/services/approval-manager.d.ts +30 -0
- package/dist/services/approval-manager.d.ts.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/model-router.d.ts +35 -0
- package/dist/services/model-router.d.ts.map +1 -0
- package/dist/services/policy-compiler.d.ts +27 -0
- package/dist/services/policy-compiler.d.ts.map +1 -0
- package/dist/services/run-trace.d.ts +34 -0
- package/dist/services/run-trace.d.ts.map +1 -0
- package/dist/services/services.test.d.ts +2 -0
- package/dist/services/services.test.d.ts.map +1 -0
- package/dist/services/telemetry.d.ts +34 -0
- package/dist/services/telemetry.d.ts.map +1 -0
- package/dist/tools/agent-dispatch.test.d.ts +2 -0
- package/dist/tools/agent-dispatch.test.d.ts.map +1 -0
- package/dist/tools/codebase-state.d.ts +4 -0
- package/dist/tools/codebase-state.d.ts.map +1 -0
- package/dist/tools/context-generator.d.ts +3 -0
- package/dist/tools/context-generator.d.ts.map +1 -0
- package/dist/tools/council.d.ts +4 -0
- package/dist/tools/council.d.ts.map +1 -0
- package/dist/tools/decision-trace.d.ts +16 -0
- package/dist/tools/decision-trace.d.ts.map +1 -0
- package/dist/tools/delegate.d.ts +4 -0
- package/dist/tools/delegate.d.ts.map +1 -0
- package/dist/tools/failure-replay.d.ts +19 -0
- package/dist/tools/failure-replay.d.ts.map +1 -0
- package/dist/tools/failure-replay.test.d.ts +2 -0
- package/dist/tools/failure-replay.test.d.ts.map +1 -0
- package/dist/tools/hash-edit.d.ts +3 -0
- package/dist/tools/hash-edit.d.ts.map +1 -0
- package/dist/tools/planning-state-lib.d.ts +65 -0
- package/dist/tools/planning-state-lib.d.ts.map +1 -0
- package/dist/tools/planning-state.d.ts +3 -0
- package/dist/tools/planning-state.d.ts.map +1 -0
- package/dist/tools/policy-engine.d.ts +19 -0
- package/dist/tools/policy-engine.d.ts.map +1 -0
- package/dist/tools/repo-memory.d.ts +20 -0
- package/dist/tools/repo-memory.d.ts.map +1 -0
- package/dist/tools/repo-memory.test.d.ts +2 -0
- package/dist/tools/repo-memory.test.d.ts.map +1 -0
- package/dist/tools/run-parallel.d.ts +4 -0
- package/dist/tools/run-parallel.d.ts.map +1 -0
- package/dist/tools/run-pipeline.d.ts +4 -0
- package/dist/tools/run-pipeline.d.ts.map +1 -0
- package/dist/tools/volatility-map.d.ts +18 -0
- package/dist/tools/volatility-map.d.ts.map +1 -0
- package/dist/tools/volatility-map.test.d.ts +2 -0
- package/dist/tools/volatility-map.test.d.ts.map +1 -0
- package/dist/tools/workspace-state.d.ts +3 -0
- package/dist/tools/workspace-state.d.ts.map +1 -0
- package/docs/USER_GUIDE.md +20 -0
- package/docs/agents.md +562 -0
- package/docs/best-practices.md +47 -0
- package/docs/command-migration.md +175 -0
- package/docs/commands/fd-analyze-change.md +107 -0
- package/docs/commands/fd-ask.md +51 -0
- package/docs/commands/fd-checkpoint.md +10 -0
- package/docs/commands/fd-dashboard.md +11 -0
- package/docs/commands/fd-deploy-check.md +11 -0
- package/docs/commands/fd-discuss.md +28 -0
- package/docs/commands/fd-evaluate-risk.md +134 -0
- package/docs/commands/fd-fix-bug.md +24 -0
- package/docs/commands/fd-guarded-edit.md +105 -0
- package/docs/commands/fd-map-codebase.md +27 -0
- package/docs/commands/fd-multi-repo.md +63 -0
- package/docs/commands/fd-new-feature.md +25 -0
- package/docs/commands/fd-new-project.md +24 -0
- package/docs/commands/fd-plan.md +33 -0
- package/docs/commands/fd-progress.md +11 -0
- package/docs/commands/fd-resume.md +10 -0
- package/docs/commands/fd-review-code.md +29 -0
- package/docs/commands/fd-roadmap.md +10 -0
- package/docs/commands/fd-settings.md +10 -0
- package/docs/commands/fd-write-docs.md +10 -0
- package/docs/commands.md +476 -0
- package/docs/configuration.md +211 -0
- package/docs/feature-integration-architecture.md +255 -0
- package/docs/index.md +75 -0
- package/docs/installation.md +134 -0
- package/docs/intelligence.md +294 -0
- package/docs/multi-repo.md +201 -0
- package/docs/notifications.md +170 -0
- package/docs/parallel-execution.md +227 -0
- package/docs/quick-start.md +174 -0
- package/docs/rules.md +459 -0
- package/docs/skills.md +408 -0
- package/docs/workflows.md +376 -0
- package/package.json +58 -0
- package/postinstall.mjs +102 -0
- package/src/rules/README.md +37 -0
- package/src/rules/common/agent-orchestration.md +86 -0
- package/src/rules/common/coding-style.md +120 -0
- package/src/rules/common/git-workflow.md +77 -0
- package/src/rules/common/security.md +94 -0
- package/src/rules/common/testing.md +105 -0
- package/src/rules/golang/patterns.md +187 -0
- package/src/rules/java/patterns.md +204 -0
- package/src/rules/python/patterns.md +141 -0
- package/src/rules/rust/patterns.md +210 -0
- package/src/rules/typescript/patterns.md +168 -0
- package/src/skills/api-design/SKILL.md +143 -0
- package/src/skills/arch-constraint-guard/SKILL.md +61 -0
- package/src/skills/blast-radius-preview/SKILL.md +65 -0
- package/src/skills/change-impact-radar/SKILL.md +63 -0
- package/src/skills/code-review/SKILL.md +108 -0
- package/src/skills/code-tour/SKILL.md +101 -0
- package/src/skills/codebase-mapping/SKILL.md +87 -0
- package/src/skills/codebase-onboarding/SKILL.md +133 -0
- package/src/skills/confidence-aware-planning/SKILL.md +67 -0
- package/src/skills/context-load/SKILL.md +63 -0
- package/src/skills/debug-flow/SKILL.md +75 -0
- package/src/skills/decision-trace/SKILL.md +72 -0
- package/src/skills/dependency-audit/SKILL.md +126 -0
- package/src/skills/deploy-check/SKILL.md +87 -0
- package/src/skills/documentation-writer/SKILL.md +154 -0
- package/src/skills/failure-replay-engine/SKILL.md +59 -0
- package/src/skills/git-release/SKILL.md +94 -0
- package/src/skills/git-workflow/SKILL.md +177 -0
- package/src/skills/golang-patterns/SKILL.md +511 -0
- package/src/skills/human-review-routing/SKILL.md +65 -0
- package/src/skills/intent-translator/SKILL.md +57 -0
- package/src/skills/java-patterns/SKILL.md +479 -0
- package/src/skills/multi-repo/SKILL.md +187 -0
- package/src/skills/parallel-execute/SKILL.md +92 -0
- package/src/skills/patch-trust-score/SKILL.md +44 -0
- package/src/skills/performance-profiling/SKILL.md +153 -0
- package/src/skills/plan-task/SKILL.md +101 -0
- package/src/skills/python-patterns/SKILL.md +529 -0
- package/src/skills/refactor-guide/SKILL.md +117 -0
- package/src/skills/regression-prediction/SKILL.md +57 -0
- package/src/skills/repo-memory-graph/SKILL.md +49 -0
- package/src/skills/rust-patterns/SKILL.md +492 -0
- package/src/skills/security-scan/SKILL.md +91 -0
- package/src/skills/self-healing-policies/SKILL.md +76 -0
- package/src/skills/tdd-workflow/SKILL.md +126 -0
- package/src/skills/test-coverage/SKILL.md +94 -0
- package/src/skills/test-gap-detector/SKILL.md +58 -0
- package/src/skills/volatility-map/SKILL.md +52 -0
- package/src/workflows/debug-flow.md +119 -0
- package/src/workflows/deploy-check-flow.md +98 -0
- package/src/workflows/discuss-flow.md +97 -0
- package/src/workflows/execute-flow.md +233 -0
- package/src/workflows/execute-phase.md +142 -0
- package/src/workflows/fix-bug-flow.md +210 -0
- package/src/workflows/map-codebase-flow.md +92 -0
- package/src/workflows/multi-repo-flow.md +226 -0
- package/src/workflows/parallel-execution-flow.md +236 -0
- package/src/workflows/plan-flow.md +126 -0
- package/src/workflows/plan-phase.md +101 -0
- package/src/workflows/refactor-flow.md +122 -0
- package/src/workflows/review-code-flow.md +105 -0
- package/src/workflows/spec-driven-flow.md +43 -0
- package/src/workflows/write-docs-flow.md +95 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# TypeScript Patterns
|
|
2
|
+
|
|
3
|
+
TypeScript-specific conventions and patterns for FlowDeck projects.
|
|
4
|
+
|
|
5
|
+
## Strict Mode
|
|
6
|
+
|
|
7
|
+
Always on. No exceptions.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
// tsconfig.json
|
|
11
|
+
{
|
|
12
|
+
"compilerOptions": {
|
|
13
|
+
"strict": true,
|
|
14
|
+
"noImplicitAny": true,
|
|
15
|
+
"strictNullChecks": true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## API Response Format
|
|
21
|
+
|
|
22
|
+
Use a consistent response shape for all API responses:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
interface ApiResponse<T> {
|
|
26
|
+
data: T;
|
|
27
|
+
error: null;
|
|
28
|
+
metadata?: {
|
|
29
|
+
page?: number;
|
|
30
|
+
total?: number;
|
|
31
|
+
cursor?: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface ApiError {
|
|
36
|
+
data: null;
|
|
37
|
+
error: {
|
|
38
|
+
code: string;
|
|
39
|
+
message: string;
|
|
40
|
+
details?: unknown;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
type ApiResult<T> = ApiResponse<T> | ApiError;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Custom Hooks Pattern
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// ✅ Return an object (not an array) when returning multiple values
|
|
51
|
+
function useAuth() {
|
|
52
|
+
const [user, setUser] = useState<User | null>(null);
|
|
53
|
+
const [loading, setLoading] = useState(true);
|
|
54
|
+
|
|
55
|
+
const login = useCallback(async (email: string, password: string) => {
|
|
56
|
+
setLoading(true);
|
|
57
|
+
try {
|
|
58
|
+
const user = await authService.login(email, password);
|
|
59
|
+
setUser(user);
|
|
60
|
+
} finally {
|
|
61
|
+
setLoading(false);
|
|
62
|
+
}
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
return { user, loading, login };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Naming: useXxx
|
|
69
|
+
// Co-locate with the component that primarily uses it
|
|
70
|
+
// Return object (not array) for more than one value
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Repository Pattern
|
|
74
|
+
|
|
75
|
+
Interface first. Concrete implementation separate. Inject at the call site.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Define the interface
|
|
79
|
+
interface UserRepository {
|
|
80
|
+
findById(id: string): Promise<User | null>;
|
|
81
|
+
findByEmail(email: string): Promise<User | null>;
|
|
82
|
+
create(input: CreateUserInput): Promise<User>;
|
|
83
|
+
update(id: string, patch: Partial<UpdateUserInput>): Promise<User>;
|
|
84
|
+
delete(id: string): Promise<void>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Concrete implementation
|
|
88
|
+
class PostgresUserRepository implements UserRepository {
|
|
89
|
+
constructor(private readonly db: Database) {}
|
|
90
|
+
|
|
91
|
+
async findById(id: string): Promise<User | null> {
|
|
92
|
+
return this.db.query('SELECT * FROM users WHERE id = $1', [id]).then(r => r.rows[0] ?? null);
|
|
93
|
+
}
|
|
94
|
+
// ...
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Inject at service level — never instantiate in the method
|
|
98
|
+
class UserService {
|
|
99
|
+
constructor(private readonly users: UserRepository) {}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Result Types for Error Handling
|
|
104
|
+
|
|
105
|
+
Never throw in business logic. Use Result types.
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
type Ok<T> = { ok: true; value: T };
|
|
109
|
+
type Err<E> = { ok: false; error: E };
|
|
110
|
+
type Result<T, E = Error> = Ok<T> | Err<E>;
|
|
111
|
+
|
|
112
|
+
function ok<T>(value: T): Ok<T> {
|
|
113
|
+
return { ok: true, value };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function err<E>(error: E): Err<E> {
|
|
117
|
+
return { ok: false, error };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Usage
|
|
121
|
+
async function createUser(input: CreateUserInput): Promise<Result<User, ValidationError>> {
|
|
122
|
+
const validation = validateInput(input);
|
|
123
|
+
if (!validation.ok) return err(validation.error);
|
|
124
|
+
|
|
125
|
+
const user = await db.create(input);
|
|
126
|
+
return ok(user);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Caller
|
|
130
|
+
const result = await createUser(input);
|
|
131
|
+
if (!result.ok) {
|
|
132
|
+
logger.error('Validation failed', result.error);
|
|
133
|
+
return res.status(422).json({ error: result.error });
|
|
134
|
+
}
|
|
135
|
+
res.status(201).json(result.value);
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## TypeScript Conventions
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
// ✅ Interfaces for object shapes (preferred over type aliases)
|
|
142
|
+
interface User {
|
|
143
|
+
id: string;
|
|
144
|
+
email: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ✅ Type aliases for unions and complex types
|
|
148
|
+
type UserRole = 'admin' | 'user' | 'guest';
|
|
149
|
+
type LoadingState = 'idle' | 'loading' | 'success' | 'error';
|
|
150
|
+
|
|
151
|
+
// ✅ Explicit return types on all public functions
|
|
152
|
+
async function fetchUser(id: string): Promise<User | null> { ... }
|
|
153
|
+
|
|
154
|
+
// ✅ Const assertions for literal types
|
|
155
|
+
const ROLES = ['admin', 'user', 'guest'] as const;
|
|
156
|
+
type Role = typeof ROLES[number]; // 'admin' | 'user' | 'guest'
|
|
157
|
+
|
|
158
|
+
// ✅ Discriminated unions for state machines
|
|
159
|
+
type RequestState =
|
|
160
|
+
| { status: 'idle' }
|
|
161
|
+
| { status: 'loading' }
|
|
162
|
+
| { status: 'success'; data: User }
|
|
163
|
+
| { status: 'error'; error: string };
|
|
164
|
+
|
|
165
|
+
// ❌ No implicit any
|
|
166
|
+
function process(data) { ... } // ❌
|
|
167
|
+
function process(data: unknown) { } // ✅
|
|
168
|
+
```
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-design
|
|
3
|
+
description: REST API design patterns for resource naming, status codes, pagination, filtering, versioning, and error responses. Activate when designing or reviewing API endpoints.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# API Design Skill
|
|
8
|
+
|
|
9
|
+
REST API design patterns. Consistent, predictable, and easy to use.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate when:
|
|
14
|
+
- Designing new API endpoints
|
|
15
|
+
- Reviewing existing API for inconsistencies
|
|
16
|
+
- Adding a new resource to an existing API
|
|
17
|
+
- Evaluating an external API design
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
|
|
21
|
+
- **Nouns, not verbs** in URLs — resources, not actions
|
|
22
|
+
- **Consistent naming** — same conventions throughout
|
|
23
|
+
- **Standard status codes** — use what HTTP intended
|
|
24
|
+
- **No breaking changes** without versioning
|
|
25
|
+
|
|
26
|
+
## Resource Design
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
✅ Good:
|
|
30
|
+
GET /api/v1/users — list users
|
|
31
|
+
GET /api/v1/users/:id — get user by ID
|
|
32
|
+
POST /api/v1/users — create user
|
|
33
|
+
PUT /api/v1/users/:id — replace user
|
|
34
|
+
PATCH /api/v1/users/:id — update user fields
|
|
35
|
+
DELETE /api/v1/users/:id — delete user
|
|
36
|
+
|
|
37
|
+
❌ Bad:
|
|
38
|
+
GET /getUsers
|
|
39
|
+
POST /createUser
|
|
40
|
+
GET /deleteUser?id=123
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## HTTP Methods and Status Codes
|
|
44
|
+
|
|
45
|
+
| Method | Success Code | Use For |
|
|
46
|
+
|--------|-------------|---------|
|
|
47
|
+
| GET | 200 OK | Retrieve resource(s) |
|
|
48
|
+
| POST | 201 Created | Create new resource |
|
|
49
|
+
| PUT | 200 OK | Replace entire resource |
|
|
50
|
+
| PATCH | 200 OK | Update specific fields |
|
|
51
|
+
| DELETE | 204 No Content | Delete resource |
|
|
52
|
+
|
|
53
|
+
**Error codes:**
|
|
54
|
+
| Code | Meaning |
|
|
55
|
+
|------|---------|
|
|
56
|
+
| 400 | Bad Request — malformed request body |
|
|
57
|
+
| 401 | Unauthorized — missing or invalid auth token |
|
|
58
|
+
| 403 | Forbidden — authenticated but not authorized |
|
|
59
|
+
| 404 | Not Found — resource does not exist |
|
|
60
|
+
| 409 | Conflict — duplicate resource |
|
|
61
|
+
| 422 | Unprocessable — valid format, failed validation |
|
|
62
|
+
| 429 | Too Many Requests — rate limit exceeded |
|
|
63
|
+
| 500 | Internal Server Error — unexpected server failure |
|
|
64
|
+
|
|
65
|
+
## Error Response Format
|
|
66
|
+
|
|
67
|
+
All errors use this standard shape:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"error": {
|
|
72
|
+
"code": "VALIDATION_ERROR",
|
|
73
|
+
"message": "Email address is invalid",
|
|
74
|
+
"details": [
|
|
75
|
+
{ "field": "email", "message": "Must be a valid email address" }
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Pagination
|
|
82
|
+
|
|
83
|
+
**Offset-based** (simple, but slow on large datasets):
|
|
84
|
+
```
|
|
85
|
+
GET /api/v1/users?page=2&limit=20
|
|
86
|
+
|
|
87
|
+
Response:
|
|
88
|
+
{
|
|
89
|
+
"data": [...],
|
|
90
|
+
"pagination": {
|
|
91
|
+
"page": 2,
|
|
92
|
+
"limit": 20,
|
|
93
|
+
"total": 847,
|
|
94
|
+
"pages": 43
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Cursor-based** (efficient, consistent):
|
|
100
|
+
```
|
|
101
|
+
GET /api/v1/users?after=cursor_abc123&limit=20
|
|
102
|
+
|
|
103
|
+
Response:
|
|
104
|
+
{
|
|
105
|
+
"data": [...],
|
|
106
|
+
"pagination": {
|
|
107
|
+
"nextCursor": "cursor_def456",
|
|
108
|
+
"hasMore": true
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Filtering and Sorting
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
GET /api/v1/users?filter[status]=active
|
|
117
|
+
GET /api/v1/users?filter[role]=admin&filter[status]=active
|
|
118
|
+
GET /api/v1/users?sort=-createdAt // descending
|
|
119
|
+
GET /api/v1/users?sort=lastName,firstName // multiple fields
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Versioning Strategy
|
|
123
|
+
|
|
124
|
+
Version in the URL path:
|
|
125
|
+
```
|
|
126
|
+
/api/v1/users — current stable
|
|
127
|
+
/api/v2/users — new version with breaking changes
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Rules:
|
|
131
|
+
- Never change v1 behavior once published
|
|
132
|
+
- Keep v1 running for at least 12 months after v2 ships
|
|
133
|
+
- Document migration guide in CHANGELOG
|
|
134
|
+
|
|
135
|
+
## Rate Limiting Headers
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
X-RateLimit-Limit: 100
|
|
139
|
+
X-RateLimit-Remaining: 87
|
|
140
|
+
X-RateLimit-Reset: 1609459200
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Return 429 when limit exceeded with `Retry-After` header.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arch-constraint-guard
|
|
3
|
+
description: Block edits that violate known system boundaries, team rules, service contracts, or domain-layer separation. Reads rules from .codebase/CONSTRAINTS.md.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Architectural Constraint Guard
|
|
8
|
+
|
|
9
|
+
Before writing any file, check if the edit violates architectural boundaries defined in `.codebase/CONSTRAINTS.md`. If it does, stop and explain the violation.
|
|
10
|
+
|
|
11
|
+
## CONSTRAINTS.md Format
|
|
12
|
+
|
|
13
|
+
Create `.codebase/CONSTRAINTS.md` to encode your team's architectural rules:
|
|
14
|
+
|
|
15
|
+
```markdown
|
|
16
|
+
## Forbidden Paths
|
|
17
|
+
- src/core/ # do not modify core — all changes via PR with 2 approvals
|
|
18
|
+
- src/generated/ # auto-generated, do not edit manually
|
|
19
|
+
- infra/secrets/ # managed by Terraform only
|
|
20
|
+
|
|
21
|
+
## Layer Rules
|
|
22
|
+
- UI components MUST NOT import from services/ directly — use hooks/ or context/
|
|
23
|
+
- services/ MUST NOT import from routes/ — services are framework-agnostic
|
|
24
|
+
- domain/ MUST NOT import from infra/ — keep domain pure
|
|
25
|
+
|
|
26
|
+
## Service Contract Rules
|
|
27
|
+
- PaymentService API is frozen — no method signature changes without RFC
|
|
28
|
+
- UserSchema is owned by auth-team — no schema changes without approval
|
|
29
|
+
|
|
30
|
+
## Naming Conventions
|
|
31
|
+
- React components: PascalCase only
|
|
32
|
+
- Database tables: snake_case only
|
|
33
|
+
- API endpoints: kebab-case only
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Workflow
|
|
37
|
+
|
|
38
|
+
For every proposed write or edit:
|
|
39
|
+
|
|
40
|
+
1. Read `.codebase/CONSTRAINTS.md`
|
|
41
|
+
2. Check the target file path against `## Forbidden Paths`
|
|
42
|
+
3. Check the import graph against `## Layer Rules`
|
|
43
|
+
4. Check method signatures against `## Service Contract Rules`
|
|
44
|
+
5. If any violation is found: **STOP**, report the specific rule violated, and suggest a compliant alternative
|
|
45
|
+
|
|
46
|
+
## When No CONSTRAINTS.md Exists
|
|
47
|
+
|
|
48
|
+
If `.codebase/CONSTRAINTS.md` does not exist:
|
|
49
|
+
1. Infer boundaries from ARCHITECTURE.md (layer names, service boundaries)
|
|
50
|
+
2. Apply common-sense defaults: UI does not directly query DB, domain does not call HTTP
|
|
51
|
+
3. Suggest creating CONSTRAINTS.md to codify the rules you discover
|
|
52
|
+
|
|
53
|
+
## Violation Report Format
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
ARCH CONSTRAINT VIOLATION
|
|
57
|
+
Rule: [rule name from CONSTRAINTS.md]
|
|
58
|
+
File: [target file]
|
|
59
|
+
Violation: [what was attempted]
|
|
60
|
+
Compliant alternative: [what to do instead]
|
|
61
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: blast-radius-preview
|
|
3
|
+
description: Show the likely downstream consequences of a proposed change — hidden dependencies, fragile integration points, and predicted breakage categories.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Blast Radius Preview
|
|
8
|
+
|
|
9
|
+
Before committing to a change, map every system that could break. Run `/blast-radius` with a change description.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
- Before merging a change that touches shared infrastructure
|
|
14
|
+
- Before modifying a public API, event schema, or DB model
|
|
15
|
+
- Before changing authentication or session handling
|
|
16
|
+
- Any time the Impact Radar returns HIGH
|
|
17
|
+
|
|
18
|
+
## Workflow
|
|
19
|
+
|
|
20
|
+
1. Load the dependency graph from `.codebase/MEMORY.json`
|
|
21
|
+
2. Start from the directly changed nodes
|
|
22
|
+
3. Walk the graph outward: find all services/modules that depend on the changed node
|
|
23
|
+
4. At each hop, check:
|
|
24
|
+
- Is this an integration point (API call, event subscription, DB query)?
|
|
25
|
+
- Does this path have regression history in `.codebase/FAILURES.json`?
|
|
26
|
+
- Is this path covered by integration tests?
|
|
27
|
+
5. Flag hidden couplings: shared mutable state, ambient context, feature flags
|
|
28
|
+
6. Produce the blast radius map
|
|
29
|
+
|
|
30
|
+
## Blast Radius Report Format
|
|
31
|
+
|
|
32
|
+
```markdown
|
|
33
|
+
## Blast Radius Report
|
|
34
|
+
|
|
35
|
+
### Change
|
|
36
|
+
[description]
|
|
37
|
+
|
|
38
|
+
### Direct Blast (depth 1)
|
|
39
|
+
| Module | Coupling Type | Test Coverage | Fragile? |
|
|
40
|
+
|--------|--------------|---------------|---------|
|
|
41
|
+
|
|
42
|
+
### Indirect Blast (depth 2–3)
|
|
43
|
+
| Module | Via | Risk Level |
|
|
44
|
+
|--------|-----|------------|
|
|
45
|
+
|
|
46
|
+
### Integration Point Risks
|
|
47
|
+
- [endpoint/event]: [why at risk]
|
|
48
|
+
|
|
49
|
+
### Hidden Couplings
|
|
50
|
+
- [module]: shared state / ambient context / feature flag
|
|
51
|
+
|
|
52
|
+
### Predicted Breakage Categories
|
|
53
|
+
- [ ] Performance: [reason]
|
|
54
|
+
- [ ] Auth: [reason]
|
|
55
|
+
- [ ] Schema: [reason]
|
|
56
|
+
- [ ] Async flow: [reason]
|
|
57
|
+
|
|
58
|
+
### Blast Radius: NARROW | MODERATE | WIDE
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Guidance
|
|
62
|
+
|
|
63
|
+
- NARROW: ≤3 downstream modules, all covered by tests → safe to proceed
|
|
64
|
+
- MODERATE: 4–10 downstream modules or ≥1 uncovered → add tests before merging
|
|
65
|
+
- WIDE: >10 downstream modules or hits fragile integration → escalate to senior review
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: change-impact-radar
|
|
3
|
+
description: Predict which files, modules, APIs, tests, and database paths will be affected before making any code changes. Returns an impact map for human review.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Change Impact Radar
|
|
8
|
+
|
|
9
|
+
Predicts blast surface before the AI touches a single file. Run `/impact-radar` with a description of the intended change.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate before:
|
|
14
|
+
- Any multi-file refactor
|
|
15
|
+
- API contract changes
|
|
16
|
+
- Schema migrations
|
|
17
|
+
- Dependency upgrades
|
|
18
|
+
- Auth / security changes
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. Read `.codebase/ARCHITECTURE.md` and `.codebase/STACK.md` for system context
|
|
23
|
+
2. Read `.codebase/MEMORY.json` to trace the module dependency graph
|
|
24
|
+
3. From the change description, identify all directly affected files
|
|
25
|
+
4. Walk the dependency graph outward from affected files (depth ≤ 3 hops)
|
|
26
|
+
5. Cross-reference against `.codebase/VOLATILITY.json` for fragile zones
|
|
27
|
+
6. Identify test files that cover the affected modules
|
|
28
|
+
7. Flag any database schema, API contracts, or config changes
|
|
29
|
+
8. Produce the impact map report
|
|
30
|
+
|
|
31
|
+
## Impact Map Report Format
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## Change Impact Report
|
|
35
|
+
|
|
36
|
+
### Direct Impact (files you will edit)
|
|
37
|
+
| File | Type | Risk |
|
|
38
|
+
|------|------|------|
|
|
39
|
+
|
|
40
|
+
### Indirect Impact (dependents, ≤3 hops)
|
|
41
|
+
| File | Dependency Chain | Risk |
|
|
42
|
+
|------|-----------------|------|
|
|
43
|
+
|
|
44
|
+
### API Contracts at Risk
|
|
45
|
+
- [contract name]: [why at risk]
|
|
46
|
+
|
|
47
|
+
### Tests to Run / Update
|
|
48
|
+
- [test file]: covers [module]
|
|
49
|
+
|
|
50
|
+
### Database / Config paths
|
|
51
|
+
- [path]: [what changes]
|
|
52
|
+
|
|
53
|
+
### Volatility Warnings
|
|
54
|
+
- [file]: marked as [stability level]
|
|
55
|
+
|
|
56
|
+
### Verdict: LOW | MEDIUM | HIGH impact
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Guidance
|
|
60
|
+
|
|
61
|
+
- If MEMORY.json does not exist, run `/map-codebase` first to build the graph.
|
|
62
|
+
- If a file has no test coverage and is indirectly impacted, flag it as "coverage gap".
|
|
63
|
+
- Never proceed with a HIGH impact change without human confirmation.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Systematic code review covering security vulnerabilities, logic errors, and quality issues. Returns findings ranked by severity with specific remediation steps. Use before merging any change.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Review Skill
|
|
8
|
+
|
|
9
|
+
Finds real problems before they reach production. Reviews only changed code, reports only confirmed issues, and provides actionable fixes.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate when:
|
|
14
|
+
- You just wrote or modified code
|
|
15
|
+
- A PR is ready for review
|
|
16
|
+
- You want a final check before pushing
|
|
17
|
+
|
|
18
|
+
## Core Principles
|
|
19
|
+
|
|
20
|
+
- Report only confirmed issues — 80%+ confidence before flagging
|
|
21
|
+
- Severity-ranked output: Critical → High → Medium → Pass
|
|
22
|
+
- Actionable fixes: every finding includes a specific remediation
|
|
23
|
+
- No style nitpicks unless they mask bugs
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
1. Run `git diff` or read specified files
|
|
28
|
+
2. Read full file context (not just the diff)
|
|
29
|
+
3. Trace call sites — who calls these functions?
|
|
30
|
+
4. Apply security checklist first
|
|
31
|
+
5. Apply quality checklist
|
|
32
|
+
6. Report by severity
|
|
33
|
+
|
|
34
|
+
## Security Checklist — CRITICAL
|
|
35
|
+
|
|
36
|
+
**SQL Injection:**
|
|
37
|
+
```typescript
|
|
38
|
+
// ❌ CRITICAL
|
|
39
|
+
const q = `SELECT * FROM users WHERE id = '${userId}'`;
|
|
40
|
+
// ✅ Parameterized
|
|
41
|
+
const q = db.query('SELECT * FROM users WHERE id = ?', [userId]);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**XSS:**
|
|
45
|
+
```html
|
|
46
|
+
<!-- ❌ CRITICAL -->
|
|
47
|
+
element.innerHTML = userInput;
|
|
48
|
+
<!-- ✅ -->
|
|
49
|
+
element.textContent = userInput;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Hardcoded credentials:**
|
|
53
|
+
```typescript
|
|
54
|
+
// ❌ CRITICAL
|
|
55
|
+
const SECRET = "abc123hardcoded";
|
|
56
|
+
// ✅
|
|
57
|
+
const SECRET = process.env.API_SECRET;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Path traversal:**
|
|
61
|
+
```typescript
|
|
62
|
+
// ❌ CRITICAL
|
|
63
|
+
fs.readFile(`./uploads/${filename}`);
|
|
64
|
+
// ✅
|
|
65
|
+
fs.readFile(path.join('./uploads', path.basename(filename)));
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quality Checklist — HIGH
|
|
69
|
+
|
|
70
|
+
- Functions over 50 lines → extract
|
|
71
|
+
- Nesting deeper than 3 levels → extract guard clauses
|
|
72
|
+
- Empty or silent catch blocks → log and rethrow
|
|
73
|
+
- Dead code (defined but never called) → remove
|
|
74
|
+
|
|
75
|
+
## Performance — MEDIUM
|
|
76
|
+
|
|
77
|
+
- N+1 queries: database call inside a loop
|
|
78
|
+
- Missing pagination on list endpoints
|
|
79
|
+
- Synchronous I/O in hot paths
|
|
80
|
+
|
|
81
|
+
## Best Practices — LOW
|
|
82
|
+
|
|
83
|
+
- Inconsistent naming within a file
|
|
84
|
+
- Missing JSDoc on public functions
|
|
85
|
+
- `console.log` left in production code
|
|
86
|
+
|
|
87
|
+
## Output Format
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
## Code Review Report
|
|
91
|
+
|
|
92
|
+
### 🔴 CRITICAL (must fix before merge)
|
|
93
|
+
| # | File | Line | Issue | Fix |
|
|
94
|
+
|---|------|------|-------|-----|
|
|
95
|
+
| 1 | auth.ts | 42 | SQL injection | Use parameterized query |
|
|
96
|
+
|
|
97
|
+
### 🟠 HIGH (fix before merge)
|
|
98
|
+
| # | File | Line | Issue | Fix |
|
|
99
|
+
|---|------|------|-------|-----|
|
|
100
|
+
|
|
101
|
+
### 🟡 MEDIUM (fix in follow-up)
|
|
102
|
+
| # | File | Line | Issue | Fix |
|
|
103
|
+
|---|------|------|-------|-----|
|
|
104
|
+
|
|
105
|
+
### ✅ PASS
|
|
106
|
+
- Auth middleware: present on all protected routes
|
|
107
|
+
- Input validation: correct at all boundaries
|
|
108
|
+
```
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-tour
|
|
3
|
+
description: Creates guided code walkthroughs as structured markdown documents. Use when onboarding new developers, explaining architecture, or creating PR review guides.
|
|
4
|
+
origin: FlowDeck
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Tour Skill
|
|
8
|
+
|
|
9
|
+
Creates step-by-step walkthroughs of a codebase or code change. Makes complex code navigable.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
Activate when:
|
|
14
|
+
- Onboarding a new developer to the codebase
|
|
15
|
+
- Explaining a complex architecture to stakeholders
|
|
16
|
+
- Creating a PR review guide for a large change
|
|
17
|
+
- Documenting how a specific flow works (auth, billing, etc.)
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
|
|
21
|
+
- **Audience-first** — write for someone unfamiliar with this code
|
|
22
|
+
- **Verified paths** — every file path and line number must be real and current
|
|
23
|
+
- **Why, not just what** — explain the design decisions, not just what the code does
|
|
24
|
+
|
|
25
|
+
## Workflow
|
|
26
|
+
|
|
27
|
+
1. **Identify audience** — new developer? tech lead? domain expert?
|
|
28
|
+
2. **Choose scope** — full codebase? single feature? specific PR?
|
|
29
|
+
3. **Read and verify** — read every file you will reference; confirm paths exist
|
|
30
|
+
4. **Write tour steps** — numbered, with file path, code snippet, explanation, and why
|
|
31
|
+
5. **Validate paths** — run `ls` on each referenced file to confirm it exists
|
|
32
|
+
|
|
33
|
+
## Tour Format
|
|
34
|
+
|
|
35
|
+
Each step follows this structure:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
### Step N: [What This Step Shows]
|
|
39
|
+
|
|
40
|
+
**File**: `src/path/to/file.ts` (lines 23-45)
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// paste the relevant code snippet here
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**What it does**: [One or two sentences explaining the code]
|
|
47
|
+
|
|
48
|
+
**Why it's designed this way**: [The design rationale]
|
|
49
|
+
|
|
50
|
+
**What to notice**: [The most important thing to understand]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Tour Types
|
|
54
|
+
|
|
55
|
+
| Type | Audience | Scope | Focus |
|
|
56
|
+
|------|---------|-------|-------|
|
|
57
|
+
| Onboarding | New developer | Full codebase | Entry points, key patterns, conventions |
|
|
58
|
+
| Architecture | Tech lead / stakeholder | System design | Component relationships, data flow |
|
|
59
|
+
| PR Review | Reviewer | Changed files | What changed, why, how to verify |
|
|
60
|
+
| RCA (Root Cause Analysis) | Team | Bug site | Call path, where it broke, why |
|
|
61
|
+
|
|
62
|
+
## Full Tour Template
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# Code Tour: [Title]
|
|
66
|
+
|
|
67
|
+
## Audience
|
|
68
|
+
[Who this tour is for]
|
|
69
|
+
|
|
70
|
+
## Scope
|
|
71
|
+
[What this tour covers]
|
|
72
|
+
|
|
73
|
+
## Prerequisites
|
|
74
|
+
- [What the reader should already know]
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Step 1: Entry Point
|
|
79
|
+
|
|
80
|
+
**File**: `src/index.ts` (line 1)
|
|
81
|
+
[code snippet]
|
|
82
|
+
[explanation]
|
|
83
|
+
|
|
84
|
+
### Step 2: [Next Concept]
|
|
85
|
+
[...]
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Summary
|
|
90
|
+
|
|
91
|
+
[2-3 sentences: what we walked through and what matters most]
|
|
92
|
+
|
|
93
|
+
## Next Steps
|
|
94
|
+
|
|
95
|
+
- [What to read next]
|
|
96
|
+
- [What to try next]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Output
|
|
100
|
+
|
|
101
|
+
Save tours to `.codebase/tours/[topic].md` or `docs/tours/[topic].md`.
|