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…
In this repositoryOne other file it gives its agents.
- .github/agents/copilot-instructions.mdCopilot instructions
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
- Distinctive: line 4
MUST follow these rules. Violations will be caught by CI and rejected.
- Distinctive: line 16
When assigned an issue:
- Distinctive: line 18
Check if it references a spec task (e.g., "T005 from spec 022")
- Distinctive: line 19
If yes, read the full spec artifacts before coding
- Distinctive: line 20
If no, treat as a standalone bugfix/improvement
- Distinctive: line 24
When implementing a task autonomously:
- Very specific: line 39
I. API-First: All mutations go through API routes, never direct DB from components.
- Very specific: line 41
II. Test-First: Every service function needs an integration test.
- Very specific: line 44
IX. Scoped Permissions: Use withPermission() middleware on all admin/mutation endpoints.
- Distinctive: line 45
XI. Resource Ownership: Every mutation verifies caller owns the resource or holds scoped admin.
- Distinctive: line 47
XV. Autonomous Pipeline: Use fast CI for iteration, full CI before merge only.
- Distinctive: line 64
When implementing a task, run ONLY these checks during development (< 3 min total):
- Distinctive: line 71
Do NOT run during development:
- Distinctive: line 83
Run these in order only when preparing for final merge.
- Distinctive: line 91
If you add a new API route, you MUST also:
- Very specific: line 92
Add integration tests in apps/web/tests/integration/
- Distinctive: line 93
Test 403 for unauthorized callers (Constitution QG-10)
- Very specific: line 94
Use createTestDb() for PGlite test isolation
- Very specific: line 106
Never trust client-injectable headers (x-user-id, x-api-key etc.)
- Distinctive: line 116
No hardcoded user-facing strings (i18n extractable, Constitution VIII)
- Very specific: line 117
No N+1 queries — use JOINs or WHERE IN for lists (Constitution VI)
- Distinctive: line 129
All tests across all workspaces
- Very specific: line 141
When assigned an issue labelled deploy-fix-auto:
- Distinctive: line 157
Do NOT modify Bicep infrastructure files without human approval
- Distinctive: line 158
Do NOT add or remove environment variables in Bicep without human approval
- Distinctive: line 159
Keep fixes minimal and focused on the diagnosed error
≈ “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.
Files
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 specificationspecs/{NNN}-{name}/plan.md— Implementation planspecs/{NNN}-{name}/tasks.md— Ordered task listspecs/{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:
- Check if it references a spec task (e.g., "T005 from spec 022")
- If yes, read the full spec artifacts before coding
- If no, treat as a standalone bugfix/improvement
Autonomous Session Protocol
When implementing a task autonomously:
- Read the assigned issue — it maps to a spec task
- Read the spec artifacts: spec.md, plan.md, data-model.md
- Create a branch:
copilot/{spec-number}/{task-id}(e.g.,copilot/022/T005) - Implement the change using the Fast Iteration Workflow below
- Create a PR with
Fixes #{issue-number}in the description to auto-close the issue - The CI pipeline handles the rest — fast CI runs automatically, then full CI before merge
Before Writing Any Code
- 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. - 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.
- I. API-First: All mutations go through API routes, never direct DB from components.
Response shapes live in
- 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:
| Workspace | Package | Purpose |
apps/web/ | @acroyoga/web | Next.js 16 web app (App Router, React 19) |
apps/mobile/ | @acroyoga/mobile | Expo React Native app |
packages/shared/ | @acroyoga/shared | Shared TypeScript types and contracts |
packages/shared-ui/ | @acroyoga/shared-ui | 15 cross-platform UI components (design tokens) |
packages/tokens/ | @acroyoga/tokens | Design 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 onlyDo 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 succeedsIf 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-keyetc.) - Admin routes:
withPermission()middleware, not barerequireAuth()
Code Conventions
- TypeScript strict mode — no
any, no@ts-ignore - Zod schemas at all API boundaries (no manual
typeofchecks) - 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 INfor lists (Constitution VI)
Quality Gates (Two-Tier CI)
Tier 1: Fast CI (ci-fast.yml) — every PR push
- Typecheck (
tsc -b) - Lint (ESLint + jsx-a11y)
- Affected workspace tests only (via paths-filter)
Tier 2: Full CI (ci-full.yml) — before merge to main
- All tests across all workspaces
- Production build
- Bundle size ≤ 200 KB compressed
- i18n string lint
- Storybook build + a11y audit (axe-core)
- 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:
- 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
- Error category (
- Identify the root cause from the logs and error classification
- Create a branch:
copilot/deploy-fix/{issue-number} - Implement the fix — focus only on the deployment failure, do not make unrelated changes
- Create a PR with
Fixes #{issue-number}in the description - The self-healing pipeline handles the rest — after merge, it will automatically rebuild and redeploy
Important constraints:
runtime/dependency/configerrors → fix autonomouslyinfraerrors → propose a fix but add theneeds-human-reviewlabel (Constitution XV)- Credential/secret errors → do NOT attempt to fix; add
needs-human-reviewlabel 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
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
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.

