feat: add GitHub Copilot prompt support

Adds GitHub Copilot VS Code instruction and prompt files for ECC workflows, with VS Code prompt frontmatter/settings aligned to current docs and tests covering the surface.

Co-authored-by: Girish Kanjiyani <girish.kanjiyani5040@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Girish Kanjiyani
2026-05-12 23:00:00 -04:00
committed by GitHub
parent ff1594ea99
commit 766f4ee1d8
14 changed files with 650 additions and 28 deletions

47
.github/prompts/build-fix.prompt.md vendored Normal file
View File

@@ -0,0 +1,47 @@
---
agent: agent
description: Systematically diagnose and fix build errors, type errors, or failing CI
---
# Build Error Resolution
Work through the error systematically. Fix root causes — do not suppress warnings or skip checks.
## Process
### 1. Capture the full error
Paste or describe the complete error output (not just the last line). Include:
- Error message and stack trace
- File and line number if shown
- Build tool and command that failed
### 2. Categorize the error
| Category | Signals |
|----------|---------|
| **Type error** | `Type X is not assignable to Y`, `Property does not exist` |
| **Import/module** | `Cannot find module`, `does not provide an export` |
| **Syntax** | `Unexpected token`, `Expected ;` |
| **Dependency** | `peer dep conflict`, `missing package`, `version mismatch` |
| **Environment** | `command not found`, `ENOENT`, missing env var |
| **Test failure** | `expected X but received Y`, assertion failure |
| **Lint** | `ESLint`, `no-unused-vars`, `no-console` |
### 3. Fix strategy
- **Type errors** — fix the type, do not cast to `any` or `unknown` unless truly unavoidable.
- **Import errors** — verify the export exists; check for circular dependencies.
- **Dependency errors** — update lockfile, reconcile peer dep versions, do not delete `node_modules` as a first step.
- **Test failures** — fix the implementation if behavior is wrong; fix the test only if the test itself is incorrect.
- **Lint errors** — fix the code, do not add `// eslint-disable` unless the rule is genuinely inapplicable and you document why.
### 4. Verify the fix
After applying a fix, run the build/test command again. Confirm the specific error is resolved and no new errors were introduced.
### 5. Check for related issues
A single root cause often produces multiple error messages. After fixing, scan for similar patterns elsewhere in the codebase.
## Rules
- Never use `--no-verify` to skip hooks.
- Never suppress type errors with `@ts-ignore` without a comment explaining why.
- Never delete lock files without understanding why they are conflicting.

56
.github/prompts/code-review.prompt.md vendored Normal file
View File

@@ -0,0 +1,56 @@
---
agent: agent
description: Comprehensive code quality and security review of the selected code or recent changes
---
# Code Review
Review the selected code (or the current diff if nothing is selected) across four dimensions. Only report issues you are **confident about** — flag uncertainty explicitly rather than guessing.
## Dimensions
### 1. Security (CRITICAL — block ship if found)
- Hardcoded secrets, tokens, API keys, passwords
- Missing input validation or sanitization at system boundaries
- SQL/NoSQL injection risk (string interpolation in queries)
- XSS risk (unsanitized HTML output)
- Auth/authz checks missing or client-side only
- Sensitive data in logs or error messages exposed to clients
- Missing rate limiting on public endpoints
### 2. Code Quality (HIGH)
- Mutation of existing state instead of creating new objects
- Functions over 50 lines or files over 800 lines
- Nesting deeper than 4 levels
- Duplicated logic that should be extracted
- Misleading or non-descriptive names
### 3. Error Handling (HIGH)
- Silently swallowed errors (`catch {}`, empty catch blocks)
- Missing error handling at async boundaries
- Errors returned but not checked by callers
- User-facing error messages leaking internal details
### 4. Test Coverage (MEDIUM)
- Missing tests for new logic
- Tests that only test happy paths (missing error/edge cases)
- Assertions that always pass
## Output Format
For each issue found:
```
**[CRITICAL|HIGH|MEDIUM|LOW]** — [File:Line if known]
Issue: [What is wrong]
Fix: [Concrete suggestion]
```
End with a summary:
```
## Summary
- Critical: N
- High: N
- Medium: N
- Approved to ship: yes / no (fix CRITICAL and HIGH first)
```

52
.github/prompts/plan.prompt.md vendored Normal file
View File

@@ -0,0 +1,52 @@
---
agent: agent
description: Create a phased implementation plan before writing any code
---
# Implementation Planner
Before writing any code for this feature/task, produce a structured plan.
## Steps
1. **Clarify the goal** — restate the requirement in one sentence; flag any ambiguities.
2. **Research first** — identify existing utilities, libraries, or patterns in the codebase that can be reused. Do not reinvent what already exists.
3. **Identify dependencies** — list external packages, APIs, environment variables, or database changes needed.
4. **Break into phases** — structure work as ordered phases, each independently shippable:
- Phase 1: Core data model / schema changes
- Phase 2: Business logic + unit tests
- Phase 3: API / integration layer + integration tests
- Phase 4: UI / consumer layer + E2E tests
5. **Identify risks** — note anything that could block progress or cause regressions.
6. **Define done** — list the exact acceptance criteria (tests passing, coverage ≥ 80%, no lint errors, docs updated).
## Output Format
```
## Goal
[One-sentence summary]
## Reuse Opportunities
- [Existing utility/pattern]
## Dependencies
- [Package / API / env var]
## Phases
### Phase 1 — [Name]
- [ ] Task A
- [ ] Task B
### Phase 2 — [Name]
...
## Risks
- [Risk and mitigation]
## Definition of Done
- [ ] All tests pass (≥80% coverage)
- [ ] No new lint errors
- [ ] Docs updated if public API changed
```
Apply ECC coding standards throughout: immutable patterns, small focused files, explicit error handling.

50
.github/prompts/refactor.prompt.md vendored Normal file
View File

@@ -0,0 +1,50 @@
---
agent: agent
description: Clean up dead code, reduce duplication, and simplify structure without changing behavior
---
# Refactor & Cleanup
Improve the internal structure of the selected code without changing its observable behavior. All tests must pass before and after.
## Before Starting
- [ ] Confirm the test suite is passing.
- [ ] Note the current coverage baseline.
- [ ] Identify the scope: single function, file, or module?
## Refactoring Targets
### Dead Code Removal
- Unused variables, imports, functions, and exports
- Commented-out code blocks (delete, don't leave as comments)
- Feature flags that are permanently enabled/disabled
- Unreachable branches
### Duplication Reduction
- Repeated logic that can be extracted into a shared utility
- Copy-pasted blocks differing only in a parameter (extract with that parameter)
- Inline constants that appear in multiple places (extract to named constants)
### Structure Improvements
- Functions over 50 lines → break into smaller, named steps
- Files over 800 lines → extract cohesive sub-modules
- Nesting deeper than 4 levels → extract early-return guards or helper functions
- Mixed concerns in one function → split into focused single-responsibility functions
### Naming
- Rename variables/functions whose names don't match their behavior
- Replace magic numbers and strings with named constants
- Align naming with the domain language used elsewhere in the codebase
## Constraints
- **No behavior changes** — refactoring is purely structural.
- **One concern at a time** — do not mix refactoring with feature work or bug fixes.
- **Keep tests green** — run the suite after each meaningful change.
- **Don't add abstractions preemptively** — extract only what has already proven to be duplicated (rule of three).
## Output
After refactoring, summarize:
- What was removed (dead code, duplication)
- What was extracted (new utilities, constants)
- What was renamed and why
- Coverage before / after (should not decrease)

View File

@@ -0,0 +1,70 @@
---
agent: agent
description: Deep security analysis — OWASP Top 10, secrets, auth, injection, and dependency risks
---
# Security Review
Perform a thorough security analysis of the selected code or current branch changes.
## Checklist
### Secrets & Configuration
- [ ] No hardcoded API keys, tokens, passwords, or private keys anywhere in source
- [ ] All secrets loaded from environment variables or a secret manager
- [ ] Required env vars validated at startup (fail fast if missing)
- [ ] `.env` files excluded from version control
### Input Validation & Injection
- [ ] All user inputs validated and sanitized before use
- [ ] Parameterized queries for every database operation (no string interpolation)
- [ ] HTML output escaped or sanitized (XSS prevention)
- [ ] File path inputs sanitized (path traversal prevention)
- [ ] Command inputs sanitized (command injection prevention)
### Authentication & Authorization
- [ ] Auth checks enforced server-side — never trust client-supplied user IDs or roles
- [ ] Session tokens are sufficiently random and expire appropriately
- [ ] Sensitive operations protected by authz checks, not just authn
- [ ] CSRF protection enabled for state-changing endpoints
### Data Exposure
- [ ] Error responses scrubbed of stack traces, internal paths, and sensitive data
- [ ] Logs do not contain PII, tokens, or passwords
- [ ] Sensitive fields excluded from API responses (no over-fetching)
- [ ] Appropriate HTTP security headers set
### Dependencies
- [ ] No known vulnerable packages (run `npm audit` / `pip-audit` / `cargo audit`)
- [ ] Dependency versions pinned or locked
- [ ] No unused dependencies that increase attack surface
### Infrastructure (if applicable)
- [ ] Rate limiting on all public endpoints
- [ ] HTTPS enforced; no HTTP fallback in production
- [ ] Principle of least privilege for service accounts and IAM roles
## Response Protocol
If a **CRITICAL** issue is found:
1. Stop and report immediately.
2. Do not ship until fixed.
3. Rotate any exposed secrets.
4. Scan the rest of the codebase for similar patterns.
## Output Format
```
## Findings
**[CRITICAL|HIGH|MEDIUM|LOW]** — [category]
Location: [file:line if known]
Issue: [what is wrong and why it is dangerous]
Fix: [concrete remediation]
## Summary
- Critical: N
- High: N
- Medium: N
- Safe to ship: yes / no
```

47
.github/prompts/tdd.prompt.md vendored Normal file
View File

@@ -0,0 +1,47 @@
---
agent: agent
description: Test-driven development cycle — write the test first, then implement
---
# TDD Workflow
Follow the RED → GREEN → IMPROVE cycle strictly. Do not write implementation code before a failing test exists.
## Cycle
### 1. RED — Write the failing test
- Write a test that describes the desired behavior.
- Run it. It **must fail** before continuing.
- Use Arrange-Act-Assert structure.
- Name tests descriptively: `returns empty array when no items match filter`, not `test itemFilter`.
### 2. GREEN — Minimal implementation
- Write the **minimum** code needed to make the test pass.
- Do not over-engineer at this stage.
- Run the test again — it **must pass**.
### 3. IMPROVE — Refactor
- Clean up duplication, naming, structure.
- Keep all tests passing after each change.
- Check coverage: target **≥ 80%**.
## Test Layer Checklist
- [ ] **Unit** — pure functions, utilities, isolated components
- [ ] **Integration** — API endpoints, database operations, service boundaries
- [ ] **E2E** — at least one critical user flow covered
## Quality Gates
Before marking the feature done:
- [ ] All tests pass
- [ ] Coverage ≥ 80%
- [ ] No skipped/commented-out tests
- [ ] Edge cases covered: empty input, nulls, boundary values, error paths
## Anti-patterns to Avoid
- Writing implementation before tests
- Testing implementation details instead of behavior
- Mocking too deeply (prefer integration tests over excessive mocks)
- Assertions that always pass (`expect(true).toBe(true)`)