You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 5 дана
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Step 1: Context Discovery & Initialization
  2. ## MANDATORY EXECUTION RULES (READ FIRST):
  3. - 🛑 NEVER generate content without user input
  4. - ✅ ALWAYS treat this as collaborative discovery between technical peers
  5. - 📋 YOU ARE A FACILITATOR, not a content generator
  6. - 💬 FOCUS on discovering existing project context and technology stack
  7. - 🎯 IDENTIFY critical implementation rules that AI agents need
  8. - ⚠️ ABSOLUTELY NO TIME ESTIMATES - AI development speed has fundamentally changed
  9. - ✅ YOU MUST ALWAYS SPEAK OUTPUT In your Agent communication style with the config `{communication_language}`
  10. ## EXECUTION PROTOCOLS:
  11. - 🎯 Show your analysis before taking any action
  12. - 📖 Read existing project files to understand current context
  13. - 💾 Initialize document and update frontmatter
  14. - 🚫 FORBIDDEN to load next step until discovery is complete
  15. ## CONTEXT BOUNDARIES:
  16. - Variables from workflow.md are available in memory
  17. - Focus on existing project files and architecture decisions
  18. - Look for patterns, conventions, and unique requirements
  19. - Prioritize rules that prevent implementation mistakes
  20. ## YOUR TASK:
  21. Discover the project's technology stack, existing patterns, and critical implementation rules that AI agents must follow when writing code.
  22. ## DISCOVERY SEQUENCE:
  23. ### 1. Check for Existing Project Context
  24. First, check if project context already exists:
  25. - Look for file at `{project_knowledge}/project-context.md or {project-root}/**/project-context.md`
  26. - If exists: Read complete file to understand existing rules
  27. - Present to user: "Found existing project context with {number_of_sections} sections. Would you like to update this or create a new one?"
  28. ### 2. Discover Project Technology Stack
  29. Load and analyze project files to identify technologies:
  30. **Architecture Document:**
  31. - Look for `{planning_artifacts}/architecture.md`
  32. - Extract technology choices with specific versions
  33. - Note architectural decisions that affect implementation
  34. **Package Files:**
  35. - Check for `package.json`, `requirements.txt`, `Cargo.toml`, etc.
  36. - Extract exact versions of all dependencies
  37. - Note development vs production dependencies
  38. **Configuration Files:**
  39. - Look for project language specific configs ( example: `tsconfig.json`)
  40. - Build tool configs (webpack, vite, next.config.js, etc.)
  41. - Linting and formatting configs (.eslintrc, .prettierrc, etc.)
  42. - Testing configurations (jest.config.js, vitest.config.ts, etc.)
  43. ### 3. Identify Existing Code Patterns
  44. Search through existing codebase for patterns:
  45. **Naming Conventions:**
  46. - File naming patterns (PascalCase, kebab-case, etc.)
  47. - Component/function naming conventions
  48. - Variable naming patterns
  49. - Test file naming patterns
  50. **Code Organization:**
  51. - How components are structured
  52. - Where utilities and helpers are placed
  53. - How services are organized
  54. - Test organization patterns
  55. **Documentation Patterns:**
  56. - Comment styles and conventions
  57. - Documentation requirements
  58. - README and API doc patterns
  59. ### 4. Extract Critical Implementation Rules
  60. Look for rules that AI agents might miss:
  61. **Language-Specific Rules:**
  62. - TypeScript strict mode requirements
  63. - Import/export conventions
  64. - Async/await vs Promise usage patterns
  65. - Error handling patterns specific to the language
  66. **Framework-Specific Rules:**
  67. - React hooks usage patterns
  68. - API route conventions
  69. - Middleware usage patterns
  70. - State management patterns
  71. **Testing Rules:**
  72. - Test structure requirements
  73. - Mock usage conventions
  74. - Integration vs unit test boundaries
  75. - Coverage requirements
  76. **Development Workflow Rules:**
  77. - Branch naming conventions
  78. - Commit message patterns
  79. - PR review requirements
  80. - Deployment procedures
  81. ### 5. Initialize Project Context Document
  82. Based on discovery, create or update the context document:
  83. #### A. Fresh Document Setup (if no existing context)
  84. Copy template from `../project-context-template.md` to `{output_folder}/project-context.md`
  85. Initialize frontmatter fields.
  86. #### B. Existing Document Update
  87. Load existing context and prepare for updates
  88. Set frontmatter `sections_completed` to track what will be updated
  89. ### 6. Present Discovery Summary
  90. Report findings to user:
  91. "Welcome {{user_name}}! I've analyzed your project for {{project_name}} to discover the context that AI agents need.
  92. **Technology Stack Discovered:**
  93. {{list_of_technologies_with_versions}}
  94. **Existing Patterns Found:**
  95. - {{number_of_patterns}} implementation patterns
  96. - {{number_of_conventions}} coding conventions
  97. - {{number_of_rules}} critical rules
  98. **Key Areas for Context Rules:**
  99. - {{area_1}} (e.g., TypeScript configuration)
  100. - {{area_2}} (e.g., Testing patterns)
  101. - {{area_3}} (e.g., Code organization)
  102. {if_existing_context}
  103. **Existing Context:** Found {{sections}} sections already defined. We can update or add to these.
  104. {/if_existing_context}
  105. Ready to create/update your project context. This will help AI agents implement code consistently with your project's standards.
  106. [C] Continue to context generation"
  107. **HALT — wait for user selection before proceeding.**
  108. ## SUCCESS METRICS:
  109. ✅ Existing project context properly detected and handled
  110. ✅ Technology stack accurately identified with versions
  111. ✅ Critical implementation patterns discovered
  112. ✅ Project context document properly initialized
  113. ✅ Discovery findings clearly presented to user
  114. ✅ User ready to proceed with context generation
  115. ## FAILURE MODES:
  116. ❌ Not checking for existing project context before creating new one
  117. ❌ Missing critical technology versions or configurations
  118. ❌ Overlooking important coding patterns or conventions
  119. ❌ Not initializing frontmatter properly
  120. ❌ Not presenting clear discovery summary to user
  121. ## NEXT STEP:
  122. After user selects [C] to continue, load `./step-02-generate.md` to collaboratively generate the specific project context rules.
  123. Remember: Do NOT proceed to step-02 until user explicitly selects [C] from the menu and discovery is confirmed and the initial file has been written as directed in this discovery step!