ソース情報
- リポジトリ
- CodySwannGT/lisa
- ソースの最終更新活動
- 2026年7月10日 13:59
- 検出された SKILL.md の言語
- 英語
- スター
- 3
- フォーク
- 3
インストール方法
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
ソースファイルを確認
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
メニュー
デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。
インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/CodySwannGT/lisa --skill reduce-complexityコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
SOC 職業分類に基づく
SKILL.md を表示中
| name | reduce-complexity |
| description | This skill provides strategies… |
This skill provides systematic approaches for reducing cognitive complexity in React components while adhering to this project's Container/View pattern requirements.
sonarjs/cognitive-complexity violations (threshold: 28)Cognitive complexity increases with:
| Source | Complexity Impact | Common in View Components |
|---|---|---|
| Nested conditionals | +1 per nesting | Yes |
| Ternary expressions | +1 each | Yes |
| Logical operators (&&) | +1 each | Yes |
| Loops (map, filter) | +1 each | Yes |
| Switch/case statements | +1 per case | Rare |
| Catch blocks | +1 each | No (Container only) |
| Nested functions | +1 per nesting | Yes |
Before extracting code, determine the appropriate strategy:
// Helper function - no logic, just rendering
function renderSectionHeader(props: {
readonly title: string;
readonly count: number;
}) {
return (
<HStack className="justify-between">
<Text className="font-bold">{props.title}</Text>
<Text className="text-sm">({props.count})</Text>
</HStack>
);
}
FilterChipList/
├── FilterChipListContainer.tsx # Handles selection logic
├── FilterChipListView.tsx # Renders chip list
└── index.tsx # Exports Container
Run ESLint to identify the violation:
bun run lint 2>&1 | grep "cognitive-complexity"
Note: Replace
bunwith your project's package manager (npm,yarn,pnpm) as needed.
Read the file and identify:
Use the decision framework above. For View components:
| Situation | Strategy |
|---|---|
| Repeated JSX, no logic | Helper function |
| Repeated JSX, needs props | Helper function with props object |
| Repeated pattern, 3+ files | Full Container/View component |
| Complex section, own state | Full Container/View component |
| Deeply nested ternaries | Pre-compute flags in Container |
Before refactoring, ensure test coverage exists:
# Check existing coverage
bun run test:unit --coverage --collectCoverageFrom='<file-path>'
If no tests exist, write tests that verify current behavior before refactoring.
For helper functions, see references/extraction-strategies.md.
For full components, use the Container/View pattern skill.
bun run lint 2>&1 | grep "cognitive-complexity"
bun run test:unit
Before (high complexity):
<Pressable
style={{
backgroundColor: selected.includes(item) ? colors.primary : colors.bg,
borderColor: selected.includes(item) ? colors.primary : colors.border,
}}
>
<Text style={{ color: selected.includes(item) ? "#FFF" : colors.text }}>
{item}
</Text>
</Pressable>
After (reduced complexity):
// In Container - pre-compute selection state
const itemStates = useMemo(
() =>
items.map(item => ({
item,
isSelected: selected.includes(item),
})),
[items, selected]
);
// In View - simple conditional
<Pressable style={isSelected ? styles.selected : styles.default}>
<Text style={isSelected ? styles.selectedText : styles.defaultText}>
{item}
</Text>
</Pressable>;
Before (4x repeated pattern = high complexity):
{positions.length > 0 && (
<VStack>
<Text>Positions</Text>
<HStack>{positions.map(p => <Chip key={p} ... />)}</HStack>
</VStack>
)}
{tags.length > 0 && (
<VStack>
<Text>Tags</Text>
<HStack>{tags.map(t => <Chip key={t.id} ... />)}</HStack>
</VStack>
)}
// ... repeated 2 more times
After (extract FilterChipList component):
<FilterChipList
title="Positions"
items={positions}
selectedItems={filters.positions}
onToggle={onPositionToggle}
/>
<FilterChipList
title="Tags"
items={tags}
selectedItems={filters.tags}
onToggle={onTagToggle}
/>
Before:
{
isLoading ? (
<Spinner />
) : hasError ? (
<Error />
) : isEmpty ? (
<Empty />
) : (
<Content />
);
}
After (pre-compute state in Container):
// Container
const viewState = useMemo(() => {
if (isLoading) return "loading";
if (hasError) return "error";
if (isEmpty) return "empty";
return "content";
}, [isLoading, hasError, isEmpty]);
// View - map directly
const VIEW_STATES = {
loading: <Spinner />,
error: <Error />,
empty: <Empty />,
content: <Content />,
} as const;
{
VIEW_STATES[viewState];
}
For detailed patterns and complete examples:
references/extraction-strategies.md - Helper function patterns and when to use eachreferences/refactoring-patterns.md - Step-by-step refactoring examples with before/after code