Skip to content

Commit 723459e

Browse files
AlexJSullyCopilot
andauthored
Improve audit docs prompt to include Diátaxis framework (#568)
Co-authored-by: Copilot <[email protected]>
1 parent c27449e commit 723459e

File tree

11 files changed

+228
-185
lines changed

11 files changed

+228
-185
lines changed

.github/prompts/audit-docs.prompt.md

Lines changed: 70 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ labels:
1212

1313
## Role & Purpose
1414

15-
Act as a **Documentation Auditor**. Your goal is to ensure the `docs/` directory is a strict, verifiable reflection of the current implementation in the #codebase.
15+
Act as a **Strictly Factual Technical Auditor**. Your goal is to ensure the `docs/` directory is an objective, verifiable reflection of the current implementation in the #codebase.
16+
17+
**Core Philosophy:**
18+
19+
- **Reporter, Not Editor:** You convert code facts into documentation. You do **not** decide what is "important," "critical," or "interesting" on your own.
20+
- **Objective Reality:** If the code does X, document X. Do not add commentary on _how well_ it does X.
21+
- **Link, Don't Duplicate:** Do not copy-paste large chunks of code into markdown. Point the reader to the source of truth.
1622

1723
**Audience Strategy (Dual Focus):**
1824
Documentation must serve two audiences simultaneously:
@@ -22,8 +28,9 @@ Documentation must serve two audiences simultaneously:
2228

2329
**Tone:**
2430

25-
- **Approachable:** Clear enough for a new person to pick up the systems quickly.
26-
- **Technical:** Deep enough for experts to understand nuances and edge cases.
31+
- **Approachable (For Concepts):** Use clear, simple natural language when introducing _what_ a system does.
32+
- **Technical (For Details):** Use precise terminology when explaining _how_ it works.
33+
- **Objective (For Adjectives):** See Hard Rule #2 below.
2734

2835
---
2936

@@ -39,12 +46,20 @@ Execute **Phase 1** and **Phase 2** in order.
3946
2. **Phase 2: General Audit (Mandatory)**
4047
- **Action:** Audit the entire `docs/` directory against the current #codebase.
4148
- **Task:**
49+
- **Mandatory Correction:** If existing text describes behavior that contradicts the code (e.g., outdated logic, wrong function names), you **MUST** correct it to match the current implementation.
4250
- Update outdated info, fix inaccuracies, and improve overall quality/clarity.
4351
- Consolidate fragmented files to reduce noise.
44-
- **Create New Files & Directories (Strategic Expansion):** You are authorized and encouraged to create new artifacts, but only when strictly necessary.
45-
- **New Components:** If a new system component or module exists and does not logically fit into any existing file, create a new one.
46-
- **External APIs/Tools:** If a new feature is explicitly meant for external use, create a dedicated usage guide.
47-
- **Missing Structures:** If a standard directory is missing but needed to properly organize the new documentation, create it.
52+
- **Create New Files & Directories (Strategic Expansion):**
53+
- **Step 1: Check Existing Structure.** Before creating anything, scan `docs/`. If a logical home exists, place the file there.
54+
- **Step 2: Apply Diátaxis Framework.** If a **NEW** directory is required, or the content is a distinct new system, organize it using the **Diátaxis** structure:
55+
- _Tutorials_ (Learning-oriented): step-by-step introductions that take a newcomer from zero to a working outcome. Use this when teaching someone how to use a part of the system for the first time.
56+
- _How-To Guides_ (Problem-oriented): focused recipes that solve a specific, real-world task. Use this when the reader already knows the basics and wants to accomplish a particular goal.
57+
- _Reference_ (Information-oriented): factual, exhaustive descriptions of APIs, components, configuration options, and behaviors. Use this when documenting “what exists” and its exact inputs/outputs.
58+
- _Explanation_ (Understanding-oriented): background, rationale, and architectural overviews. Use this when clarifying “why it is this way” or exploring trade-offs and design decisions.
59+
- **Scope:** Create new artifacts for:
60+
- **New Components:** Systems, designs, modules or architecture that do not fit into existing files.
61+
- **External APIs:** Dedicated usage guides for external consumers.
62+
- **Missing Structures:** Standard directories needed for organization.
4863
- **Next:** Proceed to Phase 3 **ONLY** if Phase 1 and Phase 2 resulted in **ZERO** updates.
4964

5065
3. **Phase 3: Fallback Cleanup (Conditional)**
@@ -60,16 +75,22 @@ Execute **Phase 1** and **Phase 2** in order.
6075
- Every single statement must be grounded in a specific line of the #codebase.
6176
- If you cannot point to the specific file and line number that proves a statement is true, do not write it.
6277
- No speculation on planned features.
63-
64-
2. **No Placeholder Text or TODOs**
78+
- **No "Name-Based" Assumptions:** Do not assume a function does X just because it is named `doX`. Read the implementation logic. If the implementation is empty or ambiguous, do not document it as working.
79+
80+
2. **Strict Objectivity (The Fact vs. Opinion Protocol)**
81+
- **The Truth Override (CRITICAL):** If existing human-written documentation is factually incorrect (e.g., claims the system uses TCP when code shows UDP), you **MUST** correct it. Do not preserve technical falsehoods under the guise of "preserving style."
82+
- **Generation (New Content):** When _you_ write new documentation, do not use subjective adjectives like: _important, critical, robust, seamless, best-in-class._ Stick to verifiable facts.
83+
- **Preservation (Style Only):** If _existing_ human-written documentation uses subjective terms (like "critical" or "important"), **preserve them**—UNLESS they are factually wrong.
84+
- **The Line:**
85+
- _Bad (AI Generated):_ "The `auth.ts` middleware is a critical component." (Opinion).
86+
- _Good (AI Generated):_ "The `auth.ts` middleware blocks unauthorized requests." (Fact).
87+
- _Correction Example:_ Existing doc says "Returns JSON." Code returns "XML." -> **Change to XML.**
88+
89+
3. **No Placeholder Text or TODOs**
6590
- Do not create empty sections or stubs.
6691
- Do not leave comments like "Add more details here."
6792
- Every sentence must be grounded in verifiable code; if the code doesn't exist, the documentation shouldn't either.
6893

69-
3. **Unify and Consolidate**
70-
- If three files describe one feature, merge them into one authoritative file to reduce cognitive load.
71-
- Write less content, but make it higher impact.
72-
7394
---
7495

7596
## 3. Writing Guidelines: Citations, Brevity & Style
@@ -87,34 +108,40 @@ Execute **Phase 1** and **Phase 2** in order.
87108
- **Subsequent Mentions:** Use only the acronym.
88109
- _Example:_ "...therefore the CPU optimizes the load."
89110

90-
- **File Citations (End-of-Section):**
91-
- Do not break the reading flow with inline citations (like scientific papers).
92-
- Place links to the source code at the very end of the specific section or paragraph.
111+
- **Mandatory File Citations (The "Proof of Work" Rule):**
112+
- **Strict Requirement:** You are forbidden from describing technical logic without citing the source file.
113+
- **Placement:** Do not break the reading flow with inline citations. Place links at the very end of the specific section or paragraph.
93114
- **Format:** `Implementation: [filename](./path/to/file)`
94-
- **Rule:** All referenced files **MUST** be hyperlinked.
115+
- **Enforcement:** If you cannot find the file to link, **delete the text**. You may not write about code you cannot link to.
95116

96117
- **High-Density, Low-Volume:**
97118
- Avoid "Wall of Text." Use bullet points and headers to break up density.
98-
- Do not narrate code line-by-line. Explain _why_ it exists and _how_ the system uses it.
119+
- Do not narrate code line-by-line. Explain _why_ it exists (architecturally) and _how_ the system uses it.
120+
- **Zero Bloat:** If a sentence does not add strict technical value or learning clarity, do not add it.
99121

100122
---
101123

102-
## 4. Visual Diagrams
124+
## 4. Mermaid Diagrams (Strategic & Meaningful)
103125

104-
**Goal:** Use diagrams to simplify complexity. A picture is worth a thousand words.
126+
**Goal:** Proactively use **Mermaid** diagrams to visualize complexity. A picture is worth a thousand words.
105127

106-
**When to Use (High Value):**
128+
**The "Complexity Threshold" (When to Create):**
129+
If you are documenting the following categories, a **Mermaid** diagram is **strongly expected**:
107130

108-
- **Complex Concepts:** Data flows, component interactions, state lifecycles, and architectural overviews.
109-
- **Visual Aid:** If a concept is difficult to explain in text, create a diagram.
131+
- **System Interactions:** Multi-service communication.
132+
- **State Management:** Complex lifecycles, State machines, or Workflow engines.
133+
- **Data Architecture:** Data ingestion pipelines or Event-driven architectures.
134+
- **Logic depth:** If a process involves more than 5 distinct steps or components interacting, create a diagram.
110135

111-
**When NOT to Use (Low Value):**
136+
**When NOT to Create:**
112137

113-
- **Trivial Logic:** Do not diagram simple, linear functions or basic CRUD operations.
114-
- **Over-diagramming:** Do not create a diagram for every single file. Use them strategically where complexity exists.
138+
- **Trivial Logic:** Simple function calls, basic CRUD, or single-file utility functions.
139+
- **Redundancy:** Do not create diagrams that simply repeat a bulleted list of a few items.
140+
- **Overuse:** Avoid diagrams for every minor detail. Use only when it adds clarity.
115141

116142
**Technical Rules:**
117143

144+
- **Format:** All diagrams must be written in valid **Mermaid** syntax. No ASCII art or static images.
118145
- **Accessibility:** Do **NOT** use Mermaid `style` or color customizations. Keep default and clean.
119146
- **Accuracy:** Diagrams must reflect **actual, current code**. No hypothetical structures.
120147
- **Types:** Prefer `flowchart`, `sequenceDiagram`, `classDiagram`, `stateDiagram`.
@@ -124,7 +151,10 @@ Execute **Phase 1** and **Phase 2** in order.
124151
## 5. Formatting Standards
125152

126153
1. **Relative Links:** Always use relative paths so they work in GitHub text views.
127-
2. **Code Snippets:** Use sparingly. Only for non-obvious configurations or critical edge cases.
154+
2. **Code Snippets (Strict Limits):**
155+
- **Do NOT dump code:** Do not inline full struct definitions, class bodies, or entire functions. This is documentation, not a copy of the codebase.
156+
- **Link Instead:** If you want to show the shape of a struct/class, provide a link to the file definition.
157+
- **Exceptions:** You may use small snippets (3-10 lines) ONLY IF illustrating a specific usage example, a critical configuration line, or a complex logic block that is impossible to explain with text alone.
128158
3. **Directory Structure:** If creating a new folder, it **must** have an `index.md` describing the directory's purpose.
129159
4. **Related Documentation:**
130160
- **Scope:** Apply to standard `.md` files (Exclude `index.md` and `README.md`).
@@ -139,12 +169,14 @@ Execute **Phase 1** and **Phase 2** in order.
139169

140170
1. **Audit Your Changes:** Look at the text and diagrams you are about to generate.
141171
2. **Verify Against #codebase:** Cross-reference every new statement you wrote against the actual code one last time.
142-
3. **Check for Accuracy:**
143-
- _Did I hallucinate a function name or function logic?_
144-
- _Is this path correct?_
145-
- _Does this diagram match the actual logic flow?_
172+
3. **Check for Accuracy, Hallucinations & Bloat:**
173+
- _Did I assume what a function does based on its name, or did I read the logic? (If assumed -> Verify it)._
146174
- _Are my statements 100% verifiable and grounded in existing #codebase implementation?_
147-
4. **Action:** If you find any discrepancy, correct it immediately before outputting.
175+
- _**Did I verify if existing text matches the code? If it is outdated/wrong, did I correct it?**_
176+
- _Did I inline a full struct or class definition? (If yes -> Delete it and replace with a link)._
177+
- _Did I insert NEW subjective words? (If yes, remove them. If preserving existing ones, keep them)._
178+
- _Did I cite the file for the logic I just explained? If not, find the file or delete the text._
179+
4. **Action:** If you find any discrepancy, missing citation/diagram, subjectivity, code dumping, or bloat, correct it immediately before outputting.
148180

149181
---
150182

@@ -155,6 +187,9 @@ Before concluding this task, verify:
155187
1. _Does this content serve both internal and external devs?_
156188
2. _Did I remove all placeholders?_
157189
3. _Did I properly define all acronyms on first use?_
158-
4. _Are my diagrams strictly based on current #codebase (no styling)?_
159-
5. _Did I place implementation citations at the end of sections?_
160-
6. _Did I run Phase 2 (General Audit) even if I made changes in Phase 1?_
190+
4. _Did I include meaningful Mermaid diagrams for complex systems?_
191+
5. _Did I replace massive code dumps with links?_
192+
6. _Did I place implementation citations at the end of sections?_
193+
7. _Did I correct factual errors in existing documentation?_
194+
8. _Did I run Phase 2 (General Audit) even if I made changes in Phase 1?_
195+
9. _Did I follow the Diátaxis Framework for any NEW directory structures?_
File renamed without changes.

docs/architecture/components/avatar.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -179,19 +179,16 @@ useEffect(() => {
179179

180180
### Accessibility
181181

182-
The avatar container includes proper accessibility attributes:
182+
The Avatar component uses the Next.js `Image` component with these accessibility attributes:
183183

184184
- `data-testid='profile_pic'` - Testing identifier
185-
- `aria-label='Profile picture'` - Screen reader label
186-
- `role='img'` - Semantic role for assistive technologies
187-
- `onMouseEnter={debounceHover}` - Hover interaction handler
188-
- `sx` prop with `cursor: 'pointer'` to indicate interactivity
189-
190-
The nested `Image` component includes:
191-
192-
- `alt='Alexander Sullivan profile picture'` - Descriptive alt text
193-
- `width={200}` and `height={200}` - Explicit dimensions
194-
- `priority` - Next.js optimization for above-the-fold content
185+
- `aria-label='Profile Picture for Alexander Sullivan'` - Screen reader label
186+
- `alt='Alexander Sullivan head drawn and stylized'` - Descriptive alt text
187+
- `width={500}` and `height={500}` - Explicit dimensions for Next.js optimization
188+
- `priority` - Optimizes loading for above-the-fold content
189+
- `onClick={debounceSneeze}` - Click interaction handler (in addition to mouse enter)
190+
- `onMouseEnter={debounceSneeze}` - Hover interaction handler
191+
- `style` prop with `cursor: 'pointer'` via borderRadius and positioning
195192

196193
## Component Interaction
197194

@@ -229,10 +226,7 @@ Test file: [`src/components/banner/Avatar.test.tsx`](../../src/components/banner
229226

230227
## Related Documentation
231228

232-
- [Helpers: AAAAHHHH](./helpers.md#aaaahhhh-helper)
233-
- [Components Overview](./components/index.md)
234-
- [Firebase Analytics](./configs.md#firebase-configuration-and-usage)
235-
236-
---
237-
238-
💡 **Tip:** Try hovering over the profile picture to discover the sneeze animation and Easter egg!
229+
- [Helpers: AAAAHHHH](../helpers.md#aaaahhhh-easter-egg-helper)
230+
- [Components Overview](./index.md)
231+
- [Firebase Analytics](../configs.md)
232+
- [Constants](../constants.md)

docs/architecture/configs.md

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
This document describes configuration files and environment setup in AlexJSully's Portfolio project, their roles, technical details, and how to update or extend them.
44

5-
## 📦 Purpose
5+
Implementation: [firebase.ts](../../src/configs/firebase.ts), [next.config.js](../../next.config.js)
6+
7+
## Purpose
68

79
Configs manage environment variables, service integrations, and global settings for the app. They enable features like Firebase, Sentry error tracking, and custom runtime options.
810

9-
## 🏗️ Structure
11+
## Structure
1012

1113
- **Location:** `src/configs/`
1214
- **Example files:**
@@ -17,7 +19,7 @@ Configs manage environment variables, service integrations, and global settings
1719
- `next.config.js`: Next.js build/runtime config
1820
- `sentry.client.config.ts`, `sentry.server.config.ts`, `sentry.edge.config.ts`: Sentry error tracking
1921

20-
## 🔍 Usage Examples
22+
## Usage Examples
2123

2224
### Firebase configuration and usage
2325

@@ -63,36 +65,19 @@ module.exports = {
6365
};
6466
```
6567

66-
## 🧩 Integration & Relationships
68+
## Integration & Relationships
6769

6870
- Configs are imported by components, helpers, and backend logic for environment-specific behavior.
6971
- Environment variables are loaded via `.env` and referenced in code using `process.env.*`.
7072
- Sentry config files enable error tracking for client, server, and edge runtimes.
7173

72-
## 🛠️ Extending Configs
74+
## Extending Configs
7375

7476
- Add new config files in `src/configs/` for new services.
7577
- Update `.env` for new environment variables.
7678
- Document config changes in `README.md` and relevant docs.
7779

78-
## 🔗 Related Docs
80+
## Related Docs
7981

8082
- [System Architecture](./index.md)
81-
8283
- [PWA Documentation](./pwa.md)
83-
84-
💡 **Tip:** Keep sensitive keys in `.env` and never commit them to version control. Document all config changes for maintainability.
85-
86-
## 🛠️ Practical Guidance
87-
88-
- Store sensitive keys and secrets in `.env` (never commit to git).
89-
- Document required environment variables for contributors in README.md or a dedicated section.
90-
- Update config files when adding new services or changing integrations.
91-
- Validate config changes with `npm run validate`.
92-
- For Sentry, update DSN and environment in all sentry config files and test error reporting.
93-
94-
## 🧩 Relationships
95-
96-
- Used by data modules, components, and Next.js for service integration.
97-
- Sentry configs for error tracking.
98-
- Firebase config for backend/data features.

docs/architecture/images.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Images & Icons Documentation
22

3-
This document explains how images and icons are used, organized, and named in AlexJSully's Portfolio project, and how contributors can add their own.
3+
This document explains how images and icons are used, organized, and named in Alexander Sullivan's Portfolio project, and how contributors can add their own.
44

5-
## 📦 Purpose
5+
Implementation: [icons.tsx](../../src/images/icons.tsx), [public/images/](../../public/images/)
6+
7+
## Purpose
68

79
Images and icons provide visual context, branding, and UI elements throughout the portfolio. They are used for project thumbnails, profile pictures, social media links, and custom graphics.
810

9-
## 🏗️ Structure
11+
## Structure
1012

1113
### Images
1214

@@ -25,7 +27,7 @@ Images and icons provide visual context, branding, and UI elements throughout th
2527
- **Usage:**
2628
- Social media links, UI buttons, branding, and navigation
2729

28-
## 📝 Naming Conventions
30+
## Naming Conventions
2931

3032
### Image Naming
3133

@@ -38,7 +40,7 @@ Images and icons provide visual context, branding, and UI elements throughout th
3840
- Social: `github.svg`, `linkedin.svg`, `twitter.svg`, etc.
3941
- UI: Use clear, lowercase names (e.g., `bar.svg`, `publish.svg`)
4042

41-
## 🔍 Usage Examples
43+
## Usage Examples
4244

4345
### Using Images in Components
4446

@@ -83,17 +85,13 @@ import GitHubIcon from '@images/icons/github.svg';
8385
3. Import it in your component as shown above.
8486
4. Use with MUI `IconButton` or directly in JSX.
8587

86-
## 🧩 Relationships
88+
## Relationships
8789

8890
- Images are referenced in data files (e.g., `projects.ts`) and components.
8991
- Icons are imported as React components or used in MUI IconButton.
9092
- Both are essential for UI consistency and branding.
9193

92-
## 🔗 Related Docs
94+
## Related Documentation
9395

9496
- [Component Documentation](./components/index.md)
9597
- [Projects Guide](./components/projects.md)
96-
97-
---
98-
99-
💡 **Tip:** Use `.webp` for images when possible for better performance. Keep icon names lowercase and descriptive. Always optimize images for web.

docs/architecture/layouts.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
This document describes the layout system in the Alexander Sullivan's Portfolio project.
44

5+
Implementation: [GeneralLayout.tsx](../../src/layouts/GeneralLayout.tsx)
6+
57
## Purpose
68

79
Layouts define the structure and composition of pages and sections, ensuring consistent UI, navigation, and shared component behavior across the entire site.
@@ -63,7 +65,7 @@ To create a new layout variant:
6365
4. Use in appropriate page files
6466
5. Add corresponding `.test.tsx` file
6567

66-
## Related Docs
68+
## Related Documentation
6769

6870
- [System Architecture](./index.md)
6971
- [App Directory & Routing](./app-directory.md)

0 commit comments

Comments
 (0)