Skip to content

Commit dce7c55

Browse files
committed
docs: strengthen privacy-safe GenAI workflow guidance
- add Just the Docs callouts for warnings, tips, examples, checks, and takeaways - revise chapters, appendices, and prompt templates to emphasize sanitized prompts, synthetic fixtures, code/data separation, and approved real-data environments - update citation formatting and reference-audit guidance for stable source-key anchors
1 parent ab51821 commit dce7c55

23 files changed

Lines changed: 283 additions & 148 deletions

‎.agents/skills/reference-source-audit/SKILL.md‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,42 @@ Use this skill to check whether the guide's references still exist and whether c
1212
1. Inventory references:
1313

1414
```bash
15-
rg -n '<a name="ref[0-9]+"></a>|References\\.md#ref[0-9]+|#ref[0-9]+' chapters docs scripts
15+
rg -n '<a id="[^"]+"></a>|References\\.md#[A-Za-z0-9][A-Za-z0-9._-]*' chapters docs scripts
1616
```
1717

1818
2. Build three lists:
19-
- reference ids defined in `docs/References.md`
20-
- reference ids cited from content
19+
- stable source-key anchors defined in `docs/References.md`
20+
- source keys cited from content
2121
- URLs attached to each reference
2222

2323
3. Check structural integrity:
24-
- every cited `refN` exists
24+
- every cited source key exists
2525
- every reference anchor is unique
2626
- every reference has a usable title or source name
2727
- every URL is present and reasonably canonical
2828
- duplicate references are intentional or consolidated
29+
- reference list numbers are treated as display-only and are not used as citation targets
2930

30-
4. Check link health:
31+
4. Check citation display style:
32+
- distinguish citation links to `docs/References.md#source-key` from ordinary navigation or prose links
33+
- prefer visible bracketed citations such as `[[Source label](../docs/References.md#source-key)]`
34+
- do not require bracketed style for ordinary navigation links, links inside `docs/References.md` source entries, or links inside fenced copy/paste prompt bodies unless explicitly asked
35+
- report inconsistent citation styling separately from link health or source-support problems
36+
37+
5. Check link health:
3138
- URL resolves
3239
- redirects are recorded
3340
- paywalled or unstable pages are flagged
3441
- canonical DOI, PubMed, PMC, arXiv, official docs, or release-note URLs are preferred where available
3542

36-
5. Check claim support:
43+
6. Check claim support:
3744
- read the paragraph or sentence around each citation
3845
- inspect the cited source for direct support
3946
- classify as `supported`, `partially supported`, `unsupported`, `stale/changed`, or `unverifiable`
4047

41-
6. Report before editing:
48+
7. Report before editing:
4249
- file and line
43-
- ref id
50+
- source key
4451
- claim summary
4552
- source URL
4653
- link status
@@ -61,7 +68,8 @@ For clinical, medical, statistical, privacy, compliance, or research-validity cl
6168
- Do not replace a source just because it is old if it remains authoritative.
6269
- Prefer updating weak citations to stronger sources over adding more citations.
6370
- Preserve stable reference anchors when possible so existing chapter links do not break.
64-
- If renumbering references is unavoidable, update every inbound citation in the same change.
71+
- If source-key anchors change, update every inbound citation in the same change.
72+
- Renumbering display-only reference numbers should not require inbound citation changes.
6573
- Include access or verification dates for time-sensitive source checks.
6674

6775
## Verification
@@ -71,4 +79,3 @@ After edits, run:
7179
```bash
7280
bundle exec jekyll build
7381
```
74-

‎.codex/agents/reference-auditor.toml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ You are a reference and citation auditor for a practical textbook on GenAI-assis
1010
Your job is to validate references and citation alignment. Do not edit files directly unless the parent explicitly asks for patch-ready changes. Prefer a concise audit memo with evidence.
1111
1212
Audit scope:
13-
- Parse docs/References.md for reference ids, titles, source names, access dates, and URLs.
14-
- Parse chapters/, docs/, docs/templates/, and scripts/ docs for citations to References.md#refN.
15-
- Check that every cited ref id exists and that every reference anchor is well-formed.
13+
- Parse docs/References.md for stable source-key anchors, display numbers, titles, source names, access dates, and URLs.
14+
- Treat reference list numbers as display-only. Inbound citations should target stable source-key anchors such as References.md#nice-ng246-bmi, not numeric refN anchors.
15+
- Parse chapters/, docs/, docs/templates/, and scripts/ docs for citations to References.md#source-key.
16+
- Check that every cited source key exists and that every reference anchor is unique and well-formed.
17+
- Distinguish citation links from ordinary navigation/prose links. Citation links point to docs/References.md anchors; navigation links point to chapters, templates, scripts, or other pages.
18+
- For citation display style, prefer visible bracketed citations such as [[Source label](../docs/References.md#source-key)] so citations stand apart from surrounding prose. Do not require this style for ordinary navigation links, links inside docs/References.md source entries, or links inside fenced copy/paste prompt bodies unless the parent task explicitly asks for template style cleanup.
1619
- Identify unused references, duplicate references, weak sources, stale sources, and sources that should be replaced by primary sources.
1720
- Verify that reference URLs still resolve. Record status, redirects, canonical replacement URLs, and access date.
1821
- Compare the claim surrounding each citation against the cited source content. Classify each claim as supported, partially supported, unsupported, stale/changed, or unverifiable.
@@ -26,10 +29,10 @@ Source rules:
2629
2730
Output format:
2831
- Start with a high-level risk summary.
29-
- Include a table with: file:line, citation/ref id, claim summary, source URL, link status, support status, severity, recommended action.
32+
- Include a table with: file:line, citation/source key, claim summary, source URL, link status, support status, severity, recommended action.
3033
- Separate link-rot issues from claim-support issues.
34+
- List citation-style issues separately from source-validity issues, and treat inconsistent display style as low severity unless it obscures evidence boundaries.
3135
- List duplicate or low-quality references that should be consolidated or replaced.
3236
- Suggest exact replacement references when a source is missing, weak, or stale.
3337
- Recommend whether a content-editor or deep-research-content-updater should implement follow-up changes.
3438
"""
35-

‎_config.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ enable_copy_code_button: true
3232
back_to_top: true
3333
back_to_top_text: "Back to top"
3434

35+
callouts_level: quiet
36+
callouts:
37+
takeaway:
38+
title: Take Home
39+
color: green
40+
warning:
41+
title: Warning
42+
color: red
43+
check:
44+
title: Check
45+
color: yellow
46+
tip:
47+
title: Tip
48+
color: blue
49+
example:
50+
title: Example
51+
color: blue
52+
3553
mermaid:
3654
version: "9.1.3"
3755

‎chapters/Chapter01_PlanAndContext.md‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,32 @@ flowchart TB
2424

2525
The initial stage involves **defining the goal and scope** of your endeavor. This means articulating precisely what you aim to accomplish with the assistance of an LLM. For instance, in the context of our running example, the overarching goal is harmonizing BMI data from EHRs. This broad objective can be broken down into more specific aims, such as cleaning the raw data, creating a summary of BMI categories, or automating a particular data transformation process. A well-defined goal provides a clear direction for subsequent steps, including how you will prompt the LLM and how you will evaluate its output.
2626

27-
Next, it is vital to have a comprehensive **understanding of the context**. This includes noting the specific characteristics of your data, such as its format (e.g., tab-delimited, CSV), the variables it contains (e.g., `person_id`, `encounter_id`, `bmi`, `height_cm`, `weight_kg`, `measurement_date`), and any domain-specific considerations that might be relevant. In our BMI harmonization example, understanding that the data comes from EHRs implies the need to consider medical standards for BMI categories and potential data quality issues inherent in clinical data. This contextual awareness is critical for tailoring your prompts to the LLM and ensuring that its responses are aligned with the specific requirements of your research domain.
27+
Next, it is vital to have a comprehensive **understanding of the context**. This includes noting the specific characteristics of your data, such as its format (e.g., tab-delimited, CSV), the variables it contains (e.g., `person_id`, `encounter_id`, `bmi`, `height_cm`, `weight_kg`, `measurement_date`), and any domain-specific considerations that might be relevant. In our BMI harmonization example, understanding that the data comes from EHRs implies the need to consider medical standards for BMI categories and potential data quality issues inherent in clinical data. Record this context in your local project plan, but only share sanitized schema, methods, and synthetic examples with an LLM.
2828

2929
Once the goal and context are clear, the next logical step is to **plan the sub-tasks**. Complex problems are often more manageable when broken down into smaller, actionable steps. For our BMI harmonization project, this might involve sub-tasks such as reading the EHR file, cleaning and filtering the data to remove errors or inconsistencies, selecting a single representative BMI measurement for each person, categorizing the BMI values into meaningful groups (e.g., underweight, normal, overweight, obese), and finally, outputting the processed data and any summary statistics. Planning these sub-tasks provides a structured roadmap for both you and the LLM, making the overall project seem less daunting and easier to execute.
3030

3131
Finally, before you even begin to prompt an LLM, it is essential to **set success criteria**. This involves determining what the final deliverables should be and how you will validate whether your solution is successful. In our BMI example, success might be defined by the creation of a clean dataset containing one representative BMI per person, a summary table showing the distribution of individuals across different BMI categories, and a data dictionary that clearly explains the contents of the cleaned dataset. Establishing these criteria upfront allows for an objective evaluation of the LLM's contribution and the overall outcome of your workflow.
3232

33-
For modern coding agents, success criteria should also include **executable verification**. Instead of only writing "the script should clean BMI data," specify what evidence would convince you that the script works: a smoke test on synthetic EHR records, `testthat` unit tests for BMI boundary cases, an expected output schema, and the exact commands the agent should run before it claims completion. Current agent guidance from multiple vendors emphasizes giving agents concrete verification steps and asking for command output or other evidence, not just a verbal assertion that the work is done [GitHub Copilot agent best practices](../docs/References.md#github-copilot-agent-best-practices), [Claude Code best practices](../docs/References.md#claude-code-best-practices).
33+
For modern coding agents, success criteria should also include **executable verification**. Instead of only writing "the script should clean BMI data," specify what evidence would convince you that the script works: a smoke test on synthetic EHR records, `testthat` unit tests for BMI boundary cases, an expected output schema, and the exact commands the agent should run before it claims completion. Current agent guidance from multiple vendors emphasizes giving agents concrete verification steps and asking for command output or other evidence, not just a verbal assertion that the work is done [[GitHub Copilot agent best practices](../docs/References.md#github-copilot-agent-best-practices)], [[Claude Code best practices](../docs/References.md#claude-code-best-practices)].
3434

35-
This planning stage is also where you should define **data and tool boundaries**. For clinical, EHR, or genomic work, decide what the LLM or coding agent is allowed to see before any prompt is written:
35+
{: .takeaway }
36+
> A useful project plan tells the LLM what to build, what context matters, and how you will prove the result works.
3637
37-
- Do not paste PHI, direct identifiers, credentials, private access tokens, or controlled-access genomic data into public tools.
38-
- Use synthetic, simulated, or approved de-identified examples when demonstrating the workflow.
38+
This planning stage is also where you should define **data and tool boundaries**. For clinical, EHR, genomic, or other sensitive work, decide what the LLM or coding agent is allowed to see before any prompt is written:
39+
40+
{: .warning }
41+
> Decide what the LLM is allowed to see and do before writing the prompt. For clinical, EHR, genomic, or other sensitive work, treat individual-level data exposure as prohibited in the default workflow.
42+
43+
- Do not paste or attach individual-level records, PHI, PII, direct identifiers, credentials, private access tokens, controlled-access genomic data, or sensitive small-cell outputs into LLM tools; this can violate both soft expectations and hard rules.
44+
- Use schemas, code, data dictionaries, aggregate results approved for sharing, and synthetic or simulated examples when demonstrating the workflow.
45+
- Keep the codebase separate from the data. Use a code-only repository, keep protected data in its approved compute environment, and synchronize code through GitHub only in the approved direction so protected data and sensitive outputs do not flow back into the LLM-accessible workspace.
46+
- Do not run GenAI tools or repo-native coding agents inside an environment that can access protected PHI, PII, controlled-access data, secrets, private mounts, or sensitive output files.
3947
- Confirm whether your institution, data use agreement, IRB protocol, or sponsor policy allows AI-assisted processing.
4048
- If an agent can browse the web, install packages, call external APIs, or use Model Context Protocol (MCP) tools, document which actions are allowed and which require human approval.
4149

42-
These boundaries are not just administrative details. NIH guidance warns that sharing controlled-access human genomic data with public generative AI tools can violate non-transferability obligations, and HIPAA regulations specify requirements for de-identifying protected health information [NIH genomic data guidance](../docs/References.md#nih-human-genomic-data-genai), [45 CFR 164.514](../docs/References.md#hipaa-deidentification-164-514). Tool access also creates a security surface: MCP and LLM security guidance emphasize least-privilege access, validation, and careful handling of sensitive information [MCP security best practices](../docs/References.md#mcp-security-best-practices), [OWASP LLM Top 10](../docs/References.md#owasp-llm-top-10-2025).
50+
These boundaries are not just administrative details. NIH guidance warns that sharing controlled-access human genomic data with public generative AI tools can violate non-transferability obligations, and HIPAA regulations specify requirements for de-identifying protected health information [[NIH genomic data guidance](../docs/References.md#nih-human-genomic-data-genai)], [[45 CFR 164.514](../docs/References.md#hipaa-deidentification-164-514)]. Tool access also creates a security surface: MCP and LLM security guidance emphasize least-privilege access, validation, and careful handling of sensitive information [[MCP security best practices](../docs/References.md#mcp-security-best-practices)], [[OWASP LLM Top 10](../docs/References.md#owasp-llm-top-10-2025)].
4351

44-
Even at this initial planning stage, LLMs themselves can be valuable tools. You can **leverage LLMs in the planning phase** by prompting them to help brainstorm potential sub-tasks or to consider challenges you might encounter. For example, you could ask: "Based on the goal of harmonizing BMI data from EHR files, what are the typical sub-tasks involved in data cleaning and summarization?" The responses from the LLM can offer valuable suggestions and help you structure your workflow more effectively.
52+
Even at this initial planning stage, LLMs themselves can be valuable tools. You can **leverage LLMs in the planning phase** by prompting them to help brainstorm potential sub-tasks or to consider challenges you might encounter without providing rows, private file paths, or protected identifiers. For example, you could ask: "Based on the goal of writing code to harmonize BMI data from a tabular EHR extract, using only this schema and no real records, what are the typical sub-tasks involved in data cleaning and summarization?" The responses from the LLM can offer valuable suggestions and help you structure your workflow more effectively.
4553

4654
## Red Teaming Your Project Plan
4755

@@ -76,6 +84,9 @@ A particularly sophisticated critique might focus on **population-specific metho
7684

7785
This red teaming process transforms your initial plan into a more robust, defensible methodology that anticipates common criticisms and addresses potential pitfalls before they occur in your analysis.
7886

87+
{: .takeaway }
88+
> Red teaming is most valuable before code exists. It is cheaper to fix vague assumptions in a plan than to repair analysis logic after implementation.
89+
7990
In essence, this foundational planning phase is crucial for setting the stage for effective LLM utilization. A well-defined plan, coupled with a thorough understanding of the context and strengthened through red teaming, will guide your subsequent interactions with the AI assistant and ensure that the generated code and analysis are relevant, accurate, and aligned with your research objectives. Clarity at this stage ensures that both you and the AI are working toward solving the right problem.
8091

8192
---

0 commit comments

Comments
 (0)