project-patterns
Skill4 starsChanged 7 months agoMITView on GitHub
Architectural patterns, naming conventions, file organization, and error handling for the worclaude CLI project
1 other project uses a version of this.
Adopted by
Most recently taken up by
- sefaertunc/anthropic-watchtheir own version, first seen Apr 30, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- sefaertunc/anthropic-watch★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-routingSkill
- backend-conventionsSkill
- claude-md-maintenanceSkill
- coding-principlesSkill
- context-managementSkill
- coordinator-modeSkill
- frontend-design-systemSkill
- git-conventionsSkill
- memory-architectureSkill
- planning-with-filesSkill
- prompt-engineeringSkill
- review-and-handoffSkill
- security-checklistSkill
- subagent-usageSkill
- testingSkill
- verificationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 8 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 71
All user-facing output goes through display.*:
- Very specific: line 78
Never use console.log for user output.
- Distinctive: line 81
Always operate on parsed objects, never on stringified JSON:
- Distinctive: line 99
Don't simplify to a single pass.
- Distinctive: line 102
Tier 1 (additive): only when target file doesn't exist at all
- Distinctive: line 104
Tier 3 (interactive): only for CLAUDE.md and hook matcher conflicts
- Very specific: line 107
Create template in templates/agents/optional/{category}/
- Very specific: line 108
Add to AGENT_CATALOG in src/data/agents.js
- Very specific: line 109
Add routing metadata in src/data/agent-registry.js
- Distinctive: line 110
Add to scaffolder file list for hash computation
- Distinctive: line 112
Test Scenario A (fresh) and Scenario B (existing with conflicts)
- Distinctive: line 116
No central error handler. Try/catch at the command level:
- Distinctive: line 134
No retry logic anywhere. No circuit breakers.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Patterns
Architecture Overview
Single-process Node.js CLI tool. No server, no database, no external service dependencies (except npm registry for version checks with 5s timeout). Pure filesystem operations — reads templates, writes scaffolded files, merges with existing user files.
Layer diagram:
CLI Entry (index.js)
└── Commands (commands/*.js) — orchestration, user flow
├── Prompts (prompts/*.js) — Inquirer interactions, isolated from logic
├── Core (core/*.js) — business logic, no user interaction*
├── Generators (generators/*.js) — produce file content dynamically
├── Data (data/*.js) — constants, catalogs, registries
└── Utils (utils/*.js) — pure helpers, no side effects*Exception: merger.js calls promptHookConflict() directly — pragmatic compromise.
Key invariant: Commands orchestrate between prompts and core. Prompts never call core directly. Core never prompts the user (except merger.js).
Naming Conventions
- Files: kebab-case everywhere, no exceptions (
agent-routing.js,file-categorizer.js,claude-md-merge.js) - Test files: mirror source name +
.test.jssuffix (merger.test.js,agent-routing-integration.test.js) - Functions: camelCase (
buildSettingsJson,mergeSettingsPermissionsAndHooks) - Constants: UPPER_SNAKE_CASE (
UNIVERSAL_AGENTS,AGENT_CATALOG) - No private prefix: unexported functions are private by convention — no underscore prefix
File Organization
Layer-based (not feature-based):
src/
├── index.js # CLI entry point (Commander.js setup)
├── commands/ # One file per CLI command (init, upgrade, status, backup, restore, diff)
├── core/ # Business logic: scaffolder, merger, detector, backup, config, file-categorizer
├── prompts/ # Inquirer prompt definitions: project-type, tech-stack, agent-selection, conflicts
├── generators/ # Dynamic content builders (agent-routing.js)
├── data/ # Constants: agents.js (catalogs), agent-registry.js (routing metadata)
└── utils/ # Pure helpers: display.js, file.js, hash.js, time.js, npm.js
templates/ # User-facing template files (quality matters — these ship to users)
├── settings/ # 16 language-specific + base + docker JSON templates
├── agents/ # universal/ (5) + optional/ (18 across 6 categories)
├── commands/ # 10 slash command templates
└── skills/ # universal/ (9) + templates/ (3 placeholder skills)
tests/
├── commands/ # Tests mirror src/ structure
├── core/
├── prompts/
├── utils/
└── fixtures/ # Test projects: fresh-project, existing-project, workflow-projectWhere new things go:
- New CLI command →
src/commands/+ register insrc/index.js - New agent → template in
templates/agents/+ entry inagents.js+ entry inagent-registry.js - New skill → template in
templates/skills/+ scaffolder reference + hash computation - New utility →
src/utils/(must be pure, no side effects)
Common Patterns
Display namespace pattern
All user-facing output goes through display.*:
import * as display from '../utils/display.js';
display.success('Done!');
display.error('Something failed');
display.newline();Never use console.log for user output.
JSON manipulation pattern
Always operate on parsed objects, never on stringified JSON:
// CORRECT
const settings = JSON.parse(templateContent);
settings.permissions.allow.push(...newPermissions);
const output = JSON.stringify(settings, null, 2);
// WRONG — will break on special characters
const output = templateString.replace('{{permissions}}', newPermissions);Two-pass JSON parsing (parseUserJson)
User JSON files may have shell-escaped braces from zsh heredoc artifacts:
// Pass 1: try raw JSON.parse
// Pass 2: strip \{ → { and \} → }, then JSON.parse
// Both fail: throw with clear error messageDon't simplify to a single pass.
Tiered merge hierarchy
- Tier 1 (additive): only when target file doesn't exist at all
- Tier 2 (reference copy): always saves the template under
.claude/workflow-ref/<path>when same-name file exists (even if content is identical). Preserves the original filename sodiffagainst the live file is trivial. Kept out of.claude/commands/and.claude/agents/to avoid being discovered as a phantom command or agent. - Tier 3 (interactive): only for CLAUDE.md and hook matcher conflicts
Adding a new agent end-to-end
- Create template in
templates/agents/optional/{category}/ - Add to
AGENT_CATALOGinsrc/data/agents.js - Add routing metadata in
src/data/agent-registry.js - Add to scaffolder file list for hash computation
- Write tests
- Test Scenario A (fresh) and Scenario B (existing with conflicts)
Error Handling Philosophy
No central error handler. Try/catch at the command level:
// Pattern in every command file
try {
// ... main work
} catch (err) {
spinner?.fail('Human-readable failure message');
display.error(err.message);
process.exit(1);
}- Operational errors (malformed JSON, missing files): throw with clear message from the detecting function, bubble up to command-level catch
- User errors (invalid input): handled inline by Inquirer validation, never throw
- Network errors (npm registry): caught with timeout, graceful degradation (skip version check)
- Permission errors (EACCES on npm install): caught specifically, suggest
sudo
No retry logic anywhere. No circuit breakers. Operations are local and idempotent — if something fails, the user re-runs the command.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

