home / skills / doanchienthangdev / omgkit / omega-coding

omega-coding skill

/plugin/skills/omega/omega-coding

This skill boosts developer productivity by applying AI-first, specification-driven generation and iterative refinement to deliver features faster.

npx playbooks add skill doanchienthangdev/omgkit --skill omega-coding

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
7.9 KB
---
name: coding-with-omega-leverage
description: Applies AI-first development patterns for 10-100x productivity through specification-driven generation and leverage multiplication. Use when developing features with AI assistance or optimizing development workflows.
category: omega
triggers:
  - omega coding
  - ai-first development
  - ai assisted coding
  - prompt driven
  - leverage multiplication
---

# Coding with Omega Leverage

Master **AI-first development** patterns that multiply productivity 10-100x through specification-driven generation and systematic AI collaboration.

## Quick Start

```yaml
# 1. Write specification first
Spec:
  Component: "UserAuthService"
  Requirements: ["register", "login", "logout", "password-reset"]
  Interface: { input: "email, password", output: "Result<User, AuthError>" }

# 2. Generate with iterative refinement
Workflow:
  - Generate: "Implement UserAuthService from spec"
  - Test: "Run tests, check coverage"
  - Refine: "Fix issues, add edge cases"
  - Verify: "All tests pass, 80%+ coverage"

# 3. Apply leverage multiplication
Leverage:
  Manual: "4 hours/feature"
  AI-Assisted: "15 minutes/feature"
  Multiplier: "16x"
```

## Features

| Feature | Description | Guide |
|---------|-------------|-------|
| 7 Omega Principles | Core development philosophy | Apply to every coding decision |
| Specification-Driven | Requirements before code | YAML/TypeScript specs |
| Prompt Engineering | Effective AI prompts for code | Templates for generation |
| Iterative Refinement | Generate, test, improve loop | Max 5 iterations to pass |
| Leverage Tactics | 10x productivity techniques | Batch, template, transform |
| Quality Patterns | Self-documenting, testable code | Types, pure functions, DI |
| Transform, Not Recreate | Modify existing code with AI | Refactor at scale |

## Common Patterns

### The 7 Omega Principles in Code

```
1. LEVERAGE          - 1 developer + AI = 10-50 features/day
2. ABSTRACTION       - Solve classes of problems, not instances
3. AGENTIC           - Autonomous, specialist agent teams
4. AUTONOMOUS        - Self-correcting, self-healing code
5. ZERO-MARGINAL     - Build once, use infinitely
6. RECURSIVE         - Code that improves itself
7. EMERGENT          - Compose simple parts into powerful wholes
```

### Specification Template

```yaml
component:
  name: UserAuthService
  description: Authentication and session management

requirements:
  functional:
    - FR1: Register with email/password
    - FR2: Login with credentials
    - FR3: Logout and invalidate session
  non_functional:
    - NFR1: Response < 200ms
    - NFR2: PCI-DSS compliant

interface:
  methods:
    - name: register
      input: { email: "string", password: "string (min 8 chars)" }
      output: { success: boolean, userId?: string, error?: Error }
    - name: login
      input: { email: "string", password: "string" }
      output: { success: boolean, token?: "JWT 24h", error?: Error }

testing:
  unit: [password validation, token generation]
  integration: [registration flow, login flow]
  edge_cases: [duplicate email, invalid credentials]
```

### Iterative Refinement Loop

```typescript
async function omegaDevelopment(spec: Specification): Promise<Code> {
  let code = await generateFromSpec(spec);
  let iteration = 0;

  while (iteration < 5) {
    const results = await runTests(code);

    if (results.allPassing && results.coverage >= 80) {
      return code; // Done!
    }

    const issues = analyzeResults(results);
    code = await refineCode(code, issues);
    iteration++;
  }

  throw new Error('Max iterations reached');
}

// Iteration log example:
// 1: 8/12 tests pass -> Fix null checks, date handling
// 2: 11/12 tests pass -> Add empty input validation
// 3: 12/12 tests, 85% coverage -> Complete!
```

### Prompt Templates

```markdown
## Component Generation
Create a [TYPE] component named [NAME] with:

Requirements:
- [Req 1]
- [Req 2]

Interface:
[Define inputs, outputs, methods]

Constraints:
- Language: TypeScript
- Error handling: Return Result types
- Include unit tests

## Refactoring Request
Refactor this code to:
1. [Improvement 1]
2. [Improvement 2]

Current code: [paste]

Preserve: functionality, API, types

## Bug Fix Request
Fix the bug in this code:

Code: [paste]
Bug: [description]
Expected: [behavior]
Actual: [behavior]

Provide: root cause, fixed code, regression test
```

### Leverage Multiplication Tactics

```typescript
// Tactic 1: Generate, Don't Write
// Schema -> API -> Controllers -> Services -> Tests
// All generated, all consistent, all in minutes

// Tactic 2: Transform, Don't Recreate
// "Convert JavaScript to TypeScript with types"
// "Add error handling to all async functions"

// Tactic 3: Batch Operations
// "Add JSDoc to all exports in src/utils/"
// "Update all class components to functional"

// Tactic 4: Template Once, Generate Many
const template = {
  components: ['route', 'validation', 'service', 'repository', 'tests']
};
const resources = ['users', 'products', 'orders'];
// Result: 3 resources x 5 components = 15 files generated

// Tactic 5: Test-First Specification
describe('ShoppingCart', () => {
  it('calculates total', () => {
    const cart = new ShoppingCart();
    cart.addItem({ price: 10, quantity: 2 });
    expect(cart.total).toBe(20);
  });
});
// Then: "Implement ShoppingCart to pass these tests"
```

### Quality Code Patterns

```typescript
// 1. Self-documenting with branded types
interface User {
  id: UserId;           // Branded type
  email: Email;         // Validated type
  status: UserStatus;   // Union type
}

// 2. Pure functions where possible
const calculateTotal = (items: LineItem[]): Money =>
  items.reduce((sum, item) => sum.add(item.price.multiply(item.quantity)), Money.zero());

// 3. Explicit error handling with Result types
type Result<T, E = Error> = { success: true; value: T } | { success: false; error: E };

async function findUser(id: UserId): Promise<Result<User, NotFoundError>> {
  const user = await db.users.find(id);
  if (!user) return { success: false, error: new NotFoundError('User', id) };
  return { success: true, value: user };
}

// 4. Composable pipelines
const processDocument = pipe(parseMarkdown, extractEntities, enrichWithContext, generateSummary);

// 5. Dependency injection for testability
class OrderService {
  constructor(
    private readonly repo: OrderRepository,
    private readonly payment: PaymentGateway
  ) {}
}
```

### Abstraction Levels

```typescript
// Level 1: Solve one problem (avoid)
function validateEmail(email: string): boolean {
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}

// Level 2: Solve the class of problems (prefer)
function createValidator<T>(rules: ValidationRule<T>[]): Validator<T> {
  return (value: T) => {
    const errors = rules.filter(r => !r.validate(value)).map(r => r.message);
    return { valid: errors.length === 0, errors };
  };
}

// Now email validation is just one instance:
const validateEmail = createValidator([
  { validate: v => v.includes('@'), message: 'Must contain @' },
  { validate: v => v.length <= 254, message: 'Too long' }
]);
```

## Best Practices

| Do | Avoid |
|----|-------|
| Write specifications before generating | Generating without clear requirements |
| Use iterative refinement (generate, test, improve) | Trusting generated code without verification |
| Leverage AI for repetitive tasks | Skipping tests for AI-generated code |
| Verify generated code meets requirements | Using AI for security-critical code without review |
| Maintain human oversight for critical logic | Losing the spec-code relationship |
| Build reusable templates and patterns | Over-relying on AI for creative design |
| Document prompts that work well | Using outdated AI models for complex tasks |
| Combine AI strengths with human judgment | Forgetting to understand generated code |
| Start simple, add complexity | Ignoring AI suggestions for improvement |
| Keep specifications updated | Skipping code review for AI-generated code |

Overview

This skill applies AI-first development patterns to multiply developer productivity 10–100x through specification-driven generation and systematic leverage tactics. It focuses on writing precise specs, generating code iteratively, and multiplying impact with templates, batching, and targeted transforms. Use it to accelerate feature delivery while preserving testability and maintainability.

How this skill works

Start by writing a formal specification (requirements, interface, tests). Generate code from that spec, run automated tests, analyze results, and refine in short iterations until coverage and correctness targets are met. Apply leverage tactics—batch generation, transform-not-recreate, and reusable templates—to scale outputs across resources and features. Maintain human oversight for critical logic and security.

When to use it

  • Building new features with clear requirements and test targets
  • Converting large JS codebases to typed, testable TypeScript
  • Automating repetitive scaffolding across multiple resources (routes, services, tests)
  • Refactoring or transforming existing code at scale with minimal manual edits
  • Implementing test-first development workflows with AI assistance

Best practices

  • Write concise specification files before any generation (functional, non-functional, interface, tests)
  • Define measurable success criteria: passing tests and a coverage threshold (e.g., 80%)
  • Limit iterative refinements (max ~5) and log each iteration’s fixes
  • Template once and reuse: batch-generate components from a small template set
  • Prefer transformations over full rewrites to preserve intent and reduce risk
  • Keep human review for security-sensitive, complex, or domain-critical logic

Example use cases

  • Generate a UserAuthService from a YAML spec, then iterate until tests pass and coverage target is met
  • Batch-generate CRUD layers (route, validation, service, repository, tests) for multiple resources
  • Refactor a codebase: add types, centralized error handling, and tests with AI-guided transforms
  • Create prompt templates for component generation and bug fixes to standardize outputs
  • Set up an automated loop that runs generation, tests, analysis, and refinement until quality gates are satisfied

FAQ

What should I include in a specification?

Include component name, functional and non-functional requirements, explicit interface methods with input/output types, and a set of unit/integration tests and edge cases.

How many iterations are typical?

Aim for up to 3–5 short iterations. Each iteration should run tests, identify failures, and apply focused fixes until passing and coverage goals are reached.

Is human review still required?

Yes. Treat generated code as draft: review for security, performance, and domain correctness before release.