Skip to content

Commit 59ebd3a

Browse files
committed
docs: reinstated support docs
1 parent 6d5644d commit 59ebd3a

File tree

7 files changed

+257
-9
lines changed

7 files changed

+257
-9
lines changed

.claude/commands/plan.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
Create a new plan from a Jira task: fetch details, transition to In Progress, create branch, and write plan.
2+
3+
## Arguments
4+
5+
- `$ARGUMENTS` - The Jira ticket ID (e.g., `AP-23`)
6+
7+
## Instructions
8+
9+
1. **Fetch the Jira task**:
10+
- Use `mcp__atlassian__getJiraIssue` with the provided ticket ID: `$ARGUMENTS`
11+
- Extract: summary, description, issue type
12+
13+
2. **Transition to In Progress**:
14+
- Use `mcp__atlassian__getTransitionsForJiraIssue` to get available transitions
15+
- Use `mcp__atlassian__transitionJiraIssue` to move to "In Progress" (skip if already in progress)
16+
17+
3. **Create the feature branch**:
18+
- Generate branch name: `feature/{ticket-id-lowercase}-{slugified-summary}`
19+
- Example: `AP-23 Add Bulk Event Creation``feature/ap-23-add-bulk-event-creation`
20+
- Run: `git checkout main && git pull && git checkout -b {branch-name}`
21+
22+
4. **Write the plan**:
23+
- Create/overwrite `docs/plan.md`
24+
- Break down the Jira task into small, actionable checkbox tasks
25+
- Each task should be one focused change
26+
27+
5. **Activate the loop**:
28+
- Create the marker file: `touch .claude/loop`
29+
- This tells the plan-iterator hook to auto-continue through tasks
30+
31+
## Plan Format
32+
33+
```markdown
34+
# {TICKET-ID} {Summary}
35+
36+
> {Description from Jira - keep it brief}
37+
38+
## Tasks
39+
40+
- [ ] First small task
41+
- [ ] Second small task
42+
- [ ] Add tests for X
43+
- [ ] Handle edge case Y
44+
45+
## Notes
46+
47+
{Any relevant context from Jira comments or acceptance criteria}
48+
```
49+
50+
## Rules
51+
52+
- **Checkbox format**: Must use `- [ ]` exactly (the plan-iterator hook reads this)
53+
- **Small tasks**: Each task = one focused change, completable in one session
54+
- **Logical order**: Order by dependency
55+
- **Include tests**: Add test tasks where appropriate
56+
- **No time estimates**: Never add time estimates
57+
58+
## Example
59+
60+
Input: `/plan AP-42`
61+
62+
Jira task: "Add user avatar upload" with description about allowing profile pictures.
63+
64+
Output `docs/plan.md`:
65+
66+
```markdown
67+
# AP-42 Add user avatar upload
68+
69+
> Allow users to upload and display profile avatars. Accept jpg/png/webp up to 2MB.
70+
71+
## Tasks
72+
73+
- [ ] Add avatar field to user schema
74+
- [ ] Create file upload API endpoint
75+
- [ ] Add image validation (size, format)
76+
- [ ] Store avatars in cloud storage
77+
- [ ] Display avatar in profile page
78+
- [ ] Add fallback for users without avatar
79+
- [ ] Write tests for upload endpoint
80+
81+
## Notes
82+
83+
- Acceptance: users can upload from settings page
84+
- Use existing S3 bucket for storage
85+
```

.gitignore

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,3 @@ Thumbs.db
2121
# Vite
2222
vite.config.js.timestamp-*
2323
vite.config.ts.timestamp-*
24-
25-
# Report aids
26-
Assesment-criteria.md
27-
ksbs.md
28-
29-
# Temporary project files
30-
plan.md
31-
CLAUDE.md

CLAUDE.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Working Preferences
6+
7+
- **Small iterations**: Make one small change at a time, explain it, and wait for approval before proceeding
8+
- **Alignment**: Features, branches, and Jira tasks must always be aligned (e.g., branch `feature/ap-15-role-based-route-protection` for Jira ticket AP-15)
9+
- **Consistency**: Keep code consistent with existing patterns in the codebase
10+
- **Proven solutions**: Use robust, well-established approaches - no experimental or "clever" solutions
11+
- **Report updates**: When updating `docs/report.md`, check `docs/Assesment-criteria.md` and `docs/planning/ksbs.md`. Try to phrase content to align with assessment criteria where natural, but never force it - not every change needs to match a criterion. The report tracks all interesting technical decisions.
12+
- **No AI attribution**: Never add "Co-Authored-By" or "Generated with Claude" messages to commits or PRs
13+
14+
15+
## Commands
16+
17+
```bash
18+
npm run dev # Start development server
19+
npm run build # Build for production
20+
npm run test # Run all tests (Vitest)
21+
npm run test:unit # Run tests in watch mode
22+
npm run lint # Run ESLint
23+
npm run check # TypeScript type checking
24+
```
25+
26+
Run a single test file:
27+
```bash
28+
npx vitest run src/lib/server/auth.spec.ts
29+
```
30+
31+
## Architecture
32+
33+
Apprentice Pulse is a SvelteKit application that automates attendance tracking, progress reviews, and early intervention alerts for FAC apprentices. It sits on top of existing Airtable bases.
34+
35+
### Key Layers
36+
37+
- **Frontend**: Mobile-first PWA for student check-in (NFC/QR → magic link auth → one-tap attendance)
38+
- **API Routes**: `/api/auth/*`, `/api/checkin`, `/api/events`, `/api/webhooks`
39+
- **Cron Jobs**: Attendance chase, survey reminders, EPA alerts (Vercel Cron)
40+
- **External Services**: Airtable (database), Resend (email), Discord (webhooks)
41+
42+
### Airtable Integration
43+
44+
Tables and fields are referenced by **IDs** (not names) to prevent breakage when users rename things. IDs are centralized in `src/lib/airtable/config.ts`.
45+
46+
```typescript
47+
import { TABLES, APPRENTICE_FIELDS } from '$lib/airtable/config';
48+
```
49+
50+
Use `returnFieldsByFieldId: true` in queries. Note: `filterByFormula` still requires field **names** (Airtable limitation).
51+
52+
Schema documentation: `docs/schema.md`
53+
54+
### Authentication
55+
56+
Magic link auth with JWT tokens (15-min expiry). Sessions stored as HTTP-only cookies (90 days).
57+
58+
- `src/lib/server/auth.ts` - Token generation/verification
59+
- `src/lib/server/session.ts` - Cookie helpers (get/set/clear)
60+
- `src/hooks.server.ts` - Route protection middleware
61+
62+
User types: `'staff'` | `'student'`. Route protection:
63+
- `/admin/*` → staff only
64+
- `/checkin` → any authenticated user
65+
- `/login` → redirects if already authenticated
66+
67+
### Code Style
68+
69+
ESLint with `@stylistic/eslint-plugin`:
70+
- Tabs for indentation
71+
- Single quotes
72+
- Semicolons required
73+
- Brace style: `else`/`catch` on new line after closing brace
74+
75+
Svelte 5 runes syntax (`$state`, `$derived`, `$props`). Use `$app/state` not `$app/stores`.
76+
77+
**DOM element references** must use `$state` - never use plain variables:
78+
```typescript
79+
// Correct
80+
let container = $state<HTMLDivElement | null>(null);
81+
82+
// Wrong - causes "non_reactive_update" warning
83+
let container: HTMLDivElement;
84+
```
85+
86+
## Testing Auth in Development
87+
88+
Magic links log to console (not emailed). To test:
89+
90+
1. Start dev server: `npm run dev`
91+
2. POST to login: `curl -X POST http://localhost:5173/api/auth/login -H "Content-Type: application/json" -d '{"email": "your@email.com"}'`
92+
3. Copy token from server console
93+
4. Visit in browser: `http://localhost:5173/api/auth/verify?token=YOUR_TOKEN`

docs/Assesment-criteria.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
### Assesment Criteria
2+
3+
## Method1 (Project and Project report)
4+
5+
6+
| # | Assessment Criteria | Associated KSBs |
7+
|---|---------------------|-----------------|
8+
| | **Pass Criteria** | |
9+
| P1 | Explains the roles and responsibilities of all people working within the software development lifecycle, and how they relate to the project. | K2 |
10+
| P2 | Outlines how teams work effectively to produce software and how to contribute appropriately. | K6 |
11+
| P3 | Outlines and applies the rationale and use of algorithms, logic and data structures. | K9, S16 |
12+
| P4 | Reviews methods of software design with reference to functional/technical specifications and applies a justified approach to software development. | K11, S11, S12 |
13+
| P5 | Creates logical and maintainable code to deliver project outcomes, explaining their choice of approach. | S1 |
14+
| P6 | Analyses unit testing results and reviews the outcomes correcting errors. | S4 |
15+
| P7 | Identifies and creates test scenarios which satisfy the project specification. | S6 |
16+
| P8 | Applies structured techniques to problem solving to identify and resolve issues and debug basic flaws in code. | S7 |
17+
| P9 | Reviews and justifies their contribution to building, managing and deploying code into the relevant environment in accordance with the project specification. | S10 |
18+
| P10 | Establishes a logical thinking approach to areas of work which require valid reasoning and/or justified decision making. | B2 |
19+
| P11 | Describes how they have maintained a productive, professional and secure working environment throughout the project activity. | B3 |
20+
| | **Distinction Criteria** | |
21+
| D1 | Compare and contrast the requirements of a software development team, and how they would ensure that each member (including themselves) were able to make a contribution. | K6 |
22+
| D2 | Evaluates the advantages and disadvantages of different coding and programming techniques to create logical and maintainable code. | S1 |
23+
| D3 | Analyses the software to identify and debug complex issues using a fix that provides a permanent solution. | S7 |
24+
| D4 | Evaluates different software development approaches in order justifying the best alignment with a given paradigm (for example, object oriented, event driven or procedural). | S11 |

docs/ksbs.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# KSBs (Knowledge, Skills, and Behaviours)
2+
3+
| KSB | Criteria |
4+
|-----|----------|
5+
| K1 | All stages of the software development life-cycle (what each stage contains, including the inputs and outputs) |
6+
| K3 | The roles and responsibilities of the project life-cycle within your organisation, and your role |
7+
| K4 | How best to communicate using the different communication methods and how to adapt appropriately to different audiences |
8+
| K5 | The similarities and differences between different software development methodologies, such as agile and waterfall |
9+
| K7 | Software design approaches and patterns, to identify reusable solutions to commonly occurring problems |
10+
| K8 | Organisational policies and procedures relating to the tasks being undertaken, and when to follow them (e.g. GDPR sensitive data) |
11+
| K10 | Principles and uses of relational and non-relational databases |
12+
| K12 | Software testing frameworks and methodologies |
13+
| S2 | Develop effective user interfaces |
14+
| S3 | Link code to data sets |
15+
| S5 | Conduct a range of test types, such as Integration, System, User Acceptance, Non-Functional, Performance and Security testing |
16+
| S8 | Create simple software designs to effectively communicate understanding of the program |
17+
| S9 | Create analysis artefacts, such as use cases and/or user stories |
18+
| S13 | Follow testing frameworks and methodologies |
19+
| S14 | Follow company, team or client approaches to continuous integration, version and source control |
20+
| S15 | Communicate software solutions and ideas to technical and non-technical stakeholders |
21+
| S17 | Interpret and implement a given design whilst remaining compliant with security and maintainability requirements |
22+
| B1 | Works independently and takes responsibility. Has a disciplined and responsible approach to risk and stays motivated and committed when facing challenges |
23+
| B4 | Works collaboratively with a wide range of people in different roles, internally and externally, with a positive attitude to inclusion and diversity |
24+
| B5 | Acts with integrity with respect to ethical, legal and regulatory ensuring the protection of personal data, safety and security |
25+
| B6 | Shows initiative and takes responsibility for solving problems within their own remit, being resourceful when faced with a problem to solve |
26+
| B7 | Communicates effectively in a variety of situations to both a technical and non-technical audience |
27+
| B8 | Shows curiosity to the business context in which the solution will be used, displaying an inquisitive approach to solving the problem |
28+
| B9 | Committed to continued professional development |

docs/plan.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AP-27 Attendance service - aggregate queries
2+
3+
> Extend attendance service with aggregate query functions for dashboard metrics. Functions needed: getApprenticeAttendanceStats, getCohortAttendanceStats, getAttendanceSummary. Returns: total events, attended count, attendance rate, late count, excused count, trend data.
4+
5+
## Tasks
6+
7+
- [x] Define TypeScript types for attendance stats (AttendanceStats, ApprenticeAttendanceStats, CohortAttendanceStats, AttendanceSummary)
8+
- [x] Add getAllAttendance() helper to fetch all attendance records
9+
- [x] Add getAllEvents() helper to fetch all events (needed for total event counts)
10+
- [x] Implement getApprenticeAttendanceStats(apprenticeId) - individual apprentice stats
11+
- [x] Implement getCohortAttendanceStats(cohortId) - cohort aggregate stats
12+
- [x] Implement getAttendanceSummary() - overall summary for dashboard card
13+
- [x] Add trend calculation helper (compare last 4 weeks vs previous 4 weeks)
14+
- [x] Write tests for getApprenticeAttendanceStats
15+
- [x] Write tests for getCohortAttendanceStats
16+
- [x] Write tests for getAttendanceSummary
17+
18+
## Notes
19+
20+
- Existing attendance service is in `src/lib/airtable/attendance.ts`
21+
- Existing types in `src/lib/types/attendance.ts`
22+
- Cohort data available via `listCohorts()` and `getApprenticesByCohortId()` in airtable.ts
23+
- Events have cohortIds array (multi-cohort support)
24+
- Status values: Present, Absent, Late, Excused
25+
- Client-side aggregation approach (no Airtable schema changes)
26+
- Attendance rate = (Present + Late) / Total events for cohort

docs/scratchpad.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
add events button cahgnes to cancel and scroll up
1+
22

33
td elements reduce padding
44

0 commit comments

Comments
 (0)