Skip to content

Commit 92318d9

Browse files
authored
Update doc prompt to make phase 3 mandatory (#573)
1 parent ff4b4e6 commit 92318d9

File tree

3 files changed

+374
-324
lines changed

3 files changed

+374
-324
lines changed

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

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Documentation must serve two audiences simultaneously:
3838

3939
## 1. Execution Flow (Sequential)
4040

41-
Execute **Phase 1** and **Phase 2** in order.
41+
Execute **all three phases** in order.
4242

4343
1. **Phase 1: PR Sync (Priority)**
4444
- **Condition:** If #activePullRequest or #changes exist.
@@ -51,6 +51,7 @@ Execute **Phase 1** and **Phase 2** in order.
5151
- Documentation already exists but is now incomplete or outdated.
5252
- Do **NOT** conclude Phase 1 is complete simply because docs were untouched.
5353
- **Scope Constraint:** Only document behavior that **changed as a direct result of the PR**.
54+
- **Output Requirement:** Explicitly state whether you made changes or found the `docs/` directory already accurate for PR changes.
5455
- **Next:** Proceed immediately to Phase 2.
5556

5657
2. **Phase 2: General Audit (Mandatory)**
@@ -76,12 +77,57 @@ Execute **Phase 1** and **Phase 2** in order.
7677
- **New Components:** Systems, designs, modules or architecture that do not fit into existing files.
7778
- **External APIs:** Dedicated usage guides for external consumers.
7879
- **Missing Structures:** Standard directories needed for organization.
79-
- **Next:** Proceed to Phase 3 **ONLY** if Phase 1 and Phase 2 resulted in **ZERO** updates.
80-
81-
3. **Phase 3: Fallback Cleanup (Conditional)**
82-
- **Trigger:** You have confirmed that `docs/` is already 100% accurate and required no updates in Phase 1 or 2.
83-
- **Action:** Check root Markdown files (e.g., `README.md`) or in-code documentation.
84-
- **Task:** Fix only if misleading or factually incorrect. Apply same preservation and deletion policies as Phase 2.
80+
- **Output Requirement:** Explicitly state whether you made changes or found the `docs/` directory already accurate.
81+
- **Next:** Proceed immediately to Phase 3.
82+
83+
3. **Phase 3: In-Code Documentation Audit (Mandatory)**
84+
- **CRITICAL:** This phase is **NOT** conditional. You **MUST** execute Phase 3 regardless of whether Phases 1 and 2 resulted in changes.
85+
- **Scope:** Audit ALL in-code documentation and comments across the entire the given target, including:
86+
- **Root-level or subdirectory Markdown files:** Any `.md` files outside the `docs/` directory that exist within the target directory (e.g., `src/README.md`, `scripts/howto.md`)
87+
- **Docstrings/JSDoc/GoDoc/etc.:** Function, method, class, interface, type, and module documentation comments
88+
- **Inline comments:** Explanatory comments within code that describe logic, decisions, or behavior
89+
- **Package/module headers:** Top-of-file documentation blocks
90+
- **Action (Required - Execute ALL Steps):**
91+
1. **Scan the target** for all files containing documentation or comments (`.md` files, source code files with docstrings/comments)
92+
2. **Read the current implementation** of each documented element
93+
3. **Verify accuracy** by comparing documentation/comments against actual code behavior
94+
4. **Update or remove** inaccurate, outdated, or misleading content
95+
5. **Add missing documentation** ONLY for:
96+
- Exported/public functions, methods, classes, interfaces, and types that lack any documentation
97+
- Complex internal logic that would be unclear to future maintainers (use sparingly)
98+
6. **Remove bloat**:
99+
- Delete over-verbose AI-generated comments that merely narrate code
100+
- Remove redundant comments that restate obvious code behavior (unless critical for understanding)
101+
- **Keep only:** Critical "why" explanations, non-obvious "what" descriptions, and essential "how" for complex algorithms
102+
- **In-Code Documentation Standards:**
103+
- **Exported/Public Elements:** Must have concise docstrings/JSDoc explaining:
104+
- **What:** What the function/class/method does (1-2 sentences max)
105+
- **Parameters:** Brief description of each parameter (when non-obvious)
106+
- **Returns:** What is returned (when non-obvious)
107+
- **Why:** Only include if the purpose is non-obvious from the name
108+
- **Internal/Private Elements:** Document ONLY if:
109+
- Logic is complex or non-obvious
110+
- There are important gotchas or edge cases
111+
- Future maintainers would struggle to understand the code without explanation
112+
- **Inline Comments:** Use sparingly. Include ONLY when:
113+
- Explaining non-obvious business logic or algorithms
114+
- Documenting workarounds or known issues
115+
- Clarifying complex conditionals or data transformations
116+
- **Anti-Patterns to Remove:**
117+
- ❌ Comments that restate code: `// Increment counter` above `counter++`
118+
- ❌ Obvious parameter descriptions: `@param id - The id` for `function getUser(id: string)`
119+
- ❌ Verbose AI-generated docstrings with excessive detail
120+
- ❌ Outdated comments describing old behavior
121+
- ❌ TODO comments without context or owner (either fix or remove)
122+
- **Same Rules Apply:** Follow all guidelines from Hard Rules, Writing Guidelines, and Quality Assurance sections
123+
- Zero hallucination: Only document what the code actually does
124+
- Strict objectivity: No subjective adjectives in new comments
125+
- Mandatory verification: Read the implementation before updating comments
126+
- Preservation: Only modify existing comments if factually incorrect
127+
- **Output Requirement:** You **MUST** report the results of Phase 3:
128+
- List files where in-code documentation was updated
129+
- Summarize types of changes made (corrections, additions, bloat removal)
130+
- If NO changes were needed, explicitly state: "Phase 3: Audited in-code documentation across X files - all accurate, no changes required"
85131

86132
---
87133

@@ -401,3 +447,6 @@ Before concluding this task, verify:
401447
14. _Did I include appropriate Mermaid diagrams for complex systems?_
402448
15. _Did I apply the Architectural Significance Filter to Mermaid diagrams?_
403449
16. _Did I choose the best Mermaid diagram type for each visualization?_
450+
17. _Did I execute Phase 3 and audit in-code documentation?_
451+
18. _Did I scan source files for docstrings/comments and verify accuracy?_
452+
19. _Did I remove bloat from in-code documentation?_

0 commit comments

Comments
 (0)