Skills/authoring-claude-md/SKILL.md
Creating and maintaining CLAUDE.md project memory files and .claude/rules/ rule files that provide non-obvious codebase context. Use when (1) creating a new CLAUDE.md for a project, (2) adding architectural patterns or design decisions to existing CLAUDE.md, (3) capturing project-specific conventions that aren't obvious from code inspection, (4) organising instructions into path-scoped rule files.
npx skillsauth add sammcj/agentic-coding authoring-claude-mdInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create effective CLAUDE.md files and .claude/rules/ rule files that serve as project-specific memory for AI coding agents.
CLAUDE.md files and rule files provide AI agents with:
Not for Obvious patterns, duplicating documentation, or generic coding advice.:
.claude/rules/ InsteadFor larger projects, break instructions into separate files under .claude/rules/. Each .md file covers one topic. Prefer rules over a single CLAUDE.md when:
your-project/
├── .claude/
│ ├── CLAUDE.md # Main project instructions
│ └── rules/
│ ├── code-style.md # Always loaded
│ ├── testing.md # Always loaded
│ └── security.md # Always loaded
Files are discovered recursively, so subdirectories like frontend/ and backend/ work. Rules without paths frontmatter load at launch with the same priority as .claude/CLAUDE.md.
The same authoring principles apply to rule files: signal over noise, actionable context, no obvious information.
Scope rules to specific files using YAML frontmatter with the paths field. These only load when Claude reads files matching the glob patterns, reducing noise and saving context.
---
paths:
- "src/api/**/*.ts"
---
# API Development Rules
- All API endpoints must include input validation
- Use the standard error response format
- Include OpenAPI documentation comments
Rules without a paths field apply unconditionally. Path-scoped rules trigger on file read, not on every tool use.
Personal rules that apply across all your projects live at ~/.claude/rules/. These load before project rules, giving project rules higher priority.
~/.claude/rules/
├── preferences.md # Personal coding preferences
└── workflows.md # Preferred workflows
Rules load every session (or when matching files are opened). For task-specific instructions that don't need constant context, use skills instead. Skills load only when invoked or when Claude determines they're relevant.
Architectural decisions: Why microservices over monolith, event-driven patterns, state management
Non-obvious conventions:
_internal suffix for private APIs not caught by linter"/queries"Recurring issues:
verify() uses Buffer.from(secret, 'base64')"Project patterns: Error handling, logging, API versioning, migrations
src/auth/middleware.ts" not "line 42"Point to existing docs rather than duplicating content. Provide context about when to read them:
Good:
# Architecture
Event-driven architecture using AWS EventBridge.
- For database schema: see src/database/SCHEMA.md when working with data models
- For auth flows: see src/auth/README.md when working with authentication
Bad: Copying schema tables, pasting deployment steps, or duplicating API flows into CLAUDE.md
Use file:line references for specific code: "See error handling in src/utils/errors.ts:45-67"
Be specific:
refreshToken() in src/auth/refresh.ts"Be concise:
/queries"Use active voice:
npm run migrate:prod"Add to CLAUDE.md when:
Don't add:
Always use Australian English spelling
# Architecture
Event-driven architecture using AWS EventBridge. Services communicate via events, not direct calls.
Auth: JWT tokens with refresh mechanism. See src/auth/README.md for detailed flows when working on authentication.
Database schema and relationships: see src/database/SCHEMA.md when working with data models.
# Conventions
- API routes: Plural nouns (`/users`, `/orders`), no verbs in paths
- Error codes: 4-digit format `ERRR-1001`, defined in src/errors/codes.ts
- Feature flags: Check in middleware, not in business logic
- Dates: Always UTC in database, format client-side via src/utils/dates.ts
- Documentation: Use DocBlocks for public functions, never use "smart" formatting markdown
# Gotchas
**Cache race conditions**: Always acquire lock before checking cache status
**Background job authentication**: Tokens expire after 1 hour. Refresh using
`refreshToken()` in src/auth/refresh.ts before making API calls.
# Testing
- Tests should never have external API calls or dependencies.
- Run `make test` before committing.
Aim for 1k-4k tokens for CLAUDE.md. Most projects fit in 100-300 lines. A single CLAUDE.md is fine for most projects - if exceeding budget, consider whether splitting into .claude/rules/ files would help (especially if some content only applies to specific file types). If exceeding:
Check token count: ingest CLAUDE.md (if available)
Before finalising:
tools
Provides tools for managing MarkEdit, a macOS markdown editor
tools
Provides knowledge on using the `glean` CLI tool to access company knowledge and documents through Glean. Use when the user asks you to use Glean to search, read or otherwise access knowledge from their company's Confluence, Slack, Google Drive Files (Slides, Documents, Sheets) etc.
development
Applies the Diataxis framework to create or improve technical documentation. Use when being asked to write high quality tutorials, how-to guides, reference docs, or explanations, when reviewing documentation quality, or when deciding what type of documentation to create. Helps identify documentation types using the action/cognition and acquisition/application dimensions.
development
Use when answering questions from this machine-learning knowledge base. Triggers: questions about transformers, attention cost and efficiency, and long-context scaling; 'what do we know about attention', 'check the ML wiki'. Read-only querying of compiled knowledge; to add, update, supersede, lint, audit, or critique, use the llm-wiki skill instead.