code-architecture
Skill311 starsChanged 8 days agoApache-2.0View on GitHub
Code architecture patterns. Use when organizing code, refactoring classes, designing service structure, or extracting/moving code to new files. Enforces function ordering, service functions over classes, dependency injection.
- Reads credentials
11 other projects use a version of this; 2 new projects in the last 4 weeks, against 0 the 4 before.
Adopted by
Surging: 2 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- obsessiondb/rudelword for word, first seen Nov 30, 2026
- h2xd/skillstheir own version, first seen Nov 29, 2026
- evrendom/opalineword for word, first seen Nov 22, 2026
- SwastikPandey1024/agentic-engineering-ostheir own version, first seen Oct 20, 2026
- ag2ai/faststreamtheir own version, first seen Oct 8, 2026
- badjano/skillstheir own version, first seen Oct 5, 2026
Other versions11 projects use a version of this.
Word for word · 2
- evrendom/opaline★ 311100% same
- obsessiondb/rudel★ 311100% same
Edited · 0
None found.
Wrote their own version · 9
- ag2ai/faststream★ 5.4ksame name
- badjano/skills★ 1same name
- codyrao/agent-skills★ 1same name
- h2xd/skills★ 1same name
- kleosr/bridle★ 1same name
- kleosr/kleosrules★ 1same name
- SwastikPandey1024/agentic-engineering-os★ 1same name
- dhriyatinandu-bot/claude-skills★ 0same name
- nesco/skills★ 0same 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 repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-architecture-advisor/AGENTS.mdAGENTS.md
- .claude/skills/clickhouse-best-practices/AGENTS.mdAGENTS.md
- api-testingSkill
- clickhouse-architecture-advisorSkill
- clickhouse-best-practicesSkill
- clickhouse-js-node-codingSkill
- clickhouse-js-node-troubleshootingSkill
- clickhouse-querySkill
- environment-variablesSkill
- library-docsSkill
- opaline-designSkill
- pr-creationSkill
- testing-bunSkill
- typescript-standardsSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
CRITICAL: Always apply these patterns when:
- Distinctive: line 80
When a new endpoint needs the same orchestration as existing code (queue handlers, cron jobs, other endpoints):
- Very specific: line 120
Always use last parameter as env object:
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Code Architecture Standards
CRITICAL: Always apply these patterns when:
- Creating a new file that will contain multiple functions
- Extracting code from one file to another
- Refactoring or reorganizing existing code structure
Function Order (Clean Code)
Organize from high-level to detail:
// 1. Constants, types, schemas at top
const CONFIG = { ... } as const
type Options = { ... }
// 2. Main/entry point functions
async function main() {
await initialize()
await processData()
}
// 3. Supporting functions
async function initialize() { ... }
async function processData() { ... }
// 4. Utilities at bottom
function formatDate(date: Date) { ... }Avoid Bloat Proxy Functions
// ❌ Bad - Pure bloat
class MyWorkflow {
async getCursorStats() {
return await cursorService.getCursorStats({ DB: this.env.DB })
}
}
// ✅ Good - Import and use directly
import { getCursorStats } from './cursor-service'
const stats = await getCursorStats(env)Prefer Service Functions Over Classes
// ❌ Bad - Unnecessary class wrapper
export class CursorService {
constructor(private db: D1Database) {}
async getCursor(shopDomain: string) { ... }
}
// ✅ Good - Individual functions with DI
export async function getCursor(
shopDomain: string,
env: { DB: D1Database }
) {
return await env.DB.prepare('...').bind(shopDomain).first()
}Benefits
- Tree-shakable: Only import what you need
- Testable: Easy to mock dependencies
- Explicit dependencies
- No instantiation overhead
- Functional style
When to Use Classes vs Functions
- Classes: Complex stateful objects, entities with behavior, inheritance
- Functions: Simple services, utilities, data transformation, API calls
When to Extract Shared Services
When a new endpoint needs the same orchestration as existing code (queue handlers, cron jobs, other endpoints):
Extract a shared function when:
- The code is exactly the same (not just similar)
- Changes should always propagate to both call sites
- It represents the same semantic operation (e.g., "run an uptime check", "process a payment")
Don't force abstractions when:
- Code paths are similar but could legitimately diverge
- The operations might need independent evolution
- Forcing alignment would create awkward conditional logic
// ❌ Bad - Duplicated orchestration
// In queue handler
const result = await executeCheck(monitor);
await writeResult(result);
await processAlert(result);
// In new endpoint (duplicated!)
const result = await executeCheck(monitor);
await writeResult(result);
await processAlert(result);
// ✅ Good - Shared service function
export async function runUptimeCheck(
monitor: Monitor,
env: { DB: D1Database }
): Promise<CheckResult> {
const result = await executeCheck(monitor);
await writeResult(result, env);
await processAlert(result, env);
return result;
}
// Both queue handler and endpoint call the service
await runUptimeCheck(monitor, env);Dependency Injection Pattern
Always use last parameter as env object:
export async function myFunction(
param1: string,
param2: number,
env: { DB: D1Database; KV: KVNamespace }
) {
// Function implementation
}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.

