agentleFS
MicrosoftKnown publishermicrosoft/CommunityManagement-Sample-Spec-Kit/.github/copilot-instructions.md

CommunityManagement-Sample-Spec-Kit

Copilot instructions7 starsChanged 8 months agoMITView on GitHub

This project uses the Spec-Kit agentic development process. Every change MUST follow these rules. Violations will be caught by CI and rejected. This repo uses spec-kit for structured feature development: When assigned an issue: When implementing a task autonomously: 1. Find the relevant spec — Check specs/ for the feature spec matching your issue. Read spec.md, plan.md, tasks.md, and data-model.md before coding. 2. Read the constitution — specs/constitution.md (v1.7.0) defines 15 mandatory architectural principles. Key constraints: - I. API-First: All…

The file

Show its rules and text

We split this copilot-instructions.md into the rules it gives an agent

26 rules. About 0 are common, 18 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    MUST follow these rules. Violations will be caught by CI and rejected.

    line 4
  2. Distinctive:

    When assigned an issue:

    line 16
  3. Distinctive:

    Check if it references a spec task (e.g., "T005 from spec 022")

    line 18
  4. Distinctive:

    If yes, read the full spec artifacts before coding

    line 19
  5. Distinctive:

    If no, treat as a standalone bugfix/improvement

    line 20
  6. Distinctive:

    When implementing a task autonomously:

    line 24
  7. Very specific:

    I. API-First: All mutations go through API routes, never direct DB from components.

    line 39
  8. Very specific:

    II. Test-First: Every service function needs an integration test.

    line 41
  9. Very specific:

    IX. Scoped Permissions: Use withPermission() middleware on all admin/mutation endpoints.

    line 44
  10. Distinctive:

    XI. Resource Ownership: Every mutation verifies caller owns the resource or holds scoped admin.

    line 45
  11. Distinctive:

    XV. Autonomous Pipeline: Use fast CI for iteration, full CI before merge only.

    line 47
  12. Distinctive:

    When implementing a task, run ONLY these checks during development (< 3 min total):

    line 64
  13. Distinctive:

    Do NOT run during development:

    line 71
  14. Distinctive:

    Run these in order only when preparing for final merge.

    line 83
  15. Distinctive:

    If you add a new API route, you MUST also:

    line 91
  16. Very specific:

    Add integration tests in apps/web/tests/integration/

    line 92
  17. Distinctive:

    Test 403 for unauthorized callers (Constitution QG-10)

    line 93
  18. Very specific:

    Use createTestDb() for PGlite test isolation

    line 94
  19. Very specific:

    Never trust client-injectable headers (x-user-id, x-api-key etc.)

    line 106
  20. Distinctive:

    No hardcoded user-facing strings (i18n extractable, Constitution VIII)

    line 116
  21. Very specific:

    No N+1 queries — use JOINs or WHERE IN for lists (Constitution VI)

    line 117
  22. Distinctive:

    All tests across all workspaces

    line 129
  23. Very specific:

    When assigned an issue labelled deploy-fix-auto:

    line 141
  24. Distinctive:

    Do NOT modify Bicep infrastructure files without human approval

    line 157
  25. Distinctive:

    Do NOT add or remove environment variables in Bicep without human approval

    line 158
  26. Distinctive:

    Keep fixes minimal and focused on the diagnosed error

    line 159

≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

Copilot Coding Agent Instructions

This project uses the Spec-Kit agentic development process. Every change MUST follow these rules. Violations will be caught by CI and rejected.

Spec-Kit Process

This repo uses spec-kit for structured feature development:

  • specs/{NNN}-{name}/spec.md — Feature specification
  • specs/{NNN}-{name}/plan.md — Implementation plan
  • specs/{NNN}-{name}/tasks.md — Ordered task list
  • specs/{NNN}-{name}/data-model.md — Data model (if applicable)
  • specs/constitution.md — Architectural principles (v1.7.0, 15 principles — MUST read)

When assigned an issue:

  1. Check if it references a spec task (e.g., "T005 from spec 022")
  2. If yes, read the full spec artifacts before coding
  3. If no, treat as a standalone bugfix/improvement

Autonomous Session Protocol

When implementing a task autonomously:

  1. Read the assigned issue — it maps to a spec task
  2. Read the spec artifacts: spec.md, plan.md, data-model.md
  3. Create a branch: copilot/{spec-number}/{task-id} (e.g., copilot/022/T005)
  4. Implement the change using the Fast Iteration Workflow below
  5. Create a PR with Fixes #{issue-number} in the description to auto-close the issue
  6. The CI pipeline handles the rest — fast CI runs automatically, then full CI before merge

Before Writing Any Code

  1. Find the relevant spec — Check specs/ for the feature spec matching your issue. Read spec.md, plan.md, tasks.md, and data-model.md before coding.
  2. Read the constitution — specs/constitution.md (v1.7.0) defines 15 mandatory architectural principles. Key constraints:
    • I. API-First: All mutations go through API routes, never direct DB from components. Response shapes live in packages/shared/src/types/. Error responses use @/lib/errors.
    • II. Test-First: Every service function needs an integration test. Use createTestDb() for PGlite isolation.
    • III. Privacy: PII encrypted at rest, EXIF stripped from uploads, GDPR deletion covers all tables.
    • IV. Server-Side Authority: Zod schemas validate all request bodies. No trusting client input.
    • IX. Scoped Permissions: Use withPermission() middleware on all admin/mutation endpoints.
    • XI. Resource Ownership: Every mutation verifies caller owns the resource or holds scoped admin.
    • XII. Financial Integrity: Server-side pricing only. Stripe Connect with signed OAuth state.
    • XV. Autonomous Pipeline: Use fast CI for iteration, full CI before merge only.
  3. Check tasks.md — If your issue maps to a task, mark it [X] when done.

Monorepo Structure

npm workspaces monorepo — always run commands from the repo root:

WorkspacePackagePurpose
apps/web/@acroyoga/webNext.js 16 web app (App Router, React 19)
apps/mobile/@acroyoga/mobileExpo React Native app
packages/shared/@acroyoga/sharedShared TypeScript types and contracts
packages/shared-ui/@acroyoga/shared-ui15 cross-platform UI components (design tokens)
packages/tokens/@acroyoga/tokensDesign token pipeline — must build before other packages

Fast Iteration Workflow

When implementing a task, run ONLY these checks during development (< 3 min total):

npm run tokens:build -w @acroyoga/tokens   # 1. Build tokens (prerequisite, ~5s)
npm run typecheck                           # 2. Zero type errors (~30s)
npm run lint -w @acroyoga/web               # 3. Zero lint warnings (~20s)
npm run test -w @acroyoga/{workspace}       # 4. Tests for affected workspace only

Do NOT run during development:

  • Full production build (npm run build -w @acroyoga/web)
  • Storybook build + a11y audit
  • Playwright E2E tests
  • i18n string lint
  • Bundle size check

These full checks run automatically in ci-full.yml when the ready-for-merge label is applied. Commit frequently — small, atomic commits on your feature branch.

Full Validation Checklist — For Pre-Merge Only

Run these in order only when preparing for final merge. All must pass:

npm run tokens:build -w @acroyoga/tokens   # 1. Build tokens (prerequisite)
npm run typecheck                           # 2. Zero type errors
npm run lint -w @acroyoga/web               # 3. Zero lint warnings
npm run test                                # 4. All tests pass (all workspaces)
npm run build -w @acroyoga/web              # 5. Production build succeeds

If you add a new API route, you MUST also:

  • Add integration tests in apps/web/tests/integration/
  • Test 403 for unauthorized callers (Constitution QG-10)
  • Use createTestDb() for PGlite test isolation

Branch Naming Convention

  • Agent sessions: copilot/{spec-number}/{task-id} (e.g., copilot/022/T005)
  • Human features: feature/{spec-number}-{description}
  • Bugfixes: fix/{issue-number}-{description}
  • Spikes: spike/{description} (exceptions to constitution — MUST NOT merge to main)

Auth Pattern

  • Web: getServerSession() / requireAuth() — session-based only
  • Never trust client-injectable headers (x-user-id, x-api-key etc.)
  • Admin routes: withPermission() middleware, not bare requireAuth()

Code Conventions

  • TypeScript strict mode — no any, no @ts-ignore
  • Zod schemas at all API boundaries (no manual typeof checks)
  • SQL migrations: apps/web/src/db/migrations/ (raw SQL, no ORM)
  • Response types: packages/shared/src/types/
  • Error responses: { error: string, code: string, details?: unknown } via @/lib/errors
  • No hardcoded user-facing strings (i18n extractable, Constitution VIII)
  • No N+1 queries — use JOINs or WHERE IN for lists (Constitution VI)

Quality Gates (Two-Tier CI)

Tier 1: Fast CI (ci-fast.yml) — every PR push

  1. Typecheck (tsc -b)
  2. Lint (ESLint + jsx-a11y)
  3. Affected workspace tests only (via paths-filter)

Tier 2: Full CI (ci-full.yml) — before merge to main

  1. All tests across all workspaces
  2. Production build
  3. Bundle size ≤ 200 KB compressed
  4. i18n string lint
  5. Storybook build + a11y audit (axe-core)
  6. Playwright E2E tests

PRs are blocked if any Tier 1 gate fails. Tier 2 runs when the ready-for-merge label is applied. Agent PRs get this label automatically after Tier 1 passes.

Deploy-Fix Protocol (Self-Healing Pipeline)

When assigned an issue labelled deploy-fix-auto:

  1. Read the issue body — it contains structured deployment diagnostics:
    • Error category (runtime, dependency, config, infra)
    • Container logs, system logs, and smoke test results
    • Suggested fix approach based on error patterns
  2. Identify the root cause from the logs and error classification
  3. Create a branch: copilot/deploy-fix/{issue-number}
  4. Implement the fix — focus only on the deployment failure, do not make unrelated changes
  5. Create a PR with Fixes #{issue-number} in the description
  6. The self-healing pipeline handles the rest — after merge, it will automatically rebuild and redeploy

Important constraints:

  • runtime / dependency / config errors → fix autonomously
  • infra errors → propose a fix but add the needs-human-review label (Constitution XV)
  • Credential/secret errors → do NOT attempt to fix; add needs-human-review label instead
  • Do NOT modify Bicep infrastructure files without human approval
  • Do NOT add or remove environment variables in Bicep without human approval
  • Keep fixes minimal and focused on the diagnosed error

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.