flisk / cli
AGENTS.md49 starsChanged 36 days agoMITView on GitHub
This document defines the coding standards and API conventions for the Flisk CLI package. All contributions should follow these guidelines to maintain consistency.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,040 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- flisk-agent-opsSkill
- flisk-bug-hunterSkill
- flisk-buildSkill
- flisk-convertSkill
- flisk-doctorSkill
- flisk-e2e-authorSkill
- flisk-recipe-ai-agentSkill
- flisk-recipe-blogSkill
- flisk-recipe-saasSkill
- flisk-recipe-shopSkill
- flisk-recipe-startersSkill
- flisk-releaseSkill
- flisk-resourceSkill
- flisk-scan-convertSkill
- flisk-startup-perfSkill
- flisk-statusSkill
- flisk-tool-addSkill
- flisk-troubleshootSkill
- flisk-upSkill
- layer-autoresearchSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 0 are common, 9 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
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
- Distinctive: line 28
Use a camelCase prefix for clarity:
- Distinctive: line 56
Use explicit named exports instead of wildcards:
- Distinctive: line 148
Always provide explicit return types:
- Very specific: line 167
All user-facing errors should use the FliskError class:
- Very specific: line 184
Use the errorFactories object for common errors:
- Distinctive: line 196
Use consistent validation result pattern:
- Distinctive: line 218
Use descriptive names without redundant suffixes:
- Very specific: line 231
Place shared types in src/types/index.ts
- Distinctive: line 232
Place component-specific types in the component file
- Very specific: line 236
Use ? for optional properties and provide defaults where sensible:
- Very specific: line 285
Place tests in a __tests__/ folder next to the source they cover.
- Distinctive: line 297
Use descriptive test names:
- Distinctive: line 316
Use JSDoc for public functions:
- Distinctive: line 332
Use inline comments sparingly, only for complex logic:
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md 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
Flisk CLI Agent Guidelines
API Conventions & Standards
This document defines the coding standards and API conventions for the Flisk CLI package. All contributions should follow these guidelines to maintain consistency.
Naming Conventions
Functions and Variables
| Category | Convention | Example |
| Functions | camelCase | discoverResources(), isPortAvailable() |
| Variables | camelCase | const resourceCount, let projectRoot |
| Constants | UPPER_SNAKE_CASE | const CACHE_TTL = 5000 |
| Private functions | camelCase with underscore prefix | _internalHelper() (if needed) |
Types and Classes
| Category | Convention | Example |
| Classes | PascalCase | FliskError, TemplateEngine |
| Interfaces | PascalCase, descriptive | DiscoveredResource, ResourceMetadata |
| Type aliases | PascalCase | ResourceStatus, FileType |
| Factory objects | camelCase | errorFactories (not Errors) |
Boolean Properties
Use a camelCase prefix for clarity:
is*for state:isEnabled,isAvailablehas*for possession:hasDockerfile,hasTiltfilecan*for capability:canReloaddid*for past actions:didPass,didComplete
Examples:
// ✅ Good
interface CheckResult {
didPass: boolean;
isSkipped?: boolean;
isWarning?: boolean;
}
// ❌ Avoid - No prefix, so it is unclear the value is a boolean
interface CheckResult {
passed: boolean;
skipped?: boolean;
warning?: boolean;
}Export Patterns
Public API Surface
Use explicit named exports instead of wildcards:
// ✅ Good - Explicit exports
export type {
DiscoveredResource,
DiscoveredStack,
ResourceMetadata,
} from './types/index.js';
export {
discoverResources,
discoverStacks,
findProjectRoot,
} from './utils/services.js';
// ❌ Avoid - Wildcard exports
export * from './types/index.js';
export * from './utils/services.js';Export Organization
Group exports by category with comments:
/**
* Component exports for Flisk CLI UI
*/
// Main UI components
export { TabBar } from './TabBar.js';
export { ResourceTable } from './ResourceTable.js';
// Type definitions
export type { TabId } from './TabBar.js';
export type { FileNode } from './FileTree.js';
// Utility constants
export { TOOLTIPS } from './Tooltip.js';Function Signatures
Parameter Ordering
- Required data parameters first
- Optional data parameters next
- Options object last
// ✅ Good
function processResource(
name: string, // Required data
config: ResourceConfig, // Required data
options: { verbose?: boolean } = {} // Options last
): ProcessResult
// ❌ Avoid - Mixed ordering
function processResource(
options: { verbose?: boolean },
name: string,
config: ResourceConfig
)Options Object Pattern
For functions with 3+ parameters or multiple optional parameters:
// ✅ Good - Options object
function runTilt(
command: string,
args: string[] = [],
options: {
verbose?: boolean;
inheritStdio?: boolean;
timeout?: number;
} = {}
): Promise<TiltCommandResult>
// ❌ Avoid - Too many positional parameters
function runTilt(
command: string,
args: string[],
verbose: boolean,
inheritStdio: boolean,
timeout: number
): Promise<TiltCommandResult>Return Types
Always provide explicit return types:
// ✅ Good
export function findProjectRoot(startDir: string = cwd()): string | null {
// implementation
}
// ❌ Avoid - Implicit return type
export function findProjectRoot(startDir: string = cwd()) {
// implementation
}Error Handling
Use FliskError for CLI Errors
All user-facing errors should use the FliskError class:
import { FliskError } from '../utils/errors.js';
// ✅ Good
throw new FliskError(
'Resource not found',
['Check the resource name', 'Run flisk resources to list all'],
1 // exit code
);
// ❌ Avoid - Generic errors for user-facing issues
throw new Error('Resource not found');Error Factories
Use the errorFactories object for common errors:
// ✅ Good - Using factory
errorFactories.resourceNotFound(name).display();
errorFactories.notInProject().display();
// ❌ Avoid - Creating FliskError manually for common cases
new FliskError(`Resource "${name}" not found`, [...]).display();Validation Results
Use consistent validation result pattern:
// ✅ Good
interface ValidationResult {
valid: boolean;
error?: string;
}
function validateResourceName(name: string): ValidationResult {
if (!name.trim()) {
return { valid: false, error: 'Name is required' };
}
return { valid: true };
}Type Definitions
Interface Naming
Use descriptive names without redundant suffixes:
// ✅ Good
interface DiscoveredResource { ... }
interface ResourceMetadata { ... }
// ❌ Avoid - Redundant suffixes
interface DiscoveredResourceInterface { ... }
interface ResourceMetadataType { ... }Type Placement
- Place shared types in
src/types/index.ts - Place component-specific types in the component file
- Export types explicitly using
export type
Optional Properties
Use ? for optional properties and provide defaults where sensible:
interface CLIOptions {
verbose?: boolean; // Optional, defaults to false
timeout?: number; // Optional, has default
}
function runCommand(options: CLIOptions = {}) {
const verbose = options.verbose ?? false;
const timeout = options.timeout ?? 5000;
}File Organization
Directory Structure
src/
├── types/
│ └── index.ts # Shared type definitions
├── utils/
│ ├── services.ts # Resource discovery utilities
│ ├── tilt.ts # Tilt command utilities
│ ├── errors.ts # Error handling
│ ├── validation.ts # Validation utilities
│ └── formatting.ts # Formatting utilities
├── commands/
│ ├── resource.ts # flisk resource command
│ ├── stack.ts # flisk stack command
│ └── ...
└── components/
├── TabBar.tsx # UI components
└── ...File Naming
- Commands:
[command-name].ts(e.g.,resource.ts) - Utilities:
[category].ts(e.g.,services.ts,tilt.ts) - Components:
[ComponentName].tsx(PascalCase) - Tests:
__tests__/[filename].test.tsnext to the source files
Testing
Test Location
Place tests in a __tests__/ folder next to the source they cover. A few older tests still sit beside their source file; follow the folder pattern for new tests:
commands/
├── resource.ts
├── stack.ts
└── __tests__/
├── resource.test.ts
└── stack-routers.test.tsTest Naming
Use descriptive test names:
// ✅ Good
describe('resource name validation', () => {
it('should accept valid kebab-case names', () => { ... });
it('should reject names with underscores', () => { ... });
});
// ❌ Avoid - Vague names
it('works', () => { ... });
it('test 1', () => { ... });Documentation
JSDoc Comments
Use JSDoc for public functions:
/**
* Discover all resources from the project
*
* Scans the filesystem for service.json files and parses them.
*
* @returns Array of discovered resources sorted by name
*/
export function discoverResources(): DiscoveredResource[] {
// implementation
}Inline Comments
Use inline comments sparingly, only for complex logic:
// Calculate next available port from the configured range
const portRange = PORT_RANGES[resourceType];
const assignedPort = findNextPort(existingPorts, portRange);Common Patterns
Resource Discovery
export function discoverResources(): DiscoveredResource[] {
const projectRoot = findProjectRoot();
if (!projectRoot) {
throw errorFactories.notInProject();
}
// ... implementation
}Command Action Wrapper
export const commandName = new Command('command')
.description('Description')
.option('-v, --verbose', 'Enable verbose output', false)
.action(async (options) => {
await runCommand(async () => {
// Command implementation
});
});Result Type
interface Result<T, E = string> {
success: boolean;
data?: T;
error?: E;
}
function doSomething(): Result<Resource, string> {
try {
const data = process();
return { success: true, data };
} catch (err) {
return { success: false, error: err.message };
}
}Resources
- Type definitions:
cli/src/types/index.ts
Last Updated: 2025-01-30 by Agent #11 (The API Harmonizer)
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.

