Version: 1.0.0 Last Updated: $(Get-Date -Format "yyyy-MM-dd")
This guide defines linting directives for composer agents, ensuring consistent code quality and architectural patterns across the YOLOREN.AI ecosystem.
DIRECTIVE:
context: <development_context>
action: <enforce|check|optimize>
rules: <rule_set>
level: <strict|moderate|loose>ENFORCE: {
style: "airbnb",
jsx: "strict",
rules: {
"component-structure": {
pattern: "functional",
hooks: "top-level",
props: "typed-interface",
state: "immutable-first"
},
"naming-convention": {
components: "PascalCase",
hooks: "usePrefix",
handlers: "handlePrefix",
props: "camelCase"
},
"performance": {
memoization: "heavy-compute",
lazyLoading: "routes-components",
bundleSplitting: "route-based"
}
}
}CHECK: {
context: "state",
rules: {
"state-updates": {
pattern: "immutable",
batching: "required",
selectors: "memoized"
},
"side-effects": {
cleanup: "required",
dependencies: "explicit",
async: "cancelable"
}
}
}OPTIMIZE: {
context: "styles",
rules: {
"css-in-js": {
pattern: "atomic",
bundling: "critical-path",
specificity: "low"
},
"theme": {
tokens: "design-system",
variables: "css-custom-props",
responsive: "mobile-first"
}
}
}ENFORCE: {
context: "api",
rules: {
"rest-patterns": {
methods: "standard-http",
responses: "json-api-spec",
versioning: "url-path"
},
"security": {
auth: "jwt-required",
validation: "schema-strict",
sanitization: "auto-escape"
},
"performance": {
caching: "response-headers",
compression: "dynamic",
timeout: "configurable"
}
}
}CHECK: {
context: "database",
rules: {
"queries": {
transactions: "required",
n-plus-one: "prevent",
indexes: "analyze"
},
"migrations": {
rollback: "required",
data-loss: "prevent",
concurrent: "safe"
}
}
}ENFORCE: {
context: "etl",
rules: {
"data-validation": {
schema: "strict",
nulls: "explicit-handle",
types: "coerce-log"
},
"transformations": {
idempotent: "required",
logging: "detailed",
recovery: "checkpoint"
},
"loading": {
batching: "optimized",
duplicates: "handle",
consistency: "check"
}
}
}OPTIMIZE: {
context: "ml",
rules: {
"model-training": {
memory: "profile",
gradients: "check",
batching: "dynamic"
},
"inference": {
quantization: "analyze",
batching: "optimal",
caching: "selective"
},
"validation": {
metrics: "comprehensive",
splits: "stratified",
leakage: "prevent"
}
}
}ENFORCE: {
context: "ios",
rules: {
"memory": {
arc: "analyze",
cycles: "prevent",
dealloc: "verify"
},
"ui": {
main-thread: "enforce",
layout: "constraints",
responsive: "dynamic"
},
"patterns": {
delegates: "weak",
closures: "capture-list",
optionals: "safe-unwrap"
}
}
}CHECK: {
context: "android",
rules: {
"lifecycle": {
leaks: "prevent",
scope: "structured",
cleanup: "automatic"
},
"compose": {
recomposition: "minimize",
side-effects: "launch-effect",
state: "hoisted"
},
"coroutines": {
scope: "structured",
cancellation: "cooperative",
dispatchers: "appropriate"
}
}
}OPTIMIZE: {
context: "react-native",
rules: {
"platform-specific": {
code: "minimal",
components: "abstract",
apis: "unified"
},
"performance": {
renders: "minimize",
images: "optimize",
animations: "native"
},
"navigation": {
state: "persisted",
transitions: "smooth",
deep-links: "handled"
}
}
}// @lint-directive: ENFORCE component-structure
const UserProfile: React.FC<UserProfileProps> = ({ user }) => {
// Hooks at top level
const [isEditing, setIsEditing] = useState(false);
// Handlers with prefix
const handleEditClick = useCallback(() => {
setIsEditing(true);
}, []);
// Memoized expensive computations
const userStats = useMemo(() => computeUserStats(user), [user]);
return (
<ProfileContainer>
<UserInfo user={user} stats={userStats} />
<EditButton onClick={handleEditClick} />
</ProfileContainer>
);
};// @lint-directive: ENFORCE api-security
app.post("/api/v1/users",
validateSchema(userSchema),
sanitizeInput(),
async (req: Request, res: Response) => {
try {
const user = await createUser(req.body);
res.status(201).json({
data: { user },
meta: { timestamp: new Date() }
});
} catch (error) {
handleApiError(error, res);
}
}
);# @lint-directive: ENFORCE etl-validation
def transform_user_data(data: DataFrame) -> DataFrame:
# Schema validation
validate_schema(data, USER_SCHEMA)
# Explicit null handling
data = handle_nulls(data, strategy="fill")
# Type coercion with logging
data = coerce_types(data, log_errors=True)
return data-
Directive Placement
- Place directives at the top of files or before specific code blocks
- Use consistent formatting for directive comments
- Document any deviations from directive rules
-
Rule Combinations
- Combine related rules under a single directive
- Avoid conflicting rule combinations
- Use the most specific context possible
-
Performance Considerations
- Balance strictness with development velocity
- Consider the impact on build/compile time
- Use appropriate rules for development vs production
-
Maintenance
- Regularly review and update directives
- Monitor the impact on code quality metrics
- Gather feedback from development team
ENFORCE: {
context: "global",
rules: {
"error-handling": {
async: "try-catch",
types: "specific",
recovery: "graceful"
}
}
}OPTIMIZE: {
context: "global",
rules: {
"resources": {
memory: "efficient",
cpu: "minimal",
network: "batched"
}
}
}CHECK: {
context: "global",
rules: {
"security": {
input: "sanitized",
output: "escaped",
auth: "verified"
}
}
}ENFORCE: Strict rules that must be followedCHECK: Validation rules with warningsOPTIMIZE: Performance improvement suggestions
global: Applies to all codecomponent: UI component specificapi: API endpoint specificdata: Data processing specificplatform: Platform-specific code
strict: No exceptions allowedmoderate: Warnings for violationsloose: Suggestions only
To propose new directives or modifications:
- Fork the repository
- Create a feature branch
- Submit a pull request with detailed explanation
- 1.0.0: Initial release
- 1.0.1: Added mobile directives
- 1.0.2: Enhanced ETL rules