@ryuenn3123/agentic-senior-core 3.0.19 → 3.0.21

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 (77) hide show
  1. package/.agent-context/prompts/bootstrap-design.md +96 -103
  2. package/.agent-context/prompts/init-project.md +32 -100
  3. package/.agent-context/prompts/refactor.md +22 -44
  4. package/.agent-context/prompts/review-code.md +28 -52
  5. package/.agent-context/review-checklists/architecture-review.md +31 -62
  6. package/.agent-context/review-checklists/pr-checklist.md +74 -108
  7. package/.agent-context/rules/api-docs.md +18 -206
  8. package/.agent-context/rules/architecture.md +40 -207
  9. package/.agent-context/rules/database-design.md +10 -199
  10. package/.agent-context/rules/docker-runtime.md +5 -5
  11. package/.agent-context/rules/efficiency-vs-hype.md +11 -149
  12. package/.agent-context/rules/error-handling.md +9 -231
  13. package/.agent-context/rules/event-driven.md +17 -221
  14. package/.agent-context/rules/frontend-architecture.md +74 -119
  15. package/.agent-context/rules/git-workflow.md +1 -1
  16. package/.agent-context/rules/microservices.md +28 -161
  17. package/.agent-context/rules/naming-conv.md +8 -138
  18. package/.agent-context/rules/performance.md +9 -175
  19. package/.agent-context/rules/realtime.md +11 -44
  20. package/.agent-context/rules/security.md +11 -295
  21. package/.agent-context/rules/testing.md +9 -174
  22. package/.agent-context/state/benchmark-analysis.json +3 -3
  23. package/.agent-context/state/memory-continuity-benchmark.json +1 -1
  24. package/.agent-context/state/onboarding-report.json +71 -11
  25. package/.agents/workflows/init-project.md +7 -24
  26. package/.agents/workflows/refactor.md +7 -24
  27. package/.agents/workflows/review-code.md +7 -24
  28. package/.cursorrules +22 -21
  29. package/.gemini/instructions.md +2 -2
  30. package/.github/copilot-instructions.md +2 -2
  31. package/.instructions.md +112 -213
  32. package/.windsurfrules +22 -21
  33. package/AGENTS.md +4 -4
  34. package/CONTRIBUTING.md +13 -22
  35. package/README.md +6 -20
  36. package/lib/cli/commands/init.mjs +102 -148
  37. package/lib/cli/commands/launch.mjs +3 -3
  38. package/lib/cli/commands/optimize.mjs +14 -4
  39. package/lib/cli/commands/upgrade.mjs +25 -23
  40. package/lib/cli/compiler.mjs +96 -62
  41. package/lib/cli/constants.mjs +28 -136
  42. package/lib/cli/detector/design-evidence.mjs +189 -6
  43. package/lib/cli/detector.mjs +6 -7
  44. package/lib/cli/init-detection-flow.mjs +10 -93
  45. package/lib/cli/init-selection.mjs +2 -68
  46. package/lib/cli/project-scaffolder/constants.mjs +1 -1
  47. package/lib/cli/project-scaffolder/design-contract.mjs +183 -108
  48. package/lib/cli/project-scaffolder/discovery.mjs +36 -82
  49. package/lib/cli/project-scaffolder/prompt-builders.mjs +45 -55
  50. package/lib/cli/project-scaffolder/storage.mjs +0 -2
  51. package/lib/cli/token-optimization.mjs +1 -1
  52. package/lib/cli/utils.mjs +75 -9
  53. package/package.json +2 -2
  54. package/scripts/detection-benchmark.mjs +4 -15
  55. package/scripts/documentation-boundary-audit.mjs +9 -9
  56. package/scripts/explain-on-demand-audit.mjs +11 -11
  57. package/scripts/forbidden-content-check.mjs +9 -9
  58. package/scripts/frontend-usability-audit.mjs +45 -35
  59. package/scripts/llm-judge.mjs +1 -1
  60. package/scripts/mcp-server/constants.mjs +2 -2
  61. package/scripts/mcp-server/tool-registry.mjs +1 -1
  62. package/scripts/release-gate/audit-checks.mjs +22 -7
  63. package/scripts/release-gate/static-checks.mjs +5 -5
  64. package/scripts/release-gate.mjs +1 -1
  65. package/scripts/rules-guardian-audit.mjs +14 -13
  66. package/scripts/single-source-lazy-loading-audit.mjs +3 -3
  67. package/scripts/sync-thin-adapters.mjs +5 -5
  68. package/scripts/ui-design-judge/design-execution-summary.mjs +27 -1
  69. package/scripts/ui-design-judge/prompting.mjs +5 -5
  70. package/scripts/ui-design-judge/reporting.mjs +3 -1
  71. package/scripts/ui-design-judge/rubric-calibration.mjs +8 -5
  72. package/scripts/ui-design-judge/rubric-goldset.json +2 -2
  73. package/scripts/ui-design-judge.mjs +75 -7
  74. package/scripts/validate/config.mjs +138 -48
  75. package/scripts/validate/coverage-checks.mjs +32 -7
  76. package/scripts/validate.mjs +8 -4
  77. package/lib/cli/architect.mjs +0 -431
@@ -1,112 +1,105 @@
1
-
2
1
  # Bootstrap Dynamic Design Contract
3
2
 
4
- When a user requests frontend design or redesign, the agent should automatically synthesize a dynamic design contract made of:
5
- - `docs/DESIGN.md` for human-readable design direction and implementation rationale
6
- - `docs/design-intent.json` for machine-readable intent, anti-generic constraints, and validation hints
3
+ When a user requests UI, UX, frontend layout, screen, Tailwind, animation, or redesign work, create or refine:
4
+ - `docs/DESIGN.md` for human-readable design reasoning
5
+ - `docs/design-intent.json` for machine-readable design intent, guardrails, and review signals
6
+
7
+ This contract is a decision scaffold, not a style preset. It must guide the LLM to choose well from the current repo, current user brief, current project docs, and live official documentation when a technology or library claim matters.
7
8
 
8
- This contract is a structure and reasoning system, not a fixed visual template. It must adapt to product context, user needs, platform constraints, and current design signals.
9
+ ## Core Rule
9
10
 
10
- UI Design Mode is context-isolated by default:
11
- - Load [AGENTS.md](../../AGENTS.md), [frontend-architecture.md](../rules/frontend-architecture.md), this prompt, UI-relevant state files, current UI code, and existing design docs first.
12
- - Do not eagerly load backend-only rules such as [database-design.md](../rules/database-design.md), [docker-runtime.md](../rules/docker-runtime.md), or [microservices.md](../rules/microservices.md) unless the task explicitly crosses those boundaries.
13
- - Treat UI consistency, accessibility, and cross-viewport adaptation as first-class constraints, not cosmetic afterthoughts.
14
- - Start the visual language from the current project context, not from prior website references or remembered layouts from earlier chats.
11
+ We guide the agent; we do not pick the final style, stack, framework, palette, typography, layout paradigm, or animation library offline.
15
12
 
16
13
  The agent must:
17
- 1. Read [AGENTS.md](../../AGENTS.md) for project context and team roles.
18
- 2. Read [frontend-architecture.md](../rules/frontend-architecture.md) and apply its UI consistency guardrails.
19
- 3. Use repository evidence from [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), existing UI code, product copy, route names, component names, and any existing `docs/*` project docs to infer architecture and product background.
20
- 4. If `repoEvidence.designEvidenceSummary` exists, treat it as the machine-readable snapshot of the current visual system, token bypasses, and UI surface inventory before proposing a new direction.
21
- 5. When analyzing an existing UI codebase, inspect low-cost evidence such as hardcoded color density, prop-drilling candidates, breakpoint chaos, CSS variable patterns, and component surface inventory before declaring the current design direction healthy.
22
- 6. If [docs/DESIGN.md](../../docs/DESIGN.md) or `docs/design-intent.json` already exists, check for drift and improve them instead of rewriting blindly.
23
- 7. If context is incomplete, write explicit assumptions and reversible design bets instead of defaulting to generic SaaS output.
24
- 8. Explore multiple plausible design directions internally, then commit to one cohesive direction with clear rationale tied to the product context and at least one memorable signature move.
25
- 9. Treat any example structure or stylistic inspiration as non-normative. Use it only to judge depth and clarity, never to copy a visual language directly.
26
- 10. All references to docs or rules must be clickable markdown links.
27
- 11. Responsive work must adapt layout, navigation, density, and task order across viewports. Shrinking desktop layouts is not enough.
28
- 12. Motion can be bold, cinematic, or highly expressive when it improves memorability, hierarchy, feedback, or perceived product quality. Do not flatten everything into static screens. Optimize motion first, and only reject it when it harms clarity, accessibility, or runtime performance.
29
- 13. Define how core components morph across interaction states and viewports. Component quality is not only visual styling; it includes behavior under hover, focus, active, loading, error, and constrained layouts.
30
- 14. Do not reuse a color palette, component skin, or motion signature from prior chats, memories, or unrelated projects unless current repo evidence or the active brand brief explicitly asks for that continuity.
31
- 15. Treat prior website memory, old portfolio styles, and remembered screenshots as tainted context unless the user explicitly asks to continue or evolve that specific visual system.
32
- 16. Do not default to balanced card grids, soft startup gradients, safe centered heroes, or neutral dashboard chrome unless the product context explicitly justifies them.
33
- 17. For design work, only these count as valid style context by default: current repo evidence, the current user brief, current project docs, and explicitly approved reference systems.
34
- 18. Design continuity is opt-in. If the user does not explicitly ask for continuity with an older system, prefer fresh synthesis from the current repo and brief.
35
- 19. Accessibility must be split into a hard compliance floor and an advisory readability layer. Use WCAG 2.2 AA as the blocking baseline, and use APCA only as advisory perceptual tuning. APCA must never waive a WCAG failure.
36
- 20. Accessibility planning must cover more than color contrast. It must explicitly address focus visibility, focus appearance, target size, keyboard access, accessible authentication, and dynamic state/status access.
37
- 21. Structured design execution must stay representation-first. Define a surface plan, component graph, content-priority map, viewport mutation plan, and interaction-state matrix before relying on semantic review.
38
- 22. Do not depend on screenshot capture, browser automation, or image diff artifacts as the default path. The contract must be strong enough to guide precise UI from repo evidence, component logic, and user intent alone.
39
- 23. Semantic review should judge contract fidelity, distinctiveness, hierarchy, state behavior, and viewport mutation directly from the contract and changed UI code.
40
- 24. Distinctive design review must use a stable review rubric. The contract should define how to judge distinctiveness, contract fidelity, visual consistency, heuristic UX quality, and motion discipline without collapsing those into one vague taste score.
41
- 25. Genericity findings must name the actual drift signal. Do not say "generic" without tying it to a rubric dimension or explicit anti-pattern.
42
- 26. Separate taste from failure. A bold design is valid when it still follows the contract, serves the product, and respects accessibility and runtime constraints.
43
-
44
- Required `docs/DESIGN.md` sections:
14
+ 1. Read [AGENTS.md](../../AGENTS.md), this prompt, [frontend-architecture.md](../rules/frontend-architecture.md), current UI code, current project docs, and existing design docs before UI edits.
15
+ 2. If `docs/DESIGN.md` or `docs/design-intent.json` exists, refine them instead of replacing them blindly.
16
+ 3. If either design doc is missing, create it before UI implementation.
17
+ 4. Use current repo evidence, product copy, route names, component names, user goals, and existing constraints as the source of truth.
18
+ 5. Treat prior-chat visuals, unrelated project memory, benchmark screenshots, and famous-product aesthetics as tainted unless the user explicitly asks for continuity.
19
+ 6. When choosing a new UI, animation, styling, or component library, research current official docs and choose the latest stable compatible option for this project. Do not rely on offline defaults.
20
+ 7. Keep external references non-copying: extract constraints and reasoning only, never clone the surface.
21
+
22
+ ## Zero-Based Redesign Protocol
23
+
24
+ If the user says "redesign from zero", "redesain dari 0", "ulang dari 0", "research ulang", or equivalent reset language, activate reset mode.
25
+
26
+ In reset mode:
27
+ - Existing UI and existing design docs are content, behavior, accessibility, and repo-evidence inputs only. They are not visual continuity sources.
28
+ - Replace or materially rewrite `docs/DESIGN.md` and `docs/design-intent.json` before implementation so the new contract cannot inherit old palette, typography, layout, navigation shape, component morphology, motion signature, or image placement by accident.
29
+ - Define a `visualResetStrategy` that names the old visual DNA being discarded and the new direction being selected from current brief, repo evidence, and live official documentation.
30
+ - The implementation must change composition, hierarchy, palette/typography, motion/interaction, and responsive information architecture. A palette swap, dark-mode flip, or same hero with new colors is failure.
31
+ - Keep product data, copy requirements, routes, accessibility needs, and required local assets intact unless the user explicitly says they may be removed.
32
+ - If a modern UI, animation, scroll, 3D, canvas, chart, or icon library is useful, research current official docs and record the selected library, source URL, fetched date, reason, performance risk, and reduced-motion/accessibility fallback.
33
+
34
+ ## Design Quality Bar
35
+
36
+ The UI must feel authored by a strong UI/UX designer, not assembled from default cards and safe framework chrome.
37
+
38
+ Do:
39
+ - Synthesize a visual direction from the project context and explain why it fits.
40
+ - Choose color, typography, spacing, motion, density, and component morphology dynamically from the product and audience.
41
+ - Use modern, expressive interaction when it improves hierarchy, feedback, delight, confidence, or memorability.
42
+ - Keep frontend code clean, componentized, accessible, and easy to maintain.
43
+ - Use tokens and semantic aliases so future changes do not require rewriting components.
44
+ - Make design decisions explicit before coding, then implement consistently.
45
+
46
+ Do not:
47
+ - Default to generic SaaS heroes, balanced card grids, soft startup gradients, or dashboard chrome without product rationale.
48
+ - Let desktop, tablet, and mobile be the same design merely scaled down.
49
+ - Let heading, body, data, and metadata collapse into one safe typographic treatment without rationale.
50
+ - Reuse colors, layout shapes, or motion signatures from unrelated memory.
51
+ - Add decorative animation that hurts clarity, accessibility, or runtime performance.
52
+ - Choose a dependency because this repo scaffold mentioned it. The LLM must verify fit from current project context and official docs.
53
+
54
+ ## Responsive Rule
55
+
56
+ Responsive design means recomposition, not resizing.
57
+
58
+ For every UI task, define how major surfaces change across mobile, tablet, and desktop:
59
+ - What is reordered, merged, hidden, disclosed, or promoted?
60
+ - What interaction changes for touch and narrow screens?
61
+ - What content priority changes by viewport?
62
+ - What is explicitly forbidden, such as scale-only shrink or preserving desktop order without reason?
63
+
64
+ ## Required `docs/DESIGN.md` Sections
65
+
45
66
  1. Design Intent and Product Personality
46
67
  2. Audience and Use-Context Signals
47
68
  3. Visual Direction and Distinctive Moves
48
- 4. Color Science and Semantic Roles
49
- 5. Typographic Engineering and Hierarchy
50
- 6. Spacing, Layout Rhythm, and Density Strategy
51
- 7. Token Architecture and Alias Strategy
52
- 8. Responsive Strategy and Cross-Viewport Adaptation Matrix
53
- 9. Interaction, Motion, and Feedback Rules
54
- 10. Component Language, Morphology, and Shared Patterns
55
- 11. Context Hygiene and Approved Reference Boundaries
56
- 12. Accessibility Non-Negotiables
57
- 13. Anti-Patterns to Avoid
58
- 14. Implementation Notes for Future UI Tasks
59
-
60
- Required `docs/design-intent.json` fields:
61
- - `mode`
62
- - `status`
63
- - `project`
64
- - `designPhilosophy`
65
- - `brandAdjectives`
66
- - `antiAdjectives`
67
- - `visualDirection`
68
- - `mathSystems`
69
- - `tokenSystem`
70
- - `colorTruth`
71
- - `crossViewportAdaptation`
72
- - `motionSystem`
73
- - `componentMorphology`
74
- - `accessibilityPolicy`
75
- - `designExecutionPolicy`
76
- - `designExecutionHandoff`
77
- - `reviewRubric`
78
- - `contextHygiene`
79
- - `experiencePrinciples`
80
- - `forbiddenPatterns`
81
- - `validationHints`
82
- - `requiredDesignSections`
83
- - `implementation`
84
- - `repoEvidence` when onboarding or detector evidence exists
85
-
86
- Output:
87
- - Create or update both `docs/DESIGN.md` and `docs/design-intent.json`.
88
- - Keep both files synchronized: the markdown explains the why, the JSON captures the contract in machine-readable form.
89
- - `docs/design-intent.json` must define a real token system, not just loose style notes. Include primitive, semantic, and component layers plus aliasing rules and naming constraints.
90
- - `docs/design-intent.json` must include deterministic fields for `colorTruth.format`, `colorTruth.allowHexDerivatives`, and `crossViewportAdaptation.mutationRules.mobile/tablet/desktop`.
91
- - `docs/design-intent.json` must also include `motionSystem` and `componentMorphology` so future UI work preserves state behavior and purposeful motion without collapsing into generic static output.
92
- - `docs/design-intent.json` must also include `accessibilityPolicy` so the hard compliance floor, advisory contrast model, and blocking-vs-advisory checks stay machine-readable.
93
- - `docs/design-intent.json` must also include `designExecutionPolicy` so structured handoff rules, representation strategy, semantic review focus, and non-screenshot execution boundaries stay machine-readable.
94
- - `docs/design-intent.json` must also include `designExecutionHandoff` so surface plans, component graph relationships, content priority, viewport mutation, interaction states, and signature move rationale are explicit before implementation begins.
95
- - `docs/design-intent.json` must also include `reviewRubric` so distinctiveness, genericity drift, taste-vs-failure boundaries, and motion discipline are judged with stable dimensions instead of ad hoc opinion.
96
- - `docs/design-intent.json` must include `contextHygiene` so valid design sources, tainted carryover sources, and continuity rules are machine-readable.
97
- - If onboarding or detector evidence exists, preserve it under `repoEvidence.designEvidenceSummary` instead of throwing away the machine-readable snapshot of the current UI system.
98
- - Token intent must stay structure-first: primitive tokens hold raw values, semantic tokens carry purpose, and component tokens consume semantic tokens instead of bypassing them with raw values.
99
- - Color intent must be defined in a perceptual or relational color model first. Hex values may appear only as implementation derivatives.
100
- - The contract must encode viewport mutation rules, not just breakpoint names.
101
- - Motion guidance must preserve creativity: allow meaningful animation, define reduced-motion behavior, and optimize choreography instead of suppressing it by default.
102
- - Accessibility guidance must split hard compliance from advisory tuning: treat WCAG 2.2 AA as the minimum blocking floor and APCA as advisory perceptual guidance for readability nuance, especially in typography and dark mode.
103
- - Accessibility scope must include focus visibility, focus appearance, target size, accessible authentication, keyboard access, use-of-color-only failures, and dynamic status/state access.
104
- - Structured design execution guidance must define the surface plan, component graph, content-priority map, viewport mutation plan, interaction-state matrix, and semantic review focus without relying on screenshot capture.
105
- - Structured design execution must include an explicit structured handoff in `docs/design-intent.json`, not just policy booleans. The handoff should be detailed enough that a future agent can implement the UI without falling back to generic layout defaults.
106
- - The review rubric must define stable dimensions, genericity signals, valid bold signals, and reporting rules that force the agent to explain why something is generic or valid.
107
- - Color direction must come from the current project context. Similarity to prior unrelated projects is drift unless the brief or repo evidence explicitly supports it.
108
- - If no approved reference system exists, synthesize the design from zero using current product context, constraints, and content only.
109
- - Explicitly record which sources are allowed to shape the visual language and which sources are tainted unless the user opts into continuity.
110
- - The resulting system should feel authored and recognizable in implementation, not politely interchangeable with common template kits.
111
- - Use practical, modern, accessible language grounded in the project, not generic SaaS defaults or copycat brand systems.
112
- - Wait for user approval before generating Figma or code assets.
69
+ 4. Color, Typography, Spacing, and Density Decisions
70
+ 5. Token Architecture and Alias Strategy
71
+ 6. Responsive Recomposition Plan
72
+ 7. Motion, Interaction, and Feedback Rules
73
+ 8. Component Language, States, and Morphology
74
+ 9. Source Boundaries and Context Hygiene
75
+ 10. Accessibility Non-Negotiables
76
+ 11. Anti-Patterns to Avoid
77
+ 12. Implementation Notes for Future UI Tasks
78
+
79
+ ## Required `docs/design-intent.json` Behavior
80
+
81
+ The JSON must stay machine-readable and project-specific. It should record:
82
+ - the confirmed project context and assumptions to validate
83
+ - agent-chosen visual direction, not scaffold-chosen direction
84
+ - agent-chosen semantic color roles, typography system, spacing rhythm, and motion approach
85
+ - token layering with primitive, semantic, and component tokens
86
+ - viewport mutation rules for mobile, tablet, and desktop
87
+ - interaction-state expectations for key components
88
+ - accessibility hard floor and advisory readability checks
89
+ - review rubric for distinctiveness, contract fidelity, hierarchy, responsive recomposition, motion discipline, and accessibility
90
+ - forbidden patterns that are concrete bad habits for this project
91
+ - repo evidence when available, including `repoEvidence.designEvidenceSummary`
92
+
93
+ ## Accessibility and Review
94
+
95
+ WCAG 2.2 AA is the hard floor. APCA may be used only as advisory perceptual tuning and must never waive a WCAG failure.
96
+
97
+ The review must block or flag:
98
+ - inaccessible contrast, focus, target size, keyboard, auth, or dynamic-status behavior
99
+ - scale-only responsive behavior
100
+ - unresearched dependency choices
101
+ - default component-kit styling without product rationale
102
+ - visual direction copied from unrelated memory or external references
103
+ - genericity findings that cannot name the exact drift signal
104
+
105
+ Wait for user approval before generating Figma or code assets when the user only asked for planning or design direction.
@@ -1,113 +1,45 @@
1
-
2
1
  # Project Initialization Prompts
3
2
 
4
- This prompt boots a repository with strict rules operations context (Federated Governance baseline).
3
+ This prompt boots a repository with strict AI coding guidance context.
5
4
 
6
5
  ## System Directives (Auto Execution)
7
6
 
8
- When a new project is created or initialized, the agent should automatically:
9
- 1. Read [AGENTS.md](../../AGENTS.md) to understand available roles and knowledge base.
10
- 2. Scan all files in [.agent-context/rules/](../rules/) for mandatory engineering standards.
11
- 3. Review dynamic stack and architecture signals from [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.agent-context/state/stack-research-snapshot.json](../state/stack-research-snapshot.json), available stack and blueprint sources, and task constraints.
12
- 4. If Docker or Compose is in scope, load [docker-runtime.md](../rules/docker-runtime.md) and verify the latest official Docker guidance before authoring container assets. Prefer latest stable compatible images, dependencies, and Compose syntax first; only step down after documenting why.
13
- 5. For framework or package setup, prefer the latest stable compatible dependency set and official framework setup flow first. Only pin older versions after documenting the exact compatibility reason.
14
-
15
- ## Architect Mode (Recommended)
16
- If the user describes a project or feature, the agent should:
17
- 1. Propose the most efficient technology stack based on requirements and evidence.
18
- 2. Explain why this stack is the best choice for the project.
19
- 3. Draft a high-level architecture plan.
20
- 4. Wait for user approval before scaffolding the project using the selected architecture playbook.
21
-
22
- ## Direct Blueprint Mode
23
- If the user specifies a framework/blueprint, the agent should:
24
- 1. Read [AGENTS.md](../../AGENTS.md) for role context.
25
- 2. Scan all files in [.agent-context/rules/](../rules/) for engineering standards.
26
- 3. Reference [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.cursorrules](../../.cursorrules), and [.windsurfrules](../../.windsurfrules) for the active stack and blueprint guidance already applied to this project.
27
- 4. Scaffold the initial project structure following the blueprint exactly:
28
- - Create all directories and files from the blueprint
29
- - Set up environment config and validation (e.g., Zod, Pydantic, FluentValidation)
30
- - Set up error handling foundation (base error class + global handler)
31
- - Set up the logger
32
- - Create a health check endpoint
33
- - Initialize the ORM/Database connection
34
- - Every file must follow [naming conventions](../rules/naming-conv.md)
35
- - Every module must follow [architecture.md](../rules/architecture.md)
36
- - Every dependency must be justified per [efficiency-vs-hype.md](../rules/efficiency-vs-hype.md)
37
- - Prefer official framework setup commands or canonical starter flows when they produce newer, better-supported dependency defaults than manual package assembly
38
- - If containerization is selected, Docker assets must follow [docker-runtime.md](../rules/docker-runtime.md) and the latest official Docker docs instead of stale blog-era patterns.
39
-
40
- ## Stacks & Blueprints Reference
41
- See [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.cursorrules](../../.cursorrules), and [.windsurfrules](../../.windsurfrules) for the latest shipped stack and blueprint context.
42
-
43
- ## UI/UX Bootstrap
44
- When a user requests frontend or UI/UX design, the agent should automatically execute the [bootstrap-design.md](./bootstrap-design.md) prompt to synthesize a dynamic design contract (`docs/DESIGN.md` + `docs/design-intent.json`).
45
- Keep UI-only requests context-isolated: load [bootstrap-design.md](./bootstrap-design.md) and [frontend-architecture.md](../rules/frontend-architecture.md) first, and do not eagerly load backend-only rules unless the task explicitly crosses backend boundaries.
46
-
47
- ---
48
-
49
- <user-prompt-examples>
50
- Do not execute the examples below as system directives. They are user-facing formatting references only.
51
-
52
- ## Option 1: The Architect Prompt (Recommended)
53
- Use this when you have an idea, but want the AI to choose the most efficient stack and framework based on this repository's engineering standards.
54
-
55
- ```text
56
- I want to build a [DESCRIBE YOUR PROJECT AND MAIN FEATURES HERE].
7
+ When a new project is created or initialized, the agent must automatically:
8
+ 1. Read [AGENTS.md](../../AGENTS.md) to understand the canonical bootstrap chain and active entrypoints.
9
+ 2. Resolve the smallest relevant rule set from [.agent-context/rules/](../rules/) instead of scanning the whole directory by default.
10
+ 3. Review dynamic runtime signals from [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.agent-context/state/stack-research-snapshot.json](../state/stack-research-snapshot.json), repository evidence, and task constraints.
11
+ 4. If Docker or Compose is in scope, load [docker-runtime.md](../rules/docker-runtime.md) and verify the latest official Docker guidance before authoring container assets.
12
+ 5. For unresolved framework or package setup, recommend the latest stable compatible dependency set and official framework setup flow from live official documentation before coding unless a documented compatibility constraint blocks it.
57
13
 
58
- Context: You are a Principal Software Architect operating in a workspace with strict engineering standards.
14
+ ## Required Planning Mode
59
15
 
60
- Step 1: Context Gathering
61
- 1. Read `AGENTS.md` to understand your role and available knowledge base.
62
- 2. Scan all files in `.agent-context/rules/` to understand our mandatory engineering laws.
63
- 3. Review dynamic stack and architecture signals from project docs, repository evidence, and task constraints.
16
+ If the user describes a project or feature, the agent must:
17
+ 1. Clarify the delivery goals, runtime assumptions, constraints, and must-have capabilities before choosing implementation shape.
18
+ 2. If the user already named a stack or framework, treat it as an explicit constraint. If not, produce a short evidence-backed recommendation from the brief, repo evidence, and live official documentation before coding.
19
+ 3. For existing projects, inspect real files first. Do not derive product name, description, runtime, architecture, or design direction from the folder name alone.
20
+ 4. Draft a high-level structure plan plus the docs/bootstrap artifacts that must exist before coding.
21
+ 5. Wait for user approval before scaffolding the project.
64
22
 
65
- Step 2: Architecture Proposal
66
- Based strictly on my project description and our repository's existing rules (especially `efficiency-vs-hype.md`):
67
- 1. Propose the most efficient technology stack based on requirements and evidence.
68
- 2. Explain WHY this stack is the best choice for this specific project.
69
- 3. Draft a high-level architecture plan.
23
+ ## Direct Constraint Mode
70
24
 
71
- Do not write any application code yet. Write your proposal and wait for my approval. Once I approve, you will scaffold the project using the selected architecture playbook.
72
- ```
73
-
74
- ---
75
-
76
- ## Option 2: The Direct Blueprint Prompt
77
- Use this when you already know exactly which framework you want to use from the available blueprints.
78
-
79
- ```text
80
- I want to build [PROJECT NAME].
81
-
82
- Before writing any code:
83
- 1. Read `AGENTS.md` to understand your role.
84
- 2. Read ALL files in `.agent-context/rules/` to understand our engineering standards.
85
- 3. Resolve language-specific guidance from dynamic stack signals.
86
- 4. Resolve the project structure from the selected architecture playbook.
87
-
88
- Now scaffold the initial project structure following the blueprint exactly:
89
- - Create all directories and files from the blueprint
90
- - Set up the environment config and validation (e.g., Zod, Pydantic, FluentValidation)
91
- - Set up the error handling foundation (base error class + global handler)
92
- - Set up the logger
93
- - Create a health check endpoint
94
- - Initialize the ORM/Database connection
95
-
96
-
97
- Every file must follow [naming conventions](../rules/naming-conv.md).
98
- Every module must follow [architecture.md](../rules/architecture.md).
99
- Every dependency must be justified per [efficiency-vs-hype.md](../rules/efficiency-vs-hype.md).
100
- ```
101
-
102
- ---
103
-
104
- ## Stacks & Blueprints Reference
25
+ If the user specifies a framework, runtime, or architecture constraint, the agent must:
26
+ 1. Read [AGENTS.md](../../AGENTS.md) for role context.
27
+ 2. Resolve only the rules required by the explicit constraint and scope. Do not read unrelated backend, frontend, or DevOps rules by habit.
28
+ 3. Reference [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.cursorrules](../../.cursorrules), and [.windsurfrules](../../.windsurfrules) for runtime evidence and any explicit constraints already applied to this project.
29
+ 4. Scaffold the initial project structure only after runtime and architecture decisions are explicit:
30
+ - Create only the directories and files justified by the approved structure.
31
+ - Set up configuration, validation, error handling, observability, health checks, and persistence only when they fit the approved runtime and project scope.
32
+ - Every file must follow [naming conventions](../rules/naming-conv.md).
33
+ - Every module must follow [architecture.md](../rules/architecture.md).
34
+ - Every dependency must be justified per [efficiency-vs-hype.md](../rules/efficiency-vs-hype.md).
35
+ - Use official framework setup commands or canonical starter flows when they produce newer, better-supported dependency defaults than manual package assembly.
36
+ - If containerization is selected, Docker assets must follow [docker-runtime.md](../rules/docker-runtime.md) and the latest official Docker docs instead of stale blog-era patterns.
105
37
 
106
- See [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.cursorrules](../../.cursorrules), and [.windsurfrules](../../.windsurfrules) for the latest shipped stack and blueprint context.
38
+ ## Runtime and Architecture Reference
107
39
 
108
- ---
40
+ See [.agent-context/state/onboarding-report.json](../state/onboarding-report.json), [.cursorrules](../../.cursorrules), and [.windsurfrules](../../.windsurfrules) for the latest shipped runtime evidence, explicit constraints, and agent-decision status.
109
41
 
110
- ## Bootstrap UI/UX (Dynamic Design Contract)
42
+ ## UI/UX Bootstrap
111
43
 
112
- To start UI/UX design from scratch, use the [bootstrap-design.md](./bootstrap-design.md) prompt to synthesize `docs/DESIGN.md` and `docs/design-intent.json`.
113
- </user-prompt-examples>
44
+ When a user requests frontend or UI/UX design, the agent must automatically execute the [bootstrap-design.md](./bootstrap-design.md) prompt to synthesize a dynamic design contract (`docs/DESIGN.md` + `docs/design-intent.json`).
45
+ Keep UI-only requests context-isolated: load [bootstrap-design.md](./bootstrap-design.md) and [frontend-architecture.md](../rules/frontend-architecture.md) first, and do not eagerly load backend-only rules unless the task explicitly crosses backend boundaries.
@@ -1,52 +1,30 @@
1
1
  # Prompt: Refactor Code
2
2
 
3
- > Copy-paste this prompt when code needs restructuring to follow the rules.
3
+ Use this when code needs cleanup, splitting, or safer structure without changing user-visible behavior.
4
4
 
5
- ---
5
+ ```text
6
+ Refactor the target code while preserving existing behavior.
6
7
 
7
- ## The Prompt
8
-
9
- ```
10
- Refactor the following code (or module) to comply with our engineering standards.
11
-
12
- Before making changes:
13
- 1. Read .agent-context/rules/architecture.md — ensure proper layer separation.
14
- 2. Read .agent-context/rules/naming-conv.md — fix all naming violations.
15
- 3. Read .agent-context/rules/error-handling.md — fix error handling patterns.
16
- 4. Resolve active language guidance from dynamic stack signals (TypeScript in this repository).
17
- 5. Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.
8
+ Before editing:
9
+ 1. Read AGENTS.md and the smallest relevant rules from .agent-context/rules/.
10
+ 2. Inspect the real repo conventions before introducing a new structure.
11
+ 3. If required project docs are missing, stop and bootstrap or update docs first.
12
+ 4. If the change touches UI, load .agent-context/prompts/bootstrap-design.md and .agent-context/rules/frontend-architecture.md before editing.
13
+ 5. If the change touches a dependency, framework, Docker, runtime, or ecosystem claim, verify current official docs before choosing.
18
14
  6. Enforce Universal SOP hard gate: stop implementation if `docs/architecture-decision-record.md` is missing, and for UI scope stop if `docs/DESIGN.md` or `docs/design-intent.json` is missing.
15
+ 7. Enforce backend universal principles: no clever hacks, no premature abstraction, readability over brevity.
19
16
 
20
- For every change you make, provide a Reasoning Chain:
21
- - What was wrong (rule reference)
22
- - Why it was wrong (explain the risk/problem)
23
- - What you changed (show the improvement)
24
-
25
- Refactor guidance:
17
+ Refactor rules:
18
+ - Improve clarity, boundaries, naming, validation, error handling, tests, and docs.
26
19
  - Prioritize maintainability over compressed one-liners.
27
- - Prefer explicit readable control flow when short forms hide intent.
28
- - Do not introduce shared abstractions before patterns are repeated and stable.
29
-
30
- Maintain ALL existing functionality. This is a refactor, not a rewrite.
31
- Add or update tests if the refactored code changes behavior contracts.
32
- ```
33
-
34
- ## Extract Module Prompt
35
-
36
- ```
37
- Extract [FEATURE_NAME] into its own module following .agent-context/rules/architecture.md:
38
-
39
- 1. Create the module directory: src/modules/[feature-name]/
40
- 2. Separate into layers:
41
- - controller (transport — HTTP in/out only)
42
- - service (business logic — no HTTP, no SQL)
43
- - repository (data access — no business rules)
44
- - dto (Zod schemas for input validation)
45
- - types (type definitions)
46
- 3. Create barrel export (index.ts) exposing ONLY the public API
47
- 4. Update imports in consuming modules to use the new module path
48
- 5. Add unit tests for the service layer
49
-
50
- Follow naming-conv.md for all file and variable names.
51
- Provide a Reasoning Chain for every structural decision.
20
+ - Do not choose a stack, framework, library, or topology from offline assumptions.
21
+ - Keep module boundaries explicit and project-specific.
22
+ - Split large files when the split makes the flow easier to understand.
23
+ - Do not introduce abstractions before the repeated pattern is real.
24
+ - Update tests and docs whenever behavior contracts, public APIs, data shape, or UI contracts change.
25
+
26
+ For every meaningful change, explain:
27
+ - what risk or friction existed
28
+ - what changed
29
+ - why the new shape is safer or easier to maintain
52
30
  ```
@@ -1,55 +1,31 @@
1
1
  # Prompt: Review Code
2
2
 
3
- > Copy-paste this prompt when you want the AI to self-review its own code
4
- > or review code you've written.
5
-
6
- ---
7
-
8
- ## The Prompt
9
-
10
- ```
11
- Run a comprehensive code review on the current codebase (or the files I'm about to show you).
12
-
13
- Use these checklists:
14
- 1. Read .agent-context/review-checklists/pr-checklist.md apply every item.
15
- 2. Read .agent-context/review-checklists/architecture-review.md apply every item.
16
- 3. Apply documentation scope rules exactly: This applies to documentation, release notes, onboarding text, review summaries, and agent-facing explanations.
17
- 4. Treat scope-style findings as advisory unless they hide factual errors, contract mismatches, or non-negotiable violations.
18
- 5. Enforce documentation hard blockers on changed boundaries: public surface changes, API contract changes, and database structure changes must include synchronized documentation updates.
19
- 6. Enforce context-triggered strict audits: review requests, PR-intent workflows, and major feature completion must run strict security and performance audits; small edits stay lightweight unless strict mode is explicitly forced.
20
- 7. Enforce cross-session consistency guardian: session handoff must include active architecture contract summary, drift detection must warn before direction changes, and direction changes require explicit user confirmation.
21
- 8. Enforce explain-on-demand state visibility: default responses must avoid unnecessary state-file internals, state internals are exposed only on explicit request, and diagnostic mode must explain relevant state decisions when needed.
22
- 9. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, language-specific guidance must load lazily based on detected scope, and conflicting duplicate rule instructions must not appear during normal flow.
23
- 10. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (`docs/architecture-decision-record.md`, and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
24
-
25
- For EVERY violation found:
26
- - State the exact file and line
27
- - Reference the specific rule (file + section)
28
- - Explain WHY it's a problem (not just "it violates the rule")
29
- - Provide the corrected code
30
-
31
- Output format:
32
- ## PR REVIEW RESULTS
33
- PASS [Item]
34
- FAIL [Item] (with Reasoning Chain)
35
-
36
- ## SECURITY AUDIT RESULTS
37
- CRITICAL/HIGH/MEDIUM/LOW [Finding] — severity + fix
38
-
39
- VERDICT: PASS / FAIL
40
- ```
41
-
42
- ## Quick Review (Subset)
43
-
44
- If you want a faster review focusing on the most critical items:
45
-
46
- ```
47
- Quick review the current code. Check ONLY:
48
- 1. Any use of `any` type? (dynamic TypeScript stack guidance)
49
- 2. Any empty catch blocks? (rules/error-handling.md)
50
- 3. Any N+1 queries? (rules/performance.md)
51
- 4. Any hardcoded secrets? (rules/security.md)
52
- 5. Any missing input validation? (rules/security.md)
53
-
54
- Use the Reasoning Clause for every finding.
3
+ Use this when reviewing current changes, a pull request, or a focused file set.
4
+
5
+ ```text
6
+ Review the code with a production-risk mindset.
7
+
8
+ Before reviewing:
9
+ 1. Read AGENTS.md.
10
+ 2. Read .agent-context/review-checklists/pr-checklist.md.
11
+ 3. Read .agent-context/review-checklists/architecture-review.md only when architecture or boundaries changed.
12
+ 4. Load only the rules relevant to the changed scope.
13
+ 5. For UI changes, load .agent-context/prompts/bootstrap-design.md, .agent-context/rules/frontend-architecture.md, docs/DESIGN.md, and docs/design-intent.json when present.
14
+ 6. Enforce Universal SOP hard gate: block coding flow when required project docs are missing (`docs/architecture-decision-record.md`, and for UI scope `docs/DESIGN.md` plus `docs/design-intent.json`).
15
+ 7. Enforce single-source and lazy-loading policy: canonical rule source must be explicitly enforced, language-specific guidance must load lazily based on detected scope, and conflicting duplicate rule instructions must not appear during normal flow.
16
+
17
+ Prioritize findings in this order:
18
+ 1. Correctness, data loss, security, privacy, auth, and permission risks.
19
+ 2. Public contract drift: APIs, events, CLI behavior, data model, UI contract, docs.
20
+ 3. Missing tests for changed behavior.
21
+ 4. Architecture boundary drift and maintainability risk.
22
+ 5. Performance and accessibility issues with concrete impact.
23
+
24
+ For every finding:
25
+ - include file and line
26
+ - explain the real risk
27
+ - reference the rule or contract only when it materially supports the finding
28
+ - propose the smallest safe fix
29
+
30
+ Do not invent stack-specific concerns unless the repo or changed files prove they apply.
55
31
  ```