|
| 1 | +Analyze this codebase and generate or update Copilot instruction files that guide AI coding agents. |
| 2 | + |
| 3 | +## Goals |
| 4 | + |
| 5 | +1. Generate path-scoped instruction files under `.github/instructions/`. |
| 6 | +1. Separate framework-level generic guidance from repo-specific guidance: |
| 7 | + - `.github/instructions/framework/...` = generic, reusable, automation-managed |
| 8 | + - `.github/instructions/repo/...` = project-specific, manually curated |
| 9 | +1. Evaluate and extract content from `.github/instructions/repo/...` to create or update the corresponding framework instructions. |
| 10 | +1. Move any existing content from `.github/copilot-instructions.md` into the appropriate path-scoped files. |
| 11 | + |
| 12 | +## Source of existing guidance if exists |
| 13 | + |
| 14 | +Read from: |
| 15 | +`**/{.github/copilot-instructions.md,.github/instructions/**,AGENT.md,AGENTS.md,CLAUDE.md,.cursorrules,.windsurfrules,.clinerules,.cursor/rules/**,.windsurf/rules/**,.clinerules/**,README.md}` |
| 16 | + |
| 17 | +## File structure to create/update |
| 18 | + |
| 19 | +1. Path-scoped split into framework vs repo: |
| 20 | + - `.github/instructions/framework/...` = generic reusable instructions |
| 21 | + - `.github/instructions/repo/...` = repo-specific instructions |
| 22 | + - Both MAY contain the same language/tech folders but MUST be kept separate |
| 23 | +1. Framework instructions (automation-owned) |
| 24 | + - Root generic: `.github/instructions/framework/main.instructions.md` |
| 25 | + ```yaml |
| 26 | + --- |
| 27 | + applyTo: "**/*" |
| 28 | + description: Generic guidance for all files across repos |
| 29 | + --- |
| 30 | + ``` |
| 31 | + - Per language/technology (main + sections): |
| 32 | + `.github/instructions/framework/PowerShell/main.instructions.md` |
| 33 | + ```yaml |
| 34 | + --- |
| 35 | + applyTo: "**/*.{ps1,psm1,psd1}" |
| 36 | + description: Generic PowerShell guidance |
| 37 | + --- |
| 38 | + ``` |
| 39 | + `.github/instructions/framework/csharp/main.instructions.md` |
| 40 | + ```yaml |
| 41 | + --- |
| 42 | + applyTo: "**/*.{cs,csproj,sln}" |
| 43 | + description: Generic C# guidance |
| 44 | + --- |
| 45 | + ``` |
| 46 | + (repeat for all detected languages/technologies, i.e. Terraform, TypeScript/JavaScript, YAML/GitHub Actions, Markdown, JSON, etc.) |
| 47 | + - Section-specific examples: |
| 48 | + `.github/instructions/framework/PowerShell/tests.instructions.md` |
| 49 | + ```yaml |
| 50 | + --- |
| 51 | + applyTo: "**/*.Tests.ps1,**/tests/**/*.ps1" |
| 52 | + description: Generic PowerShell test guidance |
| 53 | + --- |
| 54 | + ``` |
| 55 | + (repeat for all components/types of language files, i.e. classes, functions, private functions, formats, etc. for PowerShell; main + tests for |
| 56 | + TypeScript/JavaScript; main + workflows + actions for YAML; main + docs + changelog for Markdown; etc.) |
| 57 | +1. Repo instructions (project-specific) |
| 58 | + - Root repo-specific: `.github/instructions/repo/main.instructions.md` |
| 59 | + ```yaml |
| 60 | + --- |
| 61 | + applyTo: "**/*" |
| 62 | + description: Repo-specific rules for this project |
| 63 | + --- |
| 64 | + ``` |
| 65 | + - Per language/technology (project conventions, not generic) |
| 66 | + `.github/instructions/repo/PowerShell/main.instructions.md` |
| 67 | + ```yaml |
| 68 | + --- |
| 69 | + applyTo: "**/*.{ps1,psm1,psd1}" |
| 70 | + description: Repo-specific PowerShell conventions |
| 71 | + --- |
| 72 | + ``` |
| 73 | + Section-specific as needed, same pattern as for framework instructions. |
| 74 | + |
| 75 | +1) Automation sync rules |
| 76 | + - Files under `.github/instructions/framework/` MAY be updated automatically by sync tooling, sources from a central pattern repository. |
| 77 | + - Files under `.github/instructions/repo/` MUST NOT be overwritten by automation, is meant to be manually curated within the repo. |
| 78 | + |
| 79 | +1) Root copilot-instructions.md file. |
| 80 | + - Path: `.github/copilot-instructions.md` |
| 81 | + - Merge content into any of the other files that apply: preserve valuable content, refresh outdated specifics. |
| 82 | + - Finally remove this file when content is verified to be migrated to other files. |
| 83 | + |
| 84 | +## Content model for every instruction file |
| 85 | + |
| 86 | +1) YAML front matter (required) |
| 87 | + ```yaml |
| 88 | + --- |
| 89 | + applyTo: <glob(s) only for path-scoped files; omit in the global file> |
| 90 | + description: <succinct purpose in one sentence> |
| 91 | + --- |
| 92 | + ``` |
| 93 | +2) Optional one-line context lead; do not restate description verbatim. |
| 94 | +3) Sections (sentence-case headings, no numbering inside the heading text): |
| 95 | + - Goal (if distinct from description) |
| 96 | + - Execution steps (ordered list) |
| 97 | + - Behavior rules / Constraints |
| 98 | + - Output format (if a specific result shape is required) |
| 99 | + - Error handling (only if non-trivial) |
| 100 | + - Definitions / Glossary (optional) |
| 101 | +4) Use fenced code blocks only for literal commands/templates; avoid huge blocks unless needed. |
| 102 | + |
| 103 | +## Discovery focus (repo-specific only) |
| 104 | + |
| 105 | +- Architecture: components, boundaries, data flows, and rationale. |
| 106 | +- Critical workflows: build, test, debug, release. Include exact commands and entry points. |
| 107 | +- Conventions and patterns: naming, logging, error handling, DI, layout, testing styles. |
| 108 | +- Integrations: APIs, events, queues, IaC, cross-component calls. |
| 109 | +- Language-/tech-specific idioms in this repo with concrete examples and file paths. |
| 110 | + |
| 111 | +## User input handling (reusable rule) |
| 112 | + |
| 113 | +- User input may be provided as command arguments; MUST consider it if non-empty. |
| 114 | +- Refer to raw user input placeholder exactly as `$ARGUMENTS`. |
| 115 | +- If input can be empty and flow changes, specify explicit fallback or abort behavior. |
| 116 | + |
| 117 | +## Script invocation pattern |
| 118 | + |
| 119 | +- Specify exact relative path from repo root. |
| 120 | +- Put mandatory flags first, optional flags second. |
| 121 | +- Use "Run once" / "MUST only run once" for one-time scripts. |
| 122 | +- Clarify required JSON fields expected from script output. |
| 123 | +- Use CAPITALIZED derived variable names (e.g., FEATURE_DIR, SPEC_FILE) for parsed values. |
| 124 | + |
| 125 | +## Parsing and modeling guidance |
| 126 | + |
| 127 | +- For multi-document sets (spec.md, plan.md, tasks.md), define presence rules and derivations. |
| 128 | +- Provide deterministic key generation (e.g., slugified phrases). |
| 129 | +- Include explicit mapping constructs: Requirements Inventory and Task Coverage Mapping. |
| 130 | +- Define deterministic heuristics for inference (dup detection, keyword match) to ensure stable IDs. |
| 131 | + |
| 132 | +## Detection and analysis patterns |
| 133 | + |
| 134 | +- Categories with purpose, triggers, output fields (e.g., Duplication, Ambiguity, Coverage, Constitution Alignment). |
| 135 | +- Provide a severity heuristic list and cap results (e.g., max 50 rows); specify overflow handling. |
| 136 | + |
| 137 | +## Output specification for assistant responses |
| 138 | + |
| 139 | +- Define required sections via Markdown headings (## or ###) for consumer tooling. |
| 140 | +- For tables: fixed column order and headers; stable IDs (prefix category initial + counter: A1, A2). |
| 141 | +- Include a summary metrics block when analytical. |
| 142 | +- End with an explicit next-action question when user approval is required. |
| 143 | + |
| 144 | +## Clarification workflow (clarify-style prompts) |
| 145 | + |
| 146 | +- Ask at most 5 questions, one at a time; never reveal the queue. |
| 147 | +- Provide an answer format hint line (e.g., "Format: Short answer (<=5 words)"). |
| 148 | +- Support early termination tokens: "stop", "done", "proceed". |
| 149 | +- Persist accepted answers only after validating brevity and relevance. |
| 150 | + |
| 151 | +## Task, plan, and spec generation |
| 152 | + |
| 153 | +- Enforce prerequisites (spec before plan, plan before tasks) unless user overrides. |
| 154 | +- NEVER fabricate missing clarifications; prompt the user instead. |
| 155 | +- Number tasks deterministically as T001, T002 (zero-padded to 3 digits). |
| 156 | +- Mark tasks with [P] only when no shared file path overlap. |
| 157 | +- Separate phases: Setup, Tests, Core, Integration, Polish, with explicit gates. |
| 158 | + |
| 159 | +## Constitution handling |
| 160 | + |
| 161 | +- Treat `.specify/memory/constitution.md` as authoritative and immutable during analysis. |
| 162 | +- Flag conflicts as CRITICAL; do not reinterpret principles. |
| 163 | +- On updates, apply semver (MAJOR/MINOR/PATCH) and output an HTML comment Sync Impact Report. |
| 164 | + |
| 165 | +## Error and abort rules |
| 166 | + |
| 167 | +- If a required file is missing, abort with a clear message and the next command to run (e.g., "/tasks" or "/specify"). |
| 168 | +- Do NOT partially modify artifacts when prerequisites fail. |
| 169 | +- Do not auto-create design artifacts outside their dedicated workflows. |
| 170 | + |
| 171 | +## Determinism and idempotence |
| 172 | + |
| 173 | +- Lists, IDs, and metrics MUST be stable across runs with unchanged inputs. |
| 174 | +- Avoid non-deterministic ordering; sort alphabetically or by original appearance index. |
| 175 | + |
| 176 | +## Prohibited behaviors |
| 177 | + |
| 178 | +- No silent edits unless the prompt explicitly authorizes writing. |
| 179 | +- No hallucinated sections; report absence explicitly. |
| 180 | +- Do not exceed question or task limits. |
| 181 | + |
| 182 | +## Quality and clarity |
| 183 | + |
| 184 | +- Prefer explicit over implicit dependencies (e.g., "T005 depends on T002"). |
| 185 | +- Use a consistent canonical term set and flag drift. |
| 186 | +- Replace vague nouns with domain terms. |
| 187 | + |
| 188 | +## Accessibility and formatting |
| 189 | + |
| 190 | +- Keep tables ≤120 characters wide when feasible; wrap cells minimally. |
| 191 | +- End responses with a single newline; avoid trailing spaces in table rows. |
| 192 | + |
| 193 | +## Extension and future-proofing |
| 194 | + |
| 195 | +- New prompt types SHOULD reuse the same section taxonomy when possible. |
| 196 | +- Add new severity levels only with rationale and backward compatibility notes. |
| 197 | +- Mark temporary placeholders with `TODO(<TOKEN>): reason`. |
| 198 | + |
| 199 | +## Validation checklist (apply before responding) |
| 200 | + |
| 201 | +- Verify all mandated sections for the prompt type. |
| 202 | +- Ensure no unresolved placeholders remain (except intentional TODOs). |
| 203 | +- Check line length and newline compliance. |
| 204 | +- Confirm deterministic ordering of enumerations. |
| 205 | + |
| 206 | +## Commit guidance (when files are modified) |
| 207 | + |
| 208 | +- Suggested commit: `chore(prompts): <concise change summary>` |
| 209 | +- Constitution updates: `docs: amend constitution to vX.Y.Z (<summary>)` |
| 210 | + |
| 211 | +## Deliverables |
| 212 | + |
| 213 | +1) Updated `.github/copilot-instructions.md` (merged). |
| 214 | +2) Framework instructions under `.github/instructions/framework/` (automation-managed). |
| 215 | +3) Repo instructions under `.github/instructions/repo/` (manual, project-specific). |
| 216 | +4) Short report listing each created/updated file, its `applyTo`, and whether it belongs to framework or repo. |
| 217 | + |
| 218 | +## Final step |
| 219 | + |
| 220 | +Ask the user which unclear or incomplete areas need refinement and propose specific follow-ups. |
0 commit comments