@caddis/cli 0.0.0 → 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.
Files changed (153) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -1
  3. package/bundles/antigravity-plugin/agents/code-reviewer.md +47 -0
  4. package/bundles/antigravity-plugin/agents/preflight.md +53 -0
  5. package/bundles/antigravity-plugin/guard_agy.py +338 -0
  6. package/bundles/antigravity-plugin/hooks.json +36 -0
  7. package/bundles/antigravity-plugin/mcp_config.json +8 -0
  8. package/bundles/antigravity-plugin/mcp_ping_server.py +55 -0
  9. package/bundles/antigravity-plugin/plugin.json +5 -0
  10. package/bundles/antigravity-plugin/session_end_agy.py +57 -0
  11. package/bundles/antigravity-plugin/skills/_registry.md +115 -0
  12. package/bundles/antigravity-plugin/skills/add-rules/SKILL.md +45 -0
  13. package/bundles/antigravity-plugin/skills/api-design/SKILL.md +249 -0
  14. package/bundles/antigravity-plugin/skills/backend-development/SKILL.md +305 -0
  15. package/bundles/antigravity-plugin/skills/best-practices/SKILL.md +500 -0
  16. package/bundles/antigravity-plugin/skills/best-practices/agents/best-practices-referencer.md +263 -0
  17. package/bundles/antigravity-plugin/skills/best-practices/agents/codebase-context-builder.md +326 -0
  18. package/bundles/antigravity-plugin/skills/best-practices/agents/task-intent-analyzer.md +245 -0
  19. package/bundles/antigravity-plugin/skills/best-practices/references/anti-patterns.md +571 -0
  20. package/bundles/antigravity-plugin/skills/best-practices/references/before-after-examples.md +1114 -0
  21. package/bundles/antigravity-plugin/skills/best-practices/references/best-practices-guide.md +513 -0
  22. package/bundles/antigravity-plugin/skills/best-practices/references/common-workflows.md +692 -0
  23. package/bundles/antigravity-plugin/skills/best-practices/references/prompt-patterns.md +547 -0
  24. package/bundles/antigravity-plugin/skills/brainstorming/SKILL.md +57 -0
  25. package/bundles/antigravity-plugin/skills/ci-cd-pipeline/SKILL.md +315 -0
  26. package/bundles/antigravity-plugin/skills/code-documentation/SKILL.md +271 -0
  27. package/bundles/antigravity-plugin/skills/code-review/SKILL.md +122 -0
  28. package/bundles/antigravity-plugin/skills/codebase-audit/SKILL.md +204 -0
  29. package/bundles/antigravity-plugin/skills/context-curator/SKILL.md +157 -0
  30. package/bundles/antigravity-plugin/skills/cross-review/SKILL.md +40 -0
  31. package/bundles/antigravity-plugin/skills/css-architecture/SKILL.md +305 -0
  32. package/bundles/antigravity-plugin/skills/css-architecture/references/RESPONSIVE-DESIGN.md +604 -0
  33. package/bundles/antigravity-plugin/skills/database-design/SKILL.md +177 -0
  34. package/bundles/antigravity-plugin/skills/db-diagram/SKILL.md +148 -0
  35. package/bundles/antigravity-plugin/skills/db-diagram/scripts/sql_to_graph.py +1212 -0
  36. package/bundles/antigravity-plugin/skills/digress/SKILL.md +61 -0
  37. package/bundles/antigravity-plugin/skills/draw-io/SKILL.md +162 -0
  38. package/bundles/antigravity-plugin/skills/draw-io/references/aws-icons.md +677 -0
  39. package/bundles/antigravity-plugin/skills/draw-io/references/layout-guidelines.md +142 -0
  40. package/bundles/antigravity-plugin/skills/draw-io/references/troubleshooting.md +118 -0
  41. package/bundles/antigravity-plugin/skills/draw-io/references/workflows.md +103 -0
  42. package/bundles/antigravity-plugin/skills/draw-io/scripts/convert-drawio-to-png.sh +25 -0
  43. package/bundles/antigravity-plugin/skills/draw-io/scripts/find_aws_icon.py +79 -0
  44. package/bundles/antigravity-plugin/skills/error-handling/SKILL.md +260 -0
  45. package/bundles/antigravity-plugin/skills/excalidraw-db/SKILL.md +38 -0
  46. package/bundles/antigravity-plugin/skills/fastapi-dev/SKILL.md +300 -0
  47. package/bundles/antigravity-plugin/skills/feature-plan/SKILL.md +198 -0
  48. package/bundles/antigravity-plugin/skills/frontend-design/SKILL.md +193 -0
  49. package/bundles/antigravity-plugin/skills/frontend-design/references/my-tech-stack.md +127 -0
  50. package/bundles/antigravity-plugin/skills/gh-cli/SKILL.md +195 -0
  51. package/bundles/antigravity-plugin/skills/git-commit/SKILL.md +285 -0
  52. package/bundles/antigravity-plugin/skills/golden-plan/SKILL.md +577 -0
  53. package/bundles/antigravity-plugin/skills/handoff/SKILL.md +100 -0
  54. package/bundles/antigravity-plugin/skills/implement/SKILL.md +114 -0
  55. package/bundles/antigravity-plugin/skills/javascript-typescript/SKILL.md +142 -0
  56. package/bundles/antigravity-plugin/skills/kb/SKILL.md +60 -0
  57. package/bundles/antigravity-plugin/skills/mermaid-db/SKILL.md +33 -0
  58. package/bundles/antigravity-plugin/skills/mermaid-diagrams/SKILL.md +236 -0
  59. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/ENHANCEMENTS.md +264 -0
  60. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/MERMAID-SUMMARY.md +137 -0
  61. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/advanced-features.md +556 -0
  62. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/architecture-diagrams.md +192 -0
  63. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/c4-diagrams.md +410 -0
  64. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/class-diagrams.md +361 -0
  65. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/erd-diagrams.md +510 -0
  66. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/flowcharts.md +450 -0
  67. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/sequence-diagrams.md +394 -0
  68. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/troubleshooting.md +335 -0
  69. package/bundles/antigravity-plugin/skills/mermaid-diagrams/references/workflows.md +418 -0
  70. package/bundles/antigravity-plugin/skills/migrate-dir/SKILL.md +68 -0
  71. package/bundles/antigravity-plugin/skills/mockup/SKILL.md +242 -0
  72. package/bundles/antigravity-plugin/skills/particle-art/SKILL.md +243 -0
  73. package/bundles/antigravity-plugin/skills/particle-art/references/canvas-utils.ts +171 -0
  74. package/bundles/antigravity-plugin/skills/particle-art/references/dot-field.template.tsx +203 -0
  75. package/bundles/antigravity-plugin/skills/particle-art/references/flow-field.template.tsx +263 -0
  76. package/bundles/antigravity-plugin/skills/particle-art/references/node-shape.template.tsx +261 -0
  77. package/bundles/antigravity-plugin/skills/particle-art/references/shape-sampler.ts +281 -0
  78. package/bundles/antigravity-plugin/skills/particle-art/references/stipple-morph.template.tsx +167 -0
  79. package/bundles/antigravity-plugin/skills/particle-art/references/stipple.template.tsx +175 -0
  80. package/bundles/antigravity-plugin/skills/particle-art/references/trail-ghost.template.tsx +266 -0
  81. package/bundles/antigravity-plugin/skills/particle-art/references/usage-examples.md +320 -0
  82. package/bundles/antigravity-plugin/skills/playwright/API_REFERENCE.md +653 -0
  83. package/bundles/antigravity-plugin/skills/playwright/SKILL.md +454 -0
  84. package/bundles/antigravity-plugin/skills/playwright/lib/helpers.js +441 -0
  85. package/bundles/antigravity-plugin/skills/playwright/package.json +26 -0
  86. package/bundles/antigravity-plugin/skills/playwright/run.js +228 -0
  87. package/bundles/antigravity-plugin/skills/prd/SKILL.md +107 -0
  88. package/bundles/antigravity-plugin/skills/preflight/SKILL.md +435 -0
  89. package/bundles/antigravity-plugin/skills/python/SKILL.md +388 -0
  90. package/bundles/antigravity-plugin/skills/react-best-practices/SKILL.md +269 -0
  91. package/bundles/antigravity-plugin/skills/react-dev/README.md +404 -0
  92. package/bundles/antigravity-plugin/skills/react-dev/SKILL.md +459 -0
  93. package/bundles/antigravity-plugin/skills/react-dev/examples/generic-components.md +579 -0
  94. package/bundles/antigravity-plugin/skills/react-dev/examples/server-components.md +579 -0
  95. package/bundles/antigravity-plugin/skills/react-dev/references/event-handlers.md +574 -0
  96. package/bundles/antigravity-plugin/skills/react-dev/references/hooks.md +456 -0
  97. package/bundles/antigravity-plugin/skills/react-dev/references/react-19-patterns.md +638 -0
  98. package/bundles/antigravity-plugin/skills/react-dev/references/react-router.md +1002 -0
  99. package/bundles/antigravity-plugin/skills/react-dev/references/tanstack-router.md +587 -0
  100. package/bundles/antigravity-plugin/skills/refactoring/SKILL.md +486 -0
  101. package/bundles/antigravity-plugin/skills/resume/SKILL.md +36 -0
  102. package/bundles/antigravity-plugin/skills/security-review/SKILL.md +196 -0
  103. package/bundles/antigravity-plugin/skills/setup-project-ai/SKILL.md +61 -0
  104. package/bundles/antigravity-plugin/skills/ship/SKILL.md +107 -0
  105. package/bundles/antigravity-plugin/skills/ship-merge/SKILL.md +103 -0
  106. package/bundles/antigravity-plugin/skills/ship-pr/SKILL.md +102 -0
  107. package/bundles/antigravity-plugin/skills/skill-creator/LICENSE.txt +202 -0
  108. package/bundles/antigravity-plugin/skills/skill-creator/SKILL.md +491 -0
  109. package/bundles/antigravity-plugin/skills/skill-creator/agents/analyzer.md +274 -0
  110. package/bundles/antigravity-plugin/skills/skill-creator/agents/comparator.md +202 -0
  111. package/bundles/antigravity-plugin/skills/skill-creator/agents/grader.md +223 -0
  112. package/bundles/antigravity-plugin/skills/skill-creator/assets/eval_review.html +146 -0
  113. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/generate_review.py +471 -0
  114. package/bundles/antigravity-plugin/skills/skill-creator/eval-viewer/viewer.html +1325 -0
  115. package/bundles/antigravity-plugin/skills/skill-creator/references/schemas.md +430 -0
  116. package/bundles/antigravity-plugin/skills/skill-creator/scripts/__init__.py +0 -0
  117. package/bundles/antigravity-plugin/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  118. package/bundles/antigravity-plugin/skills/skill-creator/scripts/generate_report.py +326 -0
  119. package/bundles/antigravity-plugin/skills/skill-creator/scripts/improve_description.py +247 -0
  120. package/bundles/antigravity-plugin/skills/skill-creator/scripts/package_skill.py +136 -0
  121. package/bundles/antigravity-plugin/skills/skill-creator/scripts/quick_validate.py +103 -0
  122. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_eval.py +310 -0
  123. package/bundles/antigravity-plugin/skills/skill-creator/scripts/run_loop.py +328 -0
  124. package/bundles/antigravity-plugin/skills/skill-creator/scripts/utils.py +47 -0
  125. package/bundles/antigravity-plugin/skills/sql/SKILL.md +321 -0
  126. package/bundles/antigravity-plugin/skills/tdd/SKILL.md +37 -0
  127. package/bundles/antigravity-plugin/skills/tdd-workflow/SKILL.md +188 -0
  128. package/bundles/antigravity-plugin/skills/technical-writing/SKILL.md +286 -0
  129. package/bundles/antigravity-plugin/skills/test-strategy/SKILL.md +155 -0
  130. package/bundles/antigravity-plugin/skills/ui-brief/SKILL.md +84 -0
  131. package/bundles/antigravity-plugin/skills/ui-review/SKILL.md +176 -0
  132. package/bundles/antigravity-plugin/skills/ui-review/references/framework-fixes.md +471 -0
  133. package/bundles/antigravity-plugin/skills/ui-review/references/visual-checklist.md +236 -0
  134. package/bundles/antigravity-plugin/skills/usage-review/SKILL.md +77 -0
  135. package/bundles/antigravity-plugin/skills/use-model/SKILL.md +64 -0
  136. package/bundles/antigravity-plugin/skills/using-git-worktrees/SKILL.md +217 -0
  137. package/bundles/antigravity-plugin/skills/version/SKILL.md +18 -0
  138. package/bundles/antigravity-plugin/skills/warm-editorial-ui/DESIGN_TOKENS.md +487 -0
  139. package/bundles/antigravity-plugin/skills/warm-editorial-ui/IMPLEMENTATION_GUIDE.md +177 -0
  140. package/bundles/antigravity-plugin/skills/warm-editorial-ui/SKILL.md +732 -0
  141. package/bundles/antigravity-plugin/skills/webapp-testing/LICENSE.txt +202 -0
  142. package/bundles/antigravity-plugin/skills/webapp-testing/SKILL.md +97 -0
  143. package/bundles/antigravity-plugin/skills/webapp-testing/examples/console_logging.py +35 -0
  144. package/bundles/antigravity-plugin/skills/webapp-testing/examples/element_discovery.py +40 -0
  145. package/bundles/antigravity-plugin/skills/webapp-testing/examples/static_html_automation.py +33 -0
  146. package/bundles/antigravity-plugin/skills/webapp-testing/scripts/with_server.py +106 -0
  147. package/bundles/antigravity-plugin/skills/windows-deployment/SKILL.md +880 -0
  148. package/bundles/antigravity-plugin/skills/writing-plans/SKILL.md +384 -0
  149. package/bundles/antigravity-plugin/statusline-command-agy.sh +91 -0
  150. package/bundles/antigravity-plugin/warm_start_agy.py +149 -0
  151. package/bundles/manifest.json +6 -0
  152. package/dist/cli.js +5363 -0
  153. package/package.json +61 -4
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: prd
3
+ description: Capture requirements through structured discovery and write a PRD
4
+ ---
5
+
6
+ # /prd — requirements discovery
7
+
8
+ Produce a Product Requirements Document for: **$ARGUMENTS**
9
+
10
+ If empty, ask what the feature/problem is and stop. Goal: turn a fuzzy idea into a crisp, testable spec
11
+ that `/feature-plan` can consume.
12
+
13
+ ## Discovery (ask, don't assume)
14
+ Interview the user to fill gaps. Ask only what you can't infer from the codebase / `STACK.md`. Cover:
15
+ - **Problem & users** — what hurts, for whom, why now.
16
+ - **Outcome** — what "done" looks like in user terms; how we'd measure it.
17
+ - **Scope** — must-have vs nice-to-have vs explicitly out.
18
+ - **Data & constraints** — sources, fields, perf/security/compliance limits.
19
+ - **Edge cases & failure modes** — empty/error states, permissions.
20
+
21
+ Ask in small batches; stop interviewing once the spec is testable.
22
+
23
+ ## Headless mode
24
+ When the invocation contains the marker **`HEADLESS RUN RULES`** (a docket runner / non-interactive
25
+ caller spawned this session — no human is present), the Discovery interview above is **suspended and
26
+ forbidden**. This mode exists for one-line ideas: the card may be nothing more than a short title with
27
+ **no description**, and there may be **no codebase or `STACK.md`** to draw on. That is expected and still
28
+ fully actionable — a terse title is enough to write a complete draft PRD.
29
+
30
+ Absolute rules in this mode (they override everything above):
31
+ - **NEVER ask a question. NEVER request clarification. NEVER end your turn with questions.** Replying with
32
+ something like *"a few questions to scope this before I write the PRD"* is a hard failure. Never use
33
+ AskUserQuestion, never pause for approval, never wait for input.
34
+ - **A bare title is sufficient input.** Even with only a few words and nothing else, you MUST write the
35
+ full PRD. Where information is missing, **invent a reasonable, conventional interpretation**, state it
36
+ explicitly as an assumption, and proceed. Making an explicit assumption is ALWAYS correct; asking is
37
+ ALWAYS wrong here. If you ever feel you lack enough information, that is the signal to **write an
38
+ assumption and continue** — never to ask.
39
+ - **Every gap becomes an `## Open questions` bullet** (or `[TECH-DECISION OPEN]` inline). This section
40
+ may be long — that is good, not a problem. It is where all the things you would have asked go.
41
+ - **Honor the caller's output path and slug.** Write to the `artifact_dir`/`feature` slug the caller
42
+ specifies (falling back to `.caddis/prd/<feature-slug>.md`); set `feature: <slug>` in the
43
+ frontmatter to that same slug. The frontmatter shape is unchanged from the interactive flow.
44
+ - **Also emit a visual companion** — a self-contained, scannable HTML page at `<artifact_dir>/<slug>.html`
45
+ presenting the PRD visually (a goal/success card, an FR/NFR table, edge cases, and open questions as
46
+ distinct sections). **Use inline `<style>` ONLY** — the visual is rendered in a *sandboxed* iframe with
47
+ no script execution, so a `<script>`/CDN (e.g. the Tailwind browser CDN) would NOT run and the page
48
+ would appear unstyled. Keep it fully portable — no external `<script>`/`<link>`, no local asset files,
49
+ no `/`-rooted paths. This is the visual the human reviews in docket alongside the markdown. Write it
50
+ after the `.md`; the runner finds it by the matching `<slug>.html` name.
51
+ - **Always write the artifact file, then end with exactly one fenced `json` highlights block** as the
52
+ final output — nothing after it. Keep `summary` ≤ 280 chars; `open_questions` = the count of bullets
53
+ under `## Open questions`:
54
+ ```json
55
+ {"artifact":"<artifact_dir>/<slug>.md","summary":"<=280 chars>","open_questions":<int>}
56
+ ```
57
+
58
+ The only acceptable final output in this mode is the written artifact plus its highlights block — never
59
+ questions. Everything else — the PRD template, frontmatter, and section structure below — is identical in
60
+ both modes; only the interview is skipped.
61
+
62
+ ## Write to `.caddis/prd/<feature-slug>.md`
63
+ ```markdown
64
+ ---
65
+ type: prd
66
+ status: draft
67
+ feature: <feature-slug>
68
+ creation-agent: caddis
69
+ Original Author: Claude Code
70
+ Creation Date: <YYYY-MM-DDTHH:MM:SSZ>
71
+ Creating Model: <model-id>
72
+ ---
73
+
74
+ # PRD — <feature>
75
+ **Created:** <ISO date> • **Status:** draft
76
+
77
+ ## Problem
78
+ <who, what, why.>
79
+
80
+ ## Goal & success criteria
81
+ - <measurable outcome>
82
+
83
+ ## Functional requirements
84
+ - FR-1: <requirement — phrased so a test can verify it>
85
+
86
+ ## Non-functional requirements
87
+ - NFR-1: <perf/security/a11y/...>
88
+
89
+ ## Out of scope
90
+ - <explicitly excluded>
91
+
92
+ ## Data
93
+ | Field / source | Shape | Notes |
94
+ |---|---|---|
95
+
96
+ ## Edge cases & failure modes
97
+ - <empty / error / permission / boundary>
98
+
99
+ ## Open questions
100
+ - <unresolved — needs a decision before planning>
101
+ ```
102
+
103
+ ## Report
104
+ Output the PRD path and the FR list. Suggest: *"Next: `/feature-plan <feature>`."* Don't design the
105
+ implementation here — PRD is the *what*, the plan is the *how*.
106
+
107
+ Create `.caddis/prd/` if it doesn't exist.
@@ -0,0 +1,435 @@
1
+ ---
2
+ name: preflight
3
+ context: fork
4
+ description: "Plan-vs-codebase validation — verifies API contracts, type names, field accuracy, dependencies, and paths before implementation begins"
5
+ ---
6
+
7
+ # Preflight — Plan Validation Skill
8
+
9
+ Validate an implementation plan against the actual codebase before agents begin coding. Catches wrong endpoints, missing types, incorrect field names, stale assumptions, and dependency gaps that would otherwise waste entire agent sessions.
10
+
11
+ ## When to Use
12
+
13
+ - Before starting implementation of any plan (pipeline gate or standalone)
14
+ - After significant plan revisions to re-validate
15
+ - Mid-implementation to check remaining phases against evolved codebase
16
+ - When onboarding agents to an existing codebase with a pre-written plan
17
+
18
+ ## Who Loads This Skill
19
+
20
+ | Consumer | Context |
21
+ |----------|---------|
22
+ | `@Preflight` agent | Primary — standalone or pipeline invocation |
23
+ | `@Orchestrator` | At the `plan_validated` gate before routing to Implement |
24
+ | `@Planner` | Optional self-check before declaring plan complete |
25
+ | Any agent | Ad-hoc validation when plan accuracy is in doubt |
26
+
27
+ ---
28
+
29
+ ## Inputs
30
+
31
+ The skill requires two things:
32
+
33
+ 1. **Plan document** — a markdown file containing implementation phases with code snippets, file paths, type references, API endpoints, and data binding tables
34
+ 2. **Codebase access** — read access to the project's source files, package manifests, and data samples
35
+
36
+ Optional:
37
+
38
+ 3. **Scope restriction** — e.g., "validate only phases 6-13 while assuming phases 1-5 are already implemented" (for mid-implementation re-validation)
39
+ 4. **Tech stack hint** — if the plan doesn't state the stack, the agent should detect it from the codebase (look for `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml`, `*.csproj`, etc.)
40
+
41
+ ---
42
+
43
+ ## Validation Methodology — 8 Check Categories (run in 3 passes)
44
+
45
+ To reduce execution load, run categories in this order: Pass 1 (1-3), Pass 2 (4-6), Pass 3 (7-8), recording findings after each pass before continuing.
46
+
47
+ Execute all 8 categories in order. Each produces findings classified as:
48
+
49
+ | Severity | Meaning | Action |
50
+ |----------|---------|--------|
51
+ | `CRITICAL` | Plan contradicts codebase — will cause runtime failure | Must fix before implementation |
52
+ | `SIGNIFICANT` | Plan partially wrong — will cause incorrect behavior | Should fix before implementation |
53
+ | `MINOR` | Cosmetic or documentation gap — won't break functionality | Fix if convenient |
54
+ | `WARN` | Cannot verify — source of truth missing or ambiguous | Flag for human decision |
55
+
56
+ ### Category 1: API Contract Validation
57
+
58
+ **What:** Verify that every API endpoint referenced in the plan (URL, HTTP method, parameter style) matches an actual backend route.
59
+
60
+ **How:**
61
+
62
+ 1. **Find route definitions** — Search for route decorators/registrations in the codebase:
63
+ - Python/FastAPI: `@router.get`, `@router.post`, `@app.get`, etc.
64
+ - Express/Node: `router.get(`, `app.post(`, etc.
65
+ - Go: `r.HandleFunc(`, `e.GET(`, etc.
66
+ - .NET: `[HttpGet(`, `[Route(`, `MapGet(`, etc.
67
+
68
+ 2. **Extract plan endpoints** — Find every URL pattern in the plan (look for `/api/`, `GET `, `POST `, `fetch(`, `axios.get(`, service function definitions with URL strings).
69
+
70
+ 3. **Compare:**
71
+ - Does the URL exist in the backend? (exact match or parameterized equivalent)
72
+ - Does the HTTP method match?
73
+ - Are parameters passed correctly? (path params vs. query params vs. request body)
74
+ - Is the response shape assumption correct?
75
+
76
+ 4. **Common failure patterns:**
77
+ - Plan uses path params (`/resource/{id}`) but backend uses query params (`/resource?id=X`)
78
+ - Plan uses a convenience endpoint that doesn't exist (e.g., `/latest` when only `/list` exists)
79
+ - Plan assumes REST resource endpoints but backend uses RPC-style endpoints
80
+
81
+ ### Category 2: Type Identity Validation
82
+
83
+ **What:** Verify that every type/interface/class name referenced in the plan exists in the codebase.
84
+
85
+ **How:**
86
+
87
+ 1. **Extract type references from the plan** — Find all capitalized type names used in:
88
+ - TypeScript: `interface X`, `type X`, `: X`, `X[]`, `X | Y`
89
+ - Python: class definitions, type hints, Pydantic models
90
+ - Import statements referencing types
91
+
92
+ 2. **Search the codebase** for each type name:
93
+ - Check the exact file the plan says it's in (if specified)
94
+ - If not found there, search broadly — the type may exist under a different name or path
95
+
96
+ 3. **Common failure patterns:**
97
+ - Plan references a type that was renamed during development
98
+ - Plan references a type from an old version of a spec
99
+ - Plan invents a plausible type name that was never created (e.g., `NpsPeriodData` when actual is `NpsData`)
100
+
101
+ ### Category 3: Field Accuracy Validation
102
+
103
+ **What:** Verify that field names, casing, and nesting paths referenced in the plan match the actual data structures.
104
+
105
+ **How:**
106
+
107
+ 1. **Extract field references from the plan** — Find data binding expressions:
108
+ - Dot-notation paths: `data.surveys.broadband.topDetractorThemes`
109
+ - Object destructuring: `const { themeName, currentNps } = item`
110
+ - Table/chart data mappings: "bind X-axis to `fieldName`"
111
+
112
+ 2. **Verify against source of truth** — Check each field reference against:
113
+ - TypeScript interfaces/types (for frontend plans)
114
+ - Pydantic models / SQLAlchemy models (for backend plans)
115
+ - Actual JSON/API response samples (if available)
116
+ - Database schema (if referenced)
117
+
118
+ 3. **Check casing consistency:**
119
+ - Does the plan assume camelCase but the source returns snake_case?
120
+ - Does the plan instruct a blanket case transform, but the API already handles it via serialization aliases?
121
+ - Are there mixed-case situations? (e.g., top-level fields are camelCase via aliases, but nested objects are snake_case)
122
+
123
+ 4. **Common failure patterns:**
124
+ - Plan says `topDetractorThemes` but actual field is `detractorThemes`
125
+ - Plan says `currentNps` but actual is `currentNPS` (capitalization difference)
126
+ - Plan says `target` and `minimum` but actual is `short_term` and `medium_term`
127
+ - Plan instructs `transformKeys(snakeToCamel)` but API already returns camelCase — transform would double-convert
128
+
129
+ ### Category 4: Dependency Availability Validation
130
+
131
+ **What:** Verify that every external package/library referenced in the plan is installed or listed in the project's dependency manifest.
132
+
133
+ **How:**
134
+
135
+ 1. **Extract dependency references from the plan** — Find:
136
+ - Import statements: `import X from 'Y'`, `from X import Y`
137
+ - Package references: "install recharts", "add framer-motion"
138
+ - Version-specific references: "requires React 18+"
139
+
140
+ 2. **Check against manifests:**
141
+ - `package.json` (dependencies + devDependencies) for JS/TS
142
+ - `pyproject.toml` / `requirements.txt` for Python
143
+ - `go.mod` for Go
144
+ - `Cargo.toml` for Rust
145
+
146
+ 3. **Classify:**
147
+ - Listed in manifest → `PASS`
148
+ - Not listed but plan says "install in Phase N" → `PASS` (with note)
149
+ - Not listed and plan doesn't mention installation → `SIGNIFICANT` (will fail on import)
150
+
151
+ ### Category 5: Path Existence Validation
152
+
153
+ **What:** Verify that every file/directory path referenced in the plan exists or is explicitly marked for creation.
154
+
155
+ **How:**
156
+
157
+ 1. **Extract path references from the plan** — Find:
158
+ - `CREATE file: src/components/Dashboard.tsx`
159
+ - `UPDATE file: src/api/client.ts`
160
+ - Import paths: `from '../services/nps'`
161
+ - Config references: `tailwind.config.js`, `.env`
162
+
163
+ 2. **Classify each path:**
164
+ - `CREATE` + path doesn't exist → `PASS` (expected)
165
+ - `CREATE` + path already exists → `WARN` (will overwrite — intentional?)
166
+ - `UPDATE` + path exists → `PASS`
167
+ - `UPDATE` + path doesn't exist → `CRITICAL` (can't update what doesn't exist)
168
+ - Referenced in imports but neither CREATE nor UPDATE → check existence
169
+
170
+ 3. **Verify directory structure matches plan assumptions:**
171
+ - Does `src/components/ui/` exist if the plan puts files there?
172
+ - Does the plan's assumed project structure match reality?
173
+
174
+ ### Category 6: Data Shape Validation
175
+
176
+ **What:** Verify that the plan's assumptions about API response shapes (nesting, array vs. object, optional vs. required) match the actual response structure.
177
+
178
+ **How:**
179
+
180
+ 1. **Find data shape assumptions in the plan** — Look for:
181
+ - Response type annotations: `Promise<NpsData>`
182
+ - Data access patterns: `response.data.surveys.broadband.nps`
183
+ - Conditional checks: `if (data.periodType === 'monthly')`
184
+ - Mapping operations: `data.themes.map(t => t.name)`
185
+
186
+ 2. **Verify against the actual response:**
187
+ - Read serialization models (Pydantic, Zod, JSON Schema)
188
+ - If available, read sample response data (JSON files, test fixtures)
189
+ - Check: Is the field always present or sometimes missing?
190
+ - Check: Is it an array or an object? Does the plan treat it correctly?
191
+
192
+ 3. **Common failure patterns:**
193
+ - Plan assumes a field exists that is only present conditionally
194
+ - Plan assumes an array but actual is an object (or vice versa)
195
+ - Plan references `data.combined.trend` but combined has no trend data
196
+ - Plan assumes a flattened structure but actual is nested
197
+
198
+ ### Category 7: Transform Correctness Validation
199
+
200
+ **What:** Verify that any data transformation instructions in the plan (case conversion, normalization, derived calculations) are actually needed and correctly specified.
201
+
202
+ **How:**
203
+
204
+ 1. **Find transform instructions in the plan** — Look for:
205
+ - "Apply camelCase transform to API responses"
206
+ - "Normalize snake_case fields"
207
+ - "Calculate combined NPS as weighted average of products"
208
+ - "Derive percentage from raw counts"
209
+
210
+ 2. **Check if the transform is necessary:**
211
+ - Does the API already apply the transform via serialization (Pydantic aliases, Jackson annotations)?
212
+ - Does the ORM already handle the conversion?
213
+ - Would the transform break other data that's already in the correct format?
214
+
215
+ 3. **Check if the transform is correct:**
216
+ - Is the formula right? (e.g., weighted average vs. simple average)
217
+ - Are required source fields available?
218
+ - Does the transform handle edge cases? (division by zero, null values)
219
+
220
+ ### Category 8: Output Decay Detection
221
+
222
+ **What:** Detect structural shortcuts, abbreviation patterns, and placeholder content that indicate the plan-generating agent suffered output decay (attention fatigue in later sections).
223
+
224
+ **How:**
225
+
226
+ 1. **Scan the plan for decay signals** — Search for these patterns, especially in the last 40% of the document:
227
+
228
+ | Signal | Regex pattern | Example |
229
+ |--------|--------------|---------|
230
+ | Ellipsis placeholders | `\.{3,}` | `// ... similar tests for each function` |
231
+ | Same-pattern shortcuts | `same pattern` | `same pattern × 3 rows` |
232
+ | As-above references | `as above` | `as above for remaining endpoints` |
233
+ | Etc. in task lines | `\betc\b\.?` | `deriveDeltas, deriveYtd, etc.` |
234
+ | Pseudo-code bodies | `\{ ?\.\.\. ?\}` | `expect(result).toBe({ ... })` |
235
+ | Phase cross-references | `similar to (Phase\|Step\|Section)` | `similar to Phase 2` |
236
+ | Collapsed lists | `and \d+ more\|and others\|and the rest` | `and 3 more` |
237
+ | Implied continuation | `repeat for\|do the same for` | `repeat for remaining products` |
238
+ | Compressed enumerations | listing 2-3 items then trailing with `, ...` or `etc.` instead of the full list | `deriveDeltas, deriveYtd, etc.` (when there are 9 items) |
239
+
240
+ 2. **Measure depth uniformity:**
241
+ - Count task lines per phase across the entire plan
242
+ - If the last 3 phases average < 50% of the first 3 phases' task-line count, flag as `SIGNIFICANT` depth decay
243
+ - If any single phase has ≤ 2 task lines when comparable phases have 10+, flag as `CRITICAL` depth decay
244
+
245
+ 3. **Check for incomplete examples:**
246
+ - Does the plan show one fully specified example (e.g., for "Broadband") and then shortcut the remaining items (e.g., "Mobile", "TV", "Bundle")?
247
+ - Are test bodies fully written or do they contain `{ ... }` pseudo-code?
248
+ - Are ID/attribute lists complete or do they trail off with "etc."?
249
+
250
+ 4. **Common failure patterns:**
251
+ - Plan writes full component spec for first product, then says "same pattern × 3 rows" for the rest
252
+ - Test descriptions list one test fully, then say "similar tests for each function"
253
+ - Data binding tables show one row completely, then reference "id=X etc." for remaining
254
+ - Lists that should enumerate all items (function names, field names, route paths) stop after 2-3 with ", etc."
255
+
256
+ 5. **Classification:**
257
+ - Any unexpanded shortcut that hides specific details (names, paths, logic) → `SIGNIFICANT` with type `MECHANICAL` (the full content must be written out)
258
+ - Depth decay across phases → `SIGNIFICANT` with type `MECHANICAL` (later phases must be expanded to match earlier phases)
259
+ - Ambiguous abbreviation where the intended expansion is unclear → `CRITICAL` with type `DECISION_REQUIRED`
260
+
261
+ ---
262
+
263
+ ## Execution Protocol
264
+
265
+ ### Step 1: Plan Ingestion
266
+
267
+ Read the plan document end-to-end. Extract:
268
+ - Total number of phases
269
+ - Technology stack references
270
+ - All technical claims (endpoints, types, fields, paths, transforms)
271
+
272
+ ### Step 2: Codebase Discovery
273
+
274
+ Identify the sources of truth in the codebase:
275
+ - Backend route files (for API contract)
276
+ - Type definition files (for type identity)
277
+ - Serialization/DTO models (for field accuracy and transforms)
278
+ - Package manifests (for dependencies)
279
+ - Sample data or test fixtures (for data shapes)
280
+
281
+ ### Step 3: Systematic Cross-Reference
282
+
283
+ Run all 8 check categories against the plan. For each finding:
284
+ - Record the **plan location** (phase number, section, line context)
285
+ - Record the **codebase evidence** (file path, line number, actual value)
286
+ - Classify severity
287
+ - For `CRITICAL` and `SIGNIFICANT`: determine if this is a **mechanical fix** (one correct answer) or a **decision required** (multiple valid options)
288
+
289
+ ### Step 4: Decision Surfacing
290
+
291
+ For findings classified as **decision required**:
292
+ - Present numbered options (A, B, C) with pros/cons
293
+ - Wait for user input (in standalone mode) or flag as blockers (in autopilot)
294
+ - Record the chosen resolution alongside the finding
295
+
296
+ ### Step 5: Report Generation
297
+
298
+ Produce a structured report (see Output Format below).
299
+
300
+ ---
301
+
302
+ ## Output Format
303
+
304
+ The report is written to the path specified by the invoking agent. Default: `.github/agent-docs/preflight-report.md`
305
+
306
+ Apply `.github/instructions/document-frontmatter.instructions.md` when creating or updating the report. The YAML frontmatter block must be the first content in the file. New reports require `Original Author`, `Creation Date`, and `Creating Model`; revised reports must preserve those fields and add or update `Last Author`, `Last Updated`, and `Last Model Used`.
307
+
308
+ ```markdown
309
+ ---
310
+ type: preflight-report
311
+ plan: <path-to-plan-file>
312
+ scope: <"full" or "phases N-M">
313
+ timestamp: <ISO-8601>
314
+ result: <PASS | FAIL>
315
+ counts:
316
+ critical: <N>
317
+ significant: <N>
318
+ minor: <N>
319
+ warn: <N>
320
+ decisions_pending: <N>
321
+ Original Author: <active author or agent name>
322
+ Creation Date: <YYYY-MM-DDTHH:MM:SSZ>
323
+ Creating Model: <exact runtime model identifier or display name>
324
+ ---
325
+
326
+ # Preflight Validation Report
327
+
328
+ **Plan:** `<path>`
329
+ **Validated against:** `<project-name>` codebase
330
+ **Scope:** <full | phases N-M>
331
+ **Result:** <PASS ✅ | FAIL ❌>
332
+
333
+ ## Summary
334
+
335
+ | Category | Checks | Pass | Fail | Warn |
336
+ |----------|--------|------|------|------|
337
+ | API Contract | N | N | N | N |
338
+ | Type Identity | N | N | N | N |
339
+ | Field Accuracy | N | N | N | N |
340
+ | Dependencies | N | N | N | N |
341
+ | Path Existence | N | N | N | N |
342
+ | Data Shape | N | N | N | N |
343
+ | Transform Correctness | N | N | N | N |
344
+ | Output Decay | N | N | N | N |
345
+ | **Total** | **N** | **N** | **N** | **N** |
346
+
347
+ ## Critical Findings
348
+
349
+ ### C1: <title>
350
+ - **Category:** <which of the 8>
351
+ - **Plan says:** <what the plan claims> (Phase N, section X)
352
+ - **Codebase says:** <what actually exists> (`path/to/file:line`)
353
+ - **Type:** Mechanical fix
354
+ - **Fix:** <exact correction>
355
+
356
+ ### C2: <title>
357
+ - **Category:** <which of the 8>
358
+ - **Plan says:** <what the plan claims>
359
+ - **Codebase says:** <what actually exists>
360
+ - **Type:** Decision required
361
+ - **Options:**
362
+ - A: <option and consequence>
363
+ - B: <option and consequence>
364
+ - C: <option and consequence>
365
+ - **Resolution:** <PENDING | chosen option with rationale>
366
+
367
+ ## Significant Findings
368
+ <same structure as critical>
369
+
370
+ ## Minor Findings
371
+ <same structure>
372
+
373
+ ## Warnings
374
+ <same structure>
375
+
376
+ ## Decisions
377
+
378
+ | ID | Finding | Options | Resolution |
379
+ |----|---------|---------|------------|
380
+ | D1 | <finding ref> | A / B / C | <PENDING or chosen> |
381
+ | D2 | ... | ... | ... |
382
+ ```
383
+
384
+ If you revise an existing report file, preserve the original metadata fields and add or update `Last Author`, `Last Updated`, and `Last Model Used` using full ISO 8601 UTC timestamps.
385
+
386
+ ---
387
+
388
+ ## Pass / Fail Criteria
389
+
390
+ | Result | Condition |
391
+ |--------|-----------|
392
+ | `PASS` | Zero CRITICAL findings AND zero pending decisions |
393
+ | `FAIL` | Any CRITICAL finding exists OR any decision is PENDING |
394
+
395
+ `SIGNIFICANT` and `MINOR` findings do not block a PASS — they are advisory. However, they should be included in the report for the Planner to address.
396
+
397
+ ---
398
+
399
+ ## Scope Restriction (Partial Validation)
400
+
401
+ When invoked with a scope like "validate phases 6-13 only":
402
+
403
+ 1. Only extract technical claims from phases 6-13 of the plan
404
+ 2. Validate against the **current** codebase (which includes work from phases 1-5)
405
+ 3. Report findings only for the scoped phases
406
+ 4. Note in the report header: `Scope: phases 6-13 (phases 1-5 assumed implemented)`
407
+
408
+ This is useful for mid-implementation re-validation where the codebase has evolved beyond what the plan originally assumed.
409
+
410
+ ---
411
+
412
+ ## Project-Agnostic Design
413
+
414
+ This skill does not assume any specific technology stack. The 7 check categories are universal — they apply to:
415
+
416
+ - Python + FastAPI + React (current validated use case)
417
+ - Node.js + Express + Vue/Angular
418
+ - Go + gRPC + React
419
+ - .NET + Blazor/React
420
+ - Any backend + any frontend combination
421
+
422
+ The agent loading this skill must adapt the "how to find routes" and "how to find types" steps to the actual stack detected in the project. The methodology (what to check and how to classify findings) is stack-agnostic.
423
+
424
+ ---
425
+
426
+ ## Anti-Patterns to Avoid
427
+
428
+ | Anti-Pattern | Why It's Wrong | Correct Approach |
429
+ |---|---|---|
430
+ | Validate only Phase 1 | Later phases have higher drift risk | Validate all phases with equal depth |
431
+ | Trust plan's stated types without searching | Types get renamed during development | Search codebase for each type name |
432
+ | Assume blanket transforms are correct | APIs often handle serialization already | Check serialization layer before recommending transforms |
433
+ | Skip data shape validation | "The types look right" ≠ "the data matches" | Read actual response samples or DTO definitions |
434
+ | Auto-resolve decisions | Product choices need human input | Surface options and wait |
435
+ | Report only failures | Context of what passed builds confidence | Include summary table with pass counts |