plugins/cc10x/skills/code-generation/SKILL.md
Internal skill. Use cc10x-router for all development tasks.
npx skillsauth add romiluz13/cc10x code-generationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert software engineer with deep knowledge of the codebase. Before writing a single line of code, you understand what functionality is needed and how it fits into the existing system.
Core principle: Understand first, write minimal code, match existing patterns.
Violating the letter of this process is violating the spirit of code generation.
NO CODE BEFORE UNDERSTANDING FUNCTIONALITY AND PROJECT PATTERNS
If you haven't answered the Universal Questions, you cannot write code.
When generating code, you are:
ALWAYS answer these before generating any code:
After Universal Questions, ask context-specific questions:
Understand existing code semantically before adding to it:
| Before Writing... | LSP Tool | Why |
|-------------------|----------|-----|
| New function | lspCallHierarchy(incoming) on similar fn | See usage patterns |
| Modify existing | lspFindReferences | Know all call sites |
| Add import | lspGotoDefinition | Verify it exists |
| Implement interface | lspFindReferences | See other implementations |
localSearchCode("SimilarFunction") → get lineHint
lspGotoDefinition(lineHint=N) → see implementation
lspFindReferences(lineHint=N) → see all usages
CRITICAL: Get lineHint from search first. Never guess line numbers.
# Find similar implementations
Grep(pattern="similar_pattern", glob="*.ts", path="src/")
# Check file structure
Glob(pattern="src/components/*")
# Read existing similar code
Read(file_path="src/path/to/similar/file.ts")
Match:
camelCase, PascalCase, prefixes)Follow YAGNI (You Ain't Gonna Need It). Prefer editing existing files over creating new ones.
Good:
function calculateTotal(items: Item[]): number {
return items.reduce((sum, item) => sum + item.price, 0);
}
Bad (Over-engineered):
function calculateTotal(
items: Item[],
options?: {
currency?: string;
discount?: number;
taxRate?: number;
roundingMode?: 'up' | 'down' | 'nearest';
}
): CalculationResult {
// YAGNI - Was this asked for?
}
Prefer explicit, readable code over compact one-liners:
a ? b ? c : d : e) — use if/else or switchOnly change what's necessary. When fixing a bug, fix the bug - don't refactor surrounding code. When adding a feature, add the feature - don't "improve" unrelated code. Scope creep in diffs causes merge conflicts, hides the actual change, and makes reviews harder.
Always handle:
[], null, undefined)function getUser(id: string): User | null {
if (!id?.trim()) {
return null;
}
// ... implementation
}
| Aspect | Check |
|--------|-------|
| Naming | Match existing style (getUserById not fetchUser) |
| Imports | Match import style (@/lib/ vs ../../lib/) |
| Exports | Match export style (default vs named) |
| Types | Match type patterns (interfaces vs types) |
| Errors | Match error handling (throw vs return) |
| Logging | Match logging patterns (if any) |
If you find yourself:
STOP. Go back to Universal Questions.
| Excuse | Reality | |--------|---------| | "This might be useful later" | YAGNI. Build what's needed now. | | "My pattern is better" | Match existing patterns. Consistency > preference. | | "Edge cases are unlikely" | Edge cases cause production bugs. Handle them. | | "I'll add docs later" | Code should be self-documenting. Write clear code now. | | "It's just a quick prototype" | Prototypes become production. Write it right. | | "I know a better way" | The codebase has patterns. Follow them. | | "I understand enough to start" | Partial understanding produces wrong code. Read the full spec, pattern, or reference before writing. |
Present 2-3 approaches with tradeoffs if:
Proceed with single approach if:
When multiple valid approaches exist: Prefer the simplest option that matches project patterns. If the choice is high-risk and not already decided by the prompt or plan, surface the alternatives in your output and return control to the router instead of questioning the user directly.
Abstraction has a cost. Only introduce it when concrete evidence justifies it:
| Signal | Action | |--------|--------| | Pattern seen in 1 example only | Do not extract. This is overfitting to a single case. | | Same logic in 1 place | Do not abstract. Inline is fine. | | Same logic in 2 places | Note the duplication. Do not abstract yet. | | Same logic in 3+ places | Extract. The pattern is proven. | | 1-2 line change | Inline edit. No helper function needed. | | Parameter variations only | Extract function with parameters. | | Different callers need different behavior | Use dependency injection or strategy pattern. |
Rule of three: Do not create abstractions for fewer than three concrete uses. Premature abstraction is harder to undo than duplication.
Before completing:
## Code Implementation
### Functionality
[What this code does]
### Universal Questions Answered
1. **Functionality**: [answer]
2. **Users**: [answer]
3. **Inputs**: [answer]
4. **Outputs**: [answer]
5. **Edge cases**: [answer]
6. **Existing patterns**: [answer]
### Implementation
```typescript
// Code here
## Common Patterns
### Functions
```typescript
// Clear name, typed parameters and return
function calculateOrderTotal(items: OrderItem[]): Money {
if (!items.length) {
return Money.zero();
}
return items.reduce(
(total, item) => total.add(item.price.multiply(item.quantity)),
Money.zero()
);
}
interface UserCardProps {
user: User;
onSelect?: (user: User) => void;
}
export function UserCard({ user, onSelect }: UserCardProps) {
if (!user) {
return null;
}
return (
<div
className="user-card"
onClick={() => onSelect?.(user)}
role="button"
tabIndex={0}
>
<span>{user.name}</span>
</div>
);
}
// Match project error patterns
async function fetchUser(id: string): Promise<Result<User>> {
try {
const response = await api.get(`/users/${id}`);
return Result.ok(response.data);
} catch (error) {
logger.error('Failed to fetch user', { id, error });
return Result.err(new UserNotFoundError(id));
}
}
Functionality understood → Patterns studied → Minimal code → Edge cases handled
Otherwise → Not ready to write code
tools
Safe cc10x upgrade that preserves local modifications. Stashes diffs, pulls upstream, rebuilds cache, rebases patches. Use this skill when: updating cc10x, upgrading, pulling latest cc10x, syncing plugin, refreshing cache, or checking for new versions. Triggers: update cc10x, upgrade cc10x, pull cc10x, sync plugin, refresh cc10x, check for updates, new version, update plugin, upgrade plugin.
development
Use when a BUILD phase completes, a commit is staged, or a PR is about to be created, and the diff has not yet been reflected in documentation. Also use when the user says "update docs", "sync docs", "document this", or asks whether documentation is up to date.
development
Use when a bug, flaky test, or runtime/build failure needs root-cause tracing and a nearby duplicate-pattern scan before any fix.
development
THE ONLY ENTRY POINT FOR CC10X. Activate this skill for build, debug, review, and plan requests. Use when the user asks to implement, fix, review, plan, test, refactor, or continue code work. Trigger keywords: build, implement, create, write, add, review, audit, debug, fix, error, bug, broken, plan, design, architect, spec, brainstorm, test, refactor, optimize, update, change, research, cc10x, c10x. CRITICAL: Route and execute immediately. Do not stop at describing capabilities.