Superpowers

From RaheesAhmed/SajiCode · View interactive version

Superpowers is an AI agent skill from the GitHub repository RaheesAhmed/SajiCode. Core engineering workflow that activates on EVERY task. Enforces systematic plan-before-code methodology, multi-file refactoring safety, dependency-aware changes, pre-flight verification, and zero-placeholder quality standards. Use PROACTIVELY on all coding tasks.

How to use this skill

Skill file

Engineering Superpowers

Workflow (ALWAYS follow this order)

1. ANALYZE — Understand before you touch

read_file → grep → glob → understand patterns → identify dependencies

2. PLAN — Think before you code

3. IMPLEMENT — Write production code

4. VERIFY — Prove it works

Multi-File Refactoring Safety

Pre-Flight Checklist

1. List ALL files that will be affected
2. Check git status — are there uncommitted changes?
3. Identify the dependency order for changes
4. Plan rollback: what to revert if something breaks

Change Order Protocol

1. Create new files first (no existing code depends on them)
2. Update shared modules (types, utils, constants)
3. Update consumers (components, routes, handlers)
4. Update entry points (index files, main files)
5. Remove deprecated code LAST

Rename/Move Safety

1. Find ALL references: grep for imports, usages, config references
2. Update ALL import paths in dependent files
3. Update barrel exports (index.ts files)
4. Update config files (tsconfig paths, webpack aliases)
5. Verify build passes after EVERY rename

Code Quality Standards

TypeScript

// GOOD: Explicit types, error handling, validation
async function fetchUser(id: string): Promise<User> {
  if (!id?.trim()) throw new Error("User ID required");
  const response = await fetch(`/api/users/${encodeURIComponent(id)}`);
  if (!response.ok) {
    throw new HttpError(`User fetch failed: ${response.status}`, response.status);
  }
  return response.json() as Promise<User>;
}

// BAD: No types, no validation, no error handling
async function fetchUser(id) {
  const res = await fetch(`/api/users/${id}`);
  return res.json();
}

Error Handling

// Typed error classes over generic Error
class AppError extends Error {
  constructor(message: string, public code: string, public statusCode: number) {
    super(message);
    this.name = "AppError";
  }
}

// Async error boundary pattern
async function safeExecute<T>(fn: () => Promise<T>, fallback: T): Promise<T> {
  try {
    return await fn();
  } catch (error) {
    logger.error("Operation failed", { error: error instanceof Error ? error.message : String(error) });
    return fallback;
  }
}

Naming Conventions

| Type | Convention | Example |

|------|-----------|---------|

| Components | PascalCase | UserProfile.tsx |

| Utilities | camelCase | formatCurrency.ts |

| Constants | UPPER_SNAKE | MAX_RETRY_COUNT |

| Types | PascalCase | ApiResponse |

| Enums | PascalCase + UPPER members | enum Status { ACTIVE, INACTIVE } |

| Files | kebab-case or camelCase | user-service.ts |

| Directories | kebab-case | api-routes/ |

Anti-Patterns (NEVER DO THESE)

Performance Defaults

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.