跳到正文
Skillpedia
技术文档15k · #11138

lat-md

它能做什么

这项技能说明如何编写 lat.md 文档文件,它以固定格式描述项目的设计决策、规则和测试。适合需要结构化项目笔记、并希望代码能够指回这些笔记的人。

适用场景

  • ✓当你需要在项目的 lat.md 文件夹中创建新章节的时候。
  • ✓当你正在编辑现有的 lat.md 文件,需要正确结构的时候。
  • ✓当你想检查 lat.md 笔记是否遵循要求的规则的时候。

技能链接

https://github.com/fathah/hermes-desktop/blob/main/.agents/skills/lat-md/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/fathah/hermes-desktop/blob/main/.agents/skills/lat-md/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请帮我写一个 lat.md 章节,解释我项目的登录规则是如何运作的?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会遵循一套规则:每个章节以一段简短的开头段落开始,笔记描述项目做什么以及为什么这样做,而不是重复代码。文本的设计目的是便于搜索和其他工具读取。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

lat.md Authoring Guide

This skill covers the syntax, structure rules, and conventions for writing lat.md/ files. Load it whenever you need to create or edit sections in the lat.md/ directory.

What belongs in lat.md

lat.md/ files describe what the project does and why — domain concepts, key design decisions, business logic, and test specifications. They do NOT duplicate source code. Think of each section as an anchor that source code references back to.

Good candidates for sections:

  • Architecture decisions and their rationale
  • Domain concepts and business rules
  • API contracts and protocols
  • Test specifications (what is tested and why)
  • Non-obvious constraints or invariants

Bad candidates:

  • Step-by-step code walkthroughs (the code itself is the walkthrough)
  • Auto-generated API docs (use tools for that)
  • Temporary notes or TODOs

Section structure

Every section must have a leading paragraph — at least one sentence immediately after the heading, before any child headings or other block content.

The first paragraph must be ≤250 characters (excluding [[wiki link]] content). This paragraph is the section's identity — it appears in search results, command output, and RAG context.

# Good Section

Brief overview of what this section documents and why it matters.

More detail can go in subsequent paragraphs, code blocks, or lists.

## Child heading

Details about this child topic.
# Bad Section

## Child heading

This is invalid — "Bad Section" has no leading paragraph.

lat check enforces this rule.

Section IDs

Sections are addressed by file path and heading chain:

  • Full form: lat.md/path/to/file#Heading#SubHeading
  • Short form: file#Heading#SubHeading (when the file stem is unique)

Examples: lat.md/tests/search#RAG Replay Tests, cli#init, parser#Wiki Links.

Wiki links

Cross-reference other sections or source code with [[target]] or [[target|alias]].

Section links

See [[cli#init]] for setup details.
The parser validates [[parser#Wiki Links|wiki link syntax]].

Source code links

Reference functions, classes, constants, and methods in source files:

[[src/config.ts#getConfigDir]]          — function
[[src/server.ts#App#listen]]            — class method
[[lib/utils.py#parse_args]]             — Python function
[[src/lib.rs#Greeter#greet]]            — Rust impl method
[[src/app.go#Greeter#Greet]]            — Go method
[[src/app.h#Greeter]]                   — C struct

lat check validates that all targets exist.

Code refs

Tie source code back to lat.md/ sections with @lat: comments:

// @lat: [[cli#init]]
export function init() { ... }
# @lat: [[cli#init]]
def init():
    ...

Supported comment styles: // (JS/TS/Rust/Go/C) and # (Python).

Place one @lat: comment per section, at the relevant code — not at the top of the file.

Test specs

Describe tests as sections in lat.md/ files. Add frontmatter to require that every leaf section has a matching @lat: comment in test code:

---
lat:
  require-code-mention: true
---
# Tests

Authentication test specifications.

## User login

Verify credential validation and error handling.

### Rejects expired tokens

Tokens past their expiry timestamp are rejected with 401, even if otherwise valid.

### Handles missing password

Login request without a password field returns 400 with a descriptive error.

Each test references its spec:

# @lat: [[tests#User login#Rejects expired tokens]]
def test_rejects_expired_tokens():
    ...

Rules:

  • Every leaf section under require-code-mention: true must be referenced by exactly one @lat: comment
  • Every section MUST have a description — at least one sentence explaining what the test verifies and why
  • lat check flags unreferenced specs and dangling code refs

Frontmatter

Optional YAML frontmatter at the top of lat.md/ files:

---
lat:
  require-code-mention: true
---

Currently the only supported field is require-code-mention for test spec enforcement.

Validation

Always run lat check after editing lat.md/ files. It validates:

  • All wiki links point to existing sections or source code symbols
  • All @lat: code refs point to existing sections
  • Every section has a leading paragraph (≤250 chars)
  • All require-code-mention leaf sections are referenced in code
常见问题

lat.md 笔记应该复制源代码吗?

不应该。笔记描述“是什么”和“为什么”,代码本身就是讲解。

开头段落应该多长?

必须为 250 个字符或更少,且不计算维基链接的文字。

这些文件中不应该包含什么?

临时笔记、待办事项和自动生成的 API 文档都不适合放在这里。

详情

作者的原始描述

Writing and maintaining lat.md documentation files — structured markdown that describes a project's architecture, design decisions, and test specs. Use when creating, editing, or reviewing files in the lat.md/ directory.

repo: fathah/hermes-desktop

热度

GitHub 星标
15k
排名
#11138
许可证
MIT
更新时间
2026/10/13

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能