選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

step-01-load-context.md 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. ---
  2. name: 'step-01-load-context'
  3. description: 'Load knowledge base, determine scope, and gather context'
  4. nextStepFile: '{skill-root}/steps-c/step-02-discover-tests.md'
  5. knowledgeIndex: './resources/tea-index.csv'
  6. outputFile: '{test_artifacts}/test-review.md'
  7. ---
  8. # Step 1: Load Context & Knowledge Base
  9. ## STEP GOAL
  10. Determine review scope, load required knowledge fragments, and gather related artifacts.
  11. ## MANDATORY EXECUTION RULES
  12. - 📖 Read the entire step file before acting
  13. - ✅ Speak in `{communication_language}`
  14. ---
  15. ## EXECUTION PROTOCOLS:
  16. - 🎯 Follow the MANDATORY SEQUENCE exactly
  17. - 💾 Record outputs before proceeding
  18. - 📖 Load the next step only when instructed
  19. ## CONTEXT BOUNDARIES:
  20. - Available context: config, loaded artifacts, and knowledge fragments
  21. - Focus: this step's goal only
  22. - Limits: do not execute future steps
  23. - Dependencies: prior steps' outputs (if any)
  24. ## MANDATORY SEQUENCE
  25. **CRITICAL:** Follow this sequence exactly. Do not skip, reorder, or improvise.
  26. ## 1. Determine Scope and Stack
  27. Use `review_scope`:
  28. - **single**: one file
  29. - **directory**: all tests in folder
  30. - **suite**: all tests in repo
  31. If unclear, ask the user.
  32. **Stack Detection** (for context-aware loading):
  33. Read `test_stack_type` from `{config_source}`. If `"auto"` or not configured, infer `{detected_stack}` by scanning `{project-root}`:
  34. - **Frontend indicators**: `playwright.config.*`, `cypress.config.*`, `package.json` with react/vue/angular
  35. - **Backend indicators**: `pyproject.toml`, `pom.xml`/`build.gradle`, `go.mod`, `*.csproj`, `Gemfile`, `Cargo.toml`
  36. - **Both present** → `fullstack`; only frontend → `frontend`; only backend → `backend`
  37. - Explicit `test_stack_type` overrides auto-detection
  38. ---
  39. ### Tiered Knowledge Loading
  40. Load fragments based on their `tier` classification in `tea-index.csv`:
  41. 1. **Core tier** (always load): Foundational fragments required for this workflow
  42. 2. **Extended tier** (load on-demand): Load when deeper analysis is needed or when the user's context requires it
  43. 3. **Specialized tier** (load only when relevant): Load only when the specific use case matches (e.g., contract-testing only for microservices, email-auth only for email flows)
  44. > **Context Efficiency**: Loading only core fragments reduces context usage by 40-50% compared to loading all fragments.
  45. ### Playwright Utils Loading Profiles
  46. **If `tea_use_playwright_utils` is enabled**, select the appropriate loading profile:
  47. - **API-only profile** (when `{detected_stack}` is `backend` or no `page.goto`/`page.locator` found in test files):
  48. Load: `overview`, `api-request`, `auth-session`, `recurse` (~1,800 lines)
  49. - **Full UI+API profile** (when `{detected_stack}` is `frontend`/`fullstack` or browser tests detected):
  50. Load: all Playwright Utils core fragments (~4,500 lines)
  51. **Detection**: Scan `{test_dir}` for files containing `page.goto` or `page.locator`. If none found, use API-only profile.
  52. ### Pact.js Utils Loading
  53. **If `tea_use_pactjs_utils` is enabled** (and contract tests detected in review scope):
  54. Load: `pactjs-utils-overview.md`, `pactjs-utils-consumer-helpers.md` (one-interaction-per-`it()` determinism rule), `pactjs-utils-provider-verifier.md` (vitest `pool: 'forks'` + `singleFork` — applies to BOTH consumer and provider), `pactjs-utils-request-filter.md`, `pact-consumer-framework-setup.md` (consumer Vitest `fileParallelism: false` + `pool: 'forks'` + `singleFork: true`, determinism gate, `jq` publish normalization), `pact-broker-webhooks.md` (webhook auth, PAT rotation, staleness monitoring — relevant if CI failure patterns include `can-i-deploy` timeouts with no verification).
  55. **If `tea_use_pactjs_utils` is disabled** but contract tests are in review scope:
  56. Load: `contract-testing.md`
  57. ### Pact MCP Loading
  58. **If `tea_pact_mcp` is `"mcp"`:**
  59. Load: `pact-mcp.md` — enables agent to use SmartBear MCP "Review Pact Tests" tool for automated best-practice feedback during test review.
  60. ## 2. Load Knowledge Base
  61. From `{knowledgeIndex}` load:
  62. Read `{config_source}` and check `tea_use_playwright_utils`, `tea_use_pactjs_utils`, `tea_pact_mcp`, and `tea_browser_automation` to select the correct fragment set.
  63. **Core:**
  64. - `test-quality.md`
  65. - `data-factories.md`
  66. - `test-levels-framework.md`
  67. - `selective-testing.md`
  68. - `test-healing-patterns.md`
  69. - `selector-resilience.md`
  70. - `timing-debugging.md`
  71. **If Playwright Utils enabled:**
  72. - `overview.md`, `api-request.md`, `network-recorder.md`, `auth-session.md`, `intercept-network-call.md`, `recurse.md`, `log.md`, `file-utils.md`, `burn-in.md`, `network-error-monitor.md`, `fixtures-composition.md`
  73. **If disabled:**
  74. - `fixture-architecture.md`
  75. - `network-first.md`
  76. - `playwright-config.md`
  77. - `component-tdd.md`
  78. - `ci-burn-in.md`
  79. **Playwright CLI (if `tea_browser_automation` is "cli" or "auto"):**
  80. - `playwright-cli.md`
  81. **MCP Patterns (if `tea_browser_automation` is "mcp" or "auto"):**
  82. - (existing MCP-related fragments, if any are added in future)
  83. **Pact.js Utils (if enabled and contract tests in review scope):**
  84. - `pactjs-utils-overview.md`, `pactjs-utils-consumer-helpers.md`, `pactjs-utils-provider-verifier.md`, `pactjs-utils-request-filter.md`, `pact-consumer-di.md`, `pact-consumer-framework-setup.md`, `pact-broker-webhooks.md`
  85. **Contract Testing (if pactjs-utils disabled but contract tests in review scope):**
  86. - `contract-testing.md`
  87. **Pact MCP (if tea_pact_mcp is "mcp"):**
  88. - `pact-mcp.md`
  89. ---
  90. ## 3. Gather Context Artifacts
  91. If available:
  92. - Story file (acceptance criteria)
  93. - Test design doc (priorities)
  94. - Framework config
  95. Summarize what was found.
  96. Coverage mapping and coverage gates are out of scope in `test-review`. Route those concerns to `trace`.
  97. ---
  98. ## 4. Save Progress
  99. **Save this step's accumulated work to `{outputFile}`.**
  100. - **If `{outputFile}` does not exist** (first save), create it using the workflow template (if available) with YAML frontmatter:
  101. ```yaml
  102. ---
  103. stepsCompleted: ['step-01-load-context']
  104. lastStep: 'step-01-load-context'
  105. lastSaved: '{date}'
  106. ---
  107. ```
  108. Then write this step's output below the frontmatter.
  109. - **If `{outputFile}` already exists**, update:
  110. - Add `'step-01-load-context'` to `stepsCompleted` array (only if not already present)
  111. - Set `lastStep: 'step-01-load-context'`
  112. - Set `lastSaved: '{date}'`
  113. - Append this step's output to the appropriate section of the document.
  114. **Update `inputDocuments`**: Set `inputDocuments` in the output template frontmatter to the list of artifact paths loaded in this step (e.g., knowledge fragments, test design documents, configuration files).
  115. Load next step: `{nextStepFile}`
  116. ## 🚨 SYSTEM SUCCESS/FAILURE METRICS:
  117. ### ✅ SUCCESS:
  118. - Step completed in full with required outputs
  119. ### ❌ SYSTEM FAILURE:
  120. - Skipped sequence steps or missing outputs
  121. **Master Rule:** Skipping steps is FORBIDDEN.