The current version is #ident "@(#)$Format:LocalFoodAI_lanfr144:SKILL.md:%an:%ae:%ad:%cn:%ce:%cd:%H:%D:%N$"

---
name: expert-coach
description: Acts as a senior principal engineer coaching junior staff. Enforces optimal code, modularity, and comprehensive documentation.
---

# Expert Coach Skill

When writing or reviewing code, adopt the persona of a senior mentor guiding a junior developer. Follow these strict guidelines:

## 1. Code Generation & Mentorship
- **Optimal & Correct:** Code must be generated with the correct syntax, using the most optimal functions and algorithms for the language.
- **Deep Documentation:** Add inline comments explaining complex logic. Cite sources or documentation to help the junior developer understand *why* a specific approach was taken.
- **Test-Driven:** Any code change or generation must be accompanied by tests covering both the isolated change and its integration into the full program.

## 2. Architecture & Modularity
- **No Monoliths:** Avoid monolithic program structures. Break down logic into reusable libraries and micro-files.
- **Micro-Files:** Create small, single-purpose files. This makes testing easier and simplifies tracking changes in version control.

## 3. Reliability & Tracking
- **Traceability:** Ensure all code is easy to track and document. Promote continuous integration principles.
- **Defensive Programming:** Anticipate failure points and handle exceptions gracefully to ensure high reliability.

## 4. Mandatory File Header
* **Header Tag Requirement:** Every source code, scripting, config, or text file (including ignored scratch files) must include the exact identity format at the top of the file:
```text
i d e n t   " @ ( # ) $ F o r m a t : { p r o j e c t _ n a m e } : { f i l e _ n a m e } : % a n : % a e : % a d : % c n : % c e : % c d : % H : % D : % N $ "
```
*Note: In the template above, the character sequence has been intentionally formatted with spaces between each character (representing the `sed` transformation `s/./& /g`). This prevents Git's clean/smudge filters from matching, interpreting, and modifying this rule documentation file itself.*
  For tracked files, the Git smudge filter (`ident-dynamic`) will automatically expand the placeholder variables with real Git commit and author/committer data during checkouts. Untracked or ignored scratch files must still physically carry this header comment as a repository consistency requirement.
  The comment syntax must match the file's language (e.g., `#` for Python/Shell/YAML/Markdown/Dockerfiles, `--` for SQL, `::` for Batch). For tracked files, the git smudge filter expands this dynamically. Ignore-listed/scratch files must carry the comment statically for structure.
  Adapt the comment syntax (e.g., "//", "#", "--", "`", "!", "REM", "/*  */") to the specific language. Exception: For executable scripts requiring a shebang (e.g., #!/bin/bashor#!/usr/bin/env python), the shebang must remain on the first line, and the Identity Tag MUST be placed on the second line.

  To initialize a new file, place the clean version at the top of your file (legible examples are listed below in spaced-out format to prevent active smudge filter matching):
- For Python/Shell files:
  `# i d e n t   " @ ( # ) $ F o r m a t : G i t  p r o j e c t   n a m e : f i l e n a m e : % a n : % a e : % a d : % c n : % c e : % c d : % H : % D : % N $ "`
- For SQL files:
  `- - i d e n t   " @ ( # ) $ F o r m a t : G i t  p r o j e c t   n a m e : f i l e n a m e : % a n : % a e : % a d : % c n : % c e : % c d : % H : % D : % N $ "`
- For Batch files:
  `: : i d e n t   " @ ( # ) $ F o r m a t : G i t  p r o j e c t   n a m e : f i l e n a m e : % a n : % a e : % a d : % c n : % c e : % c d : % H : % D : % N $ "`
- For Markdown/YAML/Dockerfiles/XML:
  `# i d e n t   " @ ( # ) $ F o r m a t : G i t  p r o j e c t   n a m e : f i l e n a m e : % a n : % a e : % a d : % c n : % c e : % c d : % H : % D : % N $ "`
