mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 17:43:04 +00:00
- Drop model-selection skill (dead, pool is dormant) - Drop PNG rendering from UI planning (HTML-only, no pnpm ui-draft:render) - Trim code-simplification: 331→~150 lines, Python/React examples moved to reference/ - Compress engineering-brief.md: remove redundant 'Pinhos do repo' (alwaysApply rules) - Deduplicate capture-review-debts: reference decision-quality.md instead of re-explaining - Create concise-output skill (35 lines) to enforce terse agent output - Trim all 99 skill descriptions to ≤1 sentence - Split AGENTS.md into layers: core (73 lines, always) + campaign/public/infra (on-demand) - Decompose plan-issue: exploration sub-agent + parallel plan-writers + register sub-agent - Decompose work-issue: exploration sub-agent + plan-writer + 2 parallel reviewers + debt sub-agent - Update agent-work-issue to match sub-agent pattern
103 lines
2.4 KiB
Markdown
103 lines
2.4 KiB
Markdown
# Language-Specific Simplification Examples
|
|
|
|
Load this file on-demand when the target code uses a specific language. Teqo is TypeScript-only; Python is included for general reference.
|
|
|
|
## TypeScript / JavaScript
|
|
|
|
```typescript
|
|
// SIMPLIFY: Unnecessary async wrapper
|
|
// Before
|
|
async function getUser(id: string): Promise<User> {
|
|
return await userService.findById(id);
|
|
}
|
|
// After
|
|
function getUser(id: string): Promise<User> {
|
|
return userService.findById(id);
|
|
}
|
|
|
|
// SIMPLIFY: Manual array building → filter
|
|
// Before
|
|
const activeUsers: User[] = [];
|
|
for (const user of users) {
|
|
if (user.isActive) activeUsers.push(user);
|
|
}
|
|
// After
|
|
const activeUsers = users.filter((u) => u.isActive);
|
|
|
|
// SIMPLIFY: Verbose conditional assignment
|
|
// Before
|
|
let displayName: string;
|
|
if (user.nickname) {
|
|
displayName = user.nickname;
|
|
} else {
|
|
displayName = user.fullName;
|
|
}
|
|
// After
|
|
const displayName = user.nickname || user.fullName;
|
|
|
|
// SIMPLIFY: Redundant boolean return
|
|
// Before
|
|
function isValid(input: string): boolean {
|
|
if (input.length > 0 && input.length < 100) return true;
|
|
return false;
|
|
}
|
|
// After
|
|
function isValid(input: string): boolean {
|
|
return input.length > 0 && input.length < 100;
|
|
}
|
|
```
|
|
|
|
## Python
|
|
|
|
```python
|
|
# SIMPLIFY: Verbose dictionary building
|
|
# Before
|
|
result = {}
|
|
for item in items:
|
|
result[item.id] = item.name
|
|
# After
|
|
result = {item.id: item.name for item in items}
|
|
|
|
# SIMPLIFY: Nested conditionals with early return
|
|
# Before
|
|
def process(data):
|
|
if data is not None:
|
|
if data.is_valid():
|
|
if data.has_permission():
|
|
return do_work(data)
|
|
else:
|
|
raise PermissionError("No permission")
|
|
else:
|
|
raise ValueError("Invalid data")
|
|
else:
|
|
raise TypeError("Data is None")
|
|
# After
|
|
def process(data):
|
|
if data is None:
|
|
raise TypeError("Data is None")
|
|
if not data.is_valid():
|
|
raise ValueError("Invalid data")
|
|
if not data.has_permission():
|
|
raise PermissionError("No permission")
|
|
return do_work(data)
|
|
```
|
|
|
|
## React / JSX
|
|
|
|
```tsx
|
|
// SIMPLIFY: Verbose conditional rendering
|
|
// Before
|
|
function UserBadge({ user }: Props) {
|
|
if (user.isAdmin) {
|
|
return <Badge variant="admin">Admin</Badge>;
|
|
} else {
|
|
return <Badge variant="default">User</Badge>;
|
|
}
|
|
}
|
|
// After
|
|
function UserBadge({ user }: Props) {
|
|
const variant = user.isAdmin ? 'admin' : 'default';
|
|
const label = user.isAdmin ? 'Admin' : 'User';
|
|
return <Badge variant={variant}>{label}</Badge>;
|
|
}
|
|
```
|